https://bugs.kde.org/show_bug.cgi?id=499503
[email protected] changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |[email protected] Summary|KDE applications can't |Icons with particular MIME |apply icons from home |media types in an inherited |directory |theme are masked by | |<type>-x-generic in the | |current theme --- Comment #2 from [email protected] --- This is still an issue in KDE Plasma 6.7.4. When a MIME type icon belonging to one of the text, audio, font, image, package, or video media types is created in any parent theme, it will never be loaded and the `-x-generic` fallback from the current theme will be used instead. This happens because the KDE themes (for example, Breeze) include the `text-x-generic`, `audio-x-generic`, etc according to the freedesktop icon naming spec. KIconLoader prefers loading these before finding a matching icon name in an inherited theme. Thus, the issue only affects KDE apps or any app using KIconLoader to load icons. The freedesktop spec writes: "The dash “-” character is used to separate levels of specificity in icon names, for all contexts other than MimeTypes." It looks like the code is trying generic names in the current theme before names in parent themes for MIME types as well. The issue seems to be inside `KIconLoaderPrivate::findMatchingIcon()`, as it is removing the dashes and explicitly trying to add `-x-generic` to MIME type names before even looking at parent themes, leading to valid MIME type icons not being found. There is also the issue that this may cause a completely different icon to be loaded for MIME types: for example, if the icon "text-html-foo" is requested, rather than giving up and returning a generic icon it will return the path to the "text-html" icon which is wrong, especially if "text-html-foo" is defined in an inherited theme. This can be reproduced by putting an icon named something like "text-x-myformat.svg" inside hicolor/scalable/mimetypes while using a theme like Breeze. The icon's existence will be recognized by the system, but anything using KIconLoader will load the wrong icon. Notice that something like "application-x-myformat.svg" will not cause the issue, because "application-x-generic" doesn't exist in Breeze following the freedesktop spec. Here is some C++ code that can also reproduce the issue: ``` // Compile with g++ -I/usr/include/qt6 -I/usr/include/qt6/QtCore -I/usr/include/KF6/KIconThemes -lKF6IconThemes -lQt6Core -fPIC #include <QDebug> #include <QString> #include <QCoreApplication> #include <KF6/KIconThemes/kiconloader.h> int main(int argc, char** argv) { QCoreApplication app(argc, argv); KIconLoader& loader = *KIconLoader::global(); qDebug() << "Resolving text-x-myformat: " << loader.iconPath("text-x-myformat", KIconLoader::NoGroup); qDebug() << "Resolving text-html-foo: " << loader.iconPath("text-html-foo", KIconLoader::NoGroup); } ``` The first line will print the path to "text-x-generic" regardless of whether or not "text-x-myformat" exists somewhere in an inherited theme. The second line will print the path to "text-html". -- You are receiving this mail because: You are watching all bug changes.
