class KServiceTypeTrader


Module kdecore
Namespace
Class KServiceTypeTrader
Inherits
KDE's trader interface (similar to the CORBA Trader), which provides a way to query the KDE infrastructure for specific applications or components.

Basically, KServiceTypeTrader provides a way for an application to query all KDE services (that is, applications, components, plugins) that match a specific set of requirements. This allows to find specific services at run-time without having to hard-code their names and/or paths.

For anything relating to mimetypes (type of files), ignore KServiceTypeTrader and use KMimeTypeTrader instead.

Example

If you want to find all plugins for your application, you would define a KMyApp/Plugin servicetype, and then you can query the trader for it:

KService.List offers =
KServiceTypeTrader.self()->query("KMyApp/Plugin");

You can add a constraint in the "trader query language". For instance:

KServiceTypeTrader.self()->query("KMyApp/Plugin",
"[X-KMyApp-InterfaceVersion] > 15");

Please note that when including property names containing arithmetic operators like - or +, then you have to put brackets around the property name, in order to correctly separate arithmetic operations from the name. So for example a constraint expression like

X-KMyApp-InterfaceVersion > 4 // wrong!
needs to be written as
[X-KMyApp-InterfaceVersion] > 4
otherwise it could also be interpreted as Substract the numeric value of the property "KMyApp" and "InterfaceVersion" from the property "X" and make sure it is greater than 4.\n Instead of the other meaning, make sure that the numeric value of "X-KMyApp-InterfaceVersion" is greater than 4.

See also KMimeTypeTrader, KService



methods