summaryrefslogtreecommitdiffstats
path: root/qt/src/qdbusconnection.h
diff options
context:
space:
mode:
authorThiago Macieira <thiago@kde.org>2006-06-04 15:52:05 +0000
committerThiago Macieira <thiago@kde.org>2006-06-04 15:52:05 +0000
commitedbf2bfc109ce94b2604ea20328fda25542e4383 (patch)
tree3281d191fa9dde9f1f26b947b145d02373f031b0 /qt/src/qdbusconnection.h
parent435c7af9b605c3ffc8641142b6d7add18bf7080b (diff)
* qt/: Update to Subversion r548032.
This includes a big reorganisation of the files inside the subdir. We really need a version control system that supports moving of files. I'm not bothering with history anyways anymore, since the bindings will be moved out to git. The history should be restored from Subversion when that happens.
Diffstat (limited to 'qt/src/qdbusconnection.h')
-rw-r--r--qt/src/qdbusconnection.h124
1 files changed, 124 insertions, 0 deletions
diff --git a/qt/src/qdbusconnection.h b/qt/src/qdbusconnection.h
new file mode 100644
index 00000000..c1c420a6
--- /dev/null
+++ b/qt/src/qdbusconnection.h
@@ -0,0 +1,124 @@
+/* qdbusconnection.h QDBusConnection object
+ *
+ * Copyright (C) 2005 Harald Fernengel <harry@kdevelop.org>
+ * Copyright (C) 2006 Trolltech AS. All rights reserved.
+ * Author: Thiago Macieira <thiago.macieira@trolltech.com>
+ *
+ * Licensed under the Academic Free License version 2.1
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef QDBUSCONNECTION_H
+#define QDBUSCONNECTION_H
+
+#include "qdbusmacros.h"
+#include <QtCore/qstring.h>
+
+class QDBusAbstractInterfacePrivate;
+class QDBusInterface;
+class QDBusError;
+class QDBusMessage;
+class QDBusBusService;
+class QObject;
+
+class QDBusConnectionPrivate;
+class QDBUS_EXPORT QDBusConnection
+{
+public:
+ enum BusType { SessionBus, SystemBus, ActivationBus };
+ enum WaitMode { UseEventLoop, NoUseEventLoop };
+ enum RegisterOption {
+ ExportAdaptors = 0x01,
+
+ ExportSlots = 0x10,
+ ExportSignals = 0x20,
+ ExportProperties = 0x40,
+ ExportContents = 0xf0,
+
+ ExportAllSlots = 0x110,
+ ExportAllSignals = 0x220,
+ ExportAllProperties = 0x440,
+ ExportAllContents = 0xff0,
+
+ ExportChildObjects = 0x1000
+ };
+ enum UnregisterMode {
+ UnregisterNode,
+ UnregisterTree
+ };
+
+ Q_DECLARE_FLAGS(RegisterOptions, RegisterOption)
+
+ QDBusConnection(const QString &name);
+ QDBusConnection(const QDBusConnection &other);
+ ~QDBusConnection();
+
+ QDBusConnection &operator=(const QDBusConnection &other);
+
+ bool isConnected() const;
+ QString baseService() const;
+ QDBusError lastError() const;
+
+ bool send(const QDBusMessage &message) const;
+ QDBusMessage sendWithReply(const QDBusMessage &message, WaitMode mode = NoUseEventLoop) const;
+ int sendWithReplyAsync(const QDBusMessage &message, QObject *receiver,
+ const char *slot) const;
+
+ bool connect(const QString &service, const QString &path, const QString &interface,
+ const QString &name, QObject *receiver, const char *slot);
+ bool connect(const QString &service, const QString &path, const QString &interface,
+ const QString &name, const QString& signature,
+ QObject *receiver, const char *slot);
+
+ bool registerObject(const QString &path, QObject *object,
+ RegisterOptions options = ExportAdaptors);
+ void unregisterObject(const QString &path, UnregisterMode mode = UnregisterNode);
+
+ template<class Interface>
+ inline Interface *findInterface(const QString &service, const QString &path);
+ QDBusInterface *findInterface(const QString& service, const QString& path,
+ const QString& interface = QString());
+
+ QDBusBusService *busService() const;
+
+ static QDBusConnection addConnection(BusType type, const QString &name);
+ static QDBusConnection addConnection(const QString &address, const QString &name);
+ static void closeConnection(const QString &name);
+
+private:
+ QDBusAbstractInterfacePrivate *findInterface_helper(const QString &, const QString &,
+ const QString&);
+ QDBusConnectionPrivate *d;
+};
+
+template<class Interface>
+inline Interface *QDBusConnection::findInterface(const QString &service, const QString &path)
+{
+ register QDBusAbstractInterfacePrivate *d;
+ d = findInterface_helper(service, path, Interface::staticInterfaceName());
+ if (d)
+ return new Interface(d);
+ return 0;
+}
+
+namespace QDBus {
+ QDBUS_EXPORT QDBusConnection &sessionBus();
+ QDBUS_EXPORT QDBusConnection &systemBus();
+}
+
+Q_DECLARE_OPERATORS_FOR_FLAGS(QDBusConnection::RegisterOptions)
+#endif