]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Replace context menu on long press with selection mode
authorMarco Martin <notmart@gmail.com>
Tue, 4 Oct 2022 13:54:11 +0000 (15:54 +0200)
committerMarco Martin <notmart@gmail.com>
Sat, 8 Oct 2022 07:02:00 +0000 (07:02 +0000)
on long touch (and not on mouse press) don't pop up the context menu
anymore but enter selection mode, similar behavior to mobile applications.
the full context menu is still available from the actions toolbar
appearing in selection mode

src/kitemviews/kitemlistcontroller.cpp

index 7297f8aaa52d06ec0d47c6ce6d7a46ced9d096e2..955e418e8ea893f5b4a3dd163140e26f27b29ef5 100644 (file)
@@ -1042,8 +1042,6 @@ void KItemListController::tapTriggered(QTapGesture* tap, const QTransform& trans
         m_pressedIndex = m_view->itemAt(m_pressedMousePos);
 
         if (m_dragActionOrRightClick) {
-            onPress(tap->hotSpot().toPoint(), tap->position().toPoint(), Qt::NoModifier, Qt::RightButton);
-            onRelease(transform.map(tap->position()), Qt::NoModifier, Qt::RightButton, false);
             m_dragActionOrRightClick = false;
         }
         else {
@@ -1074,6 +1072,9 @@ void KItemListController::tapAndHoldTriggered(QGestureEvent* event, const QTrans
         if (m_pressedIndex.has_value() && !m_selectionManager->isSelected(m_pressedIndex.value())) {
             m_selectionManager->clearSelection();
             m_selectionManager->setSelected(m_pressedIndex.value());
+            if (!m_selectionMode) {
+                Q_EMIT selectionModeChangeRequested(true);
+            }
         } else if (!m_pressedIndex.has_value()) {
             m_selectionManager->clearSelection();
             startRubberBand();