]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Do not select items when navigating back/forward with the mouse
authorDavid Rosca <nowrep@gmail.com>
Thu, 14 Nov 2013 08:08:29 +0000 (09:08 +0100)
committerFrank Reininghaus <frank78ac@googlemail.com>
Thu, 14 Nov 2013 08:08:29 +0000 (09:08 +0100)
If we detect that the user pressed the back/forward buttons while
hovering the empty space of the view, such that
DolphinView::slotMouseButtonPressed(int, Qt::MouseButtons) will request
that Dolphin navigates back/forward in the history, handling the mouse
press event should stop. This prevents the possible unexpected selection
of items in the new directory.

BUG: 327412
FIXED-IN: 4.11.4

src/kitemviews/kitemlistcontroller.cpp

index 9335ab816c334631ffa53ff6cbf78563e9399097..158c12de1d38deb475efc9c295e730f6f18bf611 100644 (file)
@@ -537,6 +537,14 @@ 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).
+        return true;
+    }
+
     if (m_view->isAboveExpansionToggle(m_pressedIndex, m_pressedMousePos)) {
         m_selectionManager->endAnchoredSelection();
         m_selectionManager->setCurrentItem(m_pressedIndex);