]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Control-rubberband selection toggles the selection state
authorFrank Reininghaus <frank78ac@googlemail.com>
Sun, 28 Aug 2011 17:16:14 +0000 (19:16 +0200)
committerFrank Reininghaus <frank78ac@googlemail.com>
Sun, 28 Aug 2011 17:16:14 +0000 (19:16 +0200)
src/kitemviews/kitemlistcontroller.cpp

index 5eae95e6dda8afe2876e8f525b7efb26c63c6c47..c0875ce3977a475df6fd8f08c4e5b5d2ea13b144 100644 (file)
@@ -678,7 +678,16 @@ void KItemListController::slotRubberBandChanged()
         }
     } while (!selectionFinished);
 
-    m_selectionManager->setSelectedItems(selectedItems + m_oldSelection);
+    if (QApplication::keyboardModifiers() & Qt::ControlModifier) {
+        // If Control is pressed, the selection state of all items in the rubberband is toggled.
+        // Therefore, the new selection contains:
+        // 1. All previously selected items which are not inside the rubberband, and
+        // 2. all items inside the rubberband which have not been selected previously.
+        m_selectionManager->setSelectedItems((m_oldSelection - selectedItems) + (selectedItems - m_oldSelection));
+    }
+    else {
+        m_selectionManager->setSelectedItems(selectedItems + m_oldSelection);
+    }
 }
 
 bool KItemListController::startDragging()