[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 20:10:06
Message-ID: 20100731201006.3C4E1AC783 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1157663 by habacker:

added quit feature

 M  +14 -12    postprocessing.cpp  
 M  +5 -1      postprocessing.h  


--- trunk/kdesupport/kdewin-installer/shared/postprocessing.cpp #1157662:1157663
@@ -27,11 +27,6 @@
 #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)
 {
 }
@@ -47,33 +42,40 @@
     emit commandStarted(msg);
 
     qDebug() << "running " << app << params;
-#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)
+    m_shouldQuit = false;
+    while (p.state() == QProcess::Running && !m_shouldQuit)
     {
         QCoreApplication::processEvents();
     }
     bool noError = p.exitStatus() == QProcess::NormalExit && p.exitCode() == 0;
-#endif
-    qDebug() << "application finished";
 
+    qDebug() << "application finished" << m_shouldQuit;
+
     emit commandFinished(noError);
     return noError;
 }
 
-bool PostProcessing::run()
+bool PostProcessing::start()
 {
     emit numberOfCommands(5);
     runCommand(0,"updating mime database","update-mime-database",QStringList() << \
QDir::fromNativeSeparators(Settings::instance().installDir()) + "/share/mime"); +    \
                if (!m_shouldQuit)
     runCommand(1,"updating system configuration database","kbuildsycoca4");
+    if (!m_shouldQuit)
     runCommand(2,"deleting old windows start menu \
entries","kwinstartmenu",QStringList() <<  "--remove"); +    if (!m_shouldQuit)
     runCommand(3,"creating new windows start menu entries","kwinstartmenu");
     emit finished();
     return true;
 }
+
+void PostProcessing::stop()
+{
+    m_shouldQuit = true;
+}
--- trunk/kdesupport/kdewin-installer/shared/postprocessing.h #1157662:1157663
@@ -34,7 +34,8 @@
     Q_OBJECT
 public:
     PostProcessing(QObject *parent = 0);
-    bool run();
+    bool start();
+    void stop();
 
 signals:
     void numberOfCommands(int count);
@@ -45,8 +46,11 @@
 
 public slots:
 
+
 protected:
     bool runCommand(int index, const QString &msg, const QString &app, const \
QStringList &params=QStringList()); +
+    bool m_shouldQuit;
 };
 
 #endif // POSTPROCESSING_H


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

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