[frameworks/kio] src/core: kfileitem: iconName, allow to read .directory files on remote files

Méven Car <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit 9ea01570c94bc748f345e64eb5b54ca7bc41e104 by Méven Car, on behalf of Damian Rogers.
Committed on 05/08/2026 at 18:57.
Pushed by meven into branch 'master'.

kfileitem: iconName, allow to read .directory files on remote files

Depending on setting PreviewSettings::EnableRemoteFolderThumbnail

M  +5    -3    src/core/kfileitem.cpp

https://invent.kde.org/frameworks/kio/-/commit/9ea01570c94bc748f345e64eb5b54ca7bc41e104

diff --git a/src/core/kfileitem.cpp b/src/core/kfileitem.cpp
index 01ace725a7..ee634d0f60 100644
--- a/src/core/kfileitem.cpp
+++ b/src/core/kfileitem.cpp
@@ -32,6 +32,7 @@
 #include <KConfigGroup>
 #include <KDesktopFile>
 #include <KLocalizedString>
+#include <KSharedConfig>
 #include <kmountpoint.h>
 #ifndef Q_OS_WIN
 #include <knfsshare.h>
@@ -1220,9 +1221,10 @@ QString KFileItem::iconName() const
         }
 
         if (isDir()) {
-            // Reading the .directory file opens it synchronously, which can block
-            // for a long time on a slow filesystem, so skip it for those.
-            if (!d->isSlow() && isDirectoryMounted(url)) {
+            // 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)))) {
                 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.