]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/kitemviews/kitemlistcontroller.cpp
Always periodically dispatch pending items
[dolphin.git] / src / kitemviews / kitemlistcontroller.cpp
index 6fb6a5132964de116cfb64cff1a025ffb6946e0c..82553ddda257473b07f93e7e4b187b54786479f9 100644 (file)
@@ -232,7 +232,8 @@ bool KItemListController::keyPressEvent(QKeyEvent* event)
     const bool controlPressed = event->modifiers() & Qt::ControlModifier;
     const bool shiftOrControlPressed = shiftPressed || controlPressed;
     const bool navigationPressed = key == Qt::Key_Home || key == Qt::Key_End  ||
-                                   key == Qt::Key_Up   || key == Qt::Key_Down ||
+                                   key == Qt::Key_PageUp || key == Qt::Key_PageDown ||
+                                   key == Qt::Key_Up || key == Qt::Key_Down ||
                                    key == Qt::Key_Left || key == Qt::Key_Right;
 
     const int itemCount = m_model->count();
@@ -461,9 +462,7 @@ bool KItemListController::keyPressEvent(QKeyEvent* event)
     }
 
     if (navigationPressed) {
-        if (index < m_view->firstVisibleIndex() || index > m_view->lastVisibleIndex()) {
-            m_view->scrollToItem(index);
-        }
+        m_view->scrollToItem(index);
     }
     return true;
 }
@@ -597,6 +596,16 @@ bool KItemListController::mousePressEvent(QGraphicsSceneMouseEvent* event, const
         m_selectionManager->endAnchoredSelection();
     }
 
+    if (event->buttons() & Qt::RightButton) {
+        // Stop rubber band from persisting after right-clicks
+        KItemListRubberBand* rubberBand = m_view->rubberBand();
+        if (rubberBand->isActive()) {
+            disconnect(rubberBand, &KItemListRubberBand::endPositionChanged, this, &KItemListController::slotRubberBandChanged);
+            rubberBand->setActive(false);
+            m_view->setAutoScroll(false);
+        }
+    }
+
     if (m_pressedIndex >= 0) {
         m_selectionManager->setCurrentItem(m_pressedIndex);