diff options
author | am <am@f440f766-f032-0410-8965-dc7d17de2ca0> | 2009-07-06 18:15:29 +0000 |
---|---|---|
committer | am <am@f440f766-f032-0410-8965-dc7d17de2ca0> | 2009-07-06 18:15:29 +0000 |
commit | 1b18f70862f62f8783976407057ea5a5cf88bdac (patch) | |
tree | fee6f613dff620d5fd62a43086fa1616de2b5bc0 | |
parent | 6af9b265b0e9e3bc88d9e0bb61701aac64b2f8f1 (diff) | |
download | SheMov-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
-rw-r--r-- | filesystemwidget.cpp | 19 | ||||
-rw-r--r-- | fileview.cpp | 4 |
2 files changed, 19 insertions, 4 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(){ diff --git a/fileview.cpp b/fileview.cpp index a09762d..541d071 100644 --- a/fileview.cpp +++ b/fileview.cpp @@ -31,10 +31,6 @@ void FileView::contextMenuEvent(QContextMenuEvent *e){ void FileView::keyPressEvent(QKeyEvent *e){ switch(e->key()){ - case Qt::Key_Right: - case Qt::Key_Asterisk: - e->accept(); - break; case Qt::Key_Backspace: emit upDir(); e->accept(); |