diff ui/listupdatedialog.cpp @ 257:06089ba2614a

Use Installwrapper to call certificate installation process
author Andre Heinecke <aheinecke@intevation.de>
date Tue, 01 Apr 2014 10:59:06 +0000
parents 6a7eb102716d
children
line wrap: on
line diff
--- a/ui/listupdatedialog.cpp	Tue Apr 01 10:52:06 2014 +0000
+++ b/ui/listupdatedialog.cpp	Tue Apr 01 10:59:06 2014 +0000
@@ -10,7 +10,11 @@
 #include <QListWidget>
 #include <QVBoxLayout>
 #include <QLabel>
+#include <QMessageBox>
+
+
 #include "certificate.h"
+#include "installwrapper.h"
 
 ListUpdateDialog::ListUpdateDialog(QMainWindow *parent,
                                    const CertificateList &listToInstall) :
@@ -86,7 +90,33 @@
     return;
 }
 
+void ListUpdateDialog::installerError(const QString& errMsg) {
+    QMessageBox::warning(this, tr("Installation Error"), errMsg);
+}
+
 void ListUpdateDialog::executeUpdate() {
+
+    QStringList instructions;
+
+    for (int i = 0; i < mCertListWidget->count(); i++) {
+        QListWidgetItem *item = mCertListWidget->item(i);
+        if (item->checkState() == Qt::Checked) {
+            instructions << item->data(Qt::UserRole).toString();
+        }
+
+        /* TODO: Check if it was an install instruction for an old certificate
+         * (already installed) and remove it in case it is unchecked. */
+    }
+
+    InstallWrapper *instWrap = new InstallWrapper(this,
+                                                  mCertificateList.fileName(),
+                                                  instructions);
+    connect(instWrap, SIGNAL(finished()), instWrap, SLOT(deleteLater()));
+    connect(instWrap, SIGNAL(error(const QString &)),
+        this, SLOT(installerError(const QString &)));
+    instWrap->start();
+
+#if 0
     /* TODO move this in another dialog and call it async*/
     QProcess installerProcess;
     QFileInfo fi(QCoreApplication::applicationFilePath());
@@ -155,6 +185,7 @@
         qDebug() << "output: " << installerProcess.readAllStandardOutput();
         return;
     }
+#endif
 }
 
 void ListUpdateDialog::showDetails(QListWidgetItem *item)

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