summaryrefslogtreecommitdiffstats
path: root/filesystemwidget.cpp
diff options
context:
space:
mode:
authorArno <am@disconnect.de>2010-11-07 11:46:42 +0100
committerArno <am@disconnect.de>2010-11-07 11:46:42 +0100
commitd12d44cd511b76181859736fb60598a3ad7e3d0f (patch)
treeb8ec25d26237cf0c8e97eb7681bc88268254509b /filesystemwidget.cpp
parent76bb89940a3818456f535b7d4a8ba6ab9f382631 (diff)
downloadSheMov-d12d44cd511b76181859736fb60598a3ad7e3d0f.tar.gz
SheMov-d12d44cd511b76181859736fb60598a3ad7e3d0f.tar.bz2
SheMov-d12d44cd511b76181859736fb60598a3ad7e3d0f.zip
Added Toobar
Implemented a toolbar with various actions. Also did some artwork :)
Diffstat (limited to 'filesystemwidget.cpp')
-rw-r--r--filesystemwidget.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/filesystemwidget.cpp b/filesystemwidget.cpp
index 52aede8..5d63aef 100644
--- a/filesystemwidget.cpp
+++ b/filesystemwidget.cpp
@@ -107,11 +107,15 @@ FilesystemWidget::FilesystemWidget(QWidget *parent) : QWidget(parent) {
setLayout(mainLayout);
}
-void FilesystemWidget::directoryChanged(const QModelIndex &selected, const QModelIndex & /* deselected */){
+void FilesystemWidget::directoryChanged(const QModelIndex &selected, const QModelIndex &deselected){
QModelIndex real = mDirProxy->mapToSource(selected);
if(!real.isValid()){
return;
}
+ QModelIndex realPrev = mDirProxy->mapToSource(deselected);
+ if(realPrev.isValid()){
+ mLastDir = realPrev.data(QFileSystemModel::FilePathRole).toString();
+ }
mModel->setRootPath(mModel->filePath(real));
mDirEdit->setText(mModel->filePath(real));
setWindowTitle(mModel->filePath(real));
@@ -170,6 +174,16 @@ void FilesystemWidget::parentDir(){
}
}
+void FilesystemWidget::goBack(){
+ if(mLastDir.isEmpty()){
+ return;
+ }
+ QModelIndex lastIdx = mModel->index(mLastDir);
+ if(lastIdx.isValid()){
+ mDirView->selectionModel()->setCurrentIndex(mDirProxy->mapFromSource(lastIdx), QItemSelectionModel::ClearAndSelect);
+ }
+}
+
void FilesystemWidget::deleteFiles(){
QSortFilterProxyModel *proxy = static_cast<QSortFilterProxyModel*>(mFileView->model());
QModelIndexList selected = mFileView->selectionModel()->selectedRows();