00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef QDBUSCONNECTION_H
00026 #define QDBUSCONNECTION_H
00027
00122 #include "dbus/qdbusmacros.h"
00123 #include <qstring.h>
00124
00125 class QDBusConnectionPrivate;
00126 class QDBusError;
00127 class QDBusMessage;
00128 class QDBusObjectBase;
00129 class QObject;
00130
00171 class QDBUS_EXPORT QDBusConnection
00172 {
00173 public:
00177 enum BusType
00178 {
00184 SessionBus,
00185
00196 SystemBus,
00197
00198
00199 ActivationBus
00200 };
00201
00211 QDBusConnection();
00212
00224 QDBusConnection(const QString &name);
00225
00234 QDBusConnection(const QDBusConnection &other);
00235
00243 ~QDBusConnection();
00244
00256 QDBusConnection &operator=(const QDBusConnection &other);
00257
00265 bool isConnected() const;
00266
00275 QDBusError lastError() const;
00276
00282 enum NameRequestMode
00283 {
00288 NoReplace = 0,
00289
00295 AllowReplace = 1,
00296
00302 ReplaceExisting = 2
00303 };
00304
00336 bool requestName(const QString &name, int modeFlags = NoReplace);
00337
00348 QString uniqueName() const;
00349
00370 bool send(const QDBusMessage &message) const;
00371
00392 QDBusMessage sendWithReply(const QDBusMessage &message, QDBusError *error = 0) const;
00393
00420 int sendWithAsyncReply(const QDBusMessage &message, QObject *receiver,
00421 const char *slot) const;
00422
00428 void flush() const;
00429
00441 void dispatch() const;
00442
00454 void scheduleDispatch() const;
00455
00498 bool connect(QObject* object, const char* slot);
00499
00510 bool disconnect(QObject* object, const char* slot);
00511
00537 bool registerObject(const QString& path, QDBusObjectBase* object);
00538
00552 void unregisterObject(const QString &path);
00553
00567 static QDBusConnection sessionBus();
00568
00582 static QDBusConnection systemBus();
00583
00617 static QDBusConnection addConnection(BusType type,
00618 const QString &name = default_connection_name);
00619
00638 static QDBusConnection addConnection(const QString &address,
00639 const QString &name = default_connection_name);
00640
00641
00651 static void closeConnection(const QString &name = default_connection_name);
00652
00656 QT_STATIC_CONST char *default_connection_name;
00657
00658 private:
00659 QDBusConnectionPrivate *d;
00660 };
00661
00662 #endif