KDBusService, Open and ActivateAction

David Faure faure at kde.org
Tue Nov 12 15:46:27 UTC 2013


On Tuesday 12 November 2013 13:40:06 Alex Merry wrote:
> This question is mainly directed at David Faure and Kevin Ottens, as the
> authors of KDBusService, but to provide context for everyone else,
> KDBusService implements (among other things) the D-Bus activation scheme
> from the desktop entry spec
> (http://standards.freedesktop.org/desktop-entry-spec/latest/ar01s07.html).
>  This specifies three actiation methods: Activate(), Open(uris) and
> ActivateAction(action_name, param).
> 
> When the application is specified as being Unique, the KDBusService
> constructor of a second instance will call Activate() on the first
> instance and then quit.  This means that any command line arguments to
> that second instance, including file names, will be lost.

Ah. There's something in the standard about that, no?
The "CommandLine" method that is commented out in our 
org.freedesktop.Application.xml
IIRC I wrote this before QCommandLineParser existed, so I wanted to see what 
we would have as command-line-parsing capabilities before moving forward with 
it. It's now much more flexible than with KCmdLineArgs (you can create another 
parser instance and give it a qstringlist), so we could implement the 
CommandLine stuff, if it's indeed in the spec (I forgot).

> What it should probably do is call Open or ActivateAction as
> appropriate.  My question is how it should determine this.
> 
> One option is to require a certain pattern for command line arguments.
> For example, all positional arguments are files (well, URIs) and we
> could have --action=foo to indicate an action called foo (and take the
> first positional arg, if any, as the parameter).

No no, I don't think the idea was for actions to come from the command line.
The idea is for them to come from the .desktop file itself, and the 
application launcher would have the logic for "start this app and then make 
this dbus call".

>From the command line, you never end up in ActivateAction (unless you use 
qdbus of course :-).
These are actions for the gui app launcher to call directly.

If you have more questions about this spec, feel free to email Ryan Lortie 
(desrt at desrt.ca) and cc me, he wrote it and will happily give more details 
to make it happen in KDE :)

Thanks for looking at this, much appreciated.

-- 
David Faure, faure at kde.org, http://www.davidfaure.fr
Working on KDE, in particular KDE Frameworks 5



More information about the Kde-frameworks-devel mailing list