This forum has been archived. All content is frozen. Please use KDE Discuss instead.

kmail, dbus and input actions module

Tags: None
(comma "," separated)
bonaire
Registered Member
Posts
6
Karma
0
OS
Hello,

i am currently playing with d-bus and the systemsettings module input actions. My task is to define a keyboard shortcut that opens a new kmail composer window to directly write a new mail. Yes, i know, that can be done via simple kmail --composer, but i'd like to learn to do this via d-bus for future purposes.

My Problem is, that i don't know how to call the method correctly from inside the input actions module or via qdbus.

As i found out, the method path is something like this:

Code: Select all
org.kde.kmail /KMail org.kde.kmail.kmail.newMessage "to@mail.org" "cc@mail.org" "bcc@mail.org" true true "" ""


If i use qdbusviewer this call opens a new composer window as expected. But if i simply use qdbus and call this via command line, i get nothing back. I found out, the method newMessage returns a so called object path. Same is, if i use the input actions module. Still nothing appears or happens.

So my question is, how to call this d-bus method correctly from inside the input actions module of systemsettings and/or from qdbus?

cu
User avatar
anda_skoa
KDE Developer
Posts
783
Karma
4
OS
newMessage seems to create a composer in a hidden state. Try openComposer instead.

Cheers,
_


anda_skoa, proud to be a member of KDE forums since 2008-Oct.
bonaire
Registered Member
Posts
6
Karma
0
OS
Thanks for response. I'd really like to test the newComposer method and it works well with qdbusviewer but i have a problem with it :/
This method requires an array/QStringList as parameter 8 and 9. I dont know how to apply this to the command line with qdbus. It is not "" or array or None. I found nothing on the web on this.
Do you know how to apply these parameters?

cu
User avatar
anda_skoa
KDE Developer
Posts
783
Karma
4
OS
Right.

I currently don't have the sources of qdbus and its documentation is non existant.

You can, however, use the dbus-send command instead:

Code: Select all
dbus-send --type=method_call --dest=org.kde.kmail /KMail org.kde.kmail.kmail.openComposer string:"to@test" string:"cc@test" string:"bcc@test" string:"subject" string:"body" boolean:false string:"" array:string:"" array:string:""


Cheers,
_


anda_skoa, proud to be a member of KDE forums since 2008-Oct.
bonaire
Registered Member
Posts
6
Karma
0
OS
Yes, thanks, that works.
But I'd like to avoid two syntax types and the one from dbus-send is not accepted by the input actions module from systemsettings. And usage of this was my primary goal :)

cu
User avatar
anda_skoa
KDE Developer
Posts
783
Karma
4
OS
You are out of luck then.

I figured out how to do lists with qdbus, but unfortunately it tries to invoke one of the other variants of openComposer (there are three) thus resulting in an error about mismatching number of arguments.

dbus-send works because it does not do any introspection, it just builds the message and sends it. The receiver then decides what to do with it.

If you ever need it for something else, string list for qdbus work like this

Code: Select all
"(" "element1" "element2" "element3" ")"


Cheers,
_


anda_skoa, proud to be a member of KDE forums since 2008-Oct.
bonaire
Registered Member
Posts
6
Karma
0
OS
Ah, okay.

so dbus-send has to do it as command in input actions module of systemsettings! I will write a small bug report to clear the situation.

Thank you very much! You helped me a lot.

cu
lefty.crupps
Registered Member
Posts
20
Karma
0
OS
Was this ever resolved? I've tried with both newMessage and with openComposer and I am not getting anywhere. However this is a bit beyond me so I figured I would ask here, even if it is an older thread.

Here is my settings in Input Actions:
Code: Select all
Remote application: org.kde.kontact
Remote object: /KMail
Function: org.kde.kmail.kmail.openComposer QString:"" QString:"" QString:"" QString:"" QString:"" boolean:false QString:"" QStringList:"" QStringList:""
Arguments: [ObjectPath: /Composer]


I have also tried changing things to lowercase as I've read that matters for the Remote Object; I have also used Function as this without success:

Code: Select all
org.kde.kmail.kmail.openComposer string:"" string:"" string:"" string:"" string:"" boolean:false string:"" array:string:"" array:string:""
onety-three
Registered Member
Posts
37
Karma
0
OS
I'm not sure about your exact requirements, but something like this works for me:

Remote application: org.kde.kmail
Remote object: /KMail
Function: openComposer
Arguments: "to" "cc" "bcc" "subject" "body" false

The number of arguments must be the same or it won't work - but you can use empty strings.

Hope this helps.
lefty.crupps
Registered Member
Posts
20
Karma
0
OS
Thank you for the reply, onety-three. I have it working with this:

Code: Select all
Remote applicate: org.kde.kontact
Remote object: /KMail
Function: org.kde.kmail.kmail.openComposer
Arguments: "" "" "" "" "" false


Why does it not work when I include the remaining three parts that are listed in QDBus Browser (messageFile, attachmentPaths, customHeaders) ? That right there makes the Arguments not line up as it says they should.

Thanks again!
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS
This is possibly due to a bug in QDBus, which causes it to only use the first item that matches the function you have specified rather than other, overloaded items.


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]


Bookmarks



Who is online

Registered users: bartoloni, Bing [Bot], Evergrowing, Google [Bot], q.ignora, watchstar