DBus runner servicename wildcard support
ClosedPublic

Authored by davidedmundson on Mar 20 2018, 4:15 PM.

Details

Summary

A requested feature was to allow a runner to query N services for
results. i.e search through of all any konsole sessions.

Users can now set in the desktop file service=org.whatever.* and all
running services that match that name are queried for actions and
matching results. Only the service that provided the match will have
relevant "Run" method invoked.

Test Plan

Updated unit test

Diff Detail

Repository
R308 KRunner
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
davidedmundson created this revision.Mar 20 2018, 4:15 PM
Restricted Application added a project: Frameworks. · View Herald TranscriptMar 20 2018, 4:15 PM
Restricted Application added a subscriber: Frameworks. · View Herald Transcript
davidedmundson requested review of this revision.Mar 20 2018, 4:15 PM

Cool!

src/dbusrunner.cpp
57–89

Should we support asterisk at an arbitrary position? But that makes it a lot more complex and main usecase is finding all org.foo.bar-somepid

60

Is this run on the runner thread otherwise this would block

69

Isn't this signal deprecated?

175

m_actions.value(service)

davidedmundson marked an inline comment as done.Mar 21 2018, 12:26 AM
davidedmundson added inline comments.
src/dbusrunner.cpp
57–89

I'd rather not, as it will prevent me from porting away from the deprecated function you mention should Qt ever get argname0 rules support.

60

It is in the main thread.

But it's only a round trip to the dbus-daemon not a client, so it's blocking in the same way
"registerService" or "connect" block.

I can make it async, but I don't think we gain too much.

69

Yes, but the alternative doesn't exist.

Without going too much into DBus match rules (which are awesome), QDBusServiceWatcher connects to the signal serviceOwnerChanged on the org.freedesktop.DBus interface to be notified *only* when either the first or second arguments match the given string.

It's why it's a lot better than this deprecated method.

DBus does have a concept of saying "match when the argument starts with [blah]", but QtDbus doesn't, it'd require a bit of a refactor to do so.

I might try and add it.

davidedmundson marked an inline comment as done.

Update &[]operator to .value()

add extra test file

broulik accepted this revision.Apr 11 2018, 10:37 AM
This revision is now accepted and ready to land.Apr 11 2018, 10:37 AM
This revision was automatically updated to reflect the committed changes.