How to Make KPPP a KUniqueApplication?

markcox markcox at iprimus.com.au
Sat Apr 13 09:50:51 BST 2002


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");


-------------- next part --------------
A non-text attachment was scrubbed...
Name: kdenetwork.kppp.main.cpp.diff
Type: text/x-diff
Size: 697 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20020413/b7fd04d6/attachment.diff>


More information about the kde-core-devel mailing list