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

List:       kde-commits
Subject:    KDE/kdebase/workspace/kcontrol/dateandtime
From:       John Tapsell <john.tapsell () kdemail ! net>
Date:       2008-08-31 14:49:27
Message-ID: 1220194167.481089.10836.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 855347 by johnflux:

* Do not freeze the whole gui when prompting for a password
* Attach the kdesu dialog to the window


 M  +26 -12    main.cpp  
 M  +4 -0      main.h  


--- trunk/KDE/kdebase/workspace/kcontrol/dateandtime/main.cpp #855346:855347
@@ -80,6 +80,8 @@
   connect(tzone, SIGNAL(zoneChanged(bool)), this, SIGNAL(changed(bool)));
 
   setButtons(Help|Apply);
+
+  process = NULL;
 }
 
 void KclockModule::save()
@@ -89,28 +91,40 @@
   tzone->save( helperargs );
   QString helper = KStandardDirs::findExe( "kcmdatetimehelper" );
   QString kdesu = KStandardDirs::findExe( "kdesu" );
-  int error = 0;
+  bool ok = true;
   if( helper.isEmpty() || kdesu.isEmpty())
-    error = -1;
+    ok = false;
   else {
-    KProcess proc;
-    proc << kdesu << "--" << helper;
-    proc << helperargs;
-    error = proc.execute();
+    process = new KProcess(this);
+    *process << kdesu;
+    *process << "--attach" << QString::number(window()->winId()) << "--" << helper;
+    *process << helperargs;
+    process->start();
+    connect( process, SIGNAL( finished(int, QProcess::ExitStatus) ),
+		     SLOT( slotDateTimeHelperFinished(int) ) );
+    ok = process->waitForStarted();
+    if(!ok) {
+      delete process;
+      process = NULL;
+    }
   }
-  if( error < 0 || error == ERROR_CALL )
+  if( !ok )
     KMessageBox::error( this, i18n( "Failed to set system date/time/timezone."), \
                i18n( "Date/Time Error" ));
-  else {
-    dtime->processHelperErrors( error );
-    tzone->processHelperErrors( error );
-  }
+}
+void KclockModule::slotDateTimeHelperFinished(int exitCode)
+{
+    dtime->processHelperErrors( exitCode );
+    tzone->processHelperErrors( exitCode);
+
+    process->deleteLater();
+    process = NULL;
 #if 0
   // Tell the clock applet about the change so that it can update its timezone
   QDBusInterface clock("org.kde.kicker", "/Applets/Clock", \
"org.kde.kicker.ClockApplet");  clock.call("reconfigure");
 #endif
+
 }
-
 void KclockModule::load()
 {
   dtime->load();
--- trunk/KDE/kdebase/workspace/kcontrol/dateandtime/main.h #855346:855347
@@ -26,6 +26,7 @@
 class Dtime;
 class Tzone;
 class QTabWidget;
+class KProcess;
 
 
 class KclockModule : public KCModule
@@ -37,11 +38,14 @@
   
   void	save();
   void	load();
+private Q_SLOTS:
+  void slotDateTimeHelperFinished(int exitCode);
 
 private:
   QTabWidget   *tab;
   Tzone	*tzone;
   Dtime	*dtime;
+  KProcess *process;
 };
 
 #endif // main_included


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

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