diff ui/processwaitdialog.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
children 957b28a97959
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ui/processwaitdialog.cpp	Wed Jun 18 14:40:06 2014 +0200
@@ -0,0 +1,53 @@
+/* Copyright (C) 2014 by Bundesamt für Sicherheit in der Informationstechnik
+ * Software engineering by Intevation GmbH
+ *
+ * This file is Free Software under the GNU GPL (v>=2)
+ * and comes with ABSOLUTELY NO WARRANTY!
+ * See LICENSE.txt for details.
+ */
+#include <QHBoxLayout>
+#include <QListWidget>
+#include <QTimer>
+#include <QList>
+#include <QLabel>
+#include <QApplication>
+
+#include "processwaitdialog.h"
+#include "processhelp.h"
+
+ProcessWaitDialog::ProcessWaitDialog(QWidget *parent, const QStringList& processNames) :
+    QDialog(parent),
+    mProcessNames(processNames) {
+    QHBoxLayout *theLayout = new QHBoxLayout(this);
+
+    setWindowTitle(tr("Applications need to be closed."));
+
+    QLabel *warnLabel = new QLabel(tr("Close all running firefox and thunderbird instances to continue installation"));
+    QLabel *warnIcon = new QLabel();
+    warnIcon->setPixmap(QApplication::style()->standardPixmap(QStyle::SP_MessageBoxWarning));
+
+    theLayout->addWidget(warnIcon);
+    theLayout->addWidget(warnLabel);
+ //   mProcessList = new QListWidget();
+//    theLayout->addWidget(mProcessList);
+    updateProcesses();
+}
+
+void ProcessWaitDialog::updateProcesses() {
+    QList<int> pids;
+    foreach (const QString& pName, mProcessNames) {
+        pids.append(ProcessHelp::getProcessesIdForName(pName));
+    }
+    if (pids.isEmpty()) {
+        accept();
+        return;
+    }
+
+  /*  mProcessList->clear();
+
+    foreach (int pId, pids) {
+        mProcessList->addItem(QString::fromLatin1("Pid ") + pId);
+    }
+*/
+    QTimer::singleShot(500, this, SLOT(updateProcesses()));
+}

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