diff options
author | Ken Moore <moorekou@gmail.com> | 2015-08-31 15:48:31 -0400 |
---|---|---|
committer | Ken Moore <moorekou@gmail.com> | 2015-08-31 15:48:31 -0400 |
commit | a11748f3e7d40d87943767c40676cca4a613eb95 (patch) | |
tree | ec2730afcc782d3c259a21174fc56b5d014fad57 /lumina-fm/widgets | |
parent | Completely overhaul lumina-fileinfo so that it is just a front-end to the XDG... (diff) | |
download | lumina-a11748f3e7d40d87943767c40676cca4a613eb95.tar.gz lumina-a11748f3e7d40d87943767c40676cca4a613eb95.tar.bz2 lumina-a11748f3e7d40d87943767c40676cca4a613eb95.zip |
Add support for the mouse "back" button (normally Mouse4, but may be set through X to something else).
Also fix a minor bug in saving/loading the last history item for a browser.
Diffstat (limited to 'lumina-fm/widgets')
-rw-r--r-- | lumina-fm/widgets/DirWidget.cpp | 20 | ||||
-rw-r--r-- | lumina-fm/widgets/DirWidget.h | 3 |
2 files changed, 22 insertions, 1 deletions
diff --git a/lumina-fm/widgets/DirWidget.cpp b/lumina-fm/widgets/DirWidget.cpp index b4a6ca78..14e7820c 100644 --- a/lumina-fm/widgets/DirWidget.cpp +++ b/lumina-fm/widgets/DirWidget.cpp @@ -217,11 +217,14 @@ void DirWidget::LoadDir(QString dir, QList<LFileInfo> list){ } if(DEBUG){ qDebug() << "Update History:" <<time.elapsed(); } //Now update the history for this browser + //qDebug() << "History:" << history << normalbasedir << lastbasedir; if(!history.isEmpty() && history.last() == normalbasedir && lastbasedir!=normalbasedir ){ //We went back one - remove this from the history history.takeLast(); ui->actionBack->setEnabled(!history.isEmpty()); + //qDebug() << " - Duplicate: removed item"; }else if(lastbasedir!=normalbasedir){ //not a refresh or internal snapshot change + //qDebug() << " - New History Item:" << normalbasedir; history << normalbasedir; ui->actionBack->setEnabled(history.length()>1); } @@ -710,8 +713,9 @@ void DirWidget::on_slider_snap_valueChanged(int val){ void DirWidget::on_actionBack_triggered(){ if(history.isEmpty()){ return; } //cannot do anything QString dir = history.takeLast(); + //qDebug() << "Go Back:" << dir << normalbasedir << history.last(); if(dir == normalbasedir){ - dir = history.last(); + dir = history.takeLast(); } stopload = true; //just in case it is still loading emit LoadDirectory(ID, dir); @@ -846,4 +850,18 @@ void DirWidget::SelectionChanged(){ void DirWidget::startSync(){ if(synctimer->isActive()){ synctimer->stop(); } synctimer->start(); +} + +//==================== +// PROTECTED +//==================== +void DirWidget::mouseReleaseEvent(QMouseEvent *ev){ + if(ev->button()==Qt::BackButton){ + ev->accept(); + on_actionBack_triggered(); + //}else if(ev->button()==Qt::ForwardButton()){ + //ev->accept(); + }else{ + ev->ignore(); //not handled here + } }
\ No newline at end of file diff --git a/lumina-fm/widgets/DirWidget.h b/lumina-fm/widgets/DirWidget.h index 55e6f8d1..a7fe3cc3 100644 --- a/lumina-fm/widgets/DirWidget.h +++ b/lumina-fm/widgets/DirWidget.h @@ -152,5 +152,8 @@ signals: void RenameFiles(QStringList); //file selection void RemoveFiles(QStringList); //file selection +protected: + void mouseReleaseEvent(QMouseEvent *); + }; #endif
\ No newline at end of file |