]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/kitemviews/kitemlistcontroller.cpp
Emit "itemMiddleClicked" when Ctrl-clicking a view in single selection mode
[dolphin.git] / src / kitemviews / kitemlistcontroller.cpp
index 5c9a2bbdd35bf3acd51d683f5397db06e1c0015c..8687872ee81b6f75d22fd6577e8bfc8f8c7f3587 100644 (file)
@@ -1550,8 +1550,9 @@ bool KItemListController::onRelease(const QPointF& pos, const Qt::KeyboardModifi
         return true;
     }
 
+    const bool controlPressed = modifiers & Qt::ControlModifier;
     const bool shiftOrControlPressed = modifiers & Qt::ShiftModifier ||
-                                       modifiers & Qt::ControlModifier;
+                                       controlPressed;
 
     KItemListRubberBand* rubberBand = m_view->rubberBand();
     if (rubberBand->isActive()) {
@@ -1585,6 +1586,11 @@ bool KItemListController::onRelease(const QPointF& pos, const Qt::KeyboardModifi
             } else if (shiftOrControlPressed) {
                 // The mouse click should only update the selection, not trigger the item
                 emitItemActivated = false;
+                // When Ctrl-clicking an item when in single selection mode
+                // i.e. where Ctrl won't change the selection, pretend it was middle clicked
+                if (controlPressed && m_selectionBehavior == SingleSelection) {
+                    Q_EMIT itemMiddleClicked(index);
+                }
             } else if (!(m_view->style()->styleHint(QStyle::SH_ItemView_ActivateItemOnSingleClick) || m_singleClickActivationEnforced)) {
                 if (touch) {
                 emitItemActivated = true;