Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qdbusconnectioninterface.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3// Qt-Security score:significant reason:default
4
5#ifndef QDBUSCONNECTIONINTERFACE_H
6#define QDBUSCONNECTIONINTERFACE_H
7
8#include <QtDBus/qtdbusglobal.h>
9#include <QtCore/qstringlist.h>
10
11#include <QtDBus/qdbusabstractinterface.h>
12#include <QtDBus/qdbusreply.h>
13
14#ifndef QT_NO_DBUS
15
17
18
19class QDBusConnection;
20class QString;
21class QByteArray;
22
23/*
24 * Proxy class for interface org.freedesktop.DBus
25 */
26class Q_DBUS_EXPORT QDBusConnectionInterface: public QDBusAbstractInterface
27{
28 Q_OBJECT
29 friend class QDBusConnectionPrivate;
30 static inline const char *staticInterfaceName();
31
32 explicit QDBusConnectionInterface(const QDBusConnection &connection, QObject *parent);
33 ~QDBusConnectionInterface();
34
35 Q_PROPERTY(QDBusReply<QStringList> registeredServiceNames READ registeredServiceNames)
36 Q_PROPERTY(QDBusReply<QStringList> activatableServiceNames READ activatableServiceNames)
37
38public:
39 enum ServiceQueueOptions {
40 DontQueueService,
41 QueueService,
42 ReplaceExistingService
43 };
44 Q_ENUM(ServiceQueueOptions)
45 enum ServiceReplacementOptions {
46 DontAllowReplacement,
47 AllowReplacement
48 };
49 Q_ENUM(ServiceReplacementOptions)
50 enum RegisterServiceReply {
51 ServiceNotRegistered = 0,
52 ServiceRegistered,
53 ServiceQueued
54 };
55 Q_ENUM(RegisterServiceReply)
56
57public Q_SLOTS:
58 QDBusReply<QStringList> registeredServiceNames() const;
59 QDBusReply<QStringList> activatableServiceNames() const;
60 QDBusReply<bool> isServiceRegistered(const QString &serviceName) const;
61 QDBusReply<QString> serviceOwner(const QString &name) const;
62 QDBusReply<bool> unregisterService(const QString &serviceName);
63 QDBusReply<QDBusConnectionInterface::RegisterServiceReply> registerService(const QString &serviceName,
64 ServiceQueueOptions qoption = DontQueueService,
65 ServiceReplacementOptions roption = DontAllowReplacement);
66
67 QDBusReply<uint> servicePid(const QString &serviceName) const;
68 QDBusReply<uint> serviceUid(const QString &serviceName) const;
69
70 QDBusReply<QVariantMap> serviceCredentials(const QString &serviceName) const;
71
72 QDBusReply<void> startService(const QString &name);
73
74Q_SIGNALS:
75 void serviceRegistered(const QString &service);
76 void serviceUnregistered(const QString &service);
77 void serviceOwnerChanged(const QString &name, const QString &oldOwner, const QString &newOwner);
78 void callWithCallbackFailed(const QDBusError &error, const QDBusMessage &call);
79
80#ifndef Q_QDOC
81 // internal signals
82 // do not use
83 void NameAcquired(const QString &);
84 void NameLost(const QString &);
85 void NameOwnerChanged(const QString &, const QString &, const QString &);
86protected:
87 void connectNotify(const QMetaMethod &) override;
88 void disconnectNotify(const QMetaMethod &) override;
89#endif
90};
91
92QT_END_NAMESPACE
93
94Q_DECLARE_BUILTIN_METATYPE(UInt, QMetaType::UInt, QDBusConnectionInterface::RegisterServiceReply)
95
96#endif // QT_NO_DBUS
97#endif