annotate ui/processwaitdialog.cpp @ 611:957b28a97959

Add exclamation mark to warning message for running firefox / thunderbird instances
author Andre Heinecke <andre.heinecke@intevation.de>
date Wed, 18 Jun 2014 14:43:56 +0200
parents 292c590ba9cb
children 47235ae3fa9a
rev   line source
609
292c590ba9cb Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
1 /* Copyright (C) 2014 by Bundesamt für Sicherheit in der Informationstechnik
292c590ba9cb Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
2 * Software engineering by Intevation GmbH
292c590ba9cb Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
3 *
292c590ba9cb Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
4 * This file is Free Software under the GNU GPL (v>=2)
292c590ba9cb Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY!
292c590ba9cb Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
6 * See LICENSE.txt for details.
292c590ba9cb Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
7 */
292c590ba9cb Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
8 #include <QHBoxLayout>
292c590ba9cb Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
9 #include <QListWidget>
292c590ba9cb Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
10 #include <QTimer>
292c590ba9cb Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
11 #include <QList>
292c590ba9cb Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
12 #include <QLabel>
292c590ba9cb Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
13 #include <QApplication>
292c590ba9cb Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
14
292c590ba9cb Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
15 #include "processwaitdialog.h"
292c590ba9cb Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
16 #include "processhelp.h"
292c590ba9cb Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
17
292c590ba9cb Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
18 ProcessWaitDialog::ProcessWaitDialog(QWidget *parent, const QStringList& processNames) :
292c590ba9cb Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
19 QDialog(parent),
292c590ba9cb Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
20 mProcessNames(processNames) {
292c590ba9cb Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
21 QHBoxLayout *theLayout = new QHBoxLayout(this);
292c590ba9cb Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
22
292c590ba9cb Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
23 setWindowTitle(tr("Applications need to be closed."));
292c590ba9cb Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
24
611
957b28a97959 Add exclamation mark to warning message for running firefox / thunderbird instances
Andre Heinecke <andre.heinecke@intevation.de>
parents: 609
diff changeset
25 QLabel *warnLabel = new QLabel(tr("Close all running firefox and thunderbird instances to continue installation!"));
609
292c590ba9cb Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
26 QLabel *warnIcon = new QLabel();
292c590ba9cb Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
27 warnIcon->setPixmap(QApplication::style()->standardPixmap(QStyle::SP_MessageBoxWarning));
292c590ba9cb Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
28
292c590ba9cb Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
29 theLayout->addWidget(warnIcon);
292c590ba9cb Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
30 theLayout->addWidget(warnLabel);
292c590ba9cb Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
31 // mProcessList = new QListWidget();
292c590ba9cb Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
32 // theLayout->addWidget(mProcessList);
292c590ba9cb Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
33 updateProcesses();
292c590ba9cb Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
34 }
292c590ba9cb Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
35
292c590ba9cb Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
36 void ProcessWaitDialog::updateProcesses() {
292c590ba9cb Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
37 QList<int> pids;
292c590ba9cb Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
38 foreach (const QString& pName, mProcessNames) {
292c590ba9cb Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
39 pids.append(ProcessHelp::getProcessesIdForName(pName));
292c590ba9cb Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
40 }
292c590ba9cb Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
41 if (pids.isEmpty()) {
292c590ba9cb Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
42 accept();
292c590ba9cb Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
43 return;
292c590ba9cb Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
44 }
292c590ba9cb Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
45
292c590ba9cb Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
46 /* mProcessList->clear();
292c590ba9cb Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
47
292c590ba9cb Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
48 foreach (int pId, pids) {
292c590ba9cb Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
49 mProcessList->addItem(QString::fromLatin1("Pid ") + pId);
292c590ba9cb Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
50 }
292c590ba9cb Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
51 */
292c590ba9cb Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
52 QTimer::singleShot(500, this, SLOT(updateProcesses()));
292c590ba9cb Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
53 }

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