X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/a5e266e538cb32c3689cf02f23246812acbf2d8c..01e4f60a0931aba506b184d384a4e2f926b2233c:/src/kitemviews/kitemlistselectionmanager.cpp diff --git a/src/kitemviews/kitemlistselectionmanager.cpp b/src/kitemviews/kitemlistselectionmanager.cpp index ebff1a30e..ba524a6bf 100644 --- a/src/kitemviews/kitemlistselectionmanager.cpp +++ b/src/kitemviews/kitemlistselectionmanager.cpp @@ -331,6 +331,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 +347,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 +396,4 @@ int KItemListSelectionManager::indexAfterRangesRemoving(int index, const KItemRa } return qBound(-1, index - dec, m_model->count() - 1); } -#include "kitemlistselectionmanager.moc" +