Mercurial > trustbridge
diff ui/mainwindow.cpp @ 609:292c590ba9cb
Add warning dialog for running firefox and tunderbird processes
author | Andre Heinecke <andre.heinecke@intevation.de> |
---|---|
date | Wed, 18 Jun 2014 14:40:06 +0200 |
parents | e83589f1fd7f |
children | 129e611eaf50 |
line wrap: on
line diff
--- a/ui/mainwindow.cpp Wed Jun 18 11:22:15 2014 +0200 +++ b/ui/mainwindow.cpp Wed Jun 18 14:40:06 2014 +0200 @@ -27,6 +27,19 @@ #include <QImage> #include <QCheckBox> +#include "certificatelist.h" +#include "downloader.h" +#include "helpdialog.h" +#include "aboutdialog.h" +#include "certificateitemdelegate.h" +#include "separatoritemdelegate.h" +#include "installwrapper.h" +#include "util.h" +#include "logging.h" +#include "binverify.h" +#include "processhelp.h" +#include "processwaitdialog.h" + // The amount of time in minutes stay silent if we have // something to say #define NAG_INTERVAL_MINUTES 70 @@ -55,17 +68,6 @@ # endif #endif -#include "certificatelist.h" -#include "downloader.h" -#include "helpdialog.h" -#include "aboutdialog.h" -#include "certificateitemdelegate.h" -#include "separatoritemdelegate.h" -#include "installwrapper.h" -#include "util.h" -#include "logging.h" -#include "binverify.h" - MainWindow::MainWindow(bool trayMode): mTrayMode(trayMode) { @@ -508,7 +510,7 @@ installButton = new QPushButton(tr("Install selected")); installButton->setFixedHeight(80); connect(installButton, SIGNAL(clicked()), this, SLOT(resizeButtons())); - connect(installButton, SIGNAL(clicked()), this, SLOT(installCerts())); + connect(installButton, SIGNAL(clicked()), this, SLOT(checkAndInstallCerts())); quitButton = new QPushButton(tr("Quit")); quitButton->setFixedHeight(20); connect(quitButton, SIGNAL(clicked()), this, SLOT(closeApp())); @@ -855,3 +857,27 @@ saveUnselectedCertificates(); qApp->quit(); } + +void MainWindow::checkAndInstallCerts() +{ + /* Checking before opening the dialog should be cheaper */ + QList<int> pids = ProcessHelp::getProcessesIdForName("firefox"); + pids.append(ProcessHelp::getProcessesIdForName("thunderbird")); + + if (pids.isEmpty()) { + installCerts(); + return; + } + + QStringList pNames; + pNames << "firefox" << "thunderbird"; + + ProcessWaitDialog *waitDialog = new ProcessWaitDialog(this, pNames); + + connect(waitDialog, SIGNAL(accepted()), this, SLOT(installCerts())); + connect(waitDialog, SIGNAL(accepted()), waitDialog, SLOT(deleteLater())); + + waitDialog->exec(); + + return; +}