[frameworks/kio] src/core: kfileitem: iconName make sure not to read settings unless nessary

Méven Car <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit a07bdbc73b88d8041e67b635dd53f11f4e38b4a2 by Méven Car.
Committed on 06/08/2026 at 09:52.
Pushed by meven into branch 'master'.

kfileitem: iconName make sure not to read settings unless nessary

Amend 9ea01570c94bc

M  +8    -4    src/core/kfileitem.cpp

https://invent.kde.org/frameworks/kio/-/commit/a07bdbc73b88d8041e67b635dd53f11f4e38b4a2

diff --git a/src/core/kfileitem.cpp b/src/core/kfileitem.cpp
index ee634d0f60..984653c3aa 100644
--- a/src/core/kfileitem.cpp
+++ b/src/core/kfileitem.cpp
@@ -1221,10 +1221,14 @@ QString KFileItem::iconName() const
         }
 
         if (isDir()) {
-            // Only read the .directory file when the user has specified
-            // remote directory previews
-            const KConfigGroup previewConfig(KSharedConfig::openConfig(), QStringLiteral("PreviewSettings"));
-            if (isDirectoryMounted(url) && (!d->isSlow() || (d->isSlow() && previewConfig.readEntry("EnableRemoteFolderThumbnail", false)))) {
+            bool readDotDirectoryFile = isDirectoryMounted(url) && !d->isSlow();
+            if (!readDotDirectoryFile && d->isSlow()) {
+                // Only read the .directory file when the user has specified
+                // remote directory previews
+                const KConfigGroup previewConfig(KSharedConfig::openConfig(), QStringLiteral("PreviewSettings"));
+                readDotDirectoryFile = previewConfig.readEntry("EnableRemoteFolderThumbnail", false);
+            }
+            if (readDotDirectoryFile) {
                 d->m_iconName = iconFromDirectoryFile(localFile);
                 if (!d->m_iconName.isEmpty()) {
                     d->m_useIconNameCache = d->m_bMimeTypeKnown;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.