Missing KServiceType Info
David Faure
faure at kde.org
Tue Feb 8 14:06:22 GMT 2005
On Tuesday 08 February 2005 14:37, ian geiser wrote:
> Okay this makes a bit less sense then. I had hoped there was a rational
> explanation for this. Basicly whats confusing is from what you are saying
> services can randomly declare any property they please as long as it has
> X-KDE- in the front?
No, random properties in service .desktop files will be ignored unless they are
defined in a servicetype (since we wouldn't know the type, otherwise).
> All this confusion seems like overkill, basicly all i
> really wanted to do was get the possible properties for each service via some
> API.
KServiceType::propertyNames is supposed to be that.
> I guess this is my confusion over where some of these properties come from.
[snip]
After re-reading the code I see that one thing has changed.
So let me re-explain clearly how it works:
A service stores everything it finds in the .desktop file as properties. [During kbuildsycoca
this allows to discover the servicetype only *after* the .desktop file was seen, compared
to the previous solution].
Later on, when requesting a property, we need to know the type of the property.
That's when KService looks up in the service-types it implements, if the type isn't known
(the type of many builtin properties, like Library is known, of course).
This is why you won't find anything about Library in KServiceType or in the servicetypes.
It wasn't, ever, needed.
The main purpose of servicetype properties is to know the type of the properties,
and nothing else. You're looking after some generalization of "which properties
can I expect to find in the services of a given servicetype", and the answer to that
is only partial: you can get the properties that are really *specific* to that servicetype,
since that's needed to know their type, but we can't possibly know in advance
every possible key that a .desktop file might use - it's allowed to use whatever you
want and to query for it by passing the type from code
(see KService::property( const QString& _name, QVariant::Type t )).
The hardcoded list of properties listed in KService::propertyNames looks like what
you're after, I have nothing against moving it to KServiceType somehow.
--
David Faure, faure at kde.org, sponsored by Trolltech to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).
More information about the kde-core-devel
mailing list