comparison 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
comparison
equal deleted inserted replaced
608:81a44b93229e 609:292c590ba9cb
1 /* Copyright (C) 2014 by Bundesamt für Sicherheit in der Informationstechnik
2 * Software engineering by Intevation GmbH
3 *
4 * This file is Free Software under the GNU GPL (v>=2)
5 * and comes with ABSOLUTELY NO WARRANTY!
6 * See LICENSE.txt for details.
7 */
8 #include <QHBoxLayout>
9 #include <QListWidget>
10 #include <QTimer>
11 #include <QList>
12 #include <QLabel>
13 #include <QApplication>
14
15 #include "processwaitdialog.h"
16 #include "processhelp.h"
17
18 ProcessWaitDialog::ProcessWaitDialog(QWidget *parent, const QStringList& processNames) :
19 QDialog(parent),
20 mProcessNames(processNames) {
21 QHBoxLayout *theLayout = new QHBoxLayout(this);
22
23 setWindowTitle(tr("Applications need to be closed."));
24
25 QLabel *warnLabel = new QLabel(tr("Close all running firefox and thunderbird instances to continue installation"));
26 QLabel *warnIcon = new QLabel();
27 warnIcon->setPixmap(QApplication::style()->standardPixmap(QStyle::SP_MessageBoxWarning));
28
29 theLayout->addWidget(warnIcon);
30 theLayout->addWidget(warnLabel);
31 // mProcessList = new QListWidget();
32 // theLayout->addWidget(mProcessList);
33 updateProcesses();
34 }
35
36 void ProcessWaitDialog::updateProcesses() {
37 QList<int> pids;
38 foreach (const QString& pName, mProcessNames) {
39 pids.append(ProcessHelp::getProcessesIdForName(pName));
40 }
41 if (pids.isEmpty()) {
42 accept();
43 return;
44 }
45
46 /* mProcessList->clear();
47
48 foreach (int pId, pids) {
49 mProcessList->addItem(QString::fromLatin1("Pid ") + pId);
50 }
51 */
52 QTimer::singleShot(500, this, SLOT(updateProcesses()));
53 }

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