summaryrefslogtreecommitdiffstats
path: root/src/dbus/qdbusconnection.cpp
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@nokia.com>2009-10-23 17:33:38 (GMT)
committerThiago Macieira <thiago.macieira@nokia.com>2009-10-28 09:16:48 (GMT)
commited75146e45d41ca52b64193acbf433e6d2ceaaf5 (patch)
tree59ea6072b07fbe7a9391ccf2a15f97fd31ba3ce5 /src/dbus/qdbusconnection.cpp
parent26c5680cf5adbf0c87357d84f2e2a6256724d4b7 (diff)
downloadQt-ed75146e45d41ca52b64193acbf433e6d2ceaaf5.zip
Qt-ed75146e45d41ca52b64193acbf433e6d2ceaaf5.tar.gz
Qt-ed75146e45d41ca52b64193acbf433e6d2ceaaf5.tar.bz2
Move the bulk of the signal connecting/disconnecting code to QDBusConnectionPrivate
I'll need to recurse into the signal connection mechanism in the next commit.
Diffstat (limited to 'src/dbus/qdbusconnection.cpp')
-rw-r--r--src/dbus/qdbusconnection.cpp63
1 files changed, 3 insertions, 60 deletions
diff --git a/src/dbus/qdbusconnection.cpp b/src/dbus/qdbusconnection.cpp
index 3aaba68..71e433e 100644
--- a/src/dbus/qdbusconnection.cpp
+++ b/src/dbus/qdbusconnection.cpp
@@ -619,37 +619,10 @@ bool QDBusConnection::connect(const QString &service, const QString &path, const
if (interface.isEmpty() && name.isEmpty())
return false;
- // check the slot
- QDBusConnectionPrivate::SignalHook hook;
- QString key;
- QString name2 = name;
- if (name2.isNull())
- name2.detach();
-
QString owner = d->getNameOwner(service); // we don't care if the owner is empty
- hook.signature = signature; // it might get started later
- if (!d->prepareHook(hook, key, service, owner, path, interface, name, argumentMatch, receiver, slot, 0, false))
- return false; // don't connect
-
- // avoid duplicating:
+ // it might get started later
QDBusWriteLocker locker(ConnectAction, d);
- QDBusConnectionPrivate::SignalHookHash::ConstIterator it = d->signalHooks.find(key);
- QDBusConnectionPrivate::SignalHookHash::ConstIterator end = d->signalHooks.constEnd();
- for ( ; it != end && it.key() == key; ++it) {
- const QDBusConnectionPrivate::SignalHook &entry = it.value();
- if (entry.service == hook.service &&
- entry.owner == hook.owner &&
- entry.path == hook.path &&
- entry.signature == hook.signature &&
- entry.obj == hook.obj &&
- entry.midx == hook.midx) {
- // no need to compare the parameters if it's the same slot
- return true; // already there
- }
- }
-
- d->connectSignal(key, hook);
- return true;
+ return d->connectSignal(service, owner, path, interface, name, argumentMatch, signature, receiver, slot);
}
/*!
@@ -704,38 +677,8 @@ bool QDBusConnection::disconnect(const QString &service, const QString &path, co
if (interface.isEmpty() && name.isEmpty())
return false;
- // check the slot
- QDBusConnectionPrivate::SignalHook hook;
- QString key;
- QString name2 = name;
- if (name2.isNull())
- name2.detach();
-
- QString owner = d->getNameOwner(service); // we don't care of owner is empty
- hook.signature = signature;
- if (!d->prepareHook(hook, key, service, owner, path, interface, name, argumentMatch, receiver, slot, 0, false))
- return false; // don't disconnect
-
- // avoid duplicating:
QDBusWriteLocker locker(DisconnectAction, d);
- QDBusConnectionPrivate::SignalHookHash::Iterator it = d->signalHooks.find(key);
- QDBusConnectionPrivate::SignalHookHash::Iterator end = d->signalHooks.end();
- for ( ; it != end && it.key() == key; ++it) {
- const QDBusConnectionPrivate::SignalHook &entry = it.value();
- if (entry.service == hook.service &&
- entry.owner == hook.owner &&
- entry.path == hook.path &&
- entry.signature == hook.signature &&
- entry.obj == hook.obj &&
- entry.midx == hook.midx) {
- // no need to compare the parameters if it's the same slot
- d->disconnectSignal(it);
- return true; // it was there
- }
- }
-
- // the slot was not found
- return false;
+ return d->disconnectSignal(service, path, interface, name, argumentMatch, signature, receiver, slot);
}
/*!