DtkWidget 5.6.0.2
DTK Widget module
dbusinterface.h
1// SPDX-FileCopyrightText: 2016 - 2022 UnionTech Software Technology Co., Ltd.
2//
3// SPDX-License-Identifier: LGPL-3.0-or-later
4
5#ifndef DBUSINTERFACE_H
6#define DBUSINTERFACE_H
7
8#include <QtCore/QObject>
9#include <QtCore/QByteArray>
10#include <QtCore/QList>
11#include <QtCore/QMap>
12#include <QtCore/QString>
13#include <QtCore/QStringList>
14#include <QtCore/QVariant>
15#include <QtDBus/QtDBus>
16
17/*
18 * Proxy class for interface org.freedesktop.DBus
19 */
20class DBusInterface: public QDBusAbstractInterface
21{
22 Q_OBJECT
23
24 Q_SLOT void __propertyChanged__(const QDBusMessage& msg)
25 {
26 QList<QVariant> arguments = msg.arguments();
27 if (3 != arguments.count())
28 return;
29 QString interfaceName = msg.arguments().at(0).toString();
30 if (interfaceName != "org.freedesktop.DBus")
31 return;
32 QVariantMap changedProps = qdbus_cast<QVariantMap>(arguments.at(1).value<QDBusArgument>());
33 Q_FOREACH(const QString &prop, changedProps.keys()) {
34 const QMetaObject* self = metaObject();
35 for (int i=self->propertyOffset(); i < self->propertyCount(); ++i) {
36 QMetaProperty p = self->property(i);
37 QGenericArgument value(QMetaType::typeName(p.type()), const_cast<void*>(changedProps[prop].constData()));
38 if (p.name() == prop) {
39 Q_EMIT p.notifySignal().invoke(this, value);
40 }
41 }
42 }
43 }
44public:
45 static inline const char *staticInterfaceName()
46 { return "org.freedesktop.DBus"; }
47
48public:
49 DBusInterface(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent = 0);
50
52
53public Q_SLOTS: // METHODS
54 inline QDBusPendingReply<> AddMatch(const QString &in0)
55 {
56 QList<QVariant> argumentList;
57 argumentList << QVariant::fromValue(in0);
58 return asyncCallWithArgumentList(QStringLiteral("AddMatch"), argumentList);
59 }
60
61 inline QDBusPendingReply<QByteArray> GetAdtAuditSessionData(const QString &in0)
62 {
63 QList<QVariant> argumentList;
64 argumentList << QVariant::fromValue(in0);
65 return asyncCallWithArgumentList(QStringLiteral("GetAdtAuditSessionData"), argumentList);
66 }
67
68 inline QDBusPendingReply<QByteArray> GetConnectionSELinuxSecurityContext(const QString &in0)
69 {
70 QList<QVariant> argumentList;
71 argumentList << QVariant::fromValue(in0);
72 return asyncCallWithArgumentList(QStringLiteral("GetConnectionSELinuxSecurityContext"), argumentList);
73 }
74
75 inline QDBusPendingReply<uint> GetConnectionUnixProcessID(const QString &in0)
76 {
77 QList<QVariant> argumentList;
78 argumentList << QVariant::fromValue(in0);
79 return asyncCallWithArgumentList(QStringLiteral("GetConnectionUnixProcessID"), argumentList);
80 }
81
82 inline QDBusPendingReply<uint> GetConnectionUnixUser(const QString &in0)
83 {
84 QList<QVariant> argumentList;
85 argumentList << QVariant::fromValue(in0);
86 return asyncCallWithArgumentList(QStringLiteral("GetConnectionUnixUser"), argumentList);
87 }
88
89 inline QDBusPendingReply<QString> GetId()
90 {
91 QList<QVariant> argumentList;
92 return asyncCallWithArgumentList(QStringLiteral("GetId"), argumentList);
93 }
94
95 inline QDBusPendingReply<QString> GetNameOwner(const QString &in0)
96 {
97 QList<QVariant> argumentList;
98 argumentList << QVariant::fromValue(in0);
99 return asyncCallWithArgumentList(QStringLiteral("GetNameOwner"), argumentList);
100 }
101
102 inline QDBusPendingReply<QString> Hello()
103 {
104 QList<QVariant> argumentList;
105 return asyncCallWithArgumentList(QStringLiteral("Hello"), argumentList);
106 }
107
108 inline QDBusPendingReply<QStringList> ListActivatableNames()
109 {
110 QList<QVariant> argumentList;
111 return asyncCallWithArgumentList(QStringLiteral("ListActivatableNames"), argumentList);
112 }
113
114 inline QDBusPendingReply<QStringList> ListNames()
115 {
116 QList<QVariant> argumentList;
117 return asyncCallWithArgumentList(QStringLiteral("ListNames"), argumentList);
118 }
119
120 inline QDBusPendingReply<QStringList> ListQueuedOwners(const QString &in0)
121 {
122 QList<QVariant> argumentList;
123 argumentList << QVariant::fromValue(in0);
124 return asyncCallWithArgumentList(QStringLiteral("ListQueuedOwners"), argumentList);
125 }
126
127 inline QDBusPendingReply<bool> NameHasOwner(const QString &in0)
128 {
129 QList<QVariant> argumentList;
130 argumentList << QVariant::fromValue(in0);
131 return asyncCallWithArgumentList(QStringLiteral("NameHasOwner"), argumentList);
132 }
133
134 inline QDBusPendingReply<uint> ReleaseName(const QString &in0)
135 {
136 QList<QVariant> argumentList;
137 argumentList << QVariant::fromValue(in0);
138 return asyncCallWithArgumentList(QStringLiteral("ReleaseName"), argumentList);
139 }
140
141 inline QDBusPendingReply<> ReloadConfig()
142 {
143 QList<QVariant> argumentList;
144 return asyncCallWithArgumentList(QStringLiteral("ReloadConfig"), argumentList);
145 }
146
147 inline QDBusPendingReply<> RemoveMatch(const QString &in0)
148 {
149 QList<QVariant> argumentList;
150 argumentList << QVariant::fromValue(in0);
151 return asyncCallWithArgumentList(QStringLiteral("RemoveMatch"), argumentList);
152 }
153
154 inline QDBusPendingReply<uint> RequestName(const QString &in0, uint in1)
155 {
156 QList<QVariant> argumentList;
157 argumentList << QVariant::fromValue(in0) << QVariant::fromValue(in1);
158 return asyncCallWithArgumentList(QStringLiteral("RequestName"), argumentList);
159 }
160
161 inline QDBusPendingReply<uint> StartServiceByName(const QString &in0, uint in1)
162 {
163 QList<QVariant> argumentList;
164 argumentList << QVariant::fromValue(in0) << QVariant::fromValue(in1);
165 return asyncCallWithArgumentList(QStringLiteral("StartServiceByName"), argumentList);
166 }
167
168Q_SIGNALS: // SIGNALS
169 void NameAcquired(const QString &in0);
170 void NameLost(const QString &in0);
171 void NameOwnerChanged(const QString &in0, const QString &in1, const QString &in2);
172// begin property changed signals
173};
174
175namespace org {
176 namespace freedesktop {
177 typedef ::DBusInterface DBus;
178 }
179}
180#endif
Definition: dbusinterface.h:21
const T & at(int i) const const
int count(const T &value) const const
bool invoke(QObject *object, Qt::ConnectionType connectionType, QGenericReturnArgument returnValue, QGenericArgument val0, QGenericArgument val1, QGenericArgument val2, QGenericArgument val3, QGenericArgument val4, QGenericArgument val5, QGenericArgument val6, QGenericArgument val7, QGenericArgument val8, QGenericArgument val9) const const
QMetaProperty property(int index) const const
int propertyOffset() const const
const char * name() const const
QMetaMethod notifySignal() const const
QVariant::Type type() const const
const char * typeName(int typeId)
const QChar at(int position) const const
QVariant fromValue(const T &value)