]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/kitemviews/kitemlistselectionmanager.cpp
Paint icons at the correct size
[dolphin.git] / src / kitemviews / kitemlistselectionmanager.cpp
index ebff1a30ed4604db4759bd40e6d06cacabd450ba..46b77f7e42304cd548c090667a1cfe10733782da 100644 (file)
@@ -24,7 +24,6 @@
 #include "kitemlistselectionmanager.h"
 
 #include "kitemmodelbase.h"
-#include <KDebug>
 
 KItemListSelectionManager::KItemListSelectionManager(QObject* parent) :
     QObject(parent),
@@ -331,6 +330,11 @@ void KItemListSelectionManager::itemsMoved(const KItemRange& itemRange, const QL
     // Store the current selection (needed in the selectionChanged() signal)
     const KItemSet previousSelection = selectedItems();
 
+    // endAnchoredSelection() adds all items between m_currentItem and
+    // m_anchorItem to m_selectedItems. They can then be moved
+    // individually later in this function.
+    endAnchoredSelection();
+
     // Update the current item
     if (m_currentItem >= itemRange.index && m_currentItem < itemRange.index + itemRange.count) {
         const int previousCurrentItem = m_currentItem;
@@ -342,10 +346,8 @@ void KItemListSelectionManager::itemsMoved(const KItemRange& itemRange, const QL
         emit currentChanged(newCurrentItem, previousCurrentItem);
     }
 
-    // Update the anchor item
-    if (m_anchorItem >= itemRange.index && m_anchorItem < itemRange.index + itemRange.count) {
-        m_anchorItem = movedToIndexes.at(m_anchorItem - itemRange.index);
-    }
+    // Start a new anchored selection.
+    beginAnchoredSelection(m_currentItem);
 
     // Update the selections
     if (!m_selectedItems.isEmpty()) {
@@ -393,4 +395,4 @@ int KItemListSelectionManager::indexAfterRangesRemoving(int index, const KItemRa
     }
     return qBound(-1, index - dec, m_model->count() - 1);
 }
-#include "kitemlistselectionmanager.moc"
+