KDBusServiceStarter
#include <KDBusServiceStarter>
Public Member Functions | |
int | findServiceFor (const QString &serviceType, const QString &constraint=QString(), QString *error=nullptr, QString *dbusService=nullptr, int flags=0) |
virtual int | startServiceFor (const QString &serviceType, const QString &constraint=QString(), QString *error=nullptr, QString *dbusService=nullptr, int flags=0) |
Static Public Member Functions | |
static KDBusServiceStarter * | self () |
Detailed Description
A generic D-Bus service starter, using KServiceTypeTrader. The default implementation starts new processes, but this interface can also be reimplemented by specific applications to provide dlopened in-process D-Bus objects. This interface is similar to the startService() function found in QDBusConnectionInterface, but with the added benefit of using KServiceTypeTrader (and, therefore, additional constraints and the ability to search the standard KDE dirs).
- Deprecated:
- since 5.61, use D-Bus activation instead
Definition at line 31 of file kdbusservicestarter.h.
Member Function Documentation
◆ findServiceFor()
int KDBusServiceStarter::findServiceFor | ( | const QString & | serviceType, |
const QString & | constraint = QString() , |
||
QString * | error = nullptr , |
||
QString * | dbusService = nullptr , |
||
int | flags = 0 |
||
) |
Check if a given D-Bus service is available - from the serviceType it's supposed to implement.
The trader is queried to find the preferred application for this serviceType, with the constraint that its X-DBus-ServiceName property must be defined. Then the D-Bus server is checked. If the service is not available, this method will call startServiceFor to start it.
- Parameters
-
serviceType the type of service we're looking for constraint see KServiceTypeTrader error On failure, error
contains a description of the error that occurred. If the pointer is 0, the argument will be ignoreddbusService On success, dbusService
contains the D-Bus service name under which this service is available. If the pointer is 0 the argument will be ignoredflags for future extensions (currently unused)
- Returns
- an error code indicating success (== 0) or failure (> 0).
Definition at line 56 of file kdbusservicestarter.cpp.
◆ startServiceFor()
|
virtual |
Find an implementation of the given serviceType
, and start it, to use its D-Bus interface.
The default implementation uses KServiceTypeTrader to find the preferred Application, and then starts it using KToolInvocation::startService...
However applications (like kontact) can reimplement this method, to provide an in-process way of loading the implementation for this service type.
- Parameters
-
serviceType the type of service we're looking for constraint see KServiceTypeTrader error On failure, error
contains a description of the error that occurred. If the pointer is 0, the argument will be ignoreddbusService On success, dbusService
contains the D-Bus service name under which this service is available. If the pointer is 0 the argument will be ignoredflags for future extensions (currently unused)
- Returns
- an error code indicating success (== 0) or failure (> 0).
Definition at line 93 of file kdbusservicestarter.cpp.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2023 The KDE developers.
Generated on Sat Dec 2 2023 03:51:56 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.