summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMavridis Philippe <mavridisf@gmail.com>2024-05-28 00:03:14 +0300
committerMavridis Philippe <mavridisf@gmail.com>2024-06-01 17:39:03 +0300
commit750384b955254e9d12f343af59bb2e3eeaa6fa2e (patch)
tree3a73c518d21b2d887dc9431744892db19e6b6427
parent07dfb84a653d4461b665a33a5de5bce5bb09f9ea (diff)
downloadtdelibs-750384b955254e9d12f343af59bb2e3eeaa6fa2e.tar.gz
tdelibs-750384b955254e9d12f343af59bb2e3eeaa6fa2e.zip
KDirOperator: add support for history navigation mouse buttons
Signed-off-by: Mavridis Philippe <mavridisf@gmail.com> (cherry picked from commit 4911fcf8417043562fcf397596d212db5733e189)
-rw-r--r--tdeio/tdefile/tdediroperator.cpp25
-rw-r--r--tdeio/tdefile/tdediroperator.h3
2 files changed, 28 insertions, 0 deletions
diff --git a/tdeio/tdefile/tdediroperator.cpp b/tdeio/tdefile/tdediroperator.cpp
index 9bf947f20..8b133d433 100644
--- a/tdeio/tdefile/tdediroperator.cpp
+++ b/tdeio/tdefile/tdediroperator.cpp
@@ -145,6 +145,8 @@ KDirOperator::KDirOperator(const KURL& _url,
setupMenu();
setFocusPolicy(TQWidget::WheelFocus);
+
+ installEventFilter(this);
}
KDirOperator::~KDirOperator()
@@ -1046,6 +1048,11 @@ void KDirOperator::connectView(KFileView *view)
}
m_fileView = view;
+ m_fileView->widget()->installEventFilter(this);
+ if (m_fileView->widget()->inherits("TQScrollView"))
+ {
+ (static_cast<TQScrollView *>(m_fileView->widget()))->viewport()->installEventFilter(this);
+ }
m_fileView->setDropOptions(d->dropOptions);
viewActionCollection = 0L;
KFileViewSignaler *sig = view->signaler();
@@ -1734,6 +1741,24 @@ TQString KDirOperator::viewConfigGroup() const
return d->configGroup;
}
+bool KDirOperator::eventFilter(TQObject *obj, TQEvent *ev)
+{
+ if (ev->type() == TQEvent::MouseButtonRelease)
+ {
+ TQMouseEvent *mouseEv = static_cast<TQMouseEvent *>(ev);
+ switch (mouseEv->button())
+ {
+ case TQMouseEvent::HistoryBackButton:
+ back();
+ return true;
+ case TQMouseEvent::HistoryForwardButton:
+ forward();
+ return true;
+ }
+ }
+ return false;
+}
+
void KDirOperator::virtual_hook( int, void* )
{ /*BASE::virtual_hook( id, data );*/ }
diff --git a/tdeio/tdefile/tdediroperator.h b/tdeio/tdefile/tdediroperator.h
index 89b1a1709..50467fc61 100644
--- a/tdeio/tdefile/tdediroperator.h
+++ b/tdeio/tdefile/tdediroperator.h
@@ -936,6 +936,9 @@ private slots:
void insertViewDependentActions();
+public:
+ bool eventFilter(TQObject *obj, TQEvent *ev);
+
private:
static bool isReadable( const KURL& url );