changeset 385:72487438a180

More user visible errors. Correct parameters for installation.
author Andre Heinecke <andre.heinecke@intevation.de>
date Tue, 15 Apr 2014 17:48:06 +0200 (2014-04-15)
parents 638db75f0fdf
children cc1738b398a0
files ui/installwrapper.cpp
diffstat 1 files changed, 18 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/ui/installwrapper.cpp	Tue Apr 15 17:47:33 2014 +0200
+++ b/ui/installwrapper.cpp	Tue Apr 15 17:48:06 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";
@@ -136,8 +137,17 @@
 #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 +156,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;
     }
 

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