Offer an xdg-compatible mode for convertToQVariant
Needs ReviewPublic

Authored by apol on Aug 26 2019, 5:32 PM.

Details

Reviewers
None
Group Reviewers
Frameworks
Summary

It's used from KService, which works with desktop files, add support to parse xdg lists.

Test Plan

Enabled it from kservice and used:
ktraderclient5 --servicetype Application --constraint "exist Exec and (exist [X-Flatpak-RenamedFrom] and 'telegramdesktop.desktop' in [X-Flatpak-RenamedFrom])"

Diff Detail

Repository
R237 KConfig
Branch
master
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 15670
Build 15688: arc lint + arc unit
apol created this revision.Aug 26 2019, 5:32 PM
Restricted Application added a project: Frameworks. · View Herald TranscriptAug 26 2019, 5:32 PM
Restricted Application added a subscriber: kde-frameworks-devel. · View Herald Transcript
apol requested review of this revision.Aug 26 2019, 5:32 PM
kossebau added inline comments.
src/core/kconfiggroup.h
653
apol added inline comments.Aug 26 2019, 5:38 PM
src/core/kconfiggroup.h
653

Thought about it, it's private API, are you sure it makes sense to have an enum just for this?

pino added a subscriber: pino.Aug 26 2019, 5:39 PM
pino added inline comments.
src/core/kconfiggroup.h
655

this must be kept non-inline, otherwise it's a symbol loss (and thus a BIC change)

kossebau added inline comments.Aug 26 2019, 5:44 PM
src/core/kconfiggroup.h
653

Still helps readers of codes which calls this method. IMHO one should not make a difference in API style for public and private users, both deserve same nice treatment. My 2 cents.

How exactly are you using ths from KService? If just by passing the flag set, won't this break any existing custom properties which are relying on "," as separator?

grep "Type=QStringList" /usr/share/kservicetypes5/ -r hints there are quite some properties which no longer would be properly parsed then for existing desktop files?

apol added a comment.Aug 26 2019, 10:38 PM

How exactly are you using ths from KService? If just by passing the flag set, won't this break any existing custom properties which are relying on "," as separator?

diff --git a/src/services/kservice.cpp b/src/services/kservice.cpp
index f89c1f1..7d85153 100644
--- a/src/services/kservice.cpp
+++ b/src/services/kservice.cpp
@@ -560,7 +560,7 @@ QVariant KServicePrivate::property(const QString &_name, QVariant::Type t) const
         // All others
         // For instance properties defined as StringList, like MimeTypes.
         // XXX This API is accessible only through a friend declaration.
-        return KConfigGroup::convertToQVariant(_name.toUtf8().constData(), it->toString().toUtf8(), t);
+        return KConfigGroup::convertToQVariant(_name.toUtf8().constData(), it->toString().toUtf8(), t, true);

grep "Type=QStringList" /usr/share/kservicetypes5/ -r hints there are quite some properties which no longer would be properly parsed then for existing desktop files?

Yes, there's a lot of misconstructed desktop files in KDE due to this bug (and similar, I presume). Hence the e-mail I sent.