diff options
| author | Arno <arno@disconnect.de> | 2015-11-27 17:36:49 +0100 | 
|---|---|---|
| committer | Arno <arno@disconnect.de> | 2015-11-27 17:36:49 +0100 | 
| commit | 3cbba03cf065c4f7adcf6619931180ff22c9eb60 (patch) | |
| tree | 6dc40fdc88e82598b226837c5acb1b6479915bcc /filesystemwidget.cpp | |
| parent | e1fd385d598e17c77a8b8175b8674b219b45cd8d (diff) | |
| download | SheMov-3cbba03cf065c4f7adcf6619931180ff22c9eb60.tar.gz SheMov-3cbba03cf065c4f7adcf6619931180ff22c9eb60.tar.bz2 SheMov-3cbba03cf065c4f7adcf6619931180ff22c9eb60.zip | |
Remember selections between dir changes
Select all items previously selected when going back()
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(){ | 
