Version: 2.5.0 (using KDE 3.5.0, Gentoo) Compiler: gcc version 3.4.4 (Gentoo 3.4.4-r1, ssp-3.4.4-1.0, pie-8.7.8) OS: Linux (x86_64) release 2.6.14-gentoo-r2-Stolz Situation: ========== The new Kate 2.5.0 (KDE 3.5.0) has introduced the named session feature which has changed the old behavior when opening new files with Kate. I want to simulate the old behavior, that is: -- Whenever I open Kate I want it always starts with my own session (with my custom toolbar, layout, etc..). -- Whenever I open a document from Konqueror or command line, and there is yet another Kate session opened, I want the document gets opened in that session, not in a new one. Actions: ======== In order to reach my objectives: -- I've created my own session and named it "MySession". I've konfigured Kate to include window decoration in sessions, to load last used session and to do not save session on exit. -- I've created the alias kate="kate -s MySession -u" to simulate the old behavior in command line. -- I've edited kate.desktop in order it executes "Exec=kate -s MySession -u %U" (w/o quotes) to simulate the old behavior in KDE. The problem: ============ When I open several files from Konqueror they open in the same Kate and in MySession (nice!, those were my objectives) but there's an error everytime. A window called "Sorry - Konqueror" with the message "KDEInit could not launch 'Kate'" si showed.
SVN commit 493097 by alund: Fix instance reuse with klauncher - registering with dcop makes it happy Attempt to show the window when a file is opened with --use. This works if the broken focus stealing prevention is off, otherwise it works if the window is minimized (restore of maximize also raises and focuses). BUG: 119146 M +25 -0 katemain.cpp --- branches/KDE/3.5/kdebase/kate/app/katemain.cpp #493096:493097 @@ -26,6 +26,7 @@ #include <kglobal.h> #include <kconfig.h> #include <kinstance.h> +#include <kstartupinfo.h> #include <dcopclient.h> #include <dcopref.h> #include <kdebug.h> @@ -137,6 +138,8 @@ if (!kateApp.isEmpty()) { kdDebug () << "kate app: " << kateApp << endl; + // make kdeinit happy + client.registerAs( "kate" ); DCOPRef kRef (kateApp, "KateApplication"); @@ -189,6 +192,24 @@ if (nav) kRef.call( "setCursor", line, column ); + // since the user tried to open a document, let us assume [s]he + // wants to see that document. + // ### what to do about the infamous focus stealing prevention? + uint mwn = kRef.call("activeMainWindowNumber"); + QCString smwn; + DCOPRef wRef( kateApp, QCString( "__KateMainWindow#") + smwn.setNum(mwn) ); + if ( wRef.call("minimized") ) + { + if ( wRef.call( "maximized" ) ) + wRef.call( "maximize" ); + else + wRef.call("restore"); + } + wRef.call( "raise" ); + + // stop startup notification + KStartupInfo::appStarted( ); + return 0; } } @@ -198,8 +219,12 @@ // app execution should already end :) if (app.shouldExit()) + { return 0; + } // execute ourself ;) return app.exec(); } + +// kate: space-indent on; indent-width 2; replace-tabs on; mixed-indent off;
JFI: This is not ported from 3.5-branch to trunk, yet. Maybe we should wait for D-Bus first + we don't know whether the problem in trunk exists at all.