From acee6d0fc59e1c1c5e1d842620245ee3d1e514b7 Mon Sep 17 00:00:00 2001 From: Peter Penz Date: Fri, 30 Dec 2011 00:02:17 +0100 Subject: Fix inconsistency in selection manager When a selection has been done with non-linear ranges, it was possible that the anchor item pointed to an invalid index that resulted into an invalid selection. As part of this fix the sorting for DolphinView::selectedItems() has been disabled (if the caller assumes a sorted selection he must manually adjust it). BUG: 288908 FIXED-IN: 4.8.0 --- src/kitemviews/kitemlistselectionmanager.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/kitemviews/kitemlistselectionmanager.h') diff --git a/src/kitemviews/kitemlistselectionmanager.h b/src/kitemviews/kitemlistselectionmanager.h index 82ae13abb..4afad1f8b 100644 --- a/src/kitemviews/kitemlistselectionmanager.h +++ b/src/kitemviews/kitemlistselectionmanager.h @@ -76,6 +76,13 @@ private: void itemsRemoved(const KItemRangeList& itemRanges); void itemsMoved(const KItemRange& itemRange, const QList& movedToIndexes); + + /** + * Helper method for itemsRemoved. Returns the changed index after removing + * the given range. If the index is part of the range, -1 will be returned. + */ + int indexAfterRangesRemoving(int index, const KItemRangeList& itemRanges) const; + private: int m_currentItem; int m_anchorItem; -- cgit v1.3