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

List:       kde-commits
Subject:    kdesupport/kdewin-installer/shared
From:       Ralf Habacker <Ralf.Habacker () freenet ! de>
Date:       2010-07-31 17:06:50
Message-ID: 20100731170650.9A91BAC783 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1157584 by habacker:

added experimental feature for processing events while running client applications - \
still disabled for now

 M  +24 -3     postprocessing.cpp  


--- trunk/kdesupport/kdewin-installer/shared/postprocessing.cpp #1157583:1157584
@@ -25,7 +25,13 @@
 
 #include <QListWidget>
 #include <QProcess>
+#include <QCoreApplication>
 
+//#define POSTPROCESSING_ALLOW_EVENTS
+// allowing events during client application
+// running requires special quit handling
+// running simply quit() does now work
+
 PostProcessing::PostProcessing(QObject *parent) : QObject(parent)
 {
 }
@@ -41,11 +47,26 @@
     emit commandStarted(msg);
 
     qDebug() << "running " << app << params;
-    int ret = QProcess::execute( f.absoluteFilePath(), params);
-    emit commandFinished(ret == 0);
-    return ret == 0;
+#ifndef POSTPROCESSING_ALLOW_EVENTS
+    int noError = QProcess::execute( f.absoluteFilePath(), params) == 0;
+#else
+    QProcess p;
+    p.start(f.absoluteFilePath(), params);
+    if (!p.waitForStarted(3000))
+        return false;
+
+    while (p.state() == QProcess::Running)
+    {
+        QCoreApplication::processEvents();
 }
+    bool noError = p.exitStatus() == QProcess::NormalExit && p.exitCode() == 0;
+#endif
+    qDebug() << "application finished";
 
+    emit commandFinished(noError);
+    return noError;
+}
+
 bool PostProcessing::run()
 {
     emit numberOfCommands(5);


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

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