diff options
Diffstat (limited to 'filesystemwidget.cpp')
-rw-r--r-- | filesystemwidget.cpp | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/filesystemwidget.cpp b/filesystemwidget.cpp index 0e6e591..07e058d 100644 --- a/filesystemwidget.cpp +++ b/filesystemwidget.cpp @@ -162,13 +162,17 @@ void FilesystemWidget::directoryChanged(const QModelIndex &selected, const QMode } QModelIndex realPrev = mDirProxy->mapToSource(deselected); if(realPrev.isValid()){ - mLastDir = realPrev.data(QFileSystemModel::FilePathRole).toString(); + mLastFiles[Previous] = mLastFiles[Current]; + mLastFiles[Current] = mFileView->selectedItems(); + mLastDir = realPrev.data(QFileSystemModel::FilePathRole).toString(); } mModel->setRootPath(mModel->filePath(real)); mDirEdit->setText(mModel->filePath(real)); setWindowTitle(); - mFileView->selectionModel()->clear(); + + mFileView->selectionModel()->clear(); mFileModel->setDir(mModel->filePath(real)); + resizeFileView(); } @@ -253,10 +257,15 @@ void FilesystemWidget::goBack(){ if(mLastDir.isEmpty()){ return; } - QModelIndex lastIdx = mModel->index(mLastDir); - if(lastIdx.isValid()){ - mDirView->selectionModel()->setCurrentIndex(mDirProxy->mapFromSource(lastIdx), QItemSelectionModel::ClearAndSelect); - } + QModelIndex lastIdx = mModel->index(mLastDir); + mDirView->selectionModel()->setCurrentIndex(mDirProxy->mapFromSource(lastIdx), QItemSelectionModel::ClearAndSelect); + if(lastIdx.isValid()){ + if(!mLastFiles[Previous].isEmpty()){ + foreach(QString lf, mLastFiles[Previous]){ + mFileView->selectItem(lf); + } + } + } } void FilesystemWidget::deleteFiles(){ |