From 5798e081f52371b9fd91cf0348cc946ebcc28a4a Mon Sep 17 00:00:00 2001 From: Peter Penz Date: Mon, 19 Mar 2012 16:47:11 +0100 Subject: Let additional mouse buttons trigger history navigation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Thanks to Sebastian Dörner for the patch! REVIEW: 101335 BUG: 181823 FIXED-IN: 4.9 --- src/views/dolphinview.cpp | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'src/views/dolphinview.cpp') diff --git a/src/views/dolphinview.cpp b/src/views/dolphinview.cpp index 29a132184..75561a9c6 100644 --- a/src/views/dolphinview.cpp +++ b/src/views/dolphinview.cpp @@ -142,7 +142,7 @@ DolphinView::DolphinView(const KUrl& url, QWidget* parent) : connect(controller, SIGNAL(itemContextMenuRequested(int,QPointF)), this, SLOT(slotItemContextMenuRequested(int,QPointF))); connect(controller, SIGNAL(viewContextMenuRequested(QPointF)), this, SLOT(slotViewContextMenuRequested(QPointF))); connect(controller, SIGNAL(headerContextMenuRequested(QPointF)), this, SLOT(slotHeaderContextMenuRequested(QPointF))); - connect(controller, SIGNAL(itemPressed(int,Qt::MouseButton)), this, SLOT(hideToolTip())); + connect(controller, SIGNAL(mouseButtonPressed(int,Qt::MouseButtons)), this, SLOT(slotMouseButtonPressed(int,Qt::MouseButtons))); connect(controller, SIGNAL(itemHovered(int)), this, SLOT(slotItemHovered(int))); connect(controller, SIGNAL(itemUnhovered(int)), this, SLOT(slotItemUnhovered(int))); connect(controller, SIGNAL(itemDropEvent(int,QGraphicsSceneDragDropEvent*)), this, SLOT(slotItemDropEvent(int,QGraphicsSceneDragDropEvent*))); @@ -889,6 +889,22 @@ void DolphinView::slotModelChanged(KItemModelBase* current, KItemModelBase* prev m_versionControlObserver->setModel(fileItemModel); } +void DolphinView::slotMouseButtonPressed(int itemIndex, Qt::MouseButtons buttons) +{ + hideToolTip(); + + if (itemIndex < 0) { + // Trigger the history navigation only when clicking on the viewport: + // Above an item the XButtons provide a simple way to select items in + // the singleClick mode. + if (buttons & Qt::XButton1) { + emit goBackRequested(); + } else if (buttons & Qt::XButton2) { + emit goForwardRequested(); + } + } +} + void DolphinView::slotSelectionChanged(const QSet& current, const QSet& previous) { const int currentCount = current.count(); -- cgit v1.3