summaryrefslogtreecommitdiff
path: root/src/dbus
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@nokia.com>2011-02-16 12:25:09 +0100
committerThiago Macieira <thiago.macieira@nokia.com>2011-04-13 14:56:21 +0200
commit8334e79a0340c9fcd5ccedeb867a84044d4d83dd (patch)
tree79cf59bc4656116f46f6aa49e9a2037acdb1618e /src/dbus
parentfe5822786526c69fc5566d480d4b37a5365db4e2 (diff)
downloadqt4-tools-8334e79a0340c9fcd5ccedeb867a84044d4d83dd.tar.gz
Retrieve the connection capabilities in QDBusConnection
Task-number: QTBUG-17477
Diffstat (limited to 'src/dbus')
-rw-r--r--src/dbus/qdbusintegrator.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/dbus/qdbusintegrator.cpp b/src/dbus/qdbusintegrator.cpp
index ee917a5ad2..aaf19cfb6f 100644
--- a/src/dbus/qdbusintegrator.cpp
+++ b/src/dbus/qdbusintegrator.cpp
@@ -1667,6 +1667,28 @@ void QDBusConnectionPrivate::setPeer(DBusConnection *c, const QDBusErrorInternal
QMetaObject::invokeMethod(this, "doDispatch", Qt::QueuedConnection);
}
+static QDBusConnection::ConnectionCapabilities connectionCapabilies(DBusConnection *connection)
+{
+ QDBusConnection::ConnectionCapabilities result = 0;
+
+#if defined(QT_LINKED_LIBDBUS) && DBUS_VERSION < 0x010400
+ // no capabilities are possible
+#else
+# if !defined(QT_LINKED_LIBDBUS)
+ // run-time check if the next functions are available
+ int major, minor, micro;
+ q_dbus_get_version(&major, &minor, &micro);
+ if (major == 1 && minor < 4)
+ return result;
+# endif
+
+ if (q_dbus_connection_can_send_type(connection, DBUS_TYPE_UNIX_FD))
+ result |= QDBusConnection::UnixFileDescriptorPassing;
+#endif
+
+ return result;
+}
+
void QDBusConnectionPrivate::setConnection(DBusConnection *dbc, const QDBusErrorInternal &error)
{
if (!dbc) {
@@ -1680,6 +1702,7 @@ void QDBusConnectionPrivate::setConnection(DBusConnection *dbc, const QDBusError
const char *service = q_dbus_bus_get_unique_name(connection);
Q_ASSERT(service);
baseService = QString::fromUtf8(service);
+ capabilities = connectionCapabilies(connection);
q_dbus_connection_set_exit_on_disconnect(connection, false);
q_dbus_connection_set_watch_functions(connection, qDBusAddWatch, qDBusRemoveWatch,