02c231eb82797f2c728149d8f613b7827fe5ad0a
[platform/upstream/dbus.git] / qt / qdbusbus.cpp
1 /* -*- C++ -*-
2  *
3  * Copyright (C) 2006 Trolltech AS. All rights reserved.
4  *    Author: Thiago Macieira <thiago.macieira@trolltech.com>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software Foundation,
18  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19  *
20  */
21
22 /*
23  * This file was generated by dbusidl2cpp version 0.3
24  * when processing input file -
25  *
26  * dbusidl2cpp is Copyright (C) 2006 Trolltech AS. All rights reserved.
27  *
28  * This file has been hand-edited! Be careful when re-generating it!
29  *
30  */
31
32 #include "qdbusbus.h"
33
34 #include <QtCore/QByteArray>
35 #include <QtCore/QList>
36 #include <QtCore/QMap>
37 #include <QtCore/QString>
38 #include <QtCore/QStringList>
39 #include <QtCore/QVariant>
40
41 /*
42  * Implementation of interface class QDBusBusService
43  */
44
45 /*!
46     \class QDBusBusService
47     \brief Provides access to the D-Bus bus daemon service.
48
49 */
50
51 /*!
52     \enum QDBusBusService::RequestNameOption
53
54     Flags for requesting a name on the bus.
55
56     \value AllowReplacingName   Allow another application requesting the same name to take the name
57                                 from this application.
58     \value ReplaceExistingName  If another application already has the name and allows replacing,
59                                 take the name and assign it to us.
60     \value DoNotQueueName       Without this flag, if an application requests a name that is already
61                                 owned and does not allow replacing, it will be queued until the
62                                 name is given up. If this flag is given, no queueing will be
63                                 performed and the requestName() call will simply fail.
64 */
65
66 /*!
67     \enum QDBusBusService::RequestNameReply
68
69     The possible return values from requestName():
70
71     \value PrimaryOwnerReply    The caller is now the primary owner of the name.
72     \value InQueueReply         The caller is in queue for the name, but does not own it.
73     \value NameExistsReply      The name exists and could not be replaced, or the caller did
74                                 specify DoNotQueueName.
75     \value AlreadyOwnerReply    The caller tried to request a name that it already owns.
76 */
77
78 /*!
79     \enum QDBusBusService::ReleaseNameReply
80
81     The possible return values from releaseName():
82
83     \value NameReleasedReply    The caller released his claim on the name.
84     \value NameNonExistentReply The caller tried to release a name that did not exist.
85     \value NotOwnerReply        The caller tried to release a name that it did not own or was not in
86                                 queue for.
87 */
88
89 /*!
90     \enum QDBusBusService::StartServiceReply
91
92     The possible return values from startServiceByName():
93
94     \value Success              The service was successfully started.
95     \value AlreadyRunning       The service was already running.
96 */
97
98 /*!
99     \internal
100 */
101 const char *QDBusBusService::staticInterfaceName()
102 { return "org.freedesktop.DBus"; }
103
104
105 /*!
106     \internal
107 */
108 QDBusBusService::QDBusBusService(QDBusAbstractInterfacePrivate *p)
109     : QDBusAbstractInterface(p)
110 {
111     connect(this, SIGNAL(NameAcquired(QString)), this, SIGNAL(nameAcquired(QString)));
112     connect(this, SIGNAL(NameLost(QString)), this, SIGNAL(nameLost(QString)));
113     connect(this, SIGNAL(NameOwnerChanged(QString,QString,QString)),
114             this, SIGNAL(nameOwnerChanged(QString,QString,QString)));
115 }
116
117 /*!
118     \internal
119 */
120 QDBusBusService::~QDBusBusService()
121 {
122 }
123
124 /*!
125     \fn QDBusBusService::hello()
126     \internal
127     Sends a "Hello" request to the bus service. You do not want to call this.
128 */
129 QDBusReply<QString> QDBusBusService::Hello()
130 {
131     return call(QLatin1String("Hello"));
132 }
133
134 /*!
135     \fn QDBusBusService::nameOwner(const QString &name)
136     Returns the unique connection name of the primary owner of the name \a name. If the requested
137     name doesn't have an owner, returns a org.freedesktop.DBus.Error.NameHasNoOwner error.
138 */
139 QDBusReply<QString> QDBusBusService::GetNameOwner(const QString &name)
140 {
141     return call(QLatin1String("GetNameOwner.s"), name);
142 }
143
144 /*!
145     \fn QDBusBusService::listNames()
146     Lists all names currently existing on the bus.
147 */
148 QDBusReply<QStringList> QDBusBusService::ListNames()
149 {
150     return call(QLatin1String("ListNames"));
151 }
152
153 /*!
154     \fn QDBusBusService::listQueuedOwners(const QString &service)
155     Returns a list of all unique connection names in queue for the service name \a service.
156 */
157 QDBusReply<QStringList> QDBusBusService::ListQueuedOwners(const QString &service)
158 {
159     return call(QLatin1String("ListQueuedOwners.s"), service);
160 }
161
162 /*!
163     \fn QDBusBusService::nameHasOwner(const QString &service)
164     Returns true if the service name \a service has an owner.
165 */
166 QDBusReply<bool> QDBusBusService::NameHasOwner(const QString &service)
167 {
168     return call(QLatin1String("NameHasOwner.s"), service);
169 }
170
171 /*!
172     \fn QDBusBusService::addMatch(const QString &rule)
173     Adds the rule \a rule for requesting messages from the bus.
174
175     \sa removeMatch()
176 */
177 QDBusReply<void> QDBusBusService::AddMatch(const QString &rule)
178 {
179     return call(QLatin1String("AddMatch.s"), rule);
180 }
181
182 /*!
183     \fn QDBusBusService::removeMatch(const QString &rule)
184     Removes the rule \a rule, that had previously been added with addMatch().
185 */
186 QDBusReply<void> QDBusBusService::RemoveMatch(const QString &rule)
187 {
188     return call(QLatin1String("RemoveMatch.s"), rule);
189 }
190
191 /*!
192     \fn QDBusBusService::connectionSELinuxSecurityContext(const QString &service)
193     Returns the SELinux security context of the process currently holding the bus service \a
194     service.
195 */
196 QDBusReply<QByteArray> QDBusBusService::GetConnectionSELinuxSecurityContext(const QString &service)
197 {
198     return call(QLatin1String("GetConnectionSELinuxSecurityContext.s"), service);
199 }
200
201 /*!
202     \fn QDBusBusService::connectionUnixProcessID(const QString &service)
203     Returns the Unix Process ID (PID) for the process currently holding the bus service \a service.
204 */
205 QDBusReply<uint> QDBusBusService::GetConnectionUnixProcessID(const QString &service)
206 {
207     return call(QLatin1String("GetConnectionUnixProcessID.s"), service);
208 }
209
210 /*!
211     \fn QDBusBusService::connectionUnixUser(const QString &service)
212     Returns the Unix User ID (UID) for the process currently holding the bus service \a service.
213 */
214 QDBusReply<uint> QDBusBusService::GetConnectionUnixUser(const QString &service)
215 {
216     return call(QLatin1String("GetConnectionUnixUser.s"), service);
217 }
218
219 /*!
220     \fn QDBusBusService::reloadConfig()
221     Asks the D-Bus server daemon to reload its configuration.
222 */
223 QDBusReply<void> QDBusBusService::ReloadConfig()
224 {
225     return call(QLatin1String("ReloadConfig"));
226 }
227
228 inline QDBUS_EXPORT int qDBusMetaTypeId(QDBusBusService::StartServiceReply *)
229 { return QVariant::Int; }
230
231 /*!
232     \fn QDBusBusService::startServiceByName(const QString &name, uint flags)
233     Requests that the bus start the service given by the name \a name.
234
235     The \a flags parameter is currently not used.
236 */
237 QDBusReply<QDBusBusService::StartServiceReply>
238 QDBusBusService::StartServiceByName(const QString &name, uint flags)
239 {
240     return call(QLatin1String("StartServiceByName.su"), name, flags);
241 }
242
243 inline QDBUS_EXPORT int qDBusMetaTypeId(QDBusBusService::RequestNameReply *)
244 { return QVariant::Int; }
245
246 /*!
247     \fn QDBusBusService::requestName(const QString &service, RequestNameOptions flags)
248     Requests the bus service name \a service from the bus. The \a flags parameter specifies how the
249     bus server daemon should act when the same name is requested by two different applications.
250
251     \sa releaseName()
252 */
253 QDBusReply<QDBusBusService::RequestNameReply>
254 QDBusBusService::RequestName(const QString &service, RequestNameOptions flags)
255 {
256     return call(QLatin1String("RequestName.su"), service, uint(int(flags)));
257 }
258
259 inline QDBUS_EXPORT int qDBusMetaTypeId(QDBusBusService::ReleaseNameReply *)
260 { return QVariant::Int; }
261
262 /*!
263     \fn QDBusBusService::releaseName(const QString &service)
264     Releases the claim on the bus service name \a service, that had been previously requested with
265     requestName(). If this application had ownership of the name, it will be released for other
266     applications to claim. If it only had the name queued, it gives up its position in the queue.
267 */
268 QDBusReply<QDBusBusService::ReleaseNameReply>
269 QDBusBusService::ReleaseName(const QString &service)
270 {
271     return call(QLatin1String("ReleaseName.s"), service);
272 }
273
274 // signals
275 /*!
276     \fn QDBusBusService::nameAcquired(const QString &service)
277
278     This signal is emitted by the D-Bus bus server when the bus service name (unique connection name
279     or well-known service name) given by \a service is acquired by this application.
280
281     Name acquisition happens after the application requested a name using requestName().
282 */
283
284 /*!
285     \fn QDBusBusService::nameLost(const QString &service)
286
287     This signal is emitted by the D-Bus bus server when the application loses ownership of the bus
288     service name given by \a service.
289 */
290
291 /*!
292     \fn QDBusBusService::nameOwnerChanged(const QString &name, const QString &oldOwner, const QString &newOwner)
293
294     This signal is emitted by the D-Bus bus server whenever a name ownership change happens in the
295     bus, including apparition and disparition of names.
296
297     This signal means the application \a oldOwner lost ownership of bus name \a name to application
298     \a newOwner. If \a oldOwner is an empty string, it means the name \a name has just been created;
299     if \a newOwner is empty, the name \a name has no current owner.
300 */
301
302 #include "qdbusbus.moc"