]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Folders Panel: Show expansion toggles for directories on ISO-images
authorPeter Penz <peter.penz19@gmail.com>
Fri, 3 Feb 2012 08:57:18 +0000 (09:57 +0100)
committerPeter Penz <peter.penz19@gmail.com>
Fri, 3 Feb 2012 15:15:22 +0000 (16:15 +0100)
When counting the number of sub-directories consider unknown file types
as potential directories. In the "worst case" an expansion toggle will be
shown although the directory contains only files, however from a performance
point of view this seems to be an acceptable compromise.

BUG: 292642
FIXED-IN: 4.8.1

src/kitemviews/kfileitemmodelrolesupdater.cpp

index 0c204e4745c0b1301c7c62987e1eebbbfcf67837..14e7f00ff7290c136471e92556054ca3ca81a22b 100644 (file)
@@ -839,7 +839,9 @@ int KFileItemModelRolesUpdater::subItemsCount(const QString& path) const
                 }
             }
 
-            if (!showFoldersOnly || dirEntry->d_type == DT_DIR) {
+            // If only directories are counted, consider an unknown file type also
+            // as directory instead of trying to do an expensive stat() (see bug 292642).
+            if (!showFoldersOnly || dirEntry->d_type == DT_DIR || dirEntry->d_type == DT_UNKNOWN) {
                 ++count;
             }
         }