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
parentUrl.adjustPath(KUrl::RemoveTrailingSlash);
if (m_requestRole[ExpandedParentsCountRole]) {
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
KFileItem item = items.first();
// If the expanding of items is enabled, the call
+ 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.
// 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.