summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Penz <peter.penz19@gmail.com>2012-04-05 14:21:24 (GMT)
committerPeter Penz <peter.penz19@gmail.com>2012-04-05 14:21:24 (GMT)
commited5f3aaba7149b3816909a403bbd9f3e06d1a774 (patch)
tree0ef3f5fc9e8e7f1144e85f1413b9e80f763f8022
parent352e2c598b26bbca07ad4831f90174904117bf18 (diff)
Fix filtering issue
When filtering items it might be possible that the update of the widgets is wrong although the model internally has a correct state. BUG: 297269 FIXED-IN: 4.8.3
-rw-r--r--dolphin/src/kitemviews/kitemlistview.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/dolphin/src/kitemviews/kitemlistview.cpp b/dolphin/src/kitemviews/kitemlistview.cpp
index 0880687..c09c876 100644
--- a/dolphin/src/kitemviews/kitemlistview.cpp
+++ b/dolphin/src/kitemviews/kitemlistview.cpp
@@ -911,8 +911,13 @@ void KItemListView::slotItemsRemoved(const KItemRangeList& itemRanges)
m_layouter->markAsDirty();
+ int removedItemsCount = 0;
+ for (int i = 0; i < itemRanges.count(); ++i) {
+ removedItemsCount += itemRanges[i].count;
+ }
+
for (int i = itemRanges.count() - 1; i >= 0; --i) {
- const KItemRange& range = itemRanges.at(i);
+ const KItemRange& range = itemRanges[i];
const int index = range.index;
const int count = range.count;
if (index < 0 || count <= 0) {
@@ -924,7 +929,8 @@ void KItemListView::slotItemsRemoved(const KItemRangeList& itemRanges)
const int firstRemovedIndex = index;
const int lastRemovedIndex = index + count - 1;
- const int lastIndex = m_model->count() + count - 1;
+ const int lastIndex = m_model->count() - 1 + removedItemsCount;
+ removedItemsCount -= count;
// Remove all KItemListWidget instances that got deleted
for (int i = firstRemovedIndex; i <= lastRemovedIndex; ++i) {