diff ui/installwrapper.cpp @ 399:55cbe0a482ce

merged.
author Raimund Renkert <rrenkert@intevation.de>
date Wed, 16 Apr 2014 10:01:02 +0200
parents a507e5f1b999
children 17e1c8f37d72
line wrap: on
line diff
--- a/ui/installwrapper.cpp	Wed Apr 16 10:00:17 2014 +0200
+++ b/ui/installwrapper.cpp	Wed Apr 16 10:01:02 2014 +0200
@@ -69,9 +69,6 @@
         return;
     }
 
-    QString parameters = "\"list=" + mCertListFile +
-        "\" \"choices=" + choicesFile.fileName() + "\"";
-
 #ifdef WIN32
     /* QProcess on Windows uses CreateProcess but we have to
      * use the runas shell command to get the UAC prompt if necessary.
@@ -85,6 +82,10 @@
 
     memset (&shExecInfo, 0, sizeof(SHELLEXECUTEINFOW));
 
+    /* Windows needs each parameter packed in " */
+    QString parameters = "\"list=" + mCertListFile +
+        "\" \"choices=" + choicesFile.fileName() + "\"";
+
     shExecInfo.cbSize = sizeof(SHELLEXECUTEINFOW);
     shExecInfo.fMask = SEE_MASK_NOCLOSEPROCESS;
     shExecInfo.lpVerb = L"runas";
@@ -125,19 +126,30 @@
         QString qerrmsg = QString::fromUtf8(errmsg);
         free(errmsg);
         emit error (tr("Failed to check process status: %1").arg(qerrmsg));
+        CloseHandle(shExecInfo.hProcess);
+        return;
     }
     CloseHandle(shExecInfo.hProcess);
 
     if (retval != 0) {
         /* TODO make this nicer */
         emit error (tr("The process failed with return code. %1").arg(retval));
+        return;
     }
-    return;
 #else /* WIN32 */
     QProcess installerProcess;
     installerProcess.setProgram(cinstProcInfo.absoluteFilePath());
-    installerProcess.waitForStarted();
-    if (installerProcess.state() == QProcess::NotRunning) {
+    QStringList parameters;
+
+    choicesFile.setAutoRemove(false);
+    parameters << "list=" + mCertListFile << "choices=" + choicesFile.fileName();
+    installerProcess.setArguments(parameters);
+
+
+    qDebug() << "Starting process " << cinstFileName <<" params: " << parameters;
+    installerProcess.start();
+    if (!installerProcess.waitForStarted() ||
+        installerProcess.state() == QProcess::NotRunning) {
         emit error (tr("Failed to start installer process."));
         return;
     }
@@ -146,11 +158,12 @@
 
     if (installerProcess.exitStatus() == QProcess::CrashExit) {
         /* Woops */
-        qWarning() << "Installer process crashed";
+        emit error (tr("Failed to complete installation."));
+        return;
     } else if (installerProcess.exitStatus() != QProcess::NormalExit) {
         /* Can not Happen. there are only those two values but maybe
          * qt changed.. */
-        qWarning() << "Exit status neither normal nor crash.";
+        emit error (tr("Failed to complete installation."));
         return;
     }
 
@@ -163,4 +176,5 @@
         return;
     }
 #endif
+    emit installationSuccessful();
 }

http://wald.intevation.org/projects/trustbridge/