summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@nokia.com>2009-11-19 09:48:01 (GMT)
committerThiago Macieira <thiago.macieira@nokia.com>2009-11-19 10:53:19 (GMT)
commitb1196d5733ae01660e4345a5bbecd9c1b32238a4 (patch)
tree27604493a6ad621d7b9f5a20a42b3d9b6da5f038
parentf01c631f84f9373b06d0572bfed7a4e8213a46a7 (diff)
downloadQt-b1196d5733ae01660e4345a5bbecd9c1b32238a4.zip
Qt-b1196d5733ae01660e4345a5bbecd9c1b32238a4.tar.gz
Qt-b1196d5733ae01660e4345a5bbecd9c1b32238a4.tar.bz2
Remember to match the actual arguments too.
-rw-r--r--src/dbus/qdbusconnection_p.h1
-rw-r--r--src/dbus/qdbusintegrator.cpp19
2 files changed, 20 insertions, 0 deletions
diff --git a/src/dbus/qdbusconnection_p.h b/src/dbus/qdbusconnection_p.h
index ed29e4e..830dac3 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 2d27668..870ddd0 100644
--- a/src/dbus/qdbusintegrator.cpp
+++ b/src/dbus/qdbusintegrator.cpp
@@ -1230,6 +1230,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
@@ -1502,6 +1503,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 &param = 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);
}