]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Always go back/forward in history when pressing the respective buttons
authorFrank Reininghaus <frank78ac@googlemail.com>
Sat, 1 Mar 2014 11:14:47 +0000 (12:14 +0100)
committerFrank Reininghaus <frank78ac@googlemail.com>
Sat, 1 Mar 2014 11:14:47 +0000 (12:14 +0100)
Before this patch, pressing one of these buttons while an item is
hovered selected this item. The motivation for this behavior was to
provide a fast way to select items. However, this was counter-intuitive
and confusing for many users.

BUG: 310288
FIXED-IN: 4.13.0
REVIEW: 116469

src/kitemviews/kitemlistcontroller.cpp
src/views/dolphinview.cpp

index 7344b9960f07ec72eb7f47d6a76caa66b063d75c..61337d1664433def2015864fa5d69f8d6675871d 100644 (file)
@@ -538,11 +538,10 @@ bool KItemListController::mousePressEvent(QGraphicsSceneMouseEvent* event, const
     m_pressedIndex = m_view->itemAt(m_pressedMousePos);
     emit mouseButtonPressed(m_pressedIndex, event->buttons());
 
-    if ((event->buttons() & (Qt::XButton1 | Qt::XButton2)) && m_pressedIndex < 0) {
-        // Do not select items when clicking the empty part of the view with
-        // the back/forward buttons, see https://bugs.kde.org/show_bug.cgi?id=327412.
-        // Note that clicking an item with these buttons selects it, see comment in
-        // DolphinView::slotMouseButtonPressed(int, Qt::MouseButtons).
+    // TODO: Qt5: Replace Qt::XButton1 by Qt::BackButton and Qt::XButton2 by Qt::ForwardButton
+    if (event->buttons() & (Qt::XButton1 | Qt::XButton2)) {
+        // Do not select items when clicking the back/forward buttons, see
+        // https://bugs.kde.org/show_bug.cgi?id=327412.
         return true;
     }
 
index b68e8aa6ac998447bf56b906159bcac262676676..2769d670d6dd514fc2a4dbf12be8af226e3b7439 100644 (file)
@@ -1071,17 +1071,15 @@ void DolphinView::slotModelChanged(KItemModelBase* current, KItemModelBase* prev
 
 void DolphinView::slotMouseButtonPressed(int itemIndex, Qt::MouseButtons buttons)
 {
+    Q_UNUSED(itemIndex);
+
     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();
-        }
+    // TODO: Qt5: Replace Qt::XButton1 by Qt::BackButton and Qt::XButton2 by Qt::ForwardButton
+    if (buttons & Qt::XButton1) {
+        emit goBackRequested();
+    } else if (buttons & Qt::XButton2) {
+        emit goForwardRequested();
     }
 }