desktoptojson and list properties
sebas at kde.org
Mon Nov 17 17:35:51 GMT 2014
On Monday, November 17, 2014 02:04:51 Aleix Pol wrote:
> On Mon, Nov 17, 2014 at 12:24 AM, Milian Wolff <mail at milianw.de> wrote:
> On Sunday 16 November 2014 23:52:25 Milian Wolff wrote:
> > KDevelop is currently bitten hard by a bug/limitation in desktoptojson. It
> > does not actually understand the .desktop files and custom properties get
> > converted to plain JSON strings. Looking at the sources it's also clear
> > why, only a selected list of .desktop properties is interpreted as lists.
> > We have a custom kdevelopplugin.desktop file that describes our custom
> > properties via something like:
> > [Desktop Entry]
> > Type=ServiceType
> > X-KDE-ServiceType=KDevelop/Plugin
> > X-KDE-Derived=KPluginInfo
> > Name=KDevelop Plugin
> > ...
> > [PropertyDef::X-KDevelop-Interfaces]
> > Type=QStringList
> > ...
> > To me it looks like I'll have to add support for such files to
> > desktoptojson. But I wonder: Where was/is the code for the above files
> > (how
> > are they called?)?
> Apparently these are KServiceType's and the code can be found in kservice.
> In kservice.cpp's KServicePrivate::property we see code like this:
> // No luck, let's ask KServiceTypeFactory what the type of this property
> // is supposed to be.
> // ######### this looks in all servicetypes, not just the ones this service
> // supports!
You can't do this, desktoptojson is in kcoreaddons nowadays, and doesn't allow
KService as a dependency.
Currently, the list properties are hardcoded in desktoptojson. I suppose you
could also add it in there, but that feels quite meh, since ... well...
> Fine, I could add similar code to desktoptojson, but:
> > Since desktoptojson will be called for the plugins we ship in
> > KDevplatform,
> > how would/could I make desktoptojson "know" about the
> > kdevelopplugin.desktop file without it being installed yet?
> that would not work here as our service type is still unknown to
> > Or can we nowadays write the .json files directly, i.e. can scripty/ki18n
> > cope with them nowadays?
> So, any chance we can use .json directly here?
That should be possible, you can just drop the json file in there, and
reference that in the K_PLUGIN_FACTORY_WITH_JSON macro.
> I guess a solution would be to be able to provide the servicetype file as an
> argument to desktoptojson? Also given how the plan is to move away from
> kbuildsycoca database for these files (no?) maybe it would make sense to
> have an alternative way to look them up by path?
The problem is not so much looking them up, but reading them, as far as I
understand, those bits are really central to KService, and quite entangled at
that. I don't think you'll have much luck cutting that out there to make it
usable on its own -- but then, maybe you find a way...
http://www.kde.org | http://vizZzion.org | GPG Key ID: 9119 0EF9
More information about the kde-core-devel