From 4f1e2ee030f01facefab808f687d301c37707f74 Mon Sep 17 00:00:00 2001 From: am Date: Fri, 10 Jul 2009 15:53:58 +0000 Subject: -fixed selection handling -implemented proper window titles (not yet working) git-svn-id: file:///var/svn/repos2/shemov/trunk@382 f440f766-f032-0410-8965-dc7d17de2ca0 --- filesystemwidget.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'filesystemwidget.cpp') diff --git a/filesystemwidget.cpp b/filesystemwidget.cpp index 24e769b..365adaf 100644 --- a/filesystemwidget.cpp +++ b/filesystemwidget.cpp @@ -16,6 +16,7 @@ #include #include #include +#include #include #include "filesystemwidget.h" @@ -68,13 +69,14 @@ FilesystemWidget::FilesystemWidget(QWidget *parent) : QWidget(parent) { fileWidget->setLayout(fwLayout); connect(mDirView->selectionModel(), SIGNAL(currentChanged(const QModelIndex &, const QModelIndex &)), this, SLOT(directoryChanged(const QModelIndex &, const QModelIndex &))); - connect(mFileView, SIGNAL(activated(const QModelIndex &)), this, SLOT(fileViewActivated(const QModelIndex &))); + connect(mFileView, SIGNAL(doubleClicked(const QModelIndex &)), this, SLOT(fileViewActivated(const QModelIndex &))); + connect(mFileView, SIGNAL(enterPressed(const QModelIndex &)), this, SLOT(fileViewActivated(const QModelIndex &))); connect(mFileView, SIGNAL(upDir()), this, SLOT(parentDir())); - //connect(mFileView, SIGNAL(show()), this, SLOT(showItem())); connect(mDirEdit, SIGNAL(returnPressed()), this, SLOT(directoryEdited())); QSettings s; QString startDir = s.value("paths/start", QDir::homePath()).toString(); + windowTitle(startDir); QModelIndex startIndex = mModel->index(startDir); if(startIndex.isValid()){ QModelIndex proxyIndex = mDirProxy->mapFromSource(startIndex); @@ -106,9 +108,9 @@ void FilesystemWidget::directoryChanged(const QModelIndex &selected, const QMode return; } mDirEdit->setText(mModel->filePath(real)); + windowTitle(mModel->filePath(real)); QModelIndex oldSelected = mDirProxy->mapToSource(deselected); - mFileView->selectionModel()->clear(); - mFileView->setCurrentIndex(mFileProxy->mapFromSource(oldSelected)); + mFileView->selectionModel()->setCurrentIndex(mFileProxy->mapFromSource(oldSelected), QItemSelectionModel::NoUpdate); mFileView->setRootIndex(mFileProxy->mapFromSource(real)); } @@ -154,3 +156,8 @@ void FilesystemWidget::parentDir(){ mFileView->selectionModel()->clearSelection(); } +void FilesystemWidget::setWindowTitle(const QString &dir){ + QString title = QString("%1 - %2").arg(qApp->applicationName(), dir); + emit windowTitle(title); +} + -- cgit v1.2.3-70-g09d2