┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/kitemviews/kfileitemmodel.cpp
diff options
context:
space:
mode:
authorPeter Penz <[email protected]>2011-08-08 23:41:18 +0200
committerPeter Penz <[email protected]>2011-08-09 16:22:36 +0200
commit3957884bf2e44619a4ed35ba0ffead519988885b (patch)
treed8a5bf1a015cc6001adb4afc5f0f1da721908a22 /src/kitemviews/kfileitemmodel.cpp
parent4692eb7c96f57328479862c0d17d7945b4e87188 (diff)
Improvements for selections, smooth scrolling, tooltips and info-panel
Diffstat (limited to 'src/kitemviews/kfileitemmodel.cpp')
-rw-r--r--src/kitemviews/kfileitemmodel.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/kitemviews/kfileitemmodel.cpp b/src/kitemviews/kfileitemmodel.cpp
index b191abab6..ddc56209b 100644
--- a/src/kitemviews/kfileitemmodel.cpp
+++ b/src/kitemviews/kfileitemmodel.cpp
@@ -403,8 +403,9 @@ void KFileItemModel::insertItems(const KFileItemList& items)
KItemRangeList itemRanges;
int targetIndex = 0;
int sourceIndex = 0;
- int insertedAtIndex = -1;
- int insertedCount = 0;
+ int insertedAtIndex = -1; // Index for the current item-range
+ int insertedCount = 0; // Count for the current item-range
+ int previouslyInsertedCount = 0; // Sum of previously inserted items for all ranges
while (sourceIndex < sortedItems.count()) {
// Find target index from m_items to insert the current item
// in a sorted order
@@ -418,7 +419,8 @@ void KFileItemModel::insertItems(const KFileItemList& items)
if (targetIndex - previousTargetIndex > 0 && insertedAtIndex >= 0) {
itemRanges << KItemRange(insertedAtIndex, insertedCount);
- insertedAtIndex = targetIndex;
+ previouslyInsertedCount += insertedCount;
+ insertedAtIndex = targetIndex - previouslyInsertedCount;
insertedCount = 0;
}
@@ -431,6 +433,7 @@ void KFileItemModel::insertItems(const KFileItemList& items)
if (insertedAtIndex < 0) {
insertedAtIndex = targetIndex;
+ Q_ASSERT(previouslyInsertedCount == 0);
}
++targetIndex;
++sourceIndex;