KDBusService, Open and ActivateAction
Alex Merry
kde at randomguy3.me.uk
Tue Nov 12 16:12:51 UTC 2013
On 12/11/13 15:46, David Faure wrote:
> On Tuesday 12 November 2013 13:40:06 Alex Merry wrote:
>> 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).
Not that I could find. That would be ideal, though (except for the
overlap in functionality between Activate and CommandLine with an empty
list).
>> 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".
Well, except that the desktop spec allows (and encourages) the
specification of an equivalent Exec line. So the idea would be that you
would, say, specify
[Desktop Action Foo]
Name=Do Foo
Exec=app --action=foo
and then KDBusService would turn that into the D-Bus 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 :)
I did have a question about the optional parameter to ActivateAction, so
I'll probably do that.
Alex
More information about the Kde-frameworks-devel
mailing list