And first of all, thank you for taking the time to explain the matter to a

Am Dienstag, 21. Februar 2006 10:42 schrieb Lubos Lunak:
> > I read that it is not recommended to re-implement closeEvent() but rather
> > queryClose und queryExit. Further the docs say that if one has serious
> > things to do, one should connect aboutToQuit to queryExit.

> Do they?

They do:
states to use shutDown(), the cvs-api-doc states to use aboutToQuit().

> > If it is expected behaviour, how can I make KDE wait on shutdown, if the
> > application is only in the tray?

> If you want to do something specific to a window, use queryClose() (or
> closeEvent() for non-KMainWindow cases), and pay attention to
> KApplication::sessionSaving() if you do something that could break logout.
> If you want to do just a cleanup for the window, use a destructor of
> course.

I do that. Waiting for the app to finish its own shutdown-process works
perfectly, if the window is open. As you explained, it does not, if the app is
in tray only, simply because there is no window and hence not closeEvent() to
wait for.

Since the docs say something about "serious things", I thought that KDE would
not only wait for closeEVent() to return true, but also for queryExit, yet
that is obviously wrong.

> And to answer your question, I can't actually do that because I don't know
> what you need (you know, people, it'd be much simpler to help you didn't
> just say what you think you need but also mentioned why you need it).

Sorry, I'll explain what I want to do. KVpnc handles my VPN connection, if I
disconnect from the VPN, kopete has to go offline before the connection is
actually disconnected as it would not be able to send the "going offline" to
the IRC/ICQ etc.-servers afterwards.

KVpnc executes a shell-script with a dcop-command to tell kopete to go offline
and since that takes some time, a sleep of x seconds. After that KVpnc
disconnects, i.e. terminates vpnc and restores the old route and resolv.conf.

If KDE shuts down before vpnc is disconnected, the resolv.conf and route will
not be restored, so KDE shutdown should wait until the disconnecting has

> If you want to do a cleanup at exit, use a dtor or aboutToQuit(). If you
> want to display something like "shutting down KDE will cause XYZ", then a)
> first consider if the user really needs to be told that, b) use
> KSessionManaged::commitData().

No user interaction or displaying, just disconnecting and waiting for it to
finish before shutting down KDE. So, if I understood you correctly, I have to
re-implement commitData() and put the disconnecting in there, because KDE
waits for that one to finish, before telling all apps to exit? And commitData
will also be called when a window is open on KDE-shutdown.

> > KDE seems to only respect closeEvent(), yet that one seems to be not
> > triggered when apps are only in tray.

> Hmm, am I already boring to say again that hidding windows to the tray is
> a broken concept?

Is there no way to treat them as if they were minimised, but to another place
than the taskbar? Those get handled correctly, although they do not have a
visible window. Maybe just an ignorant thought by an beginner.


>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<