[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    How to Make KPPP a KUniqueApplication?
From:       markcox <markcox () iprimus ! com ! au>
Date:       2002-04-13 8:50:51
[Download RAW message or body]

Here is a patch so that if you run kppp and it is already running, it will be 
brought to the foreground. It only wants one instance to run at a time so it 
makes sense that it is a KUniqueApplication

It appears to work, and the UI behaves just fine, but as soon as you click the 
"connect" button kppp freezes. Is there a reason that kppp can't be a 
KUniqueApplication? 

Mark Cox


--- main.cpp    Sat Apr 13 17:48:37 2002
+++ main.cpp.patch      Sat Apr 13 17:48:03 2002
@@ -45,7 +45,7 @@
 #endif
 

 #include <kaboutdata.h>
-#include <kapplication.h>
+#include <kuniqueapplication.h>
 #include <kcmdlineargs.h>
 #include <kdebug.h>
 #include <kglobal.h>
@@ -201,7 +201,12 @@
   KCmdLineArgs::init( argc, argv, &aboutData );
   KCmdLineArgs::addCmdLineOptions( options );
 

-  KApplication a;
+  // Using KUniqueApplication means that if kppp is already running,
+  // then it will be brought to the front by the magic of dcop.
+  if (!KUniqueApplication::start())
+     return 0;
+
+  KUniqueApplication a;
   

   // set portable locale for decimal point
   setlocale(LC_NUMERIC ,"C");



["kdenetwork.kppp.main.cpp.diff" (text/x-diff)]

--- main.cpp	Sat Apr 13 17:48:37 2002
+++ main.cpp.patch	Sat Apr 13 17:48:03 2002
@@ -45,7 +45,7 @@
 #endif
 
 #include <kaboutdata.h>
-#include <kapplication.h>
+#include <kuniqueapplication.h>
 #include <kcmdlineargs.h>
 #include <kdebug.h>
 #include <kglobal.h>
@@ -201,7 +201,12 @@
   KCmdLineArgs::init( argc, argv, &aboutData );
   KCmdLineArgs::addCmdLineOptions( options );
 
-  KApplication a;
+  // Using KUniqueApplication means that if kppp is already running,
+  // then it will be brought to the front by the magic of dcop.
+  if (!KUniqueApplication::start())
+     return 0;
+
+  KUniqueApplication a;
   
   // set portable locale for decimal point
   setlocale(LC_NUMERIC ,"C");


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic