kdeinit launching in KApplication

David Faure faure at kde.org
Thu Aug 9 21:57:21 BST 2007

On Saturday 04 August 2007, Lubos Lunak wrote:
> On pá 3. srpna 2007, David Faure wrote:
> > On Friday 03 August 2007, Andreas Pakulat wrote:
> > > On 03.08.07 13:36:08, Lubos Lunak wrote:
> > > >  is there any special reason why kdeinit&friends are not automatically
> > > > launched from KApplication ctor like it is in KDE3 (besides this
> > > > feature getting lost while porting to DBUS)? Right now e.g. global
> > > > shortcuts don't work, since they require kded and automatically assume
> > > > it's always there. Are such things now supposed to explicitly launch
> > > > kdeinit if needed, since KApplication is now not mandatory?
> > >
> > > They are launched when they are needed I think. A plain basic kapp
> > > doesn't start it, but it seems its started when needed, for example
> > > kdevelop triggers kdeinit and kded start. So I guess this change is
> > > intentional so not to start uneeded services...
> >
> > Yes it does work; ktoolinvocation and ksycoca start kdeinit when necessary,
> > the "global shortcuts" code should just do the same.
>  It could, but should it? 
Yes :)

>  I'd expect that pretty much every KDE developer  
> simply runs apps inside KDE session, where this magically works, so it's 
> bound to get broken occassionally (or just think porting from KDE3 where it 
> worked everywhere).

I disagree. I often run a KDE app in a ssh -X shell to another computer, or in a
su - testuser session, so the kde application has to autostart kdeinit+klauncher+kded.
And this has worked all the time in kde3, so I don't see why it would break in
unfixable ways now... We even have unit tests which trigger this (unless run
from within a kde4 session of course) :)

>  Using e.g. dbus activation would be safer. I however cannot find where 
> KNotify does this and I also seem to remember there was supposed to be some 
> problem with activation - does somebody know the details?

Autostarting of knotify was broken when I left for vacations, I wonder if it's fixed now.

Personally I trust a longstanding kde3 technology more than dbus activation
which hasn't shown any signs of working yet in KDE (it seems to create install-prefix problems,
we need a way to tell dbus how to look into the kde prefix, iirc thiago had solutions for that
on his plate, but that's what I mean, it's not ready yet ;) ).

> > KToolInvocation::klauncher();  is the magic incantation that ksycoca uses.
>  Yeah, there's nothing like calling klauncher() when one wants kded :).

:-). Well KToolInvocation::ensureKdeinitKLauncherAndKdedAreRunning() is a bit long :)
But for sure when klauncher isn't running, kdeinit is started, which in turn starts klauncher and kded,
so there you go.

David Faure, faure at kde.org, sponsored by Trolltech to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).

More information about the kde-core-devel mailing list