From kde-core-devel Sat Apr 13 08:50:51 2002 From: markcox Date: Sat, 13 Apr 2002 08:50:51 +0000 To: kde-core-devel Subject: How to Make KPPP a KUniqueApplication? X-MARC-Message: https://marc.info/?l=kde-core-devel&m=101874099707925 MIME-Version: 1 Content-Type: multipart/mixed; boundary="--------------Boundary-00=_RK0IQHZO3GQ2HAZW8AH6" --------------Boundary-00=_RK0IQHZO3GQ2HAZW8AH6 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8bit 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 -#include +#include #include #include #include @@ -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"); --------------Boundary-00=_RK0IQHZO3GQ2HAZW8AH6 Content-Type: text/x-diff; charset="us-ascii"; name="kdenetwork.kppp.main.cpp.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="kdenetwork.kppp.main.cpp.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 -#include +#include #include #include #include @@ -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"); --------------Boundary-00=_RK0IQHZO3GQ2HAZW8AH6--