| Summary: | Exported Kate theme reports (incorrect) error message when the theme is imported. | ||
|---|---|---|---|
| Product: | [Frameworks and Libraries] frameworks-kio | Reporter: | Peter C. Trenholme <PTrenholme> |
| Component: | general | Assignee: | KIO Bugs <kio-bugs-null> |
| Status: | CONFIRMED --- | ||
| Severity: | normal | CC: | christoph, jpmbatrina01, kdelibs-bugs-null, waqar.17a |
| Priority: | NOR | ||
| Version First Reported In: | git master | ||
| Target Milestone: | --- | ||
| Platform: | Other | ||
| OS: | Linux | ||
| Latest Commit: | Version Fixed/Implemented In: | ||
| Sentry Crash Report: | |||
| Attachments: | Dolphin showing the same error messages | ||
|
Description
Peter C. Trenholme
2021-07-12 22:22:39 UTC
Created attachment 140046 [details] Dolphin showing the same error messages Confirmed with kate from git master (even with non-root users) The error is technically not from kate, but from dolphin or the file selection dialog. For example, if we directly put the theme file path in https://invent.kde.org/frameworks/ktexteditor/-/blob/master/src/syntax/katethemeconfig.cpp#L1091 instead of the QFileDialog::getOpenFileName call, the KConfigIni error messages do not appear. Additionally, the errors only appear when hovering (mouse-over) on kate theme files, or when such a file was previously/recently selected using the file dialog in kate. The same errors appear for other file dialogs in kate (e.g. File > Open and File > Save as) and also when using Dolphin directly, so it's possible that it is a dolphin bug. After a bit more poking, I have confirmed that the errors are coming from dolphin/KIO, but the bug is still for kate/ktexteditor. Specifically, the errors when the mouse hovers over a kate theme file are coming from the KDesktopFile constructor in this line https://invent.kde.org/frameworks/kio/-/blob/master/src/core/kfileitem.cpp#L895. I haven't located exactly where the errors for the recent files come from, but I expect they are of similar nature since they also appear in dolphin. e.g. xdg-mime query filetype export.theme returns application/x-theme, which apparently inherits application/x-desktop. Thus it is treated by KIO as a desktop file which is in INI format but the kate theme files are in JSON. The .theme file extension is also used by GTK themes (e.g. vhttps://github.com/adapta-project/adapta-gtk-theme/blob/master/gtk/index.theme), which are indeed in INI format, and this probably is the reason why an INI is expected. FWIW dock also uses an INI .theme file for themes (e.g. https://github.com/nana-4/materia-theme/blob/master/src/plank/dock.theme), but that might just be a coincidence. I think the simplest fix (not necessarily the easiest) is to use a different file extension for kate color themes (e.g. .ktetheme, .kshltheme). This would require (minor) changes to KTextEditor and KSyntaxHighlighting, but also might require special (transitional) handling for existing installations and third party themes. I assume you are right, the .theme ending was not the best idea. I would even rather settle just for .json for the files. Beside a bit compat code, I see no large issue with renaming them. Hmm, on the other side, it is no good idea that we spit out errors, .theme is perhaps an ini for icon themes, but that ending can be used by anything else, too. |