From a0690166164b7feb059164d2b587ed54fa675485 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 20 Dec 2010 19:41:08 +0100 Subject: Add a way to obtain the DBusConnection* pointer from a QDBusConnection This is internal API and the behaviour may change without notice. In the future, I could use a different implementation without libdbus-1, so this pointer may be something different. The use of DBusConnection is also entirely implementation-defined, so keeping this connection around is entirely unsupported. You have been warned. --- src/dbus/qdbusconnection.cpp | 15 +++++++++++++++ src/dbus/qdbusconnection.h | 2 ++ 2 files changed, 17 insertions(+) diff --git a/src/dbus/qdbusconnection.cpp b/src/dbus/qdbusconnection.cpp index 3fb63eb..fe7f41e 100644 --- a/src/dbus/qdbusconnection.cpp +++ b/src/dbus/qdbusconnection.cpp @@ -873,6 +873,21 @@ QDBusConnectionInterface *QDBusConnection::interface() const } /*! + \internal + \since 4.8 + + Returns the internal, implementation-defined pointer for this + connection. Currently, this returns a DBusConnection* pointer, + without changing the reference count. It is the responsibility of + the caller to call dbus_connection_ref if it wants to store the + pointer. +*/ +void *QDBusConnection::internalPointer() const +{ + return d ? d->connection : 0; +} + +/*! Returns true if this QDBusConnection object is connected. */ bool QDBusConnection::isConnected() const diff --git a/src/dbus/qdbusconnection.h b/src/dbus/qdbusconnection.h index ec59434..c0b9905 100644 --- a/src/dbus/qdbusconnection.h +++ b/src/dbus/qdbusconnection.h @@ -163,6 +163,8 @@ public: QDBusConnectionInterface *interface() const; + void *internalPointer() const; + static QDBusConnection connectToBus(BusType type, const QString &name); static QDBusConnection connectToBus(const QString &address, const QString &name); static void disconnectFromBus(const QString &name); -- cgit v0.12