Bug 174631

Summary: kmail dbus method to hide in systray doesn't work
Product: [Unmaintained] kmail Reporter: vatbier <vatbier>
Component: generalAssignee: kdepim bugs <kdepim-bugs>
Status: RESOLVED NOT A BUG    
Severity: normal    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Mandriva RPMs   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description vatbier 2008-11-08 15:45:42 UTC
Version:            (using KDE 4.1.2)
OS:                Linux
Installed from:    Mandriva RPMs

Mail Version 1.10.1
Using KDE 4.1.2

In KDE 3.5.9 I could use this command when logging into KDE to start kmail hidden in systray:
dcop $(dcopstart kmail) kmail-mainwindow#1 setHidden on

In KDE 4.1.2 I'm trying to use dbus-send command:
dbus-send --type=method_call --dest=org.kde.kmail /kmail/kmail_manwindow_1 com.trolltech.Qt.QWidget.setHidden boolean:true
dbus-send --type=method_call --dest=org.kde.kmail /kmail/kmail_manwindow_1 com.trolltech.Qt.QWidget.setHidden boolean:false
dbus-send --type=method_call --dest=org.kde.kmail /kmail/kmail_manwindow_1 com.trolltech.Qt.QWidget.setHidden :1
dbus-send --type=method_call --dest=org.kde.kmail /kmail/kmail_manwindow_1 com.trolltech.Qt.QWidget.setHidden :0
dbus-send --type=method_call --dest=org.kde.kmail /kmail/kmail_manwindow_1 com.trolltech.Qt.QWidget.hide
None of these work, the kmail window just doesn't get hidden in systray.

I suspect the dbus interface of kmail is not correctly/fully implemented.
Or does any one know a dbus-send command that works?

For the moment I did find another way to start kmail hidden when logging
into KDE:
script kmailstarthiddeninsystray:
#!bin/sh
sleep 15
kstart --skiptaskbar --iconify kmail

sleep 15: otherwise the kmail window keeps appearing on the desktop
The only problem is that I have to press the kmail icon in the systray three times before kmail window appears.

vatbier
Comment 1 vatbier 2008-11-11 00:13:36 UTC
In the kde-pim@kde.org mailing list Thomas McGuire gave me a working qdbus command on my question why my dbus-send command for kmail didn't work:
http://lists.kde.org/?l=kde-pim&r=1&b=200811&w=2 : kmail dbus method to hide in systray doesn't work

This command doesn't work:
dbus-send --type=method_call --dest=org.kde.kmail
 /kmail/kmail_manwindow_1 com.trolltech.Qt.QWidget.setHidden boolean:true

This command does work:
qdbus org.kde.kmail /kmail/kmail_mainwindow_1 setHidden true
This command also works:
qdbus org.kde.kmail /kmail/kmail_mainwindow_1 com.trolltech.Qt.QWidget.setHidden true

It hides the kmail window to systray (you must have enabled the kmail setting for the kmail system tray icon).

I'm now using this script to start kmail hidden when logging into KDE:
#!/bin/sh
kmail
while (`pidof kmail`== "")
do
  sleep 1
done
qdbus org.kde.kmail /kmail/kmail_mainwindow_1 setHidden true

It is the dbus-send command that doesn't work. Is it a bug of dbus-send 
or am I using the wrong parameters for it?
I asked a question about this in dbus@lists.freedesktop.org mailing list:
http://lists.freedesktop.org/archives/dbus/2008-November/010621.html

As the qdbus command works I change this bug to INVALID.
Comment 2 vatbier 2008-11-11 00:28:05 UTC
Stupid me,

I figured out what I did wrong with te dbus-send command:
I forgot an "i" in "..._mainwindow_...":
This does work:
dbus-send --type=method_call --dest=org.kde.kmail /kmail/kmail_mainwindow_1 com.trolltech.Qt.QWidget.setHidden boolean:true