┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrank Reininghaus <[email protected]>2013-06-26 21:18:37 +0200
committerFrank Reininghaus <[email protected]>2013-06-26 21:18:37 +0200
commitd72ce531410e548e1c9630ff9ab073958b70dfa1 (patch)
tree6194b4b1eba5f0674724bee56b3810aac4581a89
parentbbbf039338448d0721fa4c0e187cabcd59f9ee66 (diff)
Fix performance regression when loading folders in Details View
When using Details View, only insert all pending items immediately if new items are inserted which might be children of a pending item. Fixes the problem that inserting the items in multiple bunches slows down the folder loading. Note that the cause of the slowness when inserting in multiple bunches is that KItemListSizeHintResolver needs O(N^2) time in the worst case for inserting N items into a model with N existing ones. REVIEW: 111226
-rw-r--r--src/kitemviews/kfileitemmodel.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/kitemviews/kfileitemmodel.cpp b/src/kitemviews/kfileitemmodel.cpp
index f6b51f21c..698314c2f 100644
--- a/src/kitemviews/kfileitemmodel.cpp
+++ b/src/kitemviews/kfileitemmodel.cpp
@@ -759,10 +759,6 @@ void KFileItemModel::slotItemsAdded(const KUrl& directoryUrl, const KFileItemLis
parentUrl.adjustPath(KUrl::RemoveTrailingSlash);
if (m_requestRole[ExpandedParentsCountRole]) {
- // To be able to compare whether the new items may be inserted as children
- // of a parent item the pending items must be added to the model first.
- dispatchPendingItemsToInsert();
-
KFileItem item = items.first();
// If the expanding of items is enabled, the call
@@ -776,6 +772,12 @@ void KFileItemModel::slotItemsAdded(const KUrl& directoryUrl, const KFileItemLis
return;
}
+ if (directoryUrl != directory()) {
+ // To be able to compare whether the new items may be inserted as children
+ // of a parent item the pending items must be added to the model first.
+ dispatchPendingItemsToInsert();
+ }
+
// KDirLister keeps the children of items that got expanded once even if
// they got collapsed again with KFileItemModel::setExpanded(false). So it must be
// checked whether the parent for new items is still expanded.