diff options
author | Thiago Macieira <thiago.macieira@nokia.com> | 2011-02-14 12:22:05 (GMT) |
---|---|---|
committer | Thiago Macieira <thiago.macieira@nokia.com> | 2011-03-29 10:44:42 (GMT) |
commit | ee1af4d59da999df32276889d3b40fb01deb0acc (patch) | |
tree | 050f7fb27736a9cdaf7e1b0c3011037df0565cf7 /src | |
parent | e2f060294c1f9707fed48c532ba7de382efe3925 (diff) | |
download | Qt-ee1af4d59da999df32276889d3b40fb01deb0acc.zip Qt-ee1af4d59da999df32276889d3b40fb01deb0acc.tar.gz Qt-ee1af4d59da999df32276889d3b40fb01deb0acc.tar.bz2 |
Add a set of connection capabilities to QDBusConnection
The capabilities are negotiated with the D-Bus peer or bus at
connection time and may include extra features not available when
D-Bus 1.0 was released.
Currently (as of D-Bus 1.4), the only additional feature is Unix file
descriptor passing.
Proposed features are "maybe types" and single-precision floating
point. They may be added to D-Bus 1.6.
Task-number: QTBUG-17478
Diffstat (limited to 'src')
-rw-r--r-- | src/dbus/qdbusconnection.cpp | 23 | ||||
-rw-r--r-- | src/dbus/qdbusconnection.h | 7 | ||||
-rw-r--r-- | src/dbus/qdbusconnection_p.h | 1 | ||||
-rw-r--r-- | src/dbus/qdbusintegrator.cpp | 2 |
4 files changed, 31 insertions, 2 deletions
diff --git a/src/dbus/qdbusconnection.cpp b/src/dbus/qdbusconnection.cpp index 1fb11bc..4883a4d 100644 --- a/src/dbus/qdbusconnection.cpp +++ b/src/dbus/qdbusconnection.cpp @@ -248,6 +248,17 @@ void QDBusConnectionManager::setConnection(const QString &name, QDBusConnectionP */ /*! + \since 4.8 + \enum QDBusConnection::ConnectionCapabilities + The available capabilities for a D-Bus connection. + + \value UnixFileDescriptorPassing passing of Unix file descriptors to other processes + (see QDBusUnixFileDescriptor) + + \sa connectionCapabilities() +*/ + +/*! Creates a QDBusConnection object attached to the connection with name \a name. This does not open the connection. You have to call connectToBus() to open it. @@ -948,6 +959,18 @@ QString QDBusConnection::name() const } /*! + \since 4.8 + + Returns the capabilities of this connection as negotiated with the bus + server or peer. If this QDBusConnection is not connected, this function + returns no capabilities. +*/ +QDBusConnection::ConnectionCapabilities QDBusConnection::connectionCapabilities() const +{ + return d ? d->capabilities : ConnectionCapabilities(0); +} + +/*! Attempts to register the \a serviceName on the D-Bus server and returns true if the registration succeeded. The registration will fail if the name is already registered by another application. diff --git a/src/dbus/qdbusconnection.h b/src/dbus/qdbusconnection.h index c0b9905..6ab0ea2 100644 --- a/src/dbus/qdbusconnection.h +++ b/src/dbus/qdbusconnection.h @@ -111,9 +111,13 @@ public: UnregisterNode, UnregisterTree }; - Q_DECLARE_FLAGS(RegisterOptions, RegisterOption) + enum ConnectionCapability { + UnixFileDescriptorPassing = 0x0001 + }; + Q_DECLARE_FLAGS(ConnectionCapabilities, ConnectionCapability) + QDBusConnection(const QString &name); QDBusConnection(const QDBusConnection &other); ~QDBusConnection(); @@ -124,6 +128,7 @@ public: QString baseService() const; QDBusError lastError() const; QString name() const; + ConnectionCapabilities connectionCapabilities() const; bool send(const QDBusMessage &message) const; bool callWithCallback(const QDBusMessage &message, QObject *receiver, diff --git a/src/dbus/qdbusconnection_p.h b/src/dbus/qdbusconnection_p.h index 85308c1..36f7c53 100644 --- a/src/dbus/qdbusconnection_p.h +++ b/src/dbus/qdbusconnection_p.h @@ -262,6 +262,7 @@ signals: public: QAtomicInt ref; + QDBusConnection::ConnectionCapabilities capabilities; QString name; // this connection's name QString baseService; // this connection's base service diff --git a/src/dbus/qdbusintegrator.cpp b/src/dbus/qdbusintegrator.cpp index 14138e0..77c4223 100644 --- a/src/dbus/qdbusintegrator.cpp +++ b/src/dbus/qdbusintegrator.cpp @@ -967,7 +967,7 @@ void QDBusConnectionPrivate::deliverCall(QObject *object, int /*flags*/, const Q extern bool qDBusInitThreads(); QDBusConnectionPrivate::QDBusConnectionPrivate(QObject *p) - : QObject(p), ref(1), mode(InvalidMode), connection(0), server(0), busService(0), + : QObject(p), ref(1), capabilities(0), mode(InvalidMode), connection(0), server(0), busService(0), watchAndTimeoutLock(QMutex::Recursive), rootNode(QString(QLatin1Char('/'))) { |