diff options
Diffstat (limited to 'kontact/plugins/korganizer/korg_uniqueapp.cpp')
-rw-r--r-- | kontact/plugins/korganizer/korg_uniqueapp.cpp | 35 |
1 files changed, 28 insertions, 7 deletions
diff --git a/kontact/plugins/korganizer/korg_uniqueapp.cpp b/kontact/plugins/korganizer/korg_uniqueapp.cpp index b70042353..42a7adcae 100644 --- a/kontact/plugins/korganizer/korg_uniqueapp.cpp +++ b/kontact/plugins/korganizer/korg_uniqueapp.cpp @@ -20,19 +20,40 @@ */ #include "korg_uniqueapp.h" -#include <kdebug.h> #include "../../korganizer/korganizer_options.h" +#include "core.h" +#include <dcopref.h> +#include <kapplication.h> +#include <kstartupinfo.h> +#include <kwin.h> + void KOrganizerUniqueAppHandler::loadCommandLineOptions() { - KCmdLineArgs::addCmdLineOptions( korganizer_options ); + KCmdLineArgs::addCmdLineOptions( korganizer_options ); } int KOrganizerUniqueAppHandler::newInstance() { - //kdDebug(5602) << k_funcinfo << endl; - // Ensure part is loaded - (void)plugin()->part(); - // TODO handle command line options - return Kontact::UniqueAppHandler::newInstance(); + // Ensure part is loaded + (void)plugin()->part(); + DCOPRef korganizer( "korganizer", "KOrganizerIface" ); + korganizer.send( "handleCommandLine" ); + + // Bring korganizer's plugin to front + // This bit is duplicated from KUniqueApplication::newInstance() + if ( kapp->mainWidget() ) { + kapp->mainWidget()->show(); + KWin::forceActiveWindow( kapp->mainWidget()->winId() ); + KStartupInfo::appStarted(); + } + + // Then ensure the part appears in kontact. + // ALWAYS use the korganizer plugin; i.e. never show the todo nor journal + // plugins when creating a new instance via the command line, even if + // the command line options are empty; else we'd need to examine the + // options and then figure out which plugin we should show. + // kolab/issue3971 + plugin()->core()->selectPlugin( "kontact_korganizerplugin" ); + return 0; } |