annotate ui/mainwindow.cpp @ 696:55f78c4166fb

(Issue32) Change Updates to Changes and track changes.
author Andre Heinecke <andre.heinecke@intevation.de>
date Tue, 01 Jul 2014 17:20:07 +0200
parents 25a73bfec359
children 9dea3d895f53
rev   line source
404
17e1c8f37d72 Add License
Andre Heinecke <aheinecke@intevation.de>
parents: 393
diff changeset
1 /* Copyright (C) 2014 by Bundesamt für Sicherheit in der Informationstechnik
17e1c8f37d72 Add License
Andre Heinecke <aheinecke@intevation.de>
parents: 393
diff changeset
2 * Software engineering by Intevation GmbH
17e1c8f37d72 Add License
Andre Heinecke <aheinecke@intevation.de>
parents: 393
diff changeset
3 *
17e1c8f37d72 Add License
Andre Heinecke <aheinecke@intevation.de>
parents: 393
diff changeset
4 * This file is Free Software under the GNU GPL (v>=2)
17e1c8f37d72 Add License
Andre Heinecke <aheinecke@intevation.de>
parents: 393
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY!
17e1c8f37d72 Add License
Andre Heinecke <aheinecke@intevation.de>
parents: 393
diff changeset
6 * See LICENSE.txt for details.
17e1c8f37d72 Add License
Andre Heinecke <aheinecke@intevation.de>
parents: 393
diff changeset
7 */
0
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
8 #include "mainwindow.h"
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
9
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
10 #include <QDebug>
551
15121735805e Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents: 548
diff changeset
11 #include <QProcess>
365
75f7288ad67b Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents: 274
diff changeset
12 #include <QProgressDialog>
0
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
13 #include <QMessageBox>
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
14 #include <QSystemTrayIcon>
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
15 #include <QAction>
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
16 #include <QDialog>
563
aee3eb10bbba Add unit test for sw update execution and fix shell execute params
Andre Heinecke <aheinecke@intevation.de>
parents: 555
diff changeset
17 #include <QDir>
0
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
18 #include <QMenu>
2
cf88cc432b9d Add quit action
Andre Heinecke <aheinecke@intevation.de>
parents: 0
diff changeset
19 #include <QApplication>
16
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 11
diff changeset
20 #include <QFile>
19
9af6198deb8e Add timed trigger for the message
Andre Heinecke <aheinecke@intevation.de>
parents: 17
diff changeset
21 #include <QTimer>
187
0c06a608e15f Create the mainwindow content.
Raimund Renkert <rrenkert@intevation.de>
parents: 155
diff changeset
22 #include <QHBoxLayout>
0c06a608e15f Create the mainwindow content.
Raimund Renkert <rrenkert@intevation.de>
parents: 155
diff changeset
23 #include <QVBoxLayout>
0c06a608e15f Create the mainwindow content.
Raimund Renkert <rrenkert@intevation.de>
parents: 155
diff changeset
24 #include <QGroupBox>
189
5f0d45ca9de4 Show certificates in the list view and details in the textfield.
Raimund Renkert <rrenkert@intevation.de>
parents: 187
diff changeset
25 #include <QSplitter>
205
a3f542bf38f7 Added header for mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents: 200
diff changeset
26 #include <QLabel>
a3f542bf38f7 Added header for mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents: 200
diff changeset
27 #include <QImage>
250
1e112cf41e92 Updated the mainwindow layout.
Raimund Renkert <rrenkert@intevation.de>
parents: 249
diff changeset
28 #include <QCheckBox>
584
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
29 #include <QButtonGroup>
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
30 #include <QToolButton>
19
9af6198deb8e Add timed trigger for the message
Andre Heinecke <aheinecke@intevation.de>
parents: 17
diff changeset
31
609
292c590ba9cb Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents: 607
diff changeset
32 #include "certificatelist.h"
292c590ba9cb Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents: 607
diff changeset
33 #include "downloader.h"
292c590ba9cb Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents: 607
diff changeset
34 #include "helpdialog.h"
292c590ba9cb Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents: 607
diff changeset
35 #include "aboutdialog.h"
292c590ba9cb Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents: 607
diff changeset
36 #include "certificateitemdelegate.h"
292c590ba9cb Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents: 607
diff changeset
37 #include "separatoritemdelegate.h"
292c590ba9cb Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents: 607
diff changeset
38 #include "installwrapper.h"
292c590ba9cb Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents: 607
diff changeset
39 #include "util.h"
292c590ba9cb Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents: 607
diff changeset
40 #include "logging.h"
292c590ba9cb Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents: 607
diff changeset
41 #include "binverify.h"
292c590ba9cb Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents: 607
diff changeset
42 #include "processhelp.h"
292c590ba9cb Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents: 607
diff changeset
43 #include "processwaitdialog.h"
292c590ba9cb Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents: 607
diff changeset
44
19
9af6198deb8e Add timed trigger for the message
Andre Heinecke <aheinecke@intevation.de>
parents: 17
diff changeset
45 // The amount of time in minutes stay silent if we have
9af6198deb8e Add timed trigger for the message
Andre Heinecke <aheinecke@intevation.de>
parents: 17
diff changeset
46 // something to say
548
c84dc8f6d017 Increase nag interval to 70 minutes
Andre Heinecke <aheinecke@intevation.de>
parents: 531
diff changeset
47 #define NAG_INTERVAL_MINUTES 70
0
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
48
409
09bb19e5e369 Remove m13 mentions and change test certificate to intevation.de
Andre Heinecke <aheinecke@intevation.de>
parents: 407
diff changeset
49 #ifndef APPNAME
09bb19e5e369 Remove m13 mentions and change test certificate to intevation.de
Andre Heinecke <aheinecke@intevation.de>
parents: 407
diff changeset
50 #define APPNAME "TrustBridge"
09bb19e5e369 Remove m13 mentions and change test certificate to intevation.de
Andre Heinecke <aheinecke@intevation.de>
parents: 407
diff changeset
51 #endif
09bb19e5e369 Remove m13 mentions and change test certificate to intevation.de
Andre Heinecke <aheinecke@intevation.de>
parents: 407
diff changeset
52
09bb19e5e369 Remove m13 mentions and change test certificate to intevation.de
Andre Heinecke <aheinecke@intevation.de>
parents: 407
diff changeset
53 #define SERVER_URL "https://files.intevation.de:443"
72
7e304573ebd1 Add some testing hacks for interactive testing
Andre Heinecke <aheinecke@intevation.de>
parents: 71
diff changeset
54
607
e83589f1fd7f Use different URI's for development
Andre Heinecke <andre.heinecke@intevation.de>
parents: 594
diff changeset
55 #ifdef RELEASE_BUILD
e83589f1fd7f Use different URI's for development
Andre Heinecke <andre.heinecke@intevation.de>
parents: 594
diff changeset
56 # define LIST_RESOURCE "/users/aheinecke/zertifikatsliste.txt"
e83589f1fd7f Use different URI's for development
Andre Heinecke <andre.heinecke@intevation.de>
parents: 594
diff changeset
57 # ifdef Q_OS_WIN
e83589f1fd7f Use different URI's for development
Andre Heinecke <andre.heinecke@intevation.de>
parents: 594
diff changeset
58 # define SW_RESOURCE_VERSION "/users/aheinecke/TrustBridge-%1.exe"
664
911b94a475e0 Fix SW_Resource defines for linux
Andre Heinecke <andre.heinecke@intevation.de>
parents: 663
diff changeset
59 # define SW_RESOURCE "/users/aheinecke/TrustBridge.exe"
607
e83589f1fd7f Use different URI's for development
Andre Heinecke <andre.heinecke@intevation.de>
parents: 594
diff changeset
60 # else
e83589f1fd7f Use different URI's for development
Andre Heinecke <andre.heinecke@intevation.de>
parents: 594
diff changeset
61 # define SW_RESOURCE_VERSION "/users/aheinecke/TrustBridge-%1.sh"
664
911b94a475e0 Fix SW_Resource defines for linux
Andre Heinecke <andre.heinecke@intevation.de>
parents: 663
diff changeset
62 # define SW_RESOURCE "/users/aheinecke/TrustBridge.sh"
607
e83589f1fd7f Use different URI's for development
Andre Heinecke <andre.heinecke@intevation.de>
parents: 594
diff changeset
63 # endif
e83589f1fd7f Use different URI's for development
Andre Heinecke <andre.heinecke@intevation.de>
parents: 594
diff changeset
64 #else // RELEASE_BUILD
e83589f1fd7f Use different URI's for development
Andre Heinecke <andre.heinecke@intevation.de>
parents: 594
diff changeset
65 # define LIST_RESOURCE "/users/aheinecke/development/zertifikatsliste.txt"
e83589f1fd7f Use different URI's for development
Andre Heinecke <andre.heinecke@intevation.de>
parents: 594
diff changeset
66 # ifdef Q_OS_WIN
e83589f1fd7f Use different URI's for development
Andre Heinecke <andre.heinecke@intevation.de>
parents: 594
diff changeset
67 # define SW_RESOURCE_VERSION "/users/aheinecke/development/TrustBridge-development.exe"
664
911b94a475e0 Fix SW_Resource defines for linux
Andre Heinecke <andre.heinecke@intevation.de>
parents: 663
diff changeset
68 # define SW_RESOURCE "/users/aheinecke/development/TrustBridge.exe"
607
e83589f1fd7f Use different URI's for development
Andre Heinecke <andre.heinecke@intevation.de>
parents: 594
diff changeset
69 # else
e83589f1fd7f Use different URI's for development
Andre Heinecke <andre.heinecke@intevation.de>
parents: 594
diff changeset
70 # define SW_RESOURCE_VERSION "/users/aheinecke/development/TrustBridge-development.sh"
664
911b94a475e0 Fix SW_Resource defines for linux
Andre Heinecke <andre.heinecke@intevation.de>
parents: 663
diff changeset
71 # define SW_RESOURCE "/users/aheinecke/development/TrustBridge.sh"
607
e83589f1fd7f Use different URI's for development
Andre Heinecke <andre.heinecke@intevation.de>
parents: 594
diff changeset
72 # endif
486
fa56a9403939 Lookup the last modified date for software installer after first installation.
Raimund Renkert <rrenkert@intevation.de>
parents: 481
diff changeset
73 #endif
7
992c0ec57660 Add unit tests make CertificateList work.
Andre Heinecke <aheinecke@intevation.de>
parents: 2
diff changeset
74
365
75f7288ad67b Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents: 274
diff changeset
75 MainWindow::MainWindow(bool trayMode):
75f7288ad67b Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents: 274
diff changeset
76 mTrayMode(trayMode)
75f7288ad67b Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents: 274
diff changeset
77 {
0
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
78 createActions();
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
79 createTrayIcon();
187
0c06a608e15f Create the mainwindow content.
Raimund Renkert <rrenkert@intevation.de>
parents: 155
diff changeset
80 createContent();
450
4932fc33ee82 Updated window and main layout size.
Raimund Renkert <rrenkert@intevation.de>
parents: 449
diff changeset
81 resize(950, 540);
45
c6125d73faf4 Move SSLConnection into it's own class
Andre Heinecke <aheinecke@intevation.de>
parents: 31
diff changeset
82 qRegisterMetaType<SSLConnection::ErrorCode>("SSLConnection::ErrorCode");
265
ffd47b045d19 Added certificate status enum and register it as metatype.
Raimund Renkert <rrenkert@intevation.de>
parents: 250
diff changeset
83 qRegisterMetaType<Certificate::Status>("Certificate::Status");
0
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
84
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
85 connect(mTrayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)),
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
86 this, SLOT(iconActivated(QSystemTrayIcon::ActivationReason)));
19
9af6198deb8e Add timed trigger for the message
Andre Heinecke <aheinecke@intevation.de>
parents: 17
diff changeset
87
9af6198deb8e Add timed trigger for the message
Andre Heinecke <aheinecke@intevation.de>
parents: 17
diff changeset
88 mMessageTimer = new QTimer(this);
9af6198deb8e Add timed trigger for the message
Andre Heinecke <aheinecke@intevation.de>
parents: 17
diff changeset
89 connect(mMessageTimer, SIGNAL(timeout()), this, SLOT(showMessage()));
9af6198deb8e Add timed trigger for the message
Andre Heinecke <aheinecke@intevation.de>
parents: 17
diff changeset
90 mMessageTimer->setInterval(NAG_INTERVAL_MINUTES * 60 * 1000);
9af6198deb8e Add timed trigger for the message
Andre Heinecke <aheinecke@intevation.de>
parents: 17
diff changeset
91 mMessageTimer->start();
71
f22a99f7cb69 Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents: 45
diff changeset
92 checkUpdates();
389
3be838c3e4d8 Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 375
diff changeset
93 loadUnselectedCertificates();
3be838c3e4d8 Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 375
diff changeset
94 loadCertificateList();
365
75f7288ad67b Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents: 274
diff changeset
95 if (!trayMode) {
75f7288ad67b Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents: 274
diff changeset
96 show();
75f7288ad67b Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents: 274
diff changeset
97 }
0
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
98 }
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
99
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
100 void MainWindow::iconActivated(QSystemTrayIcon::ActivationReason reason)
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
101 {
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
102 switch (reason) {
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
103 case QSystemTrayIcon::Trigger:
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
104 case QSystemTrayIcon::MiddleClick:
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
105 showMessage();
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
106 break;
16
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 11
diff changeset
107 case QSystemTrayIcon::DoubleClick:
365
75f7288ad67b Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents: 274
diff changeset
108 show();
16
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 11
diff changeset
109 break;
0
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
110 default:
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
111 ;
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
112 }
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
113 }
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
114
71
f22a99f7cb69 Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents: 45
diff changeset
115 void MainWindow::messageClicked()
f22a99f7cb69 Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents: 45
diff changeset
116 {
f22a99f7cb69 Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents: 45
diff changeset
117 if (mCurState == NewListAvailable) {
365
75f7288ad67b Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents: 274
diff changeset
118 show();
71
f22a99f7cb69 Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents: 45
diff changeset
119 }
551
15121735805e Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents: 548
diff changeset
120
15121735805e Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents: 548
diff changeset
121 if (mCurState == NewSoftwareAvailable) {
587
02a89710a7cd Split up list and software verification and use it
Andre Heinecke <aheinecke@intevation.de>
parents: 563
diff changeset
122 verifySWData();
02a89710a7cd Split up list and software verification and use it
Andre Heinecke <aheinecke@intevation.de>
parents: 563
diff changeset
123 QString swFileName = mSettings.value("Software/available").toString();
02a89710a7cd Split up list and software verification and use it
Andre Heinecke <aheinecke@intevation.de>
parents: 563
diff changeset
124 if (swFileName.isEmpty()) {
02a89710a7cd Split up list and software verification and use it
Andre Heinecke <aheinecke@intevation.de>
parents: 563
diff changeset
125 checkUpdates(true);
02a89710a7cd Split up list and software verification and use it
Andre Heinecke <aheinecke@intevation.de>
parents: 563
diff changeset
126 mCurState = DownloadingSW;
02a89710a7cd Split up list and software verification and use it
Andre Heinecke <aheinecke@intevation.de>
parents: 563
diff changeset
127 return;
02a89710a7cd Split up list and software verification and use it
Andre Heinecke <aheinecke@intevation.de>
parents: 563
diff changeset
128 }
02a89710a7cd Split up list and software verification and use it
Andre Heinecke <aheinecke@intevation.de>
parents: 563
diff changeset
129 installNewSW(swFileName,
02a89710a7cd Split up list and software verification and use it
Andre Heinecke <aheinecke@intevation.de>
parents: 563
diff changeset
130 mSettings.value("Software/availableDate").toDateTime());
551
15121735805e Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents: 548
diff changeset
131 }
71
f22a99f7cb69 Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents: 45
diff changeset
132 }
f22a99f7cb69 Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents: 45
diff changeset
133
0
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
134 void MainWindow::showMessage()
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
135 {
591
26a18e3c3db4 Cleanups and coding style.
Andre Heinecke <aheinecke@intevation.de>
parents: 587
diff changeset
136 if (mCurMessage.isEmpty()) {
26a18e3c3db4 Cleanups and coding style.
Andre Heinecke <aheinecke@intevation.de>
parents: 587
diff changeset
137 return;
26a18e3c3db4 Cleanups and coding style.
Andre Heinecke <aheinecke@intevation.de>
parents: 587
diff changeset
138 }
26a18e3c3db4 Cleanups and coding style.
Andre Heinecke <aheinecke@intevation.de>
parents: 587
diff changeset
139 if (mCurState == NewSoftwareAvailable || !isVisible()) {
16
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 11
diff changeset
140 mTrayIcon->showMessage(QApplication::applicationName(), mCurMessage,
591
26a18e3c3db4 Cleanups and coding style.
Andre Heinecke <aheinecke@intevation.de>
parents: 587
diff changeset
141 QSystemTrayIcon::Information, 10000);
19
9af6198deb8e Add timed trigger for the message
Andre Heinecke <aheinecke@intevation.de>
parents: 17
diff changeset
142 mMessageTimer->start(); // Restart the timer so that we don't spam
16
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 11
diff changeset
143 }
0
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
144 }
16
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 11
diff changeset
145
587
02a89710a7cd Split up list and software verification and use it
Andre Heinecke <aheinecke@intevation.de>
parents: 563
diff changeset
146 void MainWindow::verifyListData()
0
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
147 {
389
3be838c3e4d8 Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 375
diff changeset
148 QString availableFileName = mSettings.value("List/available").toString();
3be838c3e4d8 Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 375
diff changeset
149 QString installedFileName = mSettings.value("List/installed").toString();
3be838c3e4d8 Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 375
diff changeset
150 if (!availableFileName.isEmpty()) {
3be838c3e4d8 Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 375
diff changeset
151 mListToInstall.readList(availableFileName.toLocal8Bit().constData());
71
f22a99f7cb69 Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents: 45
diff changeset
152 if (!mListToInstall.isValid()) {
82
1f27d6db5ee3 Polarssl based certificate handling
Andre Heinecke <aheinecke@intevation.de>
parents: 72
diff changeset
153 mCurState = TransferError;
16
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 11
diff changeset
154 // Probably a bug when Qt fileName is encoded and cFileName
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 11
diff changeset
155 // fails because of this. This needs a unit test!
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 11
diff changeset
156 // Maybe check that the file is in our data directory
389
3be838c3e4d8 Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 375
diff changeset
157 QFile::remove(availableFileName);
16
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 11
diff changeset
158 mSettings.remove("List/available");
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 11
diff changeset
159 mSettings.remove("List/availableDate");
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 11
diff changeset
160 }
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 11
diff changeset
161 } else {
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 11
diff changeset
162 // Make sure the available notation is also removed
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 11
diff changeset
163 mSettings.remove("List/available");
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 11
diff changeset
164 mSettings.remove("List/availableDate");
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 11
diff changeset
165 }
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 11
diff changeset
166
389
3be838c3e4d8 Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 375
diff changeset
167 if (!installedFileName.isEmpty()) {
3be838c3e4d8 Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 375
diff changeset
168 mInstalledList.readList(installedFileName.toLocal8Bit().constData());
3be838c3e4d8 Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 375
diff changeset
169 if (!mInstalledList.isValid()) {
3be838c3e4d8 Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 375
diff changeset
170 // Probably a bug when Qt fileName is encoded and cFileName
3be838c3e4d8 Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 375
diff changeset
171 // fails because of this. This needs a unit test!
3be838c3e4d8 Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 375
diff changeset
172 // Maybe check that the file is in our data directory
3be838c3e4d8 Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 375
diff changeset
173 QFile::remove(installedFileName);
3be838c3e4d8 Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 375
diff changeset
174 mSettings.remove("List/installed");
3be838c3e4d8 Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 375
diff changeset
175 mSettings.remove("List/installedDate");
3be838c3e4d8 Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 375
diff changeset
176 }
3be838c3e4d8 Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 375
diff changeset
177 } else {
3be838c3e4d8 Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 375
diff changeset
178 mSettings.remove("List/installed");
3be838c3e4d8 Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 375
diff changeset
179 mSettings.remove("List/installedDate");
3be838c3e4d8 Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 375
diff changeset
180 }
587
02a89710a7cd Split up list and software verification and use it
Andre Heinecke <aheinecke@intevation.de>
parents: 563
diff changeset
181 }
389
3be838c3e4d8 Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 375
diff changeset
182
587
02a89710a7cd Split up list and software verification and use it
Andre Heinecke <aheinecke@intevation.de>
parents: 563
diff changeset
183 void MainWindow::verifySWData()
02a89710a7cd Split up list and software verification and use it
Andre Heinecke <aheinecke@intevation.de>
parents: 563
diff changeset
184 {
02a89710a7cd Split up list and software verification and use it
Andre Heinecke <aheinecke@intevation.de>
parents: 563
diff changeset
185 QString swFileName = mSettings.value("Software/available").toString();
389
3be838c3e4d8 Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 375
diff changeset
186
591
26a18e3c3db4 Cleanups and coding style.
Andre Heinecke <aheinecke@intevation.de>
parents: 587
diff changeset
187 if (swFileName.isEmpty()) {
26a18e3c3db4 Cleanups and coding style.
Andre Heinecke <aheinecke@intevation.de>
parents: 587
diff changeset
188 mSettings.remove("Software/availableDate");
26a18e3c3db4 Cleanups and coding style.
Andre Heinecke <aheinecke@intevation.de>
parents: 587
diff changeset
189 return;
26a18e3c3db4 Cleanups and coding style.
Andre Heinecke <aheinecke@intevation.de>
parents: 587
diff changeset
190 }
26a18e3c3db4 Cleanups and coding style.
Andre Heinecke <aheinecke@intevation.de>
parents: 587
diff changeset
191
26a18e3c3db4 Cleanups and coding style.
Andre Heinecke <aheinecke@intevation.de>
parents: 587
diff changeset
192 QFileInfo fi(swFileName);
26a18e3c3db4 Cleanups and coding style.
Andre Heinecke <aheinecke@intevation.de>
parents: 587
diff changeset
193 if (!fi.exists()) {
16
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 11
diff changeset
194 mSettings.remove("Software/available");
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 11
diff changeset
195 mSettings.remove("Software/availableDate");
591
26a18e3c3db4 Cleanups and coding style.
Andre Heinecke <aheinecke@intevation.de>
parents: 587
diff changeset
196 qDebug() << "Software does not yet exist.";
26a18e3c3db4 Cleanups and coding style.
Andre Heinecke <aheinecke@intevation.de>
parents: 587
diff changeset
197 return;
26a18e3c3db4 Cleanups and coding style.
Andre Heinecke <aheinecke@intevation.de>
parents: 587
diff changeset
198 }
26a18e3c3db4 Cleanups and coding style.
Andre Heinecke <aheinecke@intevation.de>
parents: 587
diff changeset
199 if (!fi.isExecutable()) {
26a18e3c3db4 Cleanups and coding style.
Andre Heinecke <aheinecke@intevation.de>
parents: 587
diff changeset
200 qWarning() << "Downloaded file: " << swFileName << " is not executable.";
26a18e3c3db4 Cleanups and coding style.
Andre Heinecke <aheinecke@intevation.de>
parents: 587
diff changeset
201 QFile::remove(swFileName);
26a18e3c3db4 Cleanups and coding style.
Andre Heinecke <aheinecke@intevation.de>
parents: 587
diff changeset
202 mSettings.remove("Software/available");
26a18e3c3db4 Cleanups and coding style.
Andre Heinecke <aheinecke@intevation.de>
parents: 587
diff changeset
203 mSettings.remove("Software/availableDate");
26a18e3c3db4 Cleanups and coding style.
Andre Heinecke <aheinecke@intevation.de>
parents: 587
diff changeset
204 return;
26a18e3c3db4 Cleanups and coding style.
Andre Heinecke <aheinecke@intevation.de>
parents: 587
diff changeset
205 }
26a18e3c3db4 Cleanups and coding style.
Andre Heinecke <aheinecke@intevation.de>
parents: 587
diff changeset
206 bin_verify_result verifyResult = verify_binary(swFileName.toUtf8().constData(),
26a18e3c3db4 Cleanups and coding style.
Andre Heinecke <aheinecke@intevation.de>
parents: 587
diff changeset
207 swFileName.toUtf8().size());
26a18e3c3db4 Cleanups and coding style.
Andre Heinecke <aheinecke@intevation.de>
parents: 587
diff changeset
208 qDebug() << "Binary verify result: " << verifyResult;
26a18e3c3db4 Cleanups and coding style.
Andre Heinecke <aheinecke@intevation.de>
parents: 587
diff changeset
209 if (verifyResult != VerifyValid) {
26a18e3c3db4 Cleanups and coding style.
Andre Heinecke <aheinecke@intevation.de>
parents: 587
diff changeset
210 qDebug() << "Failed to verify downloaded data.";
26a18e3c3db4 Cleanups and coding style.
Andre Heinecke <aheinecke@intevation.de>
parents: 587
diff changeset
211 QFile::remove(swFileName);
26a18e3c3db4 Cleanups and coding style.
Andre Heinecke <aheinecke@intevation.de>
parents: 587
diff changeset
212 mSettings.remove("Software/available");
26a18e3c3db4 Cleanups and coding style.
Andre Heinecke <aheinecke@intevation.de>
parents: 587
diff changeset
213 mSettings.remove("Software/availableDate");
26a18e3c3db4 Cleanups and coding style.
Andre Heinecke <aheinecke@intevation.de>
parents: 587
diff changeset
214 return;
16
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 11
diff changeset
215 }
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 11
diff changeset
216 }
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 11
diff changeset
217
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 11
diff changeset
218 void MainWindow::handleNewList(const QString& fileName, const QDateTime& modDate) {
628
3a9c0f38bbad Made certificate lists member of mainwindow and added some temporary debug msgs.
Raimund Renkert <rrenkert@intevation.de>
parents: 584
diff changeset
219 qDebug() << "new list available";
71
f22a99f7cb69 Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents: 45
diff changeset
220 mSettings.setValue("List/available", fileName);
f22a99f7cb69 Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents: 45
diff changeset
221 mSettings.setValue("List/availableDate", modDate);
16
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 11
diff changeset
222
587
02a89710a7cd Split up list and software verification and use it
Andre Heinecke <aheinecke@intevation.de>
parents: 563
diff changeset
223 verifyListData();
71
f22a99f7cb69 Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents: 45
diff changeset
224 if (!mListToInstall.isValid()) {
f22a99f7cb69 Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents: 45
diff changeset
225 /* Downloader provided invalid files */
f22a99f7cb69 Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents: 45
diff changeset
226 /* TODO: Error count. Error handling. Otherwise
f22a99f7cb69 Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents: 45
diff changeset
227 * we can go into an endless loop here */
f22a99f7cb69 Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents: 45
diff changeset
228
f22a99f7cb69 Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents: 45
diff changeset
229 /* Retry the download again in 10 - 20 minutes */
f22a99f7cb69 Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents: 45
diff changeset
230 QTimer::singleShot(600000 + (qrand() % 60000), this, SLOT(checkUpdates()));
82
1f27d6db5ee3 Polarssl based certificate handling
Andre Heinecke <aheinecke@intevation.de>
parents: 72
diff changeset
231 } else {
1f27d6db5ee3 Polarssl based certificate handling
Andre Heinecke <aheinecke@intevation.de>
parents: 72
diff changeset
232 mCurMessage = tr("An updated certificate list is available. Click here to install.");
1f27d6db5ee3 Polarssl based certificate handling
Andre Heinecke <aheinecke@intevation.de>
parents: 72
diff changeset
233 setState(NewListAvailable);
1f27d6db5ee3 Polarssl based certificate handling
Andre Heinecke <aheinecke@intevation.de>
parents: 72
diff changeset
234 showMessage();
189
5f0d45ca9de4 Show certificates in the list view and details in the textfield.
Raimund Renkert <rrenkert@intevation.de>
parents: 187
diff changeset
235 loadCertificateList();
71
f22a99f7cb69 Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents: 45
diff changeset
236 }
16
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 11
diff changeset
237 }
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 11
diff changeset
238
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 11
diff changeset
239 void MainWindow::handleNewSW(const QString& fileName, const QDateTime& modDate) {
555
4cc378f335f5 Use native path to execute software update on windows
Andre Heinecke <aheinecke@intevation.de>
parents: 554
diff changeset
240 mCurMessage = tr("An update for %1 is available.\n"
551
15121735805e Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents: 548
diff changeset
241 "Click here to download and install the update.").arg(
16
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 11
diff changeset
242 QApplication::applicationName());
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 11
diff changeset
243 setState(NewSoftwareAvailable);
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 11
diff changeset
244 mSettings.setValue("Software/available", fileName);
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 11
diff changeset
245 mSettings.setValue("Software/availableDate", modDate);
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 11
diff changeset
246
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 11
diff changeset
247 mSettings.sync();
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 11
diff changeset
248 showMessage();
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 11
diff changeset
249 }
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 11
diff changeset
250
551
15121735805e Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents: 548
diff changeset
251 void MainWindow::installNewSW(const QString& fileName, const QDateTime& modDate) {
15121735805e Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents: 548
diff changeset
252 QFileInfo instProcInfo = QFileInfo(fileName);
563
aee3eb10bbba Add unit test for sw update execution and fix shell execute params
Andre Heinecke <aheinecke@intevation.de>
parents: 555
diff changeset
253 QString filePath = QDir::toNativeSeparators(instProcInfo.absoluteFilePath());
592
778f74d0706f Verify the binary directly without relying on settings (which might differ)
Andre Heinecke <aheinecke@intevation.de>
parents: 591
diff changeset
254
778f74d0706f Verify the binary directly without relying on settings (which might differ)
Andre Heinecke <aheinecke@intevation.de>
parents: 591
diff changeset
255 if (verify_binary(filePath.toUtf8().constData(),
778f74d0706f Verify the binary directly without relying on settings (which might differ)
Andre Heinecke <aheinecke@intevation.de>
parents: 591
diff changeset
256 filePath.toUtf8().size()) != VerifyValid) {
778f74d0706f Verify the binary directly without relying on settings (which might differ)
Andre Heinecke <aheinecke@intevation.de>
parents: 591
diff changeset
257 qDebug() << "Invalid software. Not installing";
551
15121735805e Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents: 548
diff changeset
258 return;
592
778f74d0706f Verify the binary directly without relying on settings (which might differ)
Andre Heinecke <aheinecke@intevation.de>
parents: 591
diff changeset
259 }
778f74d0706f Verify the binary directly without relying on settings (which might differ)
Andre Heinecke <aheinecke@intevation.de>
parents: 591
diff changeset
260 QFileInfo fi(QCoreApplication::applicationFilePath());
778f74d0706f Verify the binary directly without relying on settings (which might differ)
Andre Heinecke <aheinecke@intevation.de>
parents: 591
diff changeset
261 QDir installDir = fi.absoluteDir();
778f74d0706f Verify the binary directly without relying on settings (which might differ)
Andre Heinecke <aheinecke@intevation.de>
parents: 591
diff changeset
262
551
15121735805e Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents: 548
diff changeset
263 #ifdef WIN32
594
c944de9900de Add installation parameters with correct quoting
Andre Heinecke <aheinecke@intevation.de>
parents: 592
diff changeset
264 QString parameters = QString::fromLatin1("/S /UPDATE=1 /D=") +
c944de9900de Add installation parameters with correct quoting
Andre Heinecke <aheinecke@intevation.de>
parents: 592
diff changeset
265 installDir.path().replace("/", "\\") + "";
c944de9900de Add installation parameters with correct quoting
Andre Heinecke <aheinecke@intevation.de>
parents: 592
diff changeset
266
551
15121735805e Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents: 548
diff changeset
267 SHELLEXECUTEINFOW shExecInfo;
563
aee3eb10bbba Add unit test for sw update execution and fix shell execute params
Andre Heinecke <aheinecke@intevation.de>
parents: 555
diff changeset
268 memset (&shExecInfo, 0, sizeof(SHELLEXECUTEINFOW));
aee3eb10bbba Add unit test for sw update execution and fix shell execute params
Andre Heinecke <aheinecke@intevation.de>
parents: 555
diff changeset
269 shExecInfo.cbSize = sizeof(SHELLEXECUTEINFOW);
aee3eb10bbba Add unit test for sw update execution and fix shell execute params
Andre Heinecke <aheinecke@intevation.de>
parents: 555
diff changeset
270
aee3eb10bbba Add unit test for sw update execution and fix shell execute params
Andre Heinecke <aheinecke@intevation.de>
parents: 555
diff changeset
271 shExecInfo.lpFile = reinterpret_cast<LPCWSTR> (filePath.utf16());
594
c944de9900de Add installation parameters with correct quoting
Andre Heinecke <aheinecke@intevation.de>
parents: 592
diff changeset
272 shExecInfo.lpParameters = reinterpret_cast<LPCWSTR> (parameters.utf16());
563
aee3eb10bbba Add unit test for sw update execution and fix shell execute params
Andre Heinecke <aheinecke@intevation.de>
parents: 555
diff changeset
273
594
c944de9900de Add installation parameters with correct quoting
Andre Heinecke <aheinecke@intevation.de>
parents: 592
diff changeset
274 // shExecInfo.fMask = SEE_MASK_NOASYNC;
c944de9900de Add installation parameters with correct quoting
Andre Heinecke <aheinecke@intevation.de>
parents: 592
diff changeset
275 shExecInfo.nShow = SW_SHOWDEFAULT;
551
15121735805e Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents: 548
diff changeset
276
15121735805e Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents: 548
diff changeset
277 if (!is_admin()) {
15121735805e Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents: 548
diff changeset
278 shExecInfo.lpVerb = L"open";
15121735805e Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents: 548
diff changeset
279 } else {
15121735805e Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents: 548
diff changeset
280 shExecInfo.lpVerb = L"runas";
15121735805e Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents: 548
diff changeset
281 }
15121735805e Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents: 548
diff changeset
282
594
c944de9900de Add installation parameters with correct quoting
Andre Heinecke <aheinecke@intevation.de>
parents: 592
diff changeset
283 qDebug() << "Starting process: " << filePath
c944de9900de Add installation parameters with correct quoting
Andre Heinecke <aheinecke@intevation.de>
parents: 592
diff changeset
284 << " with arguments: " << parameters;
551
15121735805e Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents: 548
diff changeset
285
15121735805e Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents: 548
diff changeset
286 if (!ShellExecuteExW(&shExecInfo)) {
15121735805e Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents: 548
diff changeset
287 /* Execution failed, maybe the user aborted the UAC check? */
15121735805e Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents: 548
diff changeset
288 char* errmsg = getLastErrorMsg();
15121735805e Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents: 548
diff changeset
289 QString qerrmsg = QString::fromUtf8(errmsg);
15121735805e Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents: 548
diff changeset
290 free(errmsg);
15121735805e Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents: 548
diff changeset
291 qDebug() << "Failed to start process: " << qerrmsg;
15121735805e Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents: 548
diff changeset
292 setState(NewSoftwareAvailable);
15121735805e Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents: 548
diff changeset
293 return;
15121735805e Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents: 548
diff changeset
294 }
15121735805e Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents: 548
diff changeset
295 #else /* WIN32 */
594
c944de9900de Add installation parameters with correct quoting
Andre Heinecke <aheinecke@intevation.de>
parents: 592
diff changeset
296 QStringList parameters;
c944de9900de Add installation parameters with correct quoting
Andre Heinecke <aheinecke@intevation.de>
parents: 592
diff changeset
297 parameters << "/S" << "/UPDATE=1"
c944de9900de Add installation parameters with correct quoting
Andre Heinecke <aheinecke@intevation.de>
parents: 592
diff changeset
298 << QString::fromLatin1("/D=%1").arg(installDir.path());
551
15121735805e Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents: 548
diff changeset
299
594
c944de9900de Add installation parameters with correct quoting
Andre Heinecke <aheinecke@intevation.de>
parents: 592
diff changeset
300 qDebug() << "Starting process " << filePath << " args: " << parameters;
c944de9900de Add installation parameters with correct quoting
Andre Heinecke <aheinecke@intevation.de>
parents: 592
diff changeset
301
c944de9900de Add installation parameters with correct quoting
Andre Heinecke <aheinecke@intevation.de>
parents: 592
diff changeset
302 if (!QProcess::startDetached(filePath, parameters)) {
551
15121735805e Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents: 548
diff changeset
303 qDebug() << "Failed to start process.";
15121735805e Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents: 548
diff changeset
304 return;
15121735805e Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents: 548
diff changeset
305 }
15121735805e Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents: 548
diff changeset
306 #endif
15121735805e Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents: 548
diff changeset
307 /* Installer process should now be running. We exit */
15121735805e Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents: 548
diff changeset
308
15121735805e Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents: 548
diff changeset
309 closeApp();
15121735805e Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents: 548
diff changeset
310 }
15121735805e Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents: 548
diff changeset
311
461
1ce835c40eb7 Ask the user if software updates should be installed.
Raimund Renkert <rrenkert@intevation.de>
parents: 456
diff changeset
312 void MainWindow::checkUpdates(bool downloadSW)
16
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 11
diff changeset
313 {
587
02a89710a7cd Split up list and software verification and use it
Andre Heinecke <aheinecke@intevation.de>
parents: 563
diff changeset
314 verifyListData();
16
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 11
diff changeset
315
551
15121735805e Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents: 548
diff changeset
316 if (!mSettings.contains("Software/installedDate") ||
15121735805e Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents: 548
diff changeset
317 mSettings.value("Software/installedVersion").toString() != QApplication::applicationVersion()) {
15121735805e Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents: 548
diff changeset
318 /* This should only happen on initial startup and after an update has
15121735805e Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents: 548
diff changeset
319 * been installed */
15121735805e Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents: 548
diff changeset
320 getLastModForCurrentVersion();
486
fa56a9403939 Lookup the last modified date for software installer after first installation.
Raimund Renkert <rrenkert@intevation.de>
parents: 481
diff changeset
321 return;
fa56a9403939 Lookup the last modified date for software installer after first installation.
Raimund Renkert <rrenkert@intevation.de>
parents: 481
diff changeset
322 }
17
c12825a651ed Read out content-length and use this to skip existing files
Andre Heinecke <aheinecke@intevation.de>
parents: 16
diff changeset
323 QDateTime listInstalledLastMod = mSettings.value("List/installedDate").toDateTime();
c12825a651ed Read out content-length and use this to skip existing files
Andre Heinecke <aheinecke@intevation.de>
parents: 16
diff changeset
324 QDateTime swInstalledLastMod = mSettings.value("Software/installedDate").toDateTime();
16
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 11
diff changeset
325
389
3be838c3e4d8 Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 375
diff changeset
326 QString listResource = QString::fromLatin1(LIST_RESOURCE);
3be838c3e4d8 Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 375
diff changeset
327 QString swResource = QString::fromLatin1(SW_RESOURCE);
3be838c3e4d8 Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 375
diff changeset
328
3be838c3e4d8 Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 375
diff changeset
329 #ifndef RELEASE_BUILD
3be838c3e4d8 Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 375
diff changeset
330 /* Use this for testing to specify another file name for updates */
3be838c3e4d8 Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 375
diff changeset
331 listResource = mSettings.value("List/resource", listResource).toString();
3be838c3e4d8 Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 375
diff changeset
332 swResource = mSettings.value("Software/resource", swResource).toString();
3be838c3e4d8 Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 375
diff changeset
333 #endif
3be838c3e4d8 Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 375
diff changeset
334
3be838c3e4d8 Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 375
diff changeset
335
72
7e304573ebd1 Add some testing hacks for interactive testing
Andre Heinecke <aheinecke@intevation.de>
parents: 71
diff changeset
336 Downloader* downloader = new Downloader(this,
7e304573ebd1 Add some testing hacks for interactive testing
Andre Heinecke <aheinecke@intevation.de>
parents: 71
diff changeset
337 QString::fromLatin1(SERVER_URL),
7e304573ebd1 Add some testing hacks for interactive testing
Andre Heinecke <aheinecke@intevation.de>
parents: 71
diff changeset
338 QByteArray(),
551
15121735805e Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents: 548
diff changeset
339 swInstalledLastMod,
72
7e304573ebd1 Add some testing hacks for interactive testing
Andre Heinecke <aheinecke@intevation.de>
parents: 71
diff changeset
340 listInstalledLastMod,
437
4b486a14252f Acutally use the values that can be taken from the config
Andre Heinecke <aheinecke@intevation.de>
parents: 434
diff changeset
341 swResource,
461
1ce835c40eb7 Ask the user if software updates should be installed.
Raimund Renkert <rrenkert@intevation.de>
parents: 456
diff changeset
342 listResource,
1ce835c40eb7 Ask the user if software updates should be installed.
Raimund Renkert <rrenkert@intevation.de>
parents: 456
diff changeset
343 downloadSW);
17
c12825a651ed Read out content-length and use this to skip existing files
Andre Heinecke <aheinecke@intevation.de>
parents: 16
diff changeset
344
16
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 11
diff changeset
345 connect(downloader, SIGNAL(newListAvailable(const QString&, const QDateTime&)),
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 11
diff changeset
346 this, SLOT(handleNewList(const QString&, const QDateTime&)));
461
1ce835c40eb7 Ask the user if software updates should be installed.
Raimund Renkert <rrenkert@intevation.de>
parents: 456
diff changeset
347 if (!downloadSW) {
1ce835c40eb7 Ask the user if software updates should be installed.
Raimund Renkert <rrenkert@intevation.de>
parents: 456
diff changeset
348 connect(downloader, SIGNAL(newSoftwareAvailable(const QString&, const QDateTime&)),
551
15121735805e Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents: 548
diff changeset
349 this, SLOT(handleNewSW(const QString&, const QDateTime&)));
15121735805e Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents: 548
diff changeset
350 } else {
15121735805e Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents: 548
diff changeset
351 connect(downloader, SIGNAL(newSoftwareAvailable(const QString&, const QDateTime&)),
15121735805e Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents: 548
diff changeset
352 this, SLOT(installNewSW(const QString&, const QDateTime&)));
461
1ce835c40eb7 Ask the user if software updates should be installed.
Raimund Renkert <rrenkert@intevation.de>
parents: 456
diff changeset
353 }
551
15121735805e Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents: 548
diff changeset
354
16
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 11
diff changeset
355 connect(downloader, SIGNAL(finished()), downloader, SLOT(deleteLater()));
45
c6125d73faf4 Move SSLConnection into it's own class
Andre Heinecke <aheinecke@intevation.de>
parents: 31
diff changeset
356 connect(downloader, SIGNAL(error(const QString &, SSLConnection::ErrorCode)),
c6125d73faf4 Move SSLConnection into it's own class
Andre Heinecke <aheinecke@intevation.de>
parents: 31
diff changeset
357 this, SLOT(downloaderError(const QString &, SSLConnection::ErrorCode)));
10
fe39d93f1261 Start on Downloader component
Andre Heinecke <aheinecke@intevation.de>
parents: 7
diff changeset
358 downloader->start();
0
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
359 }
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
360
551
15121735805e Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents: 548
diff changeset
361 void MainWindow::getLastModForCurrentVersion()
486
fa56a9403939 Lookup the last modified date for software installer after first installation.
Raimund Renkert <rrenkert@intevation.de>
parents: 481
diff changeset
362 {
fa56a9403939 Lookup the last modified date for software installer after first installation.
Raimund Renkert <rrenkert@intevation.de>
parents: 481
diff changeset
363 QString softwareVersion = QString::fromLatin1(SW_RESOURCE_VERSION).arg(
fa56a9403939 Lookup the last modified date for software installer after first installation.
Raimund Renkert <rrenkert@intevation.de>
parents: 481
diff changeset
364 QApplication::applicationVersion());
fa56a9403939 Lookup the last modified date for software installer after first installation.
Raimund Renkert <rrenkert@intevation.de>
parents: 481
diff changeset
365 qDebug() << softwareVersion;
fa56a9403939 Lookup the last modified date for software installer after first installation.
Raimund Renkert <rrenkert@intevation.de>
parents: 481
diff changeset
366 QString listResource = QString::fromLatin1(LIST_RESOURCE);
fa56a9403939 Lookup the last modified date for software installer after first installation.
Raimund Renkert <rrenkert@intevation.de>
parents: 481
diff changeset
367 Downloader* downloader = new Downloader(this,
fa56a9403939 Lookup the last modified date for software installer after first installation.
Raimund Renkert <rrenkert@intevation.de>
parents: 481
diff changeset
368 QString::fromLatin1(SERVER_URL),
fa56a9403939 Lookup the last modified date for software installer after first installation.
Raimund Renkert <rrenkert@intevation.de>
parents: 481
diff changeset
369 QByteArray(),
fa56a9403939 Lookup the last modified date for software installer after first installation.
Raimund Renkert <rrenkert@intevation.de>
parents: 481
diff changeset
370 QDateTime::currentDateTime(),
fa56a9403939 Lookup the last modified date for software installer after first installation.
Raimund Renkert <rrenkert@intevation.de>
parents: 481
diff changeset
371 QDateTime::currentDateTime(),
fa56a9403939 Lookup the last modified date for software installer after first installation.
Raimund Renkert <rrenkert@intevation.de>
parents: 481
diff changeset
372 softwareVersion,
fa56a9403939 Lookup the last modified date for software installer after first installation.
Raimund Renkert <rrenkert@intevation.de>
parents: 481
diff changeset
373 listResource,
fa56a9403939 Lookup the last modified date for software installer after first installation.
Raimund Renkert <rrenkert@intevation.de>
parents: 481
diff changeset
374 false);
fa56a9403939 Lookup the last modified date for software installer after first installation.
Raimund Renkert <rrenkert@intevation.de>
parents: 481
diff changeset
375 connect(downloader, SIGNAL(finished()), downloader, SLOT(deleteLater()));
fa56a9403939 Lookup the last modified date for software installer after first installation.
Raimund Renkert <rrenkert@intevation.de>
parents: 481
diff changeset
376 connect(downloader, SIGNAL(error(const QString &, SSLConnection::ErrorCode)),
fa56a9403939 Lookup the last modified date for software installer after first installation.
Raimund Renkert <rrenkert@intevation.de>
parents: 481
diff changeset
377 this, SLOT(downloaderError(const QString &, SSLConnection::ErrorCode)));
fa56a9403939 Lookup the last modified date for software installer after first installation.
Raimund Renkert <rrenkert@intevation.de>
parents: 481
diff changeset
378 connect(downloader, SIGNAL(lastModifiedDate(const QDateTime&)),
551
15121735805e Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents: 548
diff changeset
379 this, SLOT(setLastModifiedSWDate(const QDateTime&)));
486
fa56a9403939 Lookup the last modified date for software installer after first installation.
Raimund Renkert <rrenkert@intevation.de>
parents: 481
diff changeset
380
fa56a9403939 Lookup the last modified date for software installer after first installation.
Raimund Renkert <rrenkert@intevation.de>
parents: 481
diff changeset
381 downloader->start();
fa56a9403939 Lookup the last modified date for software installer after first installation.
Raimund Renkert <rrenkert@intevation.de>
parents: 481
diff changeset
382 }
fa56a9403939 Lookup the last modified date for software installer after first installation.
Raimund Renkert <rrenkert@intevation.de>
parents: 481
diff changeset
383
551
15121735805e Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents: 548
diff changeset
384 void MainWindow::setLastModifiedSWDate(const QDateTime &date)
486
fa56a9403939 Lookup the last modified date for software installer after first installation.
Raimund Renkert <rrenkert@intevation.de>
parents: 481
diff changeset
385 {
fa56a9403939 Lookup the last modified date for software installer after first installation.
Raimund Renkert <rrenkert@intevation.de>
parents: 481
diff changeset
386 mSettings.beginGroup("Software");
fa56a9403939 Lookup the last modified date for software installer after first installation.
Raimund Renkert <rrenkert@intevation.de>
parents: 481
diff changeset
387 mSettings.setValue("installedDate", date);
551
15121735805e Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents: 548
diff changeset
388 mSettings.setValue("installedVersion", QApplication::applicationVersion());
486
fa56a9403939 Lookup the last modified date for software installer after first installation.
Raimund Renkert <rrenkert@intevation.de>
parents: 481
diff changeset
389 mSettings.endGroup();
fa56a9403939 Lookup the last modified date for software installer after first installation.
Raimund Renkert <rrenkert@intevation.de>
parents: 481
diff changeset
390 checkUpdates();
fa56a9403939 Lookup the last modified date for software installer after first installation.
Raimund Renkert <rrenkert@intevation.de>
parents: 481
diff changeset
391 }
fa56a9403939 Lookup the last modified date for software installer after first installation.
Raimund Renkert <rrenkert@intevation.de>
parents: 481
diff changeset
392
45
c6125d73faf4 Move SSLConnection into it's own class
Andre Heinecke <aheinecke@intevation.de>
parents: 31
diff changeset
393 void MainWindow::downloaderError(const QString &message, SSLConnection::ErrorCode error)
16
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 11
diff changeset
394 {
551
15121735805e Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents: 548
diff changeset
395 /* TODO logging and handle error according to a plan */
16
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 11
diff changeset
396 mCurMessage = message;
27
62cd56cea09b Start on polarssl Downloader.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 19
diff changeset
397 showMessage();
551
15121735805e Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents: 548
diff changeset
398 setState(TransferError);
16
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 11
diff changeset
399 }
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 11
diff changeset
400
0
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
401 void MainWindow::createActions()
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
402 {
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
403 mCheckUpdates = new QAction(tr("Check for Updates"), this);
16
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 11
diff changeset
404 connect(mCheckUpdates, SIGNAL(triggered()), this, SLOT(checkUpdates()));
2
cf88cc432b9d Add quit action
Andre Heinecke <aheinecke@intevation.de>
parents: 0
diff changeset
405 mQuitAction = new QAction(tr("Quit"), this);
cf88cc432b9d Add quit action
Andre Heinecke <aheinecke@intevation.de>
parents: 0
diff changeset
406 connect(mQuitAction, SIGNAL(triggered()), qApp, SLOT(quit()));
0
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
407 }
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
408
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
409 void MainWindow::createTrayIcon()
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
410 {
11
7e2f14c7aba2 Split up downloader component and further implement it
Andre Heinecke <aheinecke@intevation.de>
parents: 10
diff changeset
411 QIcon trayImg(":/img/tray_22.png");
0
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
412
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
413 mTrayMenu = new QMenu(this);
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
414 mTrayMenu->addAction(mCheckUpdates);
2
cf88cc432b9d Add quit action
Andre Heinecke <aheinecke@intevation.de>
parents: 0
diff changeset
415 mTrayMenu->addAction(mQuitAction);
0
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
416
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
417 mTrayIcon = new QSystemTrayIcon(this);
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
418 mTrayIcon->setContextMenu(mTrayMenu);
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
419
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
420 mTrayIcon->setIcon(trayImg);
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
421 setWindowIcon(trayImg);
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
422 mTrayIcon->show();
407
af53c40e74b1 Rename m13ui to TrustBridge
Andre Heinecke <aheinecke@intevation.de>
parents: 404
diff changeset
423 mTrayIcon->setToolTip(tr("TrustBridge"));
71
f22a99f7cb69 Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents: 45
diff changeset
424
f22a99f7cb69 Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents: 45
diff changeset
425 connect(mTrayIcon, SIGNAL(messageClicked()), this, SLOT(messageClicked()));
0
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
426 }
155
c0fdb8d336cf Added menubar/menu and method stubs to mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents: 82
diff changeset
427
187
0c06a608e15f Create the mainwindow content.
Raimund Renkert <rrenkert@intevation.de>
parents: 155
diff changeset
428 void MainWindow::createContent()
0c06a608e15f Create the mainwindow content.
Raimund Renkert <rrenkert@intevation.de>
parents: 155
diff changeset
429 {
0c06a608e15f Create the mainwindow content.
Raimund Renkert <rrenkert@intevation.de>
parents: 155
diff changeset
430 // Create a central widget containing the main layout.
0c06a608e15f Create the mainwindow content.
Raimund Renkert <rrenkert@intevation.de>
parents: 155
diff changeset
431 QWidget *base = new QWidget;
0c06a608e15f Create the mainwindow content.
Raimund Renkert <rrenkert@intevation.de>
parents: 155
diff changeset
432
250
1e112cf41e92 Updated the mainwindow layout.
Raimund Renkert <rrenkert@intevation.de>
parents: 249
diff changeset
433 // Layouts and Container
584
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
434 QVBoxLayout *mainLayout = new QVBoxLayout;
205
a3f542bf38f7 Added header for mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents: 200
diff changeset
435 QHBoxLayout *headerLayout = new QHBoxLayout;
a3f542bf38f7 Added header for mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents: 200
diff changeset
436 QVBoxLayout *headerTextLayout = new QVBoxLayout;
584
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
437 QHBoxLayout *centerLayout = new QHBoxLayout;
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
438 QVBoxLayout *buttonBarLayout = new QVBoxLayout;
271
1ae15ea73850 Some GUI desing and layout changes.
Raimund Renkert <rrenkert@intevation.de>
parents: 267
diff changeset
439 QHBoxLayout *bottomLayout = new QHBoxLayout;
584
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
440 QHBoxLayout *containerLayout = new QHBoxLayout;
187
0c06a608e15f Create the mainwindow content.
Raimund Renkert <rrenkert@intevation.de>
parents: 155
diff changeset
441
584
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
442 // The header (icon, about text)
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
443 QImage *logoImage = new QImage(":/img/logo.png");
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
444 QLabel *logo = new QLabel;
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
445 logo->setBackgroundRole(QPalette::Base);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
446 logo->setPixmap(QPixmap::fromImage(*logoImage));
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
447 QLabel *title = new QLabel("<h1>" + QString::fromLatin1(APPNAME) + "</h1>");
689
6df31cb47d54 Updated translations.
Emanuel Schuetze <emanuel@intevation.de>
parents: 687
diff changeset
448 QLabel *subTitle = new QLabel(tr("Trust in your digital communication"));
584
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
449 headerTextLayout->addWidget(title);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
450 headerTextLayout->addWidget(subTitle);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
451 headerLayout->addWidget(logo);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
452 headerLayout->addLayout(headerTextLayout);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
453 headerLayout->setStretch(0, 0);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
454 headerLayout->setStretch(1, 10);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
455
652
f65503c1833b Updated mainwindow layout and removed obsolete code.
Raimund Renkert <rrenkert@intevation.de>
parents: 643
diff changeset
456 /***********************************
f65503c1833b Updated mainwindow layout and removed obsolete code.
Raimund Renkert <rrenkert@intevation.de>
parents: 643
diff changeset
457 * The Buttonbar on the left side.
f65503c1833b Updated mainwindow layout and removed obsolete code.
Raimund Renkert <rrenkert@intevation.de>
parents: 643
diff changeset
458 ***********************************/
584
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
459 mButtonGroup = new QButtonGroup;
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
460
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
461 QToolButton *updatesButton = new QToolButton;
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
462 updatesButton->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
463 updatesButton->setIcon(QIcon(":/img/view-refresh.png"));
673
e8bc1215904e (UI) Changed some icons.
Emanuel Schuetze <emanuel@intevation.de>
parents: 669
diff changeset
464 updatesButton->setIconSize(QSize(40, 40));
696
55f78c4166fb (Issue32) Change Updates to Changes and track changes.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 694
diff changeset
465 updatesButton->setText(tr("Changes"));
663
b00c26fbc695 (UI) linebreak and bigger buttons for German translations.
Emanuel Schuetze <emanuel@intevation.de>
parents: 661
diff changeset
466 updatesButton->setFixedWidth(120);
673
e8bc1215904e (UI) Changed some icons.
Emanuel Schuetze <emanuel@intevation.de>
parents: 669
diff changeset
467 updatesButton->setFixedHeight(80);
584
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
468 updatesButton->setCheckable(true);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
469 updatesButton->setChecked(true);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
470
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
471 QToolButton *allInstallButton = new QToolButton;
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
472 allInstallButton->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
473 allInstallButton->setIcon(QIcon(":/img/document-encrypt.png"));
673
e8bc1215904e (UI) Changed some icons.
Emanuel Schuetze <emanuel@intevation.de>
parents: 669
diff changeset
474 allInstallButton->setIconSize(QSize(40, 40));
659
c7405d526ead (UI) Updated English strings.
Emanuel Schuetze <emanuel@intevation.de>
parents: 657
diff changeset
475 allInstallButton->setText(tr("Trusted\ncertificates"));
663
b00c26fbc695 (UI) linebreak and bigger buttons for German translations.
Emanuel Schuetze <emanuel@intevation.de>
parents: 661
diff changeset
476 allInstallButton->setFixedWidth(120);
673
e8bc1215904e (UI) Changed some icons.
Emanuel Schuetze <emanuel@intevation.de>
parents: 669
diff changeset
477 allInstallButton->setFixedHeight(80);
584
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
478 allInstallButton->setCheckable(true);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
479
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
480 QToolButton *allRemoveButton = new QToolButton;
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
481 allRemoveButton->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
673
e8bc1215904e (UI) Changed some icons.
Emanuel Schuetze <emanuel@intevation.de>
parents: 669
diff changeset
482 allRemoveButton->setIcon(QIcon(":/img/dialog-warning.png"));
e8bc1215904e (UI) Changed some icons.
Emanuel Schuetze <emanuel@intevation.de>
parents: 669
diff changeset
483 allRemoveButton->setIconSize(QSize(40, 40));
661
320a64d58e62 (UI) Updated English strings. Removed Issuer fields.
Emanuel Schuetze <emanuel@intevation.de>
parents: 659
diff changeset
484 allRemoveButton->setText(tr("Revoked\ncertificates"));
663
b00c26fbc695 (UI) linebreak and bigger buttons for German translations.
Emanuel Schuetze <emanuel@intevation.de>
parents: 661
diff changeset
485 allRemoveButton->setFixedWidth(120);
673
e8bc1215904e (UI) Changed some icons.
Emanuel Schuetze <emanuel@intevation.de>
parents: 669
diff changeset
486 allRemoveButton->setFixedHeight(80);
584
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
487 allRemoveButton->setCheckable(true);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
488
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
489 QToolButton *infoButton = new QToolButton;
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
490 infoButton->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
491 infoButton->setIcon(QIcon(":/img/dialog-information.png"));
673
e8bc1215904e (UI) Changed some icons.
Emanuel Schuetze <emanuel@intevation.de>
parents: 669
diff changeset
492 infoButton->setIconSize(QSize(40, 40));
659
c7405d526ead (UI) Updated English strings.
Emanuel Schuetze <emanuel@intevation.de>
parents: 657
diff changeset
493 infoButton->setText(tr("Information\nand help"));
663
b00c26fbc695 (UI) linebreak and bigger buttons for German translations.
Emanuel Schuetze <emanuel@intevation.de>
parents: 661
diff changeset
494 infoButton->setFixedWidth(120);
673
e8bc1215904e (UI) Changed some icons.
Emanuel Schuetze <emanuel@intevation.de>
parents: 669
diff changeset
495 infoButton->setFixedHeight(80);
584
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
496 infoButton->setCheckable(true);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
497
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
498 mButtonGroup->addButton(updatesButton);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
499 mButtonGroup->addButton(allInstallButton);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
500 mButtonGroup->addButton(allRemoveButton);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
501 mButtonGroup->addButton(infoButton);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
502 mButtonGroup->setId(updatesButton, 0);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
503 mButtonGroup->setId(allInstallButton, 1);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
504 mButtonGroup->setId(allRemoveButton, 2);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
505 mButtonGroup->setId(infoButton, 3);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
506
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
507 connect(mButtonGroup, SIGNAL(buttonClicked(int)),
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
508 this, SLOT(togglePages(int)));
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
509 buttonBarLayout->addWidget(updatesButton);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
510 buttonBarLayout->addWidget(allInstallButton);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
511 buttonBarLayout->addWidget(allRemoveButton);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
512 buttonBarLayout->insertStretch(3, 10);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
513 buttonBarLayout->addWidget(infoButton);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
514
652
f65503c1833b Updated mainwindow layout and removed obsolete code.
Raimund Renkert <rrenkert@intevation.de>
parents: 643
diff changeset
515 /********************************
f65503c1833b Updated mainwindow layout and removed obsolete code.
Raimund Renkert <rrenkert@intevation.de>
parents: 643
diff changeset
516 * The main pages.
f65503c1833b Updated mainwindow layout and removed obsolete code.
Raimund Renkert <rrenkert@intevation.de>
parents: 643
diff changeset
517 ********************************/
f65503c1833b Updated mainwindow layout and removed obsolete code.
Raimund Renkert <rrenkert@intevation.de>
parents: 643
diff changeset
518
f65503c1833b Updated mainwindow layout and removed obsolete code.
Raimund Renkert <rrenkert@intevation.de>
parents: 643
diff changeset
519 /********************************
f65503c1833b Updated mainwindow layout and removed obsolete code.
Raimund Renkert <rrenkert@intevation.de>
parents: 643
diff changeset
520 * The updates page.
f65503c1833b Updated mainwindow layout and removed obsolete code.
Raimund Renkert <rrenkert@intevation.de>
parents: 643
diff changeset
521 ********************************/
f65503c1833b Updated mainwindow layout and removed obsolete code.
Raimund Renkert <rrenkert@intevation.de>
parents: 643
diff changeset
522 QVBoxLayout *updatesMainLayout = new QVBoxLayout;
584
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
523 mUpdatesPanel = new QScrollArea;
652
f65503c1833b Updated mainwindow layout and removed obsolete code.
Raimund Renkert <rrenkert@intevation.de>
parents: 643
diff changeset
524 QScrollArea *updatesContent = new QScrollArea;
f65503c1833b Updated mainwindow layout and removed obsolete code.
Raimund Renkert <rrenkert@intevation.de>
parents: 643
diff changeset
525 // updatesContent->setFrameShape(QFrame::NoFrame);
584
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
526 mUpdatesWidget = new QWidget;
652
f65503c1833b Updated mainwindow layout and removed obsolete code.
Raimund Renkert <rrenkert@intevation.de>
parents: 643
diff changeset
527
f65503c1833b Updated mainwindow layout and removed obsolete code.
Raimund Renkert <rrenkert@intevation.de>
parents: 643
diff changeset
528 /* The updates header */
584
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
529 QHBoxLayout *updatesHeaderLayout = new QHBoxLayout;
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
530 QVBoxLayout *updatesHeaderTextLayout = new QVBoxLayout;
652
f65503c1833b Updated mainwindow layout and removed obsolete code.
Raimund Renkert <rrenkert@intevation.de>
parents: 643
diff changeset
531 QVBoxLayout *updatesHeaderButtonLayout = new QVBoxLayout;
f65503c1833b Updated mainwindow layout and removed obsolete code.
Raimund Renkert <rrenkert@intevation.de>
parents: 643
diff changeset
532 QHBoxLayout *updatesHeaderActionLayout = new QHBoxLayout;
f65503c1833b Updated mainwindow layout and removed obsolete code.
Raimund Renkert <rrenkert@intevation.de>
parents: 643
diff changeset
533 QHBoxLayout *updatesHeaderSearchLayout = new QHBoxLayout;
584
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
534
628
3a9c0f38bbad Made certificate lists member of mainwindow and added some temporary debug msgs.
Raimund Renkert <rrenkert@intevation.de>
parents: 584
diff changeset
535 mUpdatesHeader =
696
55f78c4166fb (Issue32) Change Updates to Changes and track changes.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 694
diff changeset
536 new QLabel("<h2>" + tr("Certificates unchanged")+ "</h2>");
628
3a9c0f38bbad Made certificate lists member of mainwindow and added some temporary debug msgs.
Raimund Renkert <rrenkert@intevation.de>
parents: 584
diff changeset
537 mLastCertUpdate =
659
c7405d526ead (UI) Updated English strings.
Emanuel Schuetze <emanuel@intevation.de>
parents: 657
diff changeset
538 new QLabel(tr("Last update of certificates: %1").arg(""));
628
3a9c0f38bbad Made certificate lists member of mainwindow and added some temporary debug msgs.
Raimund Renkert <rrenkert@intevation.de>
parents: 584
diff changeset
539 mLastSWupdate =
659
c7405d526ead (UI) Updated English strings.
Emanuel Schuetze <emanuel@intevation.de>
parents: 657
diff changeset
540 new QLabel(tr("Last update of TrustBridge: %1").arg(""));
652
f65503c1833b Updated mainwindow layout and removed obsolete code.
Raimund Renkert <rrenkert@intevation.de>
parents: 643
diff changeset
541 QLabel *updatesTip =
659
c7405d526ead (UI) Updated English strings.
Emanuel Schuetze <emanuel@intevation.de>
parents: 657
diff changeset
542 new QLabel(tr("You should apply the following changes to your root certificates:"));
696
55f78c4166fb (Issue32) Change Updates to Changes and track changes.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 694
diff changeset
543 updatesTip->setWordWrap(true);
652
f65503c1833b Updated mainwindow layout and removed obsolete code.
Raimund Renkert <rrenkert@intevation.de>
parents: 643
diff changeset
544
628
3a9c0f38bbad Made certificate lists member of mainwindow and added some temporary debug msgs.
Raimund Renkert <rrenkert@intevation.de>
parents: 584
diff changeset
545 updatesHeaderTextLayout->addWidget(mUpdatesHeader);
3a9c0f38bbad Made certificate lists member of mainwindow and added some temporary debug msgs.
Raimund Renkert <rrenkert@intevation.de>
parents: 584
diff changeset
546 updatesHeaderTextLayout->addWidget(mLastCertUpdate);
3a9c0f38bbad Made certificate lists member of mainwindow and added some temporary debug msgs.
Raimund Renkert <rrenkert@intevation.de>
parents: 584
diff changeset
547 updatesHeaderTextLayout->addWidget(mLastSWupdate);
652
f65503c1833b Updated mainwindow layout and removed obsolete code.
Raimund Renkert <rrenkert@intevation.de>
parents: 643
diff changeset
548 updatesHeaderTextLayout->addSpacing(10);
f65503c1833b Updated mainwindow layout and removed obsolete code.
Raimund Renkert <rrenkert@intevation.de>
parents: 643
diff changeset
549 updatesHeaderTextLayout->addWidget(updatesTip);
584
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
550
659
c7405d526ead (UI) Updated English strings.
Emanuel Schuetze <emanuel@intevation.de>
parents: 657
diff changeset
551 QPushButton *searchUpdates = new QPushButton(tr("Check for updates"));
673
e8bc1215904e (UI) Changed some icons.
Emanuel Schuetze <emanuel@intevation.de>
parents: 669
diff changeset
552 searchUpdates->setIcon(QIcon(":/img/edit-find.png"));
693
0fc1a20adaff (Issue 27) Change Quit button text depending on changes or no changes.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 692
diff changeset
553 mQuitButton = new QPushButton(tr("Quit without saving"));
0fc1a20adaff (Issue 27) Change Quit button text depending on changes or no changes.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 692
diff changeset
554 mQuitButton->setIcon(QIcon(":/img/application-exit.png"));
696
55f78c4166fb (Issue32) Change Updates to Changes and track changes.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 694
diff changeset
555 QPushButton *installButton = new QPushButton(tr("Apply changes"));
652
f65503c1833b Updated mainwindow layout and removed obsolete code.
Raimund Renkert <rrenkert@intevation.de>
parents: 643
diff changeset
556 #ifdef Q_OS_WIN
f65503c1833b Updated mainwindow layout and removed obsolete code.
Raimund Renkert <rrenkert@intevation.de>
parents: 643
diff changeset
557 if (is_admin()) {
f65503c1833b Updated mainwindow layout and removed obsolete code.
Raimund Renkert <rrenkert@intevation.de>
parents: 643
diff changeset
558 QIcon uacShield = QApplication::style()->standardIcon(QStyle::SP_VistaShield);
f65503c1833b Updated mainwindow layout and removed obsolete code.
Raimund Renkert <rrenkert@intevation.de>
parents: 643
diff changeset
559 installButton->setIcon(uacShield);
f65503c1833b Updated mainwindow layout and removed obsolete code.
Raimund Renkert <rrenkert@intevation.de>
parents: 643
diff changeset
560 }
f65503c1833b Updated mainwindow layout and removed obsolete code.
Raimund Renkert <rrenkert@intevation.de>
parents: 643
diff changeset
561 #else
673
e8bc1215904e (UI) Changed some icons.
Emanuel Schuetze <emanuel@intevation.de>
parents: 669
diff changeset
562 installButton->setIcon(QIcon(":/img/view-refresh.png"));
652
f65503c1833b Updated mainwindow layout and removed obsolete code.
Raimund Renkert <rrenkert@intevation.de>
parents: 643
diff changeset
563 #endif
693
0fc1a20adaff (Issue 27) Change Quit button text depending on changes or no changes.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 692
diff changeset
564 connect(mQuitButton, SIGNAL(clicked()), this, SLOT(closeApp()));
654
129e611eaf50 Merge branch trustbridge-refactor
Andre Heinecke <andre.heinecke@intevation.de>
parents: 609 653
diff changeset
565 connect(installButton, SIGNAL(clicked()), this, SLOT(checkAndInstallCerts()));
628
3a9c0f38bbad Made certificate lists member of mainwindow and added some temporary debug msgs.
Raimund Renkert <rrenkert@intevation.de>
parents: 584
diff changeset
566 connect(searchUpdates, SIGNAL(clicked()), this, SLOT(checkUpdates()));
652
f65503c1833b Updated mainwindow layout and removed obsolete code.
Raimund Renkert <rrenkert@intevation.de>
parents: 643
diff changeset
567
f65503c1833b Updated mainwindow layout and removed obsolete code.
Raimund Renkert <rrenkert@intevation.de>
parents: 643
diff changeset
568 updatesHeaderActionLayout->addWidget(installButton);
693
0fc1a20adaff (Issue 27) Change Quit button text depending on changes or no changes.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 692
diff changeset
569 updatesHeaderActionLayout->addWidget(mQuitButton);
652
f65503c1833b Updated mainwindow layout and removed obsolete code.
Raimund Renkert <rrenkert@intevation.de>
parents: 643
diff changeset
570 updatesHeaderSearchLayout->insertStretch(0, 1);
f65503c1833b Updated mainwindow layout and removed obsolete code.
Raimund Renkert <rrenkert@intevation.de>
parents: 643
diff changeset
571 updatesHeaderSearchLayout->addWidget(searchUpdates);
f65503c1833b Updated mainwindow layout and removed obsolete code.
Raimund Renkert <rrenkert@intevation.de>
parents: 643
diff changeset
572
f65503c1833b Updated mainwindow layout and removed obsolete code.
Raimund Renkert <rrenkert@intevation.de>
parents: 643
diff changeset
573 updatesHeaderButtonLayout->addLayout(updatesHeaderSearchLayout);
f65503c1833b Updated mainwindow layout and removed obsolete code.
Raimund Renkert <rrenkert@intevation.de>
parents: 643
diff changeset
574 updatesHeaderButtonLayout->addLayout(updatesHeaderActionLayout);
f65503c1833b Updated mainwindow layout and removed obsolete code.
Raimund Renkert <rrenkert@intevation.de>
parents: 643
diff changeset
575
584
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
576 updatesHeaderLayout->addLayout(updatesHeaderTextLayout);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
577 updatesHeaderLayout->insertStretch(1, 10);
652
f65503c1833b Updated mainwindow layout and removed obsolete code.
Raimund Renkert <rrenkert@intevation.de>
parents: 643
diff changeset
578 updatesHeaderLayout->addLayout(updatesHeaderButtonLayout);
584
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
579
652
f65503c1833b Updated mainwindow layout and removed obsolete code.
Raimund Renkert <rrenkert@intevation.de>
parents: 643
diff changeset
580 /* The central panels. */
584
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
581 QVBoxLayout *updatesCenterLayout = new QVBoxLayout;
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
582 QHBoxLayout *updatesNewLayout = new QHBoxLayout;
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
583 QHBoxLayout *updatesRemoveLayout = new QHBoxLayout;
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
584 QHBoxLayout *updatesManualLayout = new QHBoxLayout;
628
3a9c0f38bbad Made certificate lists member of mainwindow and added some temporary debug msgs.
Raimund Renkert <rrenkert@intevation.de>
parents: 584
diff changeset
585 mUpdatesNewCertificates =
584
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
586 new QLabel("<h3>" +
659
c7405d526ead (UI) Updated English strings.
Emanuel Schuetze <emanuel@intevation.de>
parents: 657
diff changeset
587 tr("Install new trusted certificates (%1/%2)").arg(0).arg(0) +
584
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
588 "</h3>");
659
c7405d526ead (UI) Updated English strings.
Emanuel Schuetze <emanuel@intevation.de>
parents: 657
diff changeset
589 mUpdatesDetailsNew = new QPushButton(tr("Show details"));
652
f65503c1833b Updated mainwindow layout and removed obsolete code.
Raimund Renkert <rrenkert@intevation.de>
parents: 643
diff changeset
590 connect(mUpdatesDetailsNew,
584
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
591 SIGNAL(clicked()),
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
592 this,
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
593 SLOT(toggleUpdatesNew()));
628
3a9c0f38bbad Made certificate lists member of mainwindow and added some temporary debug msgs.
Raimund Renkert <rrenkert@intevation.de>
parents: 584
diff changeset
594 updatesNewLayout->addWidget(mUpdatesNewCertificates);
652
f65503c1833b Updated mainwindow layout and removed obsolete code.
Raimund Renkert <rrenkert@intevation.de>
parents: 643
diff changeset
595 updatesNewLayout->addWidget(mUpdatesDetailsNew);
584
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
596 updatesNewLayout->insertStretch(2, 10);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
597 mUpdatesNew = new CertificateListWidget(this);
628
3a9c0f38bbad Made certificate lists member of mainwindow and added some temporary debug msgs.
Raimund Renkert <rrenkert@intevation.de>
parents: 584
diff changeset
598 connect(mUpdatesNew, SIGNAL(certListChanged(int)),
3a9c0f38bbad Made certificate lists member of mainwindow and added some temporary debug msgs.
Raimund Renkert <rrenkert@intevation.de>
parents: 584
diff changeset
599 this, SLOT(listChanged(int)));
584
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
600 mUpdatesNew->hide();
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
601
628
3a9c0f38bbad Made certificate lists member of mainwindow and added some temporary debug msgs.
Raimund Renkert <rrenkert@intevation.de>
parents: 584
diff changeset
602 mUpdatesRemoveCertificates =
584
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
603 new QLabel("<h3>" +
661
320a64d58e62 (UI) Updated English strings. Removed Issuer fields.
Emanuel Schuetze <emanuel@intevation.de>
parents: 659
diff changeset
604 tr("Remove revoked certificates (%1/%2)").arg(0).arg(0) +
584
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
605 "</h3>");
659
c7405d526ead (UI) Updated English strings.
Emanuel Schuetze <emanuel@intevation.de>
parents: 657
diff changeset
606 mUpdatesDetailsRemove = new QPushButton(tr("Show details"));
652
f65503c1833b Updated mainwindow layout and removed obsolete code.
Raimund Renkert <rrenkert@intevation.de>
parents: 643
diff changeset
607 connect(mUpdatesDetailsRemove,
584
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
608 SIGNAL(clicked()),
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
609 this,
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
610 SLOT(toggleUpdatesRemove()));
628
3a9c0f38bbad Made certificate lists member of mainwindow and added some temporary debug msgs.
Raimund Renkert <rrenkert@intevation.de>
parents: 584
diff changeset
611 updatesRemoveLayout->addWidget(mUpdatesRemoveCertificates);
652
f65503c1833b Updated mainwindow layout and removed obsolete code.
Raimund Renkert <rrenkert@intevation.de>
parents: 643
diff changeset
612 updatesRemoveLayout->addWidget(mUpdatesDetailsRemove);
584
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
613 updatesRemoveLayout->insertStretch(2, 10);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
614 mUpdatesRemove = new CertificateListWidget(this);
642
dd738ef17715 Update the 'remove untrusted' header on list selection change.
Raimund Renkert <rrenkert@intevation.de>
parents: 641
diff changeset
615 connect(mUpdatesRemove, SIGNAL(certListChanged(int)),
dd738ef17715 Update the 'remove untrusted' header on list selection change.
Raimund Renkert <rrenkert@intevation.de>
parents: 641
diff changeset
616 this, SLOT(listChanged(int)));
584
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
617 mUpdatesRemove->hide();
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
618
628
3a9c0f38bbad Made certificate lists member of mainwindow and added some temporary debug msgs.
Raimund Renkert <rrenkert@intevation.de>
parents: 584
diff changeset
619 mUpdatesManualCertificates =
584
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
620 new QLabel("<h3>" +
659
c7405d526ead (UI) Updated English strings.
Emanuel Schuetze <emanuel@intevation.de>
parents: 657
diff changeset
621 tr("Manually changed certificates (%1)").arg(0) +
584
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
622 "</h3>");
659
c7405d526ead (UI) Updated English strings.
Emanuel Schuetze <emanuel@intevation.de>
parents: 657
diff changeset
623 mUpdatesDetailsManual = new QPushButton(tr("Show details"));
652
f65503c1833b Updated mainwindow layout and removed obsolete code.
Raimund Renkert <rrenkert@intevation.de>
parents: 643
diff changeset
624 connect(mUpdatesDetailsManual,
584
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
625 SIGNAL(clicked()),
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
626 this,
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
627 SLOT(toggleUpdatesManual()));
628
3a9c0f38bbad Made certificate lists member of mainwindow and added some temporary debug msgs.
Raimund Renkert <rrenkert@intevation.de>
parents: 584
diff changeset
628 updatesManualLayout->addWidget(mUpdatesManualCertificates);
652
f65503c1833b Updated mainwindow layout and removed obsolete code.
Raimund Renkert <rrenkert@intevation.de>
parents: 643
diff changeset
629 updatesManualLayout->addWidget(mUpdatesDetailsManual);
584
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
630 updatesManualLayout->insertStretch(2, 10);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
631 mUpdatesManual = new CertificateListWidget(this);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
632 mUpdatesManual->hide();
640
626507197360 Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents: 628
diff changeset
633 connect(mUpdatesManual, SIGNAL(certChanged(bool, const Certificate&)),
626507197360 Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents: 628
diff changeset
634 this, SLOT(removeFromManual(bool, const Certificate&)));
692
3791a277f00b Remove code duplication and calculate headers only in listchanged
Andre Heinecke <andre.heinecke@intevation.de>
parents: 691
diff changeset
635 connect(mUpdatesManual, SIGNAL(certListChanged(int)),
3791a277f00b Remove code duplication and calculate headers only in listchanged
Andre Heinecke <andre.heinecke@intevation.de>
parents: 691
diff changeset
636 this, SLOT(listChanged(int)));
584
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
637
640
626507197360 Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents: 628
diff changeset
638 updatesNewLayout->setAlignment(Qt::AlignTop);
626507197360 Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents: 628
diff changeset
639 updatesRemoveLayout->setAlignment(Qt::AlignTop);
626507197360 Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents: 628
diff changeset
640 updatesManualLayout->setAlignment(Qt::AlignTop);
626507197360 Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents: 628
diff changeset
641 updatesCenterLayout->addLayout(updatesNewLayout);
652
f65503c1833b Updated mainwindow layout and removed obsolete code.
Raimund Renkert <rrenkert@intevation.de>
parents: 643
diff changeset
642 updatesCenterLayout->addWidget(mUpdatesNew);
640
626507197360 Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents: 628
diff changeset
643 updatesCenterLayout->addLayout(updatesRemoveLayout);
652
f65503c1833b Updated mainwindow layout and removed obsolete code.
Raimund Renkert <rrenkert@intevation.de>
parents: 643
diff changeset
644 updatesCenterLayout->addWidget(mUpdatesRemove);
640
626507197360 Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents: 628
diff changeset
645 updatesCenterLayout->addLayout(updatesManualLayout);
652
f65503c1833b Updated mainwindow layout and removed obsolete code.
Raimund Renkert <rrenkert@intevation.de>
parents: 643
diff changeset
646 updatesCenterLayout->addWidget(mUpdatesManual);
f65503c1833b Updated mainwindow layout and removed obsolete code.
Raimund Renkert <rrenkert@intevation.de>
parents: 643
diff changeset
647 updatesCenterLayout->addStretch(1);
584
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
648
652
f65503c1833b Updated mainwindow layout and removed obsolete code.
Raimund Renkert <rrenkert@intevation.de>
parents: 643
diff changeset
649 updatesCenterLayout->setSizeConstraint(QLayout::SetMinAndMaxSize);
f65503c1833b Updated mainwindow layout and removed obsolete code.
Raimund Renkert <rrenkert@intevation.de>
parents: 643
diff changeset
650 mUpdatesWidget->setLayout(updatesCenterLayout);
f65503c1833b Updated mainwindow layout and removed obsolete code.
Raimund Renkert <rrenkert@intevation.de>
parents: 643
diff changeset
651 updatesContent->setWidget(mUpdatesWidget);
584
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
652
652
f65503c1833b Updated mainwindow layout and removed obsolete code.
Raimund Renkert <rrenkert@intevation.de>
parents: 643
diff changeset
653 updatesMainLayout->addLayout(updatesHeaderLayout);
f65503c1833b Updated mainwindow layout and removed obsolete code.
Raimund Renkert <rrenkert@intevation.de>
parents: 643
diff changeset
654 updatesMainLayout->addWidget(updatesContent);
f65503c1833b Updated mainwindow layout and removed obsolete code.
Raimund Renkert <rrenkert@intevation.de>
parents: 643
diff changeset
655 mUpdatesPanel->setLayout(updatesMainLayout);
f65503c1833b Updated mainwindow layout and removed obsolete code.
Raimund Renkert <rrenkert@intevation.de>
parents: 643
diff changeset
656
f65503c1833b Updated mainwindow layout and removed obsolete code.
Raimund Renkert <rrenkert@intevation.de>
parents: 643
diff changeset
657 /*********************************
f65503c1833b Updated mainwindow layout and removed obsolete code.
Raimund Renkert <rrenkert@intevation.de>
parents: 643
diff changeset
658 * Panel for trusted certificates.
f65503c1833b Updated mainwindow layout and removed obsolete code.
Raimund Renkert <rrenkert@intevation.de>
parents: 643
diff changeset
659 *********************************/
584
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
660 mInstallPanel = new QScrollArea;
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
661
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
662 QVBoxLayout *installPanelLayout = new QVBoxLayout;
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
663 QVBoxLayout *installHeaderLayout = new QVBoxLayout;
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
664 QVBoxLayout *installCenterLayout = new QVBoxLayout;
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
665
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
666 QLabel *installHeaderLabel =
659
c7405d526ead (UI) Updated English strings.
Emanuel Schuetze <emanuel@intevation.de>
parents: 657
diff changeset
667 new QLabel("<h2>" + tr("Trusted certificates") + "</h2>");
c7405d526ead (UI) Updated English strings.
Emanuel Schuetze <emanuel@intevation.de>
parents: 657
diff changeset
668 QLabel *installHeaderText = new QLabel(tr("The following list of trusted root"
c7405d526ead (UI) Updated English strings.
Emanuel Schuetze <emanuel@intevation.de>
parents: 657
diff changeset
669 " certificates is managed by the BSI. The BSI validates independently the"
c7405d526ead (UI) Updated English strings.
Emanuel Schuetze <emanuel@intevation.de>
parents: 657
diff changeset
670 " authenticity, security and actuality of these certificates."));
694
25a73bfec359 (Issue 21) Activate wordWrap for long labels.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 693
diff changeset
671 installHeaderText->setWordWrap(true);
584
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
672 installHeaderLayout->addWidget(installHeaderLabel);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
673 installHeaderLayout->addWidget(installHeaderText);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
674
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
675 QLabel *installCenterText = new QLabel(tr("Please choose the certificates"
659
c7405d526ead (UI) Updated English strings.
Emanuel Schuetze <emanuel@intevation.de>
parents: 657
diff changeset
676 " you want to trust or untrust. TrustBridge will install these certificates for your"
c7405d526ead (UI) Updated English strings.
Emanuel Schuetze <emanuel@intevation.de>
parents: 657
diff changeset
677 " secure communication for email and internet."));
694
25a73bfec359 (Issue 21) Activate wordWrap for long labels.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 693
diff changeset
678 installCenterText->setWordWrap(true);
584
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
679 installCenterLayout->addWidget(installCenterText);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
680 mInstallList = new CertificateListWidget(this);
640
626507197360 Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents: 628
diff changeset
681 connect(mInstallList, SIGNAL(certChanged(bool, const Certificate&)),
626507197360 Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents: 628
diff changeset
682 this, SLOT(toggleInManual(bool, const Certificate&)));
584
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
683
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
684 installPanelLayout->addLayout(installHeaderLayout);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
685 installPanelLayout->addLayout(installCenterLayout);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
686 installPanelLayout->addWidget(mInstallList);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
687 mInstallPanel->setLayout(installPanelLayout);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
688
652
f65503c1833b Updated mainwindow layout and removed obsolete code.
Raimund Renkert <rrenkert@intevation.de>
parents: 643
diff changeset
689 /**********************************
656
0ca15d937490 Avoid the word insecure.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 654
diff changeset
690 * Panel for certificates to be removed.
652
f65503c1833b Updated mainwindow layout and removed obsolete code.
Raimund Renkert <rrenkert@intevation.de>
parents: 643
diff changeset
691 **********************************/
584
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
692 mRemovePanel = new QScrollArea;
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
693 QVBoxLayout *removePanelLayout = new QVBoxLayout;
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
694 QVBoxLayout *removeHeaderLayout = new QVBoxLayout;
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
695 QVBoxLayout *removeCenterLayout = new QVBoxLayout;
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
696
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
697 QLabel *removeHeaderLabel =
661
320a64d58e62 (UI) Updated English strings. Removed Issuer fields.
Emanuel Schuetze <emanuel@intevation.de>
parents: 659
diff changeset
698 new QLabel("<h2>" + tr("Revoked certificates") + "</h2>");
320a64d58e62 (UI) Updated English strings. Removed Issuer fields.
Emanuel Schuetze <emanuel@intevation.de>
parents: 659
diff changeset
699 QLabel *removeHeaderText = new QLabel(tr("Certificates can be corrupted"
320a64d58e62 (UI) Updated English strings. Removed Issuer fields.
Emanuel Schuetze <emanuel@intevation.de>
parents: 659
diff changeset
700 " or stolen and misused in many ways. Therefore the BSI recommends"
320a64d58e62 (UI) Updated English strings. Removed Issuer fields.
Emanuel Schuetze <emanuel@intevation.de>
parents: 659
diff changeset
701 " to remove all revoked certificates from your system."));
694
25a73bfec359 (Issue 21) Activate wordWrap for long labels.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 693
diff changeset
702 removeHeaderText->setWordWrap(true);
584
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
703 removeHeaderLayout->addWidget(removeHeaderLabel);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
704 removeHeaderLayout->addWidget(removeHeaderText);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
705
661
320a64d58e62 (UI) Updated English strings. Removed Issuer fields.
Emanuel Schuetze <emanuel@intevation.de>
parents: 659
diff changeset
706 QLabel *removeCenterText = new QLabel(tr("The follwing unsecure certificates were"
320a64d58e62 (UI) Updated English strings. Removed Issuer fields.
Emanuel Schuetze <emanuel@intevation.de>
parents: 659
diff changeset
707 " revoked by the BSI. Already uninstalled certificates cannot be reinstalled."
320a64d58e62 (UI) Updated English strings. Removed Issuer fields.
Emanuel Schuetze <emanuel@intevation.de>
parents: 659
diff changeset
708 " It is recommended that you select all certificates to uninstall if you still"
320a64d58e62 (UI) Updated English strings. Removed Issuer fields.
Emanuel Schuetze <emanuel@intevation.de>
parents: 659
diff changeset
709 " have revoked certificates installed."));
694
25a73bfec359 (Issue 21) Activate wordWrap for long labels.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 693
diff changeset
710 removeCenterText->setWordWrap(true);
584
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
711 removeCenterLayout->addWidget(removeCenterText);
628
3a9c0f38bbad Made certificate lists member of mainwindow and added some temporary debug msgs.
Raimund Renkert <rrenkert@intevation.de>
parents: 584
diff changeset
712 mRemoveList = new CertificateListWidget(this);
640
626507197360 Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents: 628
diff changeset
713 connect(mRemoveList, SIGNAL(certChanged(bool, const Certificate&)),
626507197360 Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents: 628
diff changeset
714 this, SLOT(toggleInManual(bool, const Certificate&)));
584
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
715
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
716 removePanelLayout->addLayout(removeHeaderLayout);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
717 removePanelLayout->addLayout(removeCenterLayout);
628
3a9c0f38bbad Made certificate lists member of mainwindow and added some temporary debug msgs.
Raimund Renkert <rrenkert@intevation.de>
parents: 584
diff changeset
718 removePanelLayout->addWidget(mRemoveList);
584
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
719 mRemovePanel->setLayout(removePanelLayout);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
720
652
f65503c1833b Updated mainwindow layout and removed obsolete code.
Raimund Renkert <rrenkert@intevation.de>
parents: 643
diff changeset
721 /**********************************
f65503c1833b Updated mainwindow layout and removed obsolete code.
Raimund Renkert <rrenkert@intevation.de>
parents: 643
diff changeset
722 * The info panel.
f65503c1833b Updated mainwindow layout and removed obsolete code.
Raimund Renkert <rrenkert@intevation.de>
parents: 643
diff changeset
723 **********************************/
584
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
724 mInfoPanel = new QScrollArea;
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
725
643
f8be956c819b Fixed mainwindow layout warning.
Raimund Renkert <rrenkert@intevation.de>
parents: 642
diff changeset
726 QVBoxLayout *infoPanelLayout = new QVBoxLayout;
584
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
727 QHBoxLayout *infoHeaderLayout = new QHBoxLayout;
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
728 QVBoxLayout *infoHeaderTextLayout = new QVBoxLayout;
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
729 QVBoxLayout *infoCenterLayout = new QVBoxLayout;
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
730
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
731 QImage *infoLogoImage = new QImage(":/img/logo.png");
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
732 QLabel *infoLogo = new QLabel;
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
733 infoLogo->setBackgroundRole(QPalette::Base);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
734 infoLogo->setPixmap(QPixmap::fromImage(*infoLogoImage));
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
735 QLabel *infoTitle = new QLabel("<h1>" + tr("TrustBridge") + "</h1>");
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
736 QString infoVersion = tr("Version: ");
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
737 infoVersion.append(QApplication::applicationVersion());
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
738 QLabel *appVersion = new QLabel(infoVersion);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
739 appVersion->setTextInteractionFlags(
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
740 Qt::TextSelectableByMouse |
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
741 Qt::TextSelectableByKeyboard);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
742
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
743 QFrame *infoHeaderSeparator = new QFrame();
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
744 infoHeaderSeparator->setFrameShape(QFrame::HLine);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
745 infoHeaderSeparator->setFrameShadow(QFrame::Sunken);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
746
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
747 infoHeaderTextLayout->addWidget(infoTitle);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
748 infoHeaderTextLayout->addWidget(appVersion);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
749 infoHeaderLayout->addWidget(infoLogo);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
750 infoHeaderLayout->addLayout(infoHeaderTextLayout);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
751 infoHeaderLayout->insertStretch(2, 10);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
752
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
753 QLabel *textDesc = new QLabel(tr("TrustBridge is a root certificate"
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
754 " installer for Windows and Linux."));
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
755 textDesc->setTextInteractionFlags(
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
756 Qt::TextSelectableByMouse |
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
757 Qt::TextSelectableByKeyboard);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
758 QLabel *textManage = new QLabel(tr("The root certificate lists are managed"
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
759 " by the German <a href=\"https://www.bsi.bund.de\">"
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
760 "Federal Office for Information Security (BSI)</a>.\n\n"));
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
761 textManage->setTextInteractionFlags(
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
762 Qt::TextBrowserInteraction |
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
763 Qt::TextSelectableByKeyboard);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
764 QLabel *textDevel = new QLabel(tr("The software was developed by the companies"
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
765 " <a href=\"http://www.intevation.de\">Intevation GmbH</a> and "
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
766 " <a href=\"http://www.dn-systems.de\">DN-Systems GmbH</a>, <br>"
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
767 " contracted by the German Federal Office for Information Security (BSI).\n\n"));
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
768 textDevel->setTextInteractionFlags(
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
769 Qt::TextBrowserInteraction |
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
770 Qt::TextSelectableByKeyboard);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
771 QLabel *textLicense = new QLabel(tr("TrustBridge is Free Software licensed"
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
772 " under GNU GPL v2+.\n\nCopyright (C) 2014 by Bundesamt für Sicherheit"
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
773 " in der Informationstechnik"));
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
774 textLicense->setTextInteractionFlags(
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
775 Qt::TextSelectableByMouse |
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
776 Qt::TextSelectableByKeyboard);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
777
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
778 infoCenterLayout->addWidget(infoHeaderSeparator);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
779 infoCenterLayout->addWidget(textDesc);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
780 infoCenterLayout->addWidget(textManage);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
781 infoCenterLayout->addWidget(textDevel);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
782 infoCenterLayout->addWidget(textLicense);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
783 infoCenterLayout->insertSpacing(2, 10);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
784 infoCenterLayout->insertSpacing(4, 10);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
785 infoCenterLayout->insertSpacing(6, 10);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
786 infoCenterLayout->insertStretch(8, 10);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
787
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
788 infoPanelLayout->addLayout(infoHeaderLayout);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
789 infoPanelLayout->addLayout(infoCenterLayout);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
790 mInfoPanel->setLayout(infoPanelLayout);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
791
652
f65503c1833b Updated mainwindow layout and removed obsolete code.
Raimund Renkert <rrenkert@intevation.de>
parents: 643
diff changeset
792 /********************************
f65503c1833b Updated mainwindow layout and removed obsolete code.
Raimund Renkert <rrenkert@intevation.de>
parents: 643
diff changeset
793 * The main layout for pages.
f65503c1833b Updated mainwindow layout and removed obsolete code.
Raimund Renkert <rrenkert@intevation.de>
parents: 643
diff changeset
794 ********************************/
584
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
795 mInstallPanel->hide();
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
796 mRemovePanel->hide();
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
797 mInfoPanel->hide();
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
798 containerLayout->addWidget(mUpdatesPanel);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
799 containerLayout->addWidget(mInstallPanel);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
800 containerLayout->addWidget(mRemovePanel);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
801 containerLayout->addWidget(mInfoPanel);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
802
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
803 centerLayout->addLayout(buttonBarLayout);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
804 centerLayout->addLayout(containerLayout);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
805
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
806 mainLayout->addLayout(headerLayout);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
807 mainLayout->addLayout(centerLayout);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
808 mainLayout->addLayout(bottomLayout);
187
0c06a608e15f Create the mainwindow content.
Raimund Renkert <rrenkert@intevation.de>
parents: 155
diff changeset
809 base->setLayout(mainLayout);
0c06a608e15f Create the mainwindow content.
Raimund Renkert <rrenkert@intevation.de>
parents: 155
diff changeset
810 setCentralWidget(base);
0c06a608e15f Create the mainwindow content.
Raimund Renkert <rrenkert@intevation.de>
parents: 155
diff changeset
811 }
0c06a608e15f Create the mainwindow content.
Raimund Renkert <rrenkert@intevation.de>
parents: 155
diff changeset
812
628
3a9c0f38bbad Made certificate lists member of mainwindow and added some temporary debug msgs.
Raimund Renkert <rrenkert@intevation.de>
parents: 584
diff changeset
813 void MainWindow::listChanged(int selected)
3a9c0f38bbad Made certificate lists member of mainwindow and added some temporary debug msgs.
Raimund Renkert <rrenkert@intevation.de>
parents: 584
diff changeset
814 {
696
55f78c4166fb (Issue32) Change Updates to Changes and track changes.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 694
diff changeset
815 int totalCount = mUpdatesRemove->selectedCertCount() +
55f78c4166fb (Issue32) Change Updates to Changes and track changes.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 694
diff changeset
816 mUpdatesNew->selectedCertCount() + mUpdatesManual->certificates().size();
55f78c4166fb (Issue32) Change Updates to Changes and track changes.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 694
diff changeset
817
55f78c4166fb (Issue32) Change Updates to Changes and track changes.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 694
diff changeset
818 if (!totalCount) {
693
0fc1a20adaff (Issue 27) Change Quit button text depending on changes or no changes.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 692
diff changeset
819 /* No changes */
0fc1a20adaff (Issue 27) Change Quit button text depending on changes or no changes.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 692
diff changeset
820 mQuitButton->setText(tr("Quit"));
696
55f78c4166fb (Issue32) Change Updates to Changes and track changes.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 694
diff changeset
821 mUpdatesHeader->setText("<h2>" + tr("Certificates unchanged") +
55f78c4166fb (Issue32) Change Updates to Changes and track changes.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 694
diff changeset
822 "</h2>");
693
0fc1a20adaff (Issue 27) Change Quit button text depending on changes or no changes.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 692
diff changeset
823 } else {
0fc1a20adaff (Issue 27) Change Quit button text depending on changes or no changes.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 692
diff changeset
824 mQuitButton->setText(tr("Quit without saving"));
696
55f78c4166fb (Issue32) Change Updates to Changes and track changes.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 694
diff changeset
825 mUpdatesHeader->setText("<h2>" + tr("Changes (%1)")
55f78c4166fb (Issue32) Change Updates to Changes and track changes.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 694
diff changeset
826 .arg(totalCount) +
55f78c4166fb (Issue32) Change Updates to Changes and track changes.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 694
diff changeset
827 "</h2>");
693
0fc1a20adaff (Issue 27) Change Quit button text depending on changes or no changes.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 692
diff changeset
828 }
0fc1a20adaff (Issue 27) Change Quit button text depending on changes or no changes.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 692
diff changeset
829
628
3a9c0f38bbad Made certificate lists member of mainwindow and added some temporary debug msgs.
Raimund Renkert <rrenkert@intevation.de>
parents: 584
diff changeset
830 mUpdatesNewCertificates->setText("<h3>" +
659
c7405d526ead (UI) Updated English strings.
Emanuel Schuetze <emanuel@intevation.de>
parents: 657
diff changeset
831 tr("Install new trusted certificates (%1/%2)")
628
3a9c0f38bbad Made certificate lists member of mainwindow and added some temporary debug msgs.
Raimund Renkert <rrenkert@intevation.de>
parents: 584
diff changeset
832 .arg(mUpdatesNew->selectedCertCount())
3a9c0f38bbad Made certificate lists member of mainwindow and added some temporary debug msgs.
Raimund Renkert <rrenkert@intevation.de>
parents: 584
diff changeset
833 .arg(mUpdatesNew->certificates().size()) +
3a9c0f38bbad Made certificate lists member of mainwindow and added some temporary debug msgs.
Raimund Renkert <rrenkert@intevation.de>
parents: 584
diff changeset
834 "</h3>");
3a9c0f38bbad Made certificate lists member of mainwindow and added some temporary debug msgs.
Raimund Renkert <rrenkert@intevation.de>
parents: 584
diff changeset
835 mUpdatesRemoveCertificates->setText("<h3>" +
661
320a64d58e62 (UI) Updated English strings. Removed Issuer fields.
Emanuel Schuetze <emanuel@intevation.de>
parents: 659
diff changeset
836 tr("Remove revoked certificates (%1/%2)")
628
3a9c0f38bbad Made certificate lists member of mainwindow and added some temporary debug msgs.
Raimund Renkert <rrenkert@intevation.de>
parents: 584
diff changeset
837 .arg(mUpdatesRemove->selectedCertCount())
3a9c0f38bbad Made certificate lists member of mainwindow and added some temporary debug msgs.
Raimund Renkert <rrenkert@intevation.de>
parents: 584
diff changeset
838 .arg(mUpdatesRemove->certificates().size()) +
3a9c0f38bbad Made certificate lists member of mainwindow and added some temporary debug msgs.
Raimund Renkert <rrenkert@intevation.de>
parents: 584
diff changeset
839 "</h3>");
3a9c0f38bbad Made certificate lists member of mainwindow and added some temporary debug msgs.
Raimund Renkert <rrenkert@intevation.de>
parents: 584
diff changeset
840 }
3a9c0f38bbad Made certificate lists member of mainwindow and added some temporary debug msgs.
Raimund Renkert <rrenkert@intevation.de>
parents: 584
diff changeset
841
189
5f0d45ca9de4 Show certificates in the list view and details in the textfield.
Raimund Renkert <rrenkert@intevation.de>
parents: 187
diff changeset
842 void MainWindow::loadCertificateList()
5f0d45ca9de4 Show certificates in the list view and details in the textfield.
Raimund Renkert <rrenkert@intevation.de>
parents: 187
diff changeset
843 {
389
3be838c3e4d8 Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 375
diff changeset
844 /* TODO: if nothing is available (neither old nor new) add some progress
3be838c3e4d8 Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 375
diff changeset
845 * indication */
628
3a9c0f38bbad Made certificate lists member of mainwindow and added some temporary debug msgs.
Raimund Renkert <rrenkert@intevation.de>
parents: 584
diff changeset
846 mInstallList->clear();
684
69def231f5ac (issue28) clear manual updates after installation.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 673
diff changeset
847 mRemoveList->clear();
628
3a9c0f38bbad Made certificate lists member of mainwindow and added some temporary debug msgs.
Raimund Renkert <rrenkert@intevation.de>
parents: 584
diff changeset
848 mUpdatesNew->clear();
3a9c0f38bbad Made certificate lists member of mainwindow and added some temporary debug msgs.
Raimund Renkert <rrenkert@intevation.de>
parents: 584
diff changeset
849 mUpdatesRemove->clear();
445
b3721ded6f5b Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents: 437
diff changeset
850 QList<Certificate> newInstallCerts;
b3721ded6f5b Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents: 437
diff changeset
851 QList<Certificate> newRemoveCerts;
b3721ded6f5b Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents: 437
diff changeset
852 QList<Certificate> oldInstallCerts;
b3721ded6f5b Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents: 437
diff changeset
853 QList<Certificate> oldRemoveCerts;
389
3be838c3e4d8 Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 375
diff changeset
854
445
b3721ded6f5b Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents: 437
diff changeset
855 if (mListToInstall.getCertificates().isEmpty()) {
b3721ded6f5b Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents: 437
diff changeset
856 // No new list available, add old certificates.
b3721ded6f5b Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents: 437
diff changeset
857 foreach (const Certificate &cert, mInstalledList.getCertificates()) {
640
626507197360 Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents: 628
diff changeset
858 bool state = !mPreviouslyUnselected.contains(cert.base64Line());
445
b3721ded6f5b Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents: 437
diff changeset
859 if (cert.isInstallCert()) {
b3721ded6f5b Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents: 437
diff changeset
860 oldInstallCerts.append(cert);
640
626507197360 Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents: 628
diff changeset
861 mInstallList->addCertificate(cert, state);
267
89e8783866f8 Use the certificate item delegate in the mainwind list view.
Raimund Renkert <rrenkert@intevation.de>
parents: 265
diff changeset
862 }
89e8783866f8 Use the certificate item delegate in the mainwind list view.
Raimund Renkert <rrenkert@intevation.de>
parents: 265
diff changeset
863 else {
445
b3721ded6f5b Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents: 437
diff changeset
864 oldRemoveCerts.append(cert);
640
626507197360 Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents: 628
diff changeset
865 mRemoveList->addCertificate(cert, state, !state);
267
89e8783866f8 Use the certificate item delegate in the mainwind list view.
Raimund Renkert <rrenkert@intevation.de>
parents: 265
diff changeset
866 }
89e8783866f8 Use the certificate item delegate in the mainwind list view.
Raimund Renkert <rrenkert@intevation.de>
parents: 265
diff changeset
867 }
445
b3721ded6f5b Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents: 437
diff changeset
868 }
b3721ded6f5b Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents: 437
diff changeset
869 else {
b3721ded6f5b Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents: 437
diff changeset
870 // Sort and filter both lists.
b3721ded6f5b Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents: 437
diff changeset
871 foreach (const Certificate &cert, mListToInstall.getCertificates()) {
640
626507197360 Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents: 628
diff changeset
872 bool state = !mPreviouslyUnselected.contains(cert.base64Line());
445
b3721ded6f5b Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents: 437
diff changeset
873 if (cert.isInstallCert()) {
b3721ded6f5b Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents: 437
diff changeset
874 // Certificate with status "install".
b3721ded6f5b Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents: 437
diff changeset
875 if (mInstalledList.getCertificates().contains(cert)) {
b3721ded6f5b Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents: 437
diff changeset
876 // Was in the old list.
b3721ded6f5b Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents: 437
diff changeset
877 oldInstallCerts.append(cert);
640
626507197360 Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents: 628
diff changeset
878 mInstallList->addCertificate(cert, state);
445
b3721ded6f5b Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents: 437
diff changeset
879 }
b3721ded6f5b Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents: 437
diff changeset
880 else {
b3721ded6f5b Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents: 437
diff changeset
881 // Is a brand new certificate
b3721ded6f5b Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents: 437
diff changeset
882 newInstallCerts.append(cert);
687
973a7ce19658 (issue24) Let the string for install / remove be set for each item individually
Andre Heinecke <andre.heinecke@intevation.de>
parents: 684
diff changeset
883 mUpdatesNew->addCertificate(cert, state, true,
973a7ce19658 (issue24) Let the string for install / remove be set for each item individually
Andre Heinecke <andre.heinecke@intevation.de>
parents: 684
diff changeset
884 tr("install"), tr("ignore"));
445
b3721ded6f5b Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents: 437
diff changeset
885 }
267
89e8783866f8 Use the certificate item delegate in the mainwind list view.
Raimund Renkert <rrenkert@intevation.de>
parents: 265
diff changeset
886 }
89e8783866f8 Use the certificate item delegate in the mainwind list view.
Raimund Renkert <rrenkert@intevation.de>
parents: 265
diff changeset
887 else {
445
b3721ded6f5b Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents: 437
diff changeset
888 // Certificate with status "remove".
b3721ded6f5b Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents: 437
diff changeset
889 if (mInstalledList.getCertificates().contains(cert)) {
b3721ded6f5b Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents: 437
diff changeset
890 // Was in the old list.
b3721ded6f5b Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents: 437
diff changeset
891 oldRemoveCerts.append(cert);
640
626507197360 Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents: 628
diff changeset
892 // Is removed, so set editable to false.
626507197360 Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents: 628
diff changeset
893 mRemoveList->addCertificate(cert, state, !state);
445
b3721ded6f5b Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents: 437
diff changeset
894 }
b3721ded6f5b Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents: 437
diff changeset
895 else {
b3721ded6f5b Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents: 437
diff changeset
896 // Was in the old list with status "install" and now has the
b3721ded6f5b Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents: 437
diff changeset
897 // status "remove".
b3721ded6f5b Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents: 437
diff changeset
898 newRemoveCerts.append(cert);
640
626507197360 Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents: 628
diff changeset
899 mUpdatesRemove->addCertificate(cert, state);
445
b3721ded6f5b Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents: 437
diff changeset
900 }
267
89e8783866f8 Use the certificate item delegate in the mainwind list view.
Raimund Renkert <rrenkert@intevation.de>
parents: 265
diff changeset
901 }
89e8783866f8 Use the certificate item delegate in the mainwind list view.
Raimund Renkert <rrenkert@intevation.de>
parents: 265
diff changeset
902 }
691
315103410002 (Issue 32) Move updates header text generation out of update avialable block
Andre Heinecke <andre.heinecke@intevation.de>
parents: 690
diff changeset
903 }
692
3791a277f00b Remove code duplication and calculate headers only in listchanged
Andre Heinecke <andre.heinecke@intevation.de>
parents: 691
diff changeset
904
691
315103410002 (Issue 32) Move updates header text generation out of update avialable block
Andre Heinecke <andre.heinecke@intevation.de>
parents: 690
diff changeset
905 mLastCertUpdate->setText(tr("Last update of certificates: %1")
628
3a9c0f38bbad Made certificate lists member of mainwindow and added some temporary debug msgs.
Raimund Renkert <rrenkert@intevation.de>
parents: 584
diff changeset
906 .arg(mInstalledList.date().toString()));
3a9c0f38bbad Made certificate lists member of mainwindow and added some temporary debug msgs.
Raimund Renkert <rrenkert@intevation.de>
parents: 584
diff changeset
907 mUpdatesManualCertificates->setText("<h3>" +
659
c7405d526ead (UI) Updated English strings.
Emanuel Schuetze <emanuel@intevation.de>
parents: 657
diff changeset
908 tr("Manually changed certificates (%1)").arg(0) +
628
3a9c0f38bbad Made certificate lists member of mainwindow and added some temporary debug msgs.
Raimund Renkert <rrenkert@intevation.de>
parents: 584
diff changeset
909 "</h3>");
692
3791a277f00b Remove code duplication and calculate headers only in listchanged
Andre Heinecke <andre.heinecke@intevation.de>
parents: 691
diff changeset
910 listChanged(0);
271
1ae15ea73850 Some GUI desing and layout changes.
Raimund Renkert <rrenkert@intevation.de>
parents: 267
diff changeset
911 }
365
75f7288ad67b Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents: 274
diff changeset
912
75f7288ad67b Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents: 274
diff changeset
913 void MainWindow::installerError(const QString& errMsg) {
75f7288ad67b Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents: 274
diff changeset
914 QMessageBox::warning(this, tr("Error executing update"), errMsg);
75f7288ad67b Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents: 274
diff changeset
915 }
75f7288ad67b Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents: 274
diff changeset
916
389
3be838c3e4d8 Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 375
diff changeset
917 void MainWindow::installerSuccess() {
3be838c3e4d8 Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 375
diff changeset
918 if (mCurState == NewListAvailable) {
3be838c3e4d8 Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 375
diff changeset
919 mCurState = NothingChanged;
3be838c3e4d8 Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 375
diff changeset
920 mCurMessage = QString();
3be838c3e4d8 Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 375
diff changeset
921
3be838c3e4d8 Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 375
diff changeset
922 QString listFileName = mSettings.value("List/available").toString();
3be838c3e4d8 Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 375
diff changeset
923 QDateTime listFileDate = mSettings.value("List/availableDate").toDateTime();
3be838c3e4d8 Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 375
diff changeset
924
3be838c3e4d8 Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 375
diff changeset
925 mSettings.remove("List/available");
3be838c3e4d8 Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 375
diff changeset
926 mSettings.remove("List/availableDate");
3be838c3e4d8 Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 375
diff changeset
927
3be838c3e4d8 Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 375
diff changeset
928 if (listFileName.isEmpty() || !listFileDate.isValid()) {
3be838c3e4d8 Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 375
diff changeset
929 qWarning() << "Error accessing settings";
3be838c3e4d8 Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 375
diff changeset
930 return; /* Try again with next check */
3be838c3e4d8 Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 375
diff changeset
931 }
3be838c3e4d8 Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 375
diff changeset
932
3be838c3e4d8 Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 375
diff changeset
933 mSettings.setValue("List/installed", listFileName);
3be838c3e4d8 Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 375
diff changeset
934 mSettings.setValue("List/installedDate", listFileDate);
480
242f2bf5417e Update the certificate list after installing certificates.
Raimund Renkert <rrenkert@intevation.de>
parents: 479
diff changeset
935 mInstalledList = mListToInstall;
242f2bf5417e Update the certificate list after installing certificates.
Raimund Renkert <rrenkert@intevation.de>
parents: 479
diff changeset
936 mListToInstall = CertificateList();
389
3be838c3e4d8 Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 375
diff changeset
937 }
684
69def231f5ac (issue28) clear manual updates after installation.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 673
diff changeset
938 mUpdatesManual->clear();
628
3a9c0f38bbad Made certificate lists member of mainwindow and added some temporary debug msgs.
Raimund Renkert <rrenkert@intevation.de>
parents: 584
diff changeset
939 loadCertificateList();
389
3be838c3e4d8 Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 375
diff changeset
940 }
3be838c3e4d8 Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 375
diff changeset
941
365
75f7288ad67b Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents: 274
diff changeset
942 void MainWindow::installCerts() {
75f7288ad67b Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents: 274
diff changeset
943 QStringList choices;
640
626507197360 Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents: 628
diff changeset
944 QStringList unselected;
365
75f7288ad67b Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents: 274
diff changeset
945
640
626507197360 Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents: 628
diff changeset
946 choices << mUpdatesNew->selectedCertificates();
626507197360 Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents: 628
diff changeset
947 choices << mUpdatesRemove->selectedCertificates();
626507197360 Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents: 628
diff changeset
948
669
7147550ee15d Always include previous certificates in choices for the installer
Andre Heinecke <andre.heinecke@intevation.de>
parents: 664
diff changeset
949 choices << mUpdatesManual->selectedCertificates();
7147550ee15d Always include previous certificates in choices for the installer
Andre Heinecke <andre.heinecke@intevation.de>
parents: 664
diff changeset
950
7147550ee15d Always include previous certificates in choices for the installer
Andre Heinecke <andre.heinecke@intevation.de>
parents: 664
diff changeset
951 /* Also include the old certificates */
7147550ee15d Always include previous certificates in choices for the installer
Andre Heinecke <andre.heinecke@intevation.de>
parents: 664
diff changeset
952 choices << mInstallList->selectedCertificates();
7147550ee15d Always include previous certificates in choices for the installer
Andre Heinecke <andre.heinecke@intevation.de>
parents: 664
diff changeset
953 choices << mRemoveList->selectedCertificates();
7147550ee15d Always include previous certificates in choices for the installer
Andre Heinecke <andre.heinecke@intevation.de>
parents: 664
diff changeset
954
640
626507197360 Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents: 628
diff changeset
955 QStringList unselectedManuals = mUpdatesManual->unselectedCertificates();
626507197360 Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents: 628
diff changeset
956 for(int i = 0; i < unselectedManuals.size(); i++) {
626507197360 Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents: 628
diff changeset
957 if (unselectedManuals.at(i).startsWith("I:")) {
626507197360 Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents: 628
diff changeset
958 QString certLine = unselectedManuals.at(i);
626507197360 Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents: 628
diff changeset
959 certLine[0] = 'R';
626507197360 Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents: 628
diff changeset
960 choices << certLine;
626507197360 Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents: 628
diff changeset
961 }
626507197360 Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents: 628
diff changeset
962 }
626507197360 Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents: 628
diff changeset
963
626507197360 Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents: 628
diff changeset
964 unselected << mUpdatesNew->unselectedCertificates();
626507197360 Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents: 628
diff changeset
965 unselected << mUpdatesRemove->unselectedCertificates();
626507197360 Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents: 628
diff changeset
966 unselected << mInstallList->unselectedCertificates();
626507197360 Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents: 628
diff changeset
967 unselected << mRemoveList->unselectedCertificates();
628
3a9c0f38bbad Made certificate lists member of mainwindow and added some temporary debug msgs.
Raimund Renkert <rrenkert@intevation.de>
parents: 584
diff changeset
968
365
75f7288ad67b Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents: 274
diff changeset
969 QProgressDialog *progress = new QProgressDialog(this);
75f7288ad67b Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents: 274
diff changeset
970 progress->setWindowModality(Qt::WindowModal);
75f7288ad67b Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents: 274
diff changeset
971 progress->setLabelText(tr("Installing certificates..."));
75f7288ad67b Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents: 274
diff changeset
972 progress->setCancelButton(0);
75f7288ad67b Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents: 274
diff changeset
973 progress->setRange(0,0);
75f7288ad67b Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents: 274
diff changeset
974 progress->setMinimumDuration(0);
75f7288ad67b Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents: 274
diff changeset
975 progress->show();
75f7288ad67b Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents: 274
diff changeset
976
75f7288ad67b Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents: 274
diff changeset
977 InstallWrapper *instWrap = new InstallWrapper(this,
393
ae2ef965a41b Provide installer with old list in case there are no news
Andre Heinecke <andre.heinecke@intevation.de>
parents: 389
diff changeset
978 mListToInstall.isValid() ?
ae2ef965a41b Provide installer with old list in case there are no news
Andre Heinecke <andre.heinecke@intevation.de>
parents: 389
diff changeset
979 mListToInstall.fileName() :
ae2ef965a41b Provide installer with old list in case there are no news
Andre Heinecke <andre.heinecke@intevation.de>
parents: 389
diff changeset
980 mInstalledList.fileName(),
365
75f7288ad67b Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents: 274
diff changeset
981 choices);
75f7288ad67b Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents: 274
diff changeset
982 /* Clean up object and progress dialog */
75f7288ad67b Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents: 274
diff changeset
983 connect(instWrap, SIGNAL(finished()), instWrap, SLOT(deleteLater()));
75f7288ad67b Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents: 274
diff changeset
984 connect(instWrap, SIGNAL(finished()), progress, SLOT(deleteLater()));
75f7288ad67b Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents: 274
diff changeset
985 connect(instWrap, SIGNAL(finished()), progress, SLOT(cancel()));
389
3be838c3e4d8 Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 375
diff changeset
986 connect(instWrap, SIGNAL(installationSuccessful()),
3be838c3e4d8 Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 375
diff changeset
987 this, SLOT(installerSuccess()));
365
75f7288ad67b Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents: 274
diff changeset
988 connect(instWrap, SIGNAL(error(const QString &)),
389
3be838c3e4d8 Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 375
diff changeset
989 this, SLOT(installerError(const QString &)));
365
75f7288ad67b Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents: 274
diff changeset
990 instWrap->start();
640
626507197360 Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents: 628
diff changeset
991
626507197360 Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents: 628
diff changeset
992 if (!saveUnselectedCertificates(unselected)) {
372
6cc124e79066 Add save/load unselected and add role enumerator
Andre Heinecke <andre.heinecke@intevation.de>
parents: 365
diff changeset
993 qWarning() << "Failed to save previosly unselected certificates.";
6cc124e79066 Add save/load unselected and add role enumerator
Andre Heinecke <andre.heinecke@intevation.de>
parents: 365
diff changeset
994 }
640
626507197360 Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents: 628
diff changeset
995
365
75f7288ad67b Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents: 274
diff changeset
996 }
372
6cc124e79066 Add save/load unselected and add role enumerator
Andre Heinecke <andre.heinecke@intevation.de>
parents: 365
diff changeset
997
6cc124e79066 Add save/load unselected and add role enumerator
Andre Heinecke <andre.heinecke@intevation.de>
parents: 365
diff changeset
998 void MainWindow::loadUnselectedCertificates()
6cc124e79066 Add save/load unselected and add role enumerator
Andre Heinecke <andre.heinecke@intevation.de>
parents: 365
diff changeset
999 {
6cc124e79066 Add save/load unselected and add role enumerator
Andre Heinecke <andre.heinecke@intevation.de>
parents: 365
diff changeset
1000 mPreviouslyUnselected.clear();
6cc124e79066 Add save/load unselected and add role enumerator
Andre Heinecke <andre.heinecke@intevation.de>
parents: 365
diff changeset
1001 mSettings.beginGroup("unselected");
6cc124e79066 Add save/load unselected and add role enumerator
Andre Heinecke <andre.heinecke@intevation.de>
parents: 365
diff changeset
1002 QStringList keys = mSettings.allKeys();
6cc124e79066 Add save/load unselected and add role enumerator
Andre Heinecke <andre.heinecke@intevation.de>
parents: 365
diff changeset
1003 foreach (const QString &key, keys) {
6cc124e79066 Add save/load unselected and add role enumerator
Andre Heinecke <andre.heinecke@intevation.de>
parents: 365
diff changeset
1004 mPreviouslyUnselected << mSettings.value(key, QString()).toString();
6cc124e79066 Add save/load unselected and add role enumerator
Andre Heinecke <andre.heinecke@intevation.de>
parents: 365
diff changeset
1005 }
6cc124e79066 Add save/load unselected and add role enumerator
Andre Heinecke <andre.heinecke@intevation.de>
parents: 365
diff changeset
1006 mSettings.endGroup();
6cc124e79066 Add save/load unselected and add role enumerator
Andre Heinecke <andre.heinecke@intevation.de>
parents: 365
diff changeset
1007 }
6cc124e79066 Add save/load unselected and add role enumerator
Andre Heinecke <andre.heinecke@intevation.de>
parents: 365
diff changeset
1008
640
626507197360 Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents: 628
diff changeset
1009 bool MainWindow::saveUnselectedCertificates(QStringList unselected)
372
6cc124e79066 Add save/load unselected and add role enumerator
Andre Heinecke <andre.heinecke@intevation.de>
parents: 365
diff changeset
1010 {
479
a8d56a2846a8 Fill the internal list of previously unselcted certificates when saving in settings.
Raimund Renkert <rrenkert@intevation.de>
parents: 461
diff changeset
1011 mPreviouslyUnselected.clear();
372
6cc124e79066 Add save/load unselected and add role enumerator
Andre Heinecke <andre.heinecke@intevation.de>
parents: 365
diff changeset
1012 mSettings.beginGroup("unselected");
6cc124e79066 Add save/load unselected and add role enumerator
Andre Heinecke <andre.heinecke@intevation.de>
parents: 365
diff changeset
1013 mSettings.remove(""); /* Clears old choices */
640
626507197360 Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents: 628
diff changeset
1014 for (int i = 0; i < unselected.size(); i++) {
626507197360 Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents: 628
diff changeset
1015 QString key = QString::fromLatin1("cert%1").arg(i);
626507197360 Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents: 628
diff changeset
1016 QString value = unselected.at(i);
626507197360 Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents: 628
diff changeset
1017 mSettings.setValue(key, value);
626507197360 Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents: 628
diff changeset
1018 mPreviouslyUnselected << value;
372
6cc124e79066 Add save/load unselected and add role enumerator
Andre Heinecke <andre.heinecke@intevation.de>
parents: 365
diff changeset
1019 }
6cc124e79066 Add save/load unselected and add role enumerator
Andre Heinecke <andre.heinecke@intevation.de>
parents: 365
diff changeset
1020 mSettings.endGroup();
6cc124e79066 Add save/load unselected and add role enumerator
Andre Heinecke <andre.heinecke@intevation.de>
parents: 365
diff changeset
1021 mSettings.sync();
6cc124e79066 Add save/load unselected and add role enumerator
Andre Heinecke <andre.heinecke@intevation.de>
parents: 365
diff changeset
1022 return mSettings.status() == QSettings::NoError;
6cc124e79066 Add save/load unselected and add role enumerator
Andre Heinecke <andre.heinecke@intevation.de>
parents: 365
diff changeset
1023 }
447
b1b14daf2116 Save the select state of certificate items when closing the app.
Raimund Renkert <rrenkert@intevation.de>
parents: 446
diff changeset
1024
640
626507197360 Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents: 628
diff changeset
1025 void MainWindow::toggleInManual(bool state, const Certificate &cert)
626507197360 Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents: 628
diff changeset
1026 {
626507197360 Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents: 628
diff changeset
1027 if (!mUpdatesManual->contains(cert)) {
626507197360 Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents: 628
diff changeset
1028 mUpdatesManual->addCertificate(cert, state);
626507197360 Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents: 628
diff changeset
1029 }
626507197360 Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents: 628
diff changeset
1030 else {
626507197360 Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents: 628
diff changeset
1031 mUpdatesManual->removeCertificate(cert);
626507197360 Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents: 628
diff changeset
1032 }
626507197360 Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents: 628
diff changeset
1033
626507197360 Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents: 628
diff changeset
1034 mUpdatesManualCertificates->setText("<h3>" +
661
320a64d58e62 (UI) Updated English strings. Removed Issuer fields.
Emanuel Schuetze <emanuel@intevation.de>
parents: 659
diff changeset
1035 tr("Manually changed certificates (%1)")
640
626507197360 Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents: 628
diff changeset
1036 .arg(mUpdatesManual->certificates().size()) +
626507197360 Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents: 628
diff changeset
1037 "</h3>");
626507197360 Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents: 628
diff changeset
1038 }
626507197360 Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents: 628
diff changeset
1039
626507197360 Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents: 628
diff changeset
1040 void MainWindow::removeFromManual(bool state, const Certificate &cert)
626507197360 Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents: 628
diff changeset
1041 {
626507197360 Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents: 628
diff changeset
1042 mUpdatesManual->removeCertificate(cert);
626507197360 Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents: 628
diff changeset
1043
626507197360 Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents: 628
diff changeset
1044 mUpdatesManualCertificates->setText("<h3>" +
661
320a64d58e62 (UI) Updated English strings. Removed Issuer fields.
Emanuel Schuetze <emanuel@intevation.de>
parents: 659
diff changeset
1045 tr("Manually changed certificates (%1)")
640
626507197360 Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents: 628
diff changeset
1046 .arg(mUpdatesManual->certificates().size()) +
626507197360 Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents: 628
diff changeset
1047 "</h3>");
626507197360 Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents: 628
diff changeset
1048
626507197360 Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents: 628
diff changeset
1049 if (cert.isInstallCert()) {
626507197360 Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents: 628
diff changeset
1050 mInstallList->setCertState(state, cert);
626507197360 Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents: 628
diff changeset
1051 }
626507197360 Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents: 628
diff changeset
1052 else {
626507197360 Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents: 628
diff changeset
1053 mRemoveList->setCertState(state, cert);
626507197360 Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents: 628
diff changeset
1054 }
626507197360 Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents: 628
diff changeset
1055 }
626507197360 Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents: 628
diff changeset
1056
447
b1b14daf2116 Save the select state of certificate items when closing the app.
Raimund Renkert <rrenkert@intevation.de>
parents: 446
diff changeset
1057 void MainWindow::closeApp()
b1b14daf2116 Save the select state of certificate items when closing the app.
Raimund Renkert <rrenkert@intevation.de>
parents: 446
diff changeset
1058 {
b1b14daf2116 Save the select state of certificate items when closing the app.
Raimund Renkert <rrenkert@intevation.de>
parents: 446
diff changeset
1059 qApp->quit();
b1b14daf2116 Save the select state of certificate items when closing the app.
Raimund Renkert <rrenkert@intevation.de>
parents: 446
diff changeset
1060 }
584
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
1061
609
292c590ba9cb Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents: 607
diff changeset
1062 void MainWindow::checkAndInstallCerts()
292c590ba9cb Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents: 607
diff changeset
1063 {
292c590ba9cb Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents: 607
diff changeset
1064 /* Checking before opening the dialog should be cheaper */
292c590ba9cb Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents: 607
diff changeset
1065 QList<int> pids = ProcessHelp::getProcessesIdForName("firefox");
292c590ba9cb Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents: 607
diff changeset
1066 pids.append(ProcessHelp::getProcessesIdForName("thunderbird"));
292c590ba9cb Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents: 607
diff changeset
1067
292c590ba9cb Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents: 607
diff changeset
1068 if (pids.isEmpty()) {
292c590ba9cb Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents: 607
diff changeset
1069 installCerts();
292c590ba9cb Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents: 607
diff changeset
1070 return;
292c590ba9cb Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents: 607
diff changeset
1071 }
292c590ba9cb Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents: 607
diff changeset
1072
292c590ba9cb Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents: 607
diff changeset
1073 QStringList pNames;
292c590ba9cb Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents: 607
diff changeset
1074 pNames << "firefox" << "thunderbird";
292c590ba9cb Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents: 607
diff changeset
1075
292c590ba9cb Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents: 607
diff changeset
1076 ProcessWaitDialog *waitDialog = new ProcessWaitDialog(this, pNames);
292c590ba9cb Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents: 607
diff changeset
1077
292c590ba9cb Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents: 607
diff changeset
1078 connect(waitDialog, SIGNAL(accepted()), this, SLOT(installCerts()));
292c590ba9cb Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents: 607
diff changeset
1079 connect(waitDialog, SIGNAL(accepted()), waitDialog, SLOT(deleteLater()));
292c590ba9cb Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents: 607
diff changeset
1080
292c590ba9cb Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents: 607
diff changeset
1081 waitDialog->exec();
292c590ba9cb Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents: 607
diff changeset
1082 return;
292c590ba9cb Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents: 607
diff changeset
1083 }
654
129e611eaf50 Merge branch trustbridge-refactor
Andre Heinecke <andre.heinecke@intevation.de>
parents: 609 653
diff changeset
1084
584
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
1085 void MainWindow::togglePages(int button)
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
1086 {
657
37ffc8ddb698 Fix merge errors
Andre Heinecke <andre.heinecke@intevation.de>
parents: 656
diff changeset
1087 mUpdatesPanel->hide();
584
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
1088 mInstallPanel->hide();
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
1089 mRemovePanel->hide();
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
1090 mInfoPanel->hide();
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
1091 switch(button) {
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
1092 case 0: mUpdatesPanel->show(); break;
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
1093 case 1: mInstallPanel->show(); break;
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
1094 case 2: mRemovePanel->show(); break;
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
1095 case 3: mInfoPanel->show(); break;
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
1096 default: mUpdatesPanel->show(); break;
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
1097 }
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
1098 return;
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
1099 }
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
1100
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
1101 void MainWindow::toggleUpdatesNew() {
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
1102 if (!mUpdatesNew->isVisible()) {
659
c7405d526ead (UI) Updated English strings.
Emanuel Schuetze <emanuel@intevation.de>
parents: 657
diff changeset
1103 mUpdatesDetailsNew->setText(tr("Hide details"));
584
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
1104 mUpdatesNew->show();
653
39f03316f675 Change button text when toggling details and select the first list item.
Raimund Renkert <rrenkert@intevation.de>
parents: 652
diff changeset
1105 mUpdatesNew->setSelected(0);
584
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
1106 }
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
1107 else {
653
39f03316f675 Change button text when toggling details and select the first list item.
Raimund Renkert <rrenkert@intevation.de>
parents: 652
diff changeset
1108 mUpdatesNew->hide();
659
c7405d526ead (UI) Updated English strings.
Emanuel Schuetze <emanuel@intevation.de>
parents: 657
diff changeset
1109 mUpdatesDetailsNew->setText(tr("Show details"));
653
39f03316f675 Change button text when toggling details and select the first list item.
Raimund Renkert <rrenkert@intevation.de>
parents: 652
diff changeset
1110 QSize old = mUpdatesWidget->size();
584
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
1111 mUpdatesWidget->resize(old.width(), old.height() - mUpdatesNew->height());
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
1112 }
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
1113 }
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
1114
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
1115 void MainWindow::toggleUpdatesRemove() {
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
1116 if (!mUpdatesRemove->isVisible()) {
659
c7405d526ead (UI) Updated English strings.
Emanuel Schuetze <emanuel@intevation.de>
parents: 657
diff changeset
1117 mUpdatesDetailsRemove->setText(tr("Hide details"));
584
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
1118 mUpdatesRemove->show();
653
39f03316f675 Change button text when toggling details and select the first list item.
Raimund Renkert <rrenkert@intevation.de>
parents: 652
diff changeset
1119 mUpdatesRemove->setSelected(0);
584
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
1120 }
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
1121 else {
653
39f03316f675 Change button text when toggling details and select the first list item.
Raimund Renkert <rrenkert@intevation.de>
parents: 652
diff changeset
1122 mUpdatesRemove->hide();
659
c7405d526ead (UI) Updated English strings.
Emanuel Schuetze <emanuel@intevation.de>
parents: 657
diff changeset
1123 mUpdatesDetailsRemove->setText(tr("Show details"));
653
39f03316f675 Change button text when toggling details and select the first list item.
Raimund Renkert <rrenkert@intevation.de>
parents: 652
diff changeset
1124 QSize old = mUpdatesWidget->size();
584
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
1125 mUpdatesWidget->resize(old.width(), old.height() - mUpdatesRemove->height());
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
1126 }
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
1127 }
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
1128
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
1129 void MainWindow::toggleUpdatesManual() {
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
1130 if (!mUpdatesManual->isVisible()) {
659
c7405d526ead (UI) Updated English strings.
Emanuel Schuetze <emanuel@intevation.de>
parents: 657
diff changeset
1131 mUpdatesDetailsManual->setText(tr("Hide details"));
584
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
1132 mUpdatesManual->show();
653
39f03316f675 Change button text when toggling details and select the first list item.
Raimund Renkert <rrenkert@intevation.de>
parents: 652
diff changeset
1133 mUpdatesManual->setSelected(0);
584
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
1134 }
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
1135 else {
659
c7405d526ead (UI) Updated English strings.
Emanuel Schuetze <emanuel@intevation.de>
parents: 657
diff changeset
1136 mUpdatesDetailsManual->setText(tr("Show details"));
653
39f03316f675 Change button text when toggling details and select the first list item.
Raimund Renkert <rrenkert@intevation.de>
parents: 652
diff changeset
1137 mUpdatesManual->hide();
39f03316f675 Change button text when toggling details and select the first list item.
Raimund Renkert <rrenkert@intevation.de>
parents: 652
diff changeset
1138 QSize old = mUpdatesWidget->size();
640
626507197360 Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents: 628
diff changeset
1139 mUpdatesWidget->resize(old.width(), old.height() - mUpdatesManual->height());
584
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
1140 }
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
1141 }
690
e4abb41484a0 (issue 27)Only close if no new list is available
Andre Heinecke <andre.heinecke@intevation.de>
parents: 689
diff changeset
1142
e4abb41484a0 (issue 27)Only close if no new list is available
Andre Heinecke <andre.heinecke@intevation.de>
parents: 689
diff changeset
1143 void MainWindow::closeEvent(QCloseEvent *event)
e4abb41484a0 (issue 27)Only close if no new list is available
Andre Heinecke <andre.heinecke@intevation.de>
parents: 689
diff changeset
1144 {
e4abb41484a0 (issue 27)Only close if no new list is available
Andre Heinecke <andre.heinecke@intevation.de>
parents: 689
diff changeset
1145 if (getState() == NewListAvailable) {
e4abb41484a0 (issue 27)Only close if no new list is available
Andre Heinecke <andre.heinecke@intevation.de>
parents: 689
diff changeset
1146 /* Only minimize to tray if there is a new list */
e4abb41484a0 (issue 27)Only close if no new list is available
Andre Heinecke <andre.heinecke@intevation.de>
parents: 689
diff changeset
1147 QMainWindow::closeEvent(event);
e4abb41484a0 (issue 27)Only close if no new list is available
Andre Heinecke <andre.heinecke@intevation.de>
parents: 689
diff changeset
1148 return;
e4abb41484a0 (issue 27)Only close if no new list is available
Andre Heinecke <andre.heinecke@intevation.de>
parents: 689
diff changeset
1149 }
e4abb41484a0 (issue 27)Only close if no new list is available
Andre Heinecke <andre.heinecke@intevation.de>
parents: 689
diff changeset
1150 return closeApp();
e4abb41484a0 (issue 27)Only close if no new list is available
Andre Heinecke <andre.heinecke@intevation.de>
parents: 689
diff changeset
1151 }

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