diff options
author | Thiago Macieira <thiago.macieira@nokia.com> | 2009-11-19 09:48:01 (GMT) |
---|---|---|
committer | Jason McDonald <jason.mcdonald@nokia.com> | 2009-11-20 13:44:24 (GMT) |
commit | dcf539f975ae4b3a2664af0b9bce0bf1eea6ab6a (patch) | |
tree | ac60766cea9de606c894f2775eb1d1daf999cf85 | |
parent | 9b7a59c4eb651e1cbad75d690c9ddec1c5cff90d (diff) | |
download | Qt-dcf539f975ae4b3a2664af0b9bce0bf1eea6ab6a.zip Qt-dcf539f975ae4b3a2664af0b9bce0bf1eea6ab6a.tar.gz Qt-dcf539f975ae4b3a2664af0b9bce0bf1eea6ab6a.tar.bz2 |
Remember to match the actual arguments too.
(cherry picked from commit b1196d5733ae01660e4345a5bbecd9c1b32238a4)
-rw-r--r-- | src/dbus/qdbusconnection_p.h | 1 | ||||
-rw-r--r-- | src/dbus/qdbusintegrator.cpp | 19 |
2 files changed, 20 insertions, 0 deletions
diff --git a/src/dbus/qdbusconnection_p.h b/src/dbus/qdbusconnection_p.h index a353638..16c7a0b 100644 --- a/src/dbus/qdbusconnection_p.h +++ b/src/dbus/qdbusconnection_p.h @@ -123,6 +123,7 @@ public: QObject* obj; int midx; QList<int> params; + QStringList argumentMatch; QByteArray matchRule; }; diff --git a/src/dbus/qdbusintegrator.cpp b/src/dbus/qdbusintegrator.cpp index 3274479..6d1c066 100644 --- a/src/dbus/qdbusintegrator.cpp +++ b/src/dbus/qdbusintegrator.cpp @@ -1229,6 +1229,7 @@ bool QDBusConnectionPrivate::prepareHook(QDBusConnectionPrivate::SignalHook &hoo hook.owner = owner; // we don't care if the service has an owner yet hook.path = path; hook.obj = receiver; + hook.argumentMatch = argMatch; // build the D-Bus signal name and signature // This should not happen for QDBusConnection::connect, use buildSignature here, since @@ -1501,6 +1502,24 @@ void QDBusConnectionPrivate::handleSignal(const QString &key, const QDBusMessage continue; if (hook.signature.isEmpty() && !hook.signature.isNull() && !msg.signature().isEmpty()) continue; + if (!hook.argumentMatch.isEmpty()) { + const QVariantList arguments = msg.arguments(); + if (hook.argumentMatch.size() > arguments.size()) + continue; + + bool matched = true; + for (int i = 0; i < hook.argumentMatch.size(); ++i) { + const QString ¶m = hook.argumentMatch.at(i); + if (param.isNull()) + continue; // don't try to match against this + if (param == arguments.at(i).toString()) + continue; // matched + matched = false; + break; + } + if (!matched) + continue; + } activateSignal(hook, msg); } |