┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/kitemviews
diff options
context:
space:
mode:
authorFrank Reininghaus <[email protected]>2014-04-26 12:29:36 +0200
committerFrank Reininghaus <[email protected]>2014-04-26 12:37:39 +0200
commitb5ca0e2de9001d2584073c043c1fbc1921e0174d (patch)
tree5886d5658cb3ba9e987cec59e8f0be5abfcad8c2 /src/kitemviews
parent272cbbd16b03e51b30b6b9d472aa56054a5ea036 (diff)
Do not change the selection when re-sorting the view
If a range of items has been selected by Shift-clicking or by pressing Shift+Arrow, then each of them is added individually to the selection before the items are re-sorted. Before this commit, the first and the last item in the range were moved, and all items between them were selected, even though these were not necessarily the items which had been selected before the re-sorting. BUG: 333457 REVIEW: 117603 FIXED-IN: 4.13.1
Diffstat (limited to 'src/kitemviews')
-rw-r--r--src/kitemviews/kitemlistselectionmanager.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/kitemviews/kitemlistselectionmanager.cpp b/src/kitemviews/kitemlistselectionmanager.cpp
index ebff1a30e..1f0a89d06 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()) {