summaryrefslogtreecommitdiffstats
path: root/filesystemwidget.cpp
diff options
context:
space:
mode:
authoram <am@f440f766-f032-0410-8965-dc7d17de2ca0>2009-07-06 18:15:29 +0000
committeram <am@f440f766-f032-0410-8965-dc7d17de2ca0>2009-07-06 18:15:29 +0000
commit1b18f70862f62f8783976407057ea5a5cf88bdac (patch)
treefee6f613dff620d5fd62a43086fa1616de2b5bc0 /filesystemwidget.cpp
parent6af9b265b0e9e3bc88d9e0bb61701aac64b2f8f1 (diff)
downloadSheMov-1b18f70862f62f8783976407057ea5a5cf88bdac.tar.gz
SheMov-1b18f70862f62f8783976407057ea5a5cf88bdac.tar.bz2
SheMov-1b18f70862f62f8783976407057ea5a5cf88bdac.zip
-fixed showing tree in fileview
-when a movie or image is activated, it's shown in the configured viewer git-svn-id: file:///var/svn/repos2/shemov/trunk@379 f440f766-f032-0410-8965-dc7d17de2ca0
Diffstat (limited to 'filesystemwidget.cpp')
-rw-r--r--filesystemwidget.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/filesystemwidget.cpp b/filesystemwidget.cpp
index 45edccb..64fc530 100644
--- a/filesystemwidget.cpp
+++ b/filesystemwidget.cpp
@@ -15,6 +15,7 @@
#include <QLineEdit>
#include <QLabel>
#include <QCompleter>
+#include <QProcess>
#include <QDebug>
#include "filesystemwidget.h"
@@ -22,6 +23,7 @@
#include "fileview.h"
#include "shemoviconprovider.h"
#include "filesystemfileproxy.h"
+#include "helper.h"
FilesystemWidget::FilesystemWidget(QWidget *parent) : QWidget(parent) {
mModel = new QDirModel;
@@ -46,6 +48,8 @@ FilesystemWidget::FilesystemWidget(QWidget *parent) : QWidget(parent) {
mFileView->setModel(mFileProxy);
mFileView->setSortingEnabled(true);
mFileView->sortByColumn(0, Qt::AscendingOrder);
+ mFileView->setItemsExpandable(false);
+ mFileView->setSelectionMode(QAbstractItemView::ExtendedSelection);
QWidget *fileWidget = new QWidget;
QHBoxLayout *directoryEdit = new QHBoxLayout;
@@ -102,6 +106,7 @@ void FilesystemWidget::directoryChanged(const QModelIndex &selected, const QMode
}
mDirEdit->setText(mModel->filePath(real));
QModelIndex oldSelected = mDirProxy->mapToSource(deselected);
+ mFileView->selectionModel()->clear();
mFileView->setCurrentIndex(mFileProxy->mapFromSource(oldSelected));
mFileView->setRootIndex(mFileProxy->mapFromSource(real));
}
@@ -123,6 +128,20 @@ void FilesystemWidget::fileViewActivated(const QModelIndex &idx){
mDirView->setCurrentIndex(mDirProxy->mapFromSource(real));
return;
}
+ QString path = mModel->filePath(real);
+ QString mt = Helper::mimeType(path);
+ QSettings s;
+ QStringList programArgs;
+ QString program;
+ if(mt.toLower().startsWith("video")){
+ program = s.value("paths/video").toString();
+ programArgs = s.value("paths/videoargs").toStringList();
+ }
+ if(mt.toLower().startsWith("image")){
+ program = s.value("paths/picture").toString();
+ }
+ programArgs << path;
+ QProcess::execute(program, programArgs);
}
void FilesystemWidget::parentDir(){