summaryrefslogtreecommitdiffstats
path: root/filesystemwidget.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'filesystemwidget.cpp')
-rw-r--r--filesystemwidget.cpp19
1 files changed, 15 insertions, 4 deletions
diff --git a/filesystemwidget.cpp b/filesystemwidget.cpp
index 4c05640..317d9c2 100644
--- a/filesystemwidget.cpp
+++ b/filesystemwidget.cpp
@@ -163,13 +163,21 @@ void FilesystemWidget::directoryEdited(){
}
void FilesystemWidget::fileViewActivated(const QModelIndex &idx){
- QModelIndex real = mFileProxy->mapToSource(idx);
+ /* we cannot use idx from the SIGNAL here, since the model
+ * may already have changed */
+ Q_UNUSED(idx);
+ TimerHandler h(mFileModel->refresTimer());
+ QModelIndexList selected = mFileView->selectionModel()->selectedRows();
+ if(selected.isEmpty()){
+ return;
+ }
+ QModelIndex real = mFileProxy->mapToSource(selected.first());
if(mFileModel->isDir(real)){
- if(idx.data().toString() == ".."){
+ if(real.data().toString() == ".."){
parentDir();
return;
}
- fileView()->selectionModel()->select(idx, QItemSelectionModel::Deselect);
+ fileView()->selectionModel()->select(selected.first(), QItemSelectionModel::Deselect);
QModelIndex curDir = mModel->index(real.data(SmDirModel::FullPathRole).toString());
mDirView->setCurrentIndex(mDirProxy->mapFromSource(curDir));
return;
@@ -216,6 +224,7 @@ void FilesystemWidget::goBack(){
}
void FilesystemWidget::deleteFiles(){
+ TimerHandler h(mFileModel->refresTimer());
QSortFilterProxyModel *proxy = qobject_cast<QSortFilterProxyModel*>(mFileView->model());
QModelIndexList selected = mFileView->selectionModel()->selectedRows();
if(selected.isEmpty()){
@@ -233,6 +242,7 @@ void FilesystemWidget::deleteFiles(){
}
void FilesystemWidget::toClipboard(int clipmode){
+ TimerHandler h(mFileModel->refresTimer());
mClipboardMode = clipmode;
QClipboard *clip = qApp->clipboard();
QModelIndexList selected = mFileView->selectionModel()->selectedRows();
@@ -279,7 +289,7 @@ void FilesystemWidget::fromClipboard(){
}
void FilesystemWidget::renameFile(){
- mFileModel->refresTimer()->stop();
+ TimerHandler h(mFileModel->refresTimer());
QModelIndex curIdx = mFileView->currentIndex();
if(curIdx.data().toString() == ".."){
return;
@@ -288,6 +298,7 @@ void FilesystemWidget::renameFile(){
}
void FilesystemWidget::playSelected(const QString &player){
+ TimerHandler h(mFileModel->refresTimer());
QStringList files = selectedFiles();
if(files.isEmpty()){
statusbarMessage(tr("Nothing selected."));