desktoptojson and list properties

Milian Wolff mail at milianw.de
Sun Nov 16 23:24:23 GMT 2014


On Sunday 16 November 2014 23:52:25 Milian Wolff wrote:
> Hello all!
> 
> 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!
KServiceTypeFactory::self()->findPropertyTypeByName(...)

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 kbuildsycoca!

> 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?

Bye
-- 
Milian Wolff
mail at milianw.de
http://milianw.de




More information about the kde-core-devel mailing list