]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/kitemviews/kfileitemmodel.cpp
Fix performance regression when loading folders in Details View
[dolphin.git] / src / kitemviews / kfileitemmodel.cpp
index f6b51f21c04f76bb618b5ec7a4553a82958dba95..698314c2fc8130591da9f1f066287853abc118fc 100644 (file)
@@ -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.