KDBusAddons
kdbusservice.cpp
65 QByteArray desktopStartupId = platformData.value(QStringLiteral("desktop-startup-id")).toByteArray();
72 const auto xdgActivationToken = platformData.value(QLatin1String("activation-token")).toByteArray();
99 if (!QDBusConnection::sessionBus().isConnected() || !(bus = QDBusConnection::sessionBus().interface())) {
101 "DBus session bus not found. To circumvent this problem try the following command (with bash):\n"
126 objectPath.replace(QLatin1Char('-'), QLatin1Char('_')); // see spec change at https://bugs.freedesktop.org/show_bug.cgi?id=95129
132 + QDBusConnection::sessionBus().baseService().replace(QRegularExpression(QStringLiteral("[\\.:]")), QStringLiteral("_"));
178 connect(bus, &QDBusConnectionInterface::serviceRegistered, this, [this](const QString &service) {
188 d->registered = (bus->registerService(d->serviceName, queueOption) == QDBusConnectionInterface::ServiceRegistered);
223 QDBusReply<int> reply = iface.CommandLine(QCoreApplication::arguments(), QDir::currentPath(), platform_data);
230 OrgFreedesktopApplicationInterface iface(d->serviceName, objectPath, QDBusConnection::sessionBus());
246 d->errorMessage = QLatin1String("Failed to register name '") + d->serviceName + QLatin1String("' with DBUS - does this process have permission to use the name, and do no other processes own it already?");
303 if (!d->registered || !QDBusConnection::sessionBus().isConnected() || !(bus = QDBusConnection::sessionBus().interface())) {
323void KDBusService::ActivateAction(const QString &action_name, const QVariantList &maybeParameter, const QVariantMap &platform_data)
334int KDBusService::CommandLine(const QStringList &arguments, const QString &workingDirectory, const QVariantMap &platform_data)
KDBusService takes care of registering the current process with D-Bus.
Definition kdbusservice.h:81
QString serviceName() const
Returns the name of the D-Bus service registered by this class.
Definition kdbusservice.cpp:295
void openRequested(const QList< QUrl > &uris)
Signals that one or more files should be opened in the application.
void unregister()
Manually unregister the given serviceName from D-Bus.
Definition kdbusservice.cpp:300
QString errorMessage() const
Returns the error message from the D-Bus registration if it failed.
Definition kdbusservice.cpp:285
~KDBusService() override
Destroys this object (but does not unregister the application).
bool isRegistered() const
Returns true if the D-Bus registration succeeded.
Definition kdbusservice.cpp:280
void activateActionRequested(const QString &actionName, const QVariant ¶meter)
Signals that an application action should be triggered.
KDBusService(StartupOptions options=Multiple, QObject *parent=nullptr)
Tries to register the current process to D-Bus at an address based on the application name and organi...
Definition kdbusservice.cpp:267
@ NoExitOnFailure
Indicates that the application should not exit if it failed to register with D-Bus.
Definition kdbusservice.h:111
@ Multiple
Indicates that multiple instances of the application may exist.
Definition kdbusservice.h:101
@ Unique
Indicates that only one instance of this application should ever exist.
Definition kdbusservice.h:95
@ Replace
Indicates that if there's already a unique service running, to be quit and replaced with our own.
Definition kdbusservice.h:121
void setExitValue(int value)
Sets the exit value to be used for a duplicate instance.
Definition kdbusservice.cpp:290
void activateRequested(const QStringList &arguments, const QString &workingDirectory)
Signals that the application is to be activated.
bool isEmpty() const const
applicationName
qint64 applicationPid()
QStringList arguments()
QCoreApplication * instance()
organizationDomain
ExportAllSlots
QDBusPendingCall asyncCall(const QDBusMessage &message, int timeout) const const
QString baseService() const const
QDBusConnectionInterface * interface() const const
bool isConnected() const const
QDBusConnection sessionBus()
ServiceRegistered
DontQueueService
QDBusReply< QDBusConnectionInterface::RegisterServiceReply > registerService(const QString &serviceName, ServiceQueueOptions qoption, ServiceReplacementOptions roption)
void serviceRegistered(const QString &service)
QDBusReply< bool > unregisterService(const QString &serviceName)
QString message() const const
QDBusMessage createMethodCall(const QString &service, const QString &path, const QString &interface, const QString &method)
const QDBusError & error()
bool isValid() const const
QString currentPath()
int exec(ProcessEventsFlags flags)
void quit()
bool exists() const const
bool isEmpty() const const
Q_EMITQ_EMIT
Q_OBJECTQ_OBJECT
QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, Functor functor)
QString fromUtf8(QByteArrayView str)
bool isEmpty() const const
QString number(double n, char format, int precision)
QString & prepend(QChar ch)
QString & replace(QChar before, QChar after, Qt::CaseSensitivity cs)
QStringList split(QChar sep, Qt::SplitBehavior behavior, Qt::CaseSensitivity cs) const const
SkipEmptyParts
void start()
void timeout()
QList< QUrl > fromStringList(const QStringList &urls, ParsingMode mode)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:08:00 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:08:00 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.