summaryrefslogtreecommitdiffstats
path: root/src/dbus
diff options
context:
space:
mode:
Diffstat (limited to 'src/dbus')
-rw-r--r--src/dbus/qdbusconnection.cpp4
-rw-r--r--src/dbus/qdbusconnection_p.h1
-rw-r--r--src/dbus/qdbusintegrator.cpp17
3 files changed, 16 insertions, 6 deletions
diff --git a/src/dbus/qdbusconnection.cpp b/src/dbus/qdbusconnection.cpp
index bb0d06f..bead369 100644
--- a/src/dbus/qdbusconnection.cpp
+++ b/src/dbus/qdbusconnection.cpp
@@ -609,7 +609,7 @@ bool QDBusConnection::connect(const QString &service, const QString &path, const
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, receiver, slot, 0, false))
+ if (!d->prepareHook(hook, key, service, owner, path, interface, name, QStringList(), receiver, slot, 0, false))
return false; // don't connect
// avoid duplicating:
@@ -663,7 +663,7 @@ bool QDBusConnection::disconnect(const QString &service, const QString &path, co
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, receiver, slot, 0, false))
+ if (!d->prepareHook(hook, key, service, owner, path, interface, name, QStringList(), receiver, slot, 0, false))
return false; // don't disconnect
// avoid duplicating:
diff --git a/src/dbus/qdbusconnection_p.h b/src/dbus/qdbusconnection_p.h
index ab96457..df51c27 100644
--- a/src/dbus/qdbusconnection_p.h
+++ b/src/dbus/qdbusconnection_p.h
@@ -278,6 +278,7 @@ public:
static bool prepareHook(QDBusConnectionPrivate::SignalHook &hook, QString &key,
const QString &service, const QString &owner,
const QString &path, const QString &interface, const QString &name,
+ const QStringList &argMatch,
QObject *receiver, const char *signal, int minMIdx,
bool buildSignature);
static DBusHandlerResult messageFilter(DBusConnection *, DBusMessage *, void *);
diff --git a/src/dbus/qdbusintegrator.cpp b/src/dbus/qdbusintegrator.cpp
index fb2dd77..9e41708 100644
--- a/src/dbus/qdbusintegrator.cpp
+++ b/src/dbus/qdbusintegrator.cpp
@@ -392,7 +392,7 @@ static void qDBusNewConnection(DBusServer *server, DBusConnection *connection, v
static QByteArray buildMatchRule(const QString &service, const QString & /*owner*/,
const QString &objectPath, const QString &interface,
- const QString &member, const QString & /*signature*/)
+ const QString &member, const QStringList &argMatch, const QString & /*signature*/)
{
QString result = QLatin1String("type='signal',");
QString keyValue = QLatin1String("%1='%2',");
@@ -406,6 +406,14 @@ static QByteArray buildMatchRule(const QString &service, const QString & /*owner
if (!member.isEmpty())
result += keyValue.arg(QLatin1String("member"), member);
+ // add the argument string-matching now
+ if (!argMatch.isEmpty()) {
+ keyValue = QLatin1String("arg%1='%2',");
+ for (int i = 0; i < argMatch.count(); ++i)
+ if (!argMatch.at(i).isNull())
+ result += keyValue.arg(i).arg(argMatch.at(i));
+ }
+
result.chop(1); // remove ending comma
return result.toLatin1();
}
@@ -1195,6 +1203,7 @@ int QDBusConnectionPrivate::findSlot(QObject* obj, const QByteArray &normalizedN
bool QDBusConnectionPrivate::prepareHook(QDBusConnectionPrivate::SignalHook &hook, QString &key,
const QString &service, const QString &owner,
const QString &path, const QString &interface, const QString &name,
+ const QStringList &argMatch,
QObject *receiver, const char *signal, int minMIdx,
bool buildSignature)
{
@@ -1235,7 +1244,7 @@ bool QDBusConnectionPrivate::prepareHook(QDBusConnectionPrivate::SignalHook &hoo
hook.signature += QLatin1String( QDBusMetaType::typeToSignature( hook.params.at(i) ) );
}
- hook.matchRule = buildMatchRule(service, owner, path, interface, mname, hook.signature);
+ hook.matchRule = buildMatchRule(service, owner, path, interface, mname, argMatch, hook.signature);
return true; // connect to this signal
}
@@ -2027,7 +2036,7 @@ void QDBusConnectionPrivate::connectRelay(const QString &service, const QString
SignalHook hook;
QString key;
- if (!prepareHook(hook, key, service, owner, path, interface, QString(), receiver, signal,
+ if (!prepareHook(hook, key, service, owner, path, interface, QString(), QStringList(), receiver, signal,
QDBusAbstractInterface::staticMetaObject.methodCount(), true))
return; // don't connect
@@ -2059,7 +2068,7 @@ void QDBusConnectionPrivate::disconnectRelay(const QString &service, const QStri
SignalHook hook;
QString key;
- if (!prepareHook(hook, key, service, owner, path, interface, QString(), receiver, signal,
+ if (!prepareHook(hook, key, service, owner, path, interface, QString(), QStringList(), receiver, signal,
QDBusAbstractInterface::staticMetaObject.methodCount(), true))
return; // don't connect