comparison 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
comparison
equal deleted inserted replaced
256:84ae353688e0 257:06089ba2614a
8 #include <QGroupBox> 8 #include <QGroupBox>
9 #include <QHBoxLayout> 9 #include <QHBoxLayout>
10 #include <QListWidget> 10 #include <QListWidget>
11 #include <QVBoxLayout> 11 #include <QVBoxLayout>
12 #include <QLabel> 12 #include <QLabel>
13 #include <QMessageBox>
14
15
13 #include "certificate.h" 16 #include "certificate.h"
17 #include "installwrapper.h"
14 18
15 ListUpdateDialog::ListUpdateDialog(QMainWindow *parent, 19 ListUpdateDialog::ListUpdateDialog(QMainWindow *parent,
16 const CertificateList &listToInstall) : 20 const CertificateList &listToInstall) :
17 QDialog(parent), 21 QDialog(parent),
18 mCertificateList(listToInstall) 22 mCertificateList(listToInstall)
84 setLayout(topLayout); 88 setLayout(topLayout);
85 89
86 return; 90 return;
87 } 91 }
88 92
93 void ListUpdateDialog::installerError(const QString& errMsg) {
94 QMessageBox::warning(this, tr("Installation Error"), errMsg);
95 }
96
89 void ListUpdateDialog::executeUpdate() { 97 void ListUpdateDialog::executeUpdate() {
98
99 QStringList instructions;
100
101 for (int i = 0; i < mCertListWidget->count(); i++) {
102 QListWidgetItem *item = mCertListWidget->item(i);
103 if (item->checkState() == Qt::Checked) {
104 instructions << item->data(Qt::UserRole).toString();
105 }
106
107 /* TODO: Check if it was an install instruction for an old certificate
108 * (already installed) and remove it in case it is unchecked. */
109 }
110
111 InstallWrapper *instWrap = new InstallWrapper(this,
112 mCertificateList.fileName(),
113 instructions);
114 connect(instWrap, SIGNAL(finished()), instWrap, SLOT(deleteLater()));
115 connect(instWrap, SIGNAL(error(const QString &)),
116 this, SLOT(installerError(const QString &)));
117 instWrap->start();
118
119 #if 0
90 /* TODO move this in another dialog and call it async*/ 120 /* TODO move this in another dialog and call it async*/
91 QProcess installerProcess; 121 QProcess installerProcess;
92 QFileInfo fi(QCoreApplication::applicationFilePath()); 122 QFileInfo fi(QCoreApplication::applicationFilePath());
93 QDir myDir = fi.absoluteDir(); 123 QDir myDir = fi.absoluteDir();
94 QString instProcName = "cinst"; 124 QString instProcName = "cinst";
153 /* TODO handle errors defined by errorcodes.h */ 183 /* TODO handle errors defined by errorcodes.h */
154 qDebug() << "Installer Process returned: " << installerProcess.exitCode(); 184 qDebug() << "Installer Process returned: " << installerProcess.exitCode();
155 qDebug() << "output: " << installerProcess.readAllStandardOutput(); 185 qDebug() << "output: " << installerProcess.readAllStandardOutput();
156 return; 186 return;
157 } 187 }
188 #endif
158 } 189 }
159 190
160 void ListUpdateDialog::showDetails(QListWidgetItem *item) 191 void ListUpdateDialog::showDetails(QListWidgetItem *item)
161 { 192 {
162 QString details = item->data(Qt::ToolTipRole).toString(); 193 QString details = item->data(Qt::ToolTipRole).toString();

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