SUMMARY STEPS TO REPRODUCE Use KIO::iconNameForUrl() to get icons for files located on a SMB server. OBSERVED RESULT KIO::iconNameForUrl() returns "network-workgroup" as icon name. EXPECTED RESULT The correct icon name for the mimetype of the file is returned. SOFTWARE/OS VERSIONS Windows: macOS: Linux/KDE Plasma: KDE Plasma Version: 5.20.3 KDE Frameworks Version: 5.76 Qt Version: 5.15.1 ADDITIONAL INFORMATION This code snippet QIcon icon = KDE::icon(KIO::iconNameForUrl(url)); yields the wrong icon for the mimetype for files on a SMB server, because KIO::iconNameForUrl(url) always returns "network-workgroup". Folders are handled correctly, though.
Can you give an example URL where this happens?
Sure. Any URL of the type smb://SERVER/Path/filename.ending should yield this result. Maybe other protocols are affected, too, but I haven't checked. By the way, earlier versions of KIO did exactly what was expected. For example, if I compile Smb4K (my program) under Kubuntu 18.04, the icon name for the mimetype is correct. So, somewhere between version 5.44 and 5.76 there must have been a change that introduced this altered behavior.
I just tested it with KF5 5.68. There the problem already exists. Maybe this helps.
From looking at git log I'd say https://phabricator.kde.org/D27539 changed this
I believe https://phabricator.kde.org/D27539 caused this. Prior to it `db.mimeTypeForUrl(url).iconName();` would become the default icon for non-local files.
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/kio/-/merge_requests/227
Git commit 55465cc6639b7e5d83a9cdf30a010e0b677765c3 by David Faure, on behalf of Méven Car. Committed on 29/11/2020 at 10:08. Pushed by dfaure into branch 'master'. KIO::iconNameForUrl: resolve icon for remote files based on name Fix a regression introduced with eb20176d1a42eebd4c6c3cbdb5dca6a854760736 FIXED-IN: 5.77 M +5 -2 autotests/kfileitemtest.cpp M +1 -1 src/core/global.cpp https://invent.kde.org/frameworks/kio/commit/55465cc6639b7e5d83a9cdf30a010e0b677765c3