]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/kitemviews/kfileitemmodelrolesupdater.cpp
fix folder size calculation on FUSE and network file systems
[dolphin.git] / src / kitemviews / kfileitemmodelrolesupdater.cpp
index 25e1a368531cd128f4c0094d18f51d69d06051da..42788d2fe6553b83629820b4451b7a500850f216 100644 (file)
@@ -776,9 +776,7 @@ void KFileItemModelRolesUpdater::slotDirectoryContentsCountReceived(const QStrin
 
             if (getSizeRole) {
                 data.insert("count", count);
-                if (size != -1) {
-                    data.insert("size", QVariant::fromValue(size));
-                }
+                data.insert("size", QVariant::fromValue(size));
             }
             if (getIsExpandableRole) {
                 data.insert("isExpandable", count > 0);
@@ -957,9 +955,9 @@ void KFileItemModelRolesUpdater::updateChangedItems()
     QList<int> visibleChangedIndexes;
     QList<int> invisibleChangedIndexes;
 
-    QMutableSetIterator<KFileItem> it(m_changedItems);
-    while (it.hasNext()) {
-        const KFileItem item = it.next();
+    // Iterate over a const copy because items are deleted within the loop
+    const auto changedItems = m_changedItems;
+    for (const KFileItem &item : changedItems) {
         const int index = m_model->index(item);
 
         if (index < 0) {
@@ -1058,7 +1056,7 @@ bool KFileItemModelRolesUpdater::applyResolvedRoles(int index, ResolveHint hint)
             data = rolesData(item);
         }
 
-        if (QIcon::hasThemeIcon(item.iconName())) {
+        if (!item.iconName().isEmpty()) {
             data.insert("iconName", item.iconName());
         }
 
@@ -1085,7 +1083,7 @@ QHash<QByteArray, QVariant> KFileItemModelRolesUpdater::rolesData(const KFileIte
     const bool getIsExpandableRole = m_roles.contains("isExpandable");
 
     if ((getSizeRole || getIsExpandableRole) && item.isDir()) {
-        if (item.isLocalFile() && !item.isSlow()) {
+        if (item.isLocalFile()) {
             // Tell m_directoryContentsCounter that we want to count the items
             // inside the directory. The result will be received in slotDirectoryContentsCountReceived.
             if (m_scanDirectories) {