Mercurial > trustbridge
changeset 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 | 84ae353688e0 |
children | e7a8b70021b6 |
files | ui/CMakeLists.txt ui/listupdatedialog.cpp ui/listupdatedialog.h |
diffstat | 3 files changed, 33 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/ui/CMakeLists.txt Tue Apr 01 10:52:06 2014 +0000 +++ b/ui/CMakeLists.txt Tue Apr 01 10:59:06 2014 +0000 @@ -20,6 +20,7 @@ ${CMAKE_CURRENT_SOURCE_DIR}/helpdialog.cpp ${CMAKE_CURRENT_SOURCE_DIR}/aboutdialog.cpp ${CMAKE_CURRENT_SOURCE_DIR}/statusdialog.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/installwrapper.cpp ${CERTIFICATELIST_SOURCES} ${DOWNLOADER_SOURCES} )
--- 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)