summaryrefslogtreecommitdiffstats
path: root/src/dbus/qdbusabstractinterface.cpp
diff options
context:
space:
mode:
authorMorten Johan Sørvig <morten.sorvig@nokia.com>2009-11-05 06:26:24 (GMT)
committerMorten Johan Sørvig <morten.sorvig@nokia.com>2009-11-05 06:26:24 (GMT)
commitee88b2d8408396188eb2ce52d740c395c6cd4656 (patch)
tree1f59ea0612fecbaca595594d3812dd2aab64cf63 /src/dbus/qdbusabstractinterface.cpp
parent673973acc20ce4e068d63fa5b0391f5c785be8a3 (diff)
parentaa58293b57a05cd52b36ba14a05958dceb65c603 (diff)
downloadQt-ee88b2d8408396188eb2ce52d740c395c6cd4656.zip
Qt-ee88b2d8408396188eb2ce52d740c395c6cd4656.tar.gz
Qt-ee88b2d8408396188eb2ce52d740c395c6cd4656.tar.bz2
Merge remote branch 'qt-official/4.6' into 4.6
Diffstat (limited to 'src/dbus/qdbusabstractinterface.cpp')
-rw-r--r--src/dbus/qdbusabstractinterface.cpp39
1 files changed, 31 insertions, 8 deletions
diff --git a/src/dbus/qdbusabstractinterface.cpp b/src/dbus/qdbusabstractinterface.cpp
index 61a9d95..994da10 100644
--- a/src/dbus/qdbusabstractinterface.cpp
+++ b/src/dbus/qdbusabstractinterface.cpp
@@ -279,9 +279,17 @@ QDBusAbstractInterface::QDBusAbstractInterface(QDBusAbstractInterfacePrivate &d,
: QDBusAbstractInterfaceBase(d, parent)
{
// keep track of the service owner
- if (!d_func()->currentOwner.isEmpty())
- QObject::connect(d_func()->connectionPrivate(), SIGNAL(serviceOwnerChanged(QString,QString,QString)),
- this, SLOT(_q_serviceOwnerChanged(QString,QString,QString)));
+ if (d.isValid &&
+ d.connection.isConnected()
+ && !d.service.isEmpty()
+ && !d.service.startsWith(QLatin1Char(':')))
+ d_func()->connection.connect(QLatin1String(DBUS_SERVICE_DBUS), // service
+ QString(), // path
+ QLatin1String(DBUS_INTERFACE_DBUS), // interface
+ QLatin1String("NameOwnerChanged"),
+ QStringList() << d.service,
+ QString(), // signature
+ this, SLOT(_q_serviceOwnerChanged(QString,QString,QString)));
}
/*!
@@ -296,9 +304,17 @@ QDBusAbstractInterface::QDBusAbstractInterface(const QString &service, const QSt
con, false), parent)
{
// keep track of the service owner
- if (d_func()->connection.isConnected())
- QObject::connect(d_func()->connectionPrivate(), SIGNAL(serviceOwnerChanged(QString,QString,QString)),
- this, SLOT(_q_serviceOwnerChanged(QString,QString,QString)));
+ if (d_func()->isValid &&
+ d_func()->connection.isConnected()
+ && !service.isEmpty()
+ && !service.startsWith(QLatin1Char(':')))
+ d_func()->connection.connect(QLatin1String(DBUS_SERVICE_DBUS), // service
+ QString(), // path
+ QLatin1String(DBUS_INTERFACE_DBUS), // interface
+ QLatin1String("NameOwnerChanged"),
+ QStringList() << service,
+ QString(), //signature
+ this, SLOT(_q_serviceOwnerChanged(QString,QString,QString)));
}
/*!
@@ -544,9 +560,16 @@ void QDBusAbstractInterface::connectNotify(const char *signal)
return;
QDBusConnectionPrivate *conn = d->connectionPrivate();
- if (conn)
- conn->connectRelay(d->service, d->currentOwner, d->path, d->interface,
+ if (conn) {
+ // do we know what our owner is?
+ QString owner;
+ if (!d->service.isEmpty() && d->currentOwner.isNull())
+ owner = QLatin1String("");
+ else
+ owner = d->currentOwner;
+ conn->connectRelay(d->service, owner, d->path, d->interface,
this, signal);
+ }
}
/*!