annotate ui/mainwindow.cpp @ 584:ebfe1128ee97 trustbridge-refactor

Started trustbridge mainwindow refactoring.
author Raimund Renkert <rrenkert@intevation.de>
date Tue, 27 May 2014 16:25:33 +0200
parents aee3eb10bbba
children 3a9c0f38bbad
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
9af6198deb8e Add timed trigger for the message
Andre Heinecke <aheinecke@intevation.de>
parents: 17
diff changeset
32 // 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
33 // something to say
548
c84dc8f6d017 Increase nag interval to 70 minutes
Andre Heinecke <aheinecke@intevation.de>
parents: 531
diff changeset
34 #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
35
409
09bb19e5e369 Remove m13 mentions and change test certificate to intevation.de
Andre Heinecke <aheinecke@intevation.de>
parents: 407
diff changeset
36 #ifndef APPNAME
09bb19e5e369 Remove m13 mentions and change test certificate to intevation.de
Andre Heinecke <aheinecke@intevation.de>
parents: 407
diff changeset
37 #define APPNAME "TrustBridge"
09bb19e5e369 Remove m13 mentions and change test certificate to intevation.de
Andre Heinecke <aheinecke@intevation.de>
parents: 407
diff changeset
38 #endif
09bb19e5e369 Remove m13 mentions and change test certificate to intevation.de
Andre Heinecke <aheinecke@intevation.de>
parents: 407
diff changeset
39
09bb19e5e369 Remove m13 mentions and change test certificate to intevation.de
Andre Heinecke <aheinecke@intevation.de>
parents: 407
diff changeset
40 #define SERVER_URL "https://files.intevation.de:443"
531
dec797c7230c Fix usage of OU / O
Andre Heinecke <aheinecke@intevation.de>
parents: 525
diff changeset
41 #define LIST_RESOURCE "/users/aheinecke/zertifikatsliste.txt"
554
d512d8eef8f6 Use case sensitive file name for SW-Updates
Andre Heinecke <aheinecke@intevation.de>
parents: 551
diff changeset
42 #define SW_RESOURCE "/users/aheinecke/TrustBridge.exe"
486
fa56a9403939 Lookup the last modified date for software installer after first installation.
Raimund Renkert <rrenkert@intevation.de>
parents: 481
diff changeset
43 #ifdef Q_OS_WIN
554
d512d8eef8f6 Use case sensitive file name for SW-Updates
Andre Heinecke <aheinecke@intevation.de>
parents: 551
diff changeset
44 #define SW_RESOURCE_VERSION "/users/aheinecke/TrustBridge-%1.exe"
486
fa56a9403939 Lookup the last modified date for software installer after first installation.
Raimund Renkert <rrenkert@intevation.de>
parents: 481
diff changeset
45 #else
554
d512d8eef8f6 Use case sensitive file name for SW-Updates
Andre Heinecke <aheinecke@intevation.de>
parents: 551
diff changeset
46 #define SW_RESOURCE_VERSION "/users/aheinecke/TrustBridge-%1.sh"
486
fa56a9403939 Lookup the last modified date for software installer after first installation.
Raimund Renkert <rrenkert@intevation.de>
parents: 481
diff changeset
47 #endif
72
7e304573ebd1 Add some testing hacks for interactive testing
Andre Heinecke <aheinecke@intevation.de>
parents: 71
diff changeset
48
7
992c0ec57660 Add unit tests make CertificateList work.
Andre Heinecke <aheinecke@intevation.de>
parents: 2
diff changeset
49 #include "certificatelist.h"
10
fe39d93f1261 Start on Downloader component
Andre Heinecke <aheinecke@intevation.de>
parents: 7
diff changeset
50 #include "downloader.h"
191
246c21b1727f Show the help dialog.
Raimund Renkert <rrenkert@intevation.de>
parents: 189
diff changeset
51 #include "helpdialog.h"
200
fe424c5fc875 Show the about dialog.
Raimund Renkert <rrenkert@intevation.de>
parents: 191
diff changeset
52 #include "aboutdialog.h"
267
89e8783866f8 Use the certificate item delegate in the mainwind list view.
Raimund Renkert <rrenkert@intevation.de>
parents: 265
diff changeset
53 #include "certificateitemdelegate.h"
274
90432cb1f374 Added a separator to certificate list to demonstrate how it works.
Raimund Renkert <rrenkert@intevation.de>
parents: 271
diff changeset
54 #include "separatoritemdelegate.h"
365
75f7288ad67b Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents: 274
diff changeset
55 #include "installwrapper.h"
507
20973a56d5ec Use is_admin to determine if UAC icon should be painted on the button
Andre Heinecke <aheinecke@intevation.de>
parents: 499
diff changeset
56 #include "util.h"
551
15121735805e Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents: 548
diff changeset
57 #include "logging.h"
7
992c0ec57660 Add unit tests make CertificateList work.
Andre Heinecke <aheinecke@intevation.de>
parents: 2
diff changeset
58
365
75f7288ad67b Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents: 274
diff changeset
59 MainWindow::MainWindow(bool trayMode):
75f7288ad67b Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents: 274
diff changeset
60 mTrayMode(trayMode)
75f7288ad67b Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents: 274
diff changeset
61 {
0
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
62 createActions();
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
63 createTrayIcon();
187
0c06a608e15f Create the mainwindow content.
Raimund Renkert <rrenkert@intevation.de>
parents: 155
diff changeset
64 createContent();
450
4932fc33ee82 Updated window and main layout size.
Raimund Renkert <rrenkert@intevation.de>
parents: 449
diff changeset
65 resize(950, 540);
45
c6125d73faf4 Move SSLConnection into it's own class
Andre Heinecke <aheinecke@intevation.de>
parents: 31
diff changeset
66 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
67 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
68
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
69 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
70 this, SLOT(iconActivated(QSystemTrayIcon::ActivationReason)));
19
9af6198deb8e Add timed trigger for the message
Andre Heinecke <aheinecke@intevation.de>
parents: 17
diff changeset
71
9af6198deb8e Add timed trigger for the message
Andre Heinecke <aheinecke@intevation.de>
parents: 17
diff changeset
72 mMessageTimer = new QTimer(this);
9af6198deb8e Add timed trigger for the message
Andre Heinecke <aheinecke@intevation.de>
parents: 17
diff changeset
73 connect(mMessageTimer, SIGNAL(timeout()), this, SLOT(showMessage()));
9af6198deb8e Add timed trigger for the message
Andre Heinecke <aheinecke@intevation.de>
parents: 17
diff changeset
74 mMessageTimer->setInterval(NAG_INTERVAL_MINUTES * 60 * 1000);
9af6198deb8e Add timed trigger for the message
Andre Heinecke <aheinecke@intevation.de>
parents: 17
diff changeset
75 mMessageTimer->start();
71
f22a99f7cb69 Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents: 45
diff changeset
76 checkUpdates();
389
3be838c3e4d8 Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 375
diff changeset
77 loadUnselectedCertificates();
3be838c3e4d8 Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 375
diff changeset
78 loadCertificateList();
365
75f7288ad67b Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents: 274
diff changeset
79 if (!trayMode) {
75f7288ad67b Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents: 274
diff changeset
80 show();
75f7288ad67b Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents: 274
diff changeset
81 }
0
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
82 }
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
83
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
84 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
85 {
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
86 switch (reason) {
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
87 case QSystemTrayIcon::Trigger:
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
88 case QSystemTrayIcon::MiddleClick:
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
89 showMessage();
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
90 break;
16
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 11
diff changeset
91 case QSystemTrayIcon::DoubleClick:
365
75f7288ad67b Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents: 274
diff changeset
92 show();
16
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 11
diff changeset
93 break;
0
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
94 default:
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
95 ;
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
96 }
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
97 }
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
98
71
f22a99f7cb69 Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents: 45
diff changeset
99 void MainWindow::messageClicked()
f22a99f7cb69 Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents: 45
diff changeset
100 {
f22a99f7cb69 Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents: 45
diff changeset
101 if (mCurState == NewListAvailable) {
365
75f7288ad67b Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents: 274
diff changeset
102 show();
71
f22a99f7cb69 Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents: 45
diff changeset
103 }
551
15121735805e Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents: 548
diff changeset
104
15121735805e Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents: 548
diff changeset
105 if (mCurState == NewSoftwareAvailable) {
15121735805e Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents: 548
diff changeset
106 checkUpdates(true);
15121735805e Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents: 548
diff changeset
107 mCurState = DownloadingSW;
15121735805e Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents: 548
diff changeset
108 }
71
f22a99f7cb69 Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents: 45
diff changeset
109 }
f22a99f7cb69 Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents: 45
diff changeset
110
0
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
111 void MainWindow::showMessage()
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
112 {
365
75f7288ad67b Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents: 274
diff changeset
113 if (!isVisible() && !mCurMessage.isEmpty()) {
16
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 11
diff changeset
114 mTrayIcon->showMessage(QApplication::applicationName(), mCurMessage,
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 11
diff changeset
115 QSystemTrayIcon::Information, 5000);
19
9af6198deb8e Add timed trigger for the message
Andre Heinecke <aheinecke@intevation.de>
parents: 17
diff changeset
116 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
117 }
0
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
118 }
16
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 11
diff changeset
119
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 11
diff changeset
120 void MainWindow::verifyAvailableData()
0
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
121 {
389
3be838c3e4d8 Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 375
diff changeset
122 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
123 QString installedFileName = mSettings.value("List/installed").toString();
16
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 11
diff changeset
124 QString swFileName = mSettings.value("Software/available").toString();
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 11
diff changeset
125
389
3be838c3e4d8 Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 375
diff changeset
126 if (!availableFileName.isEmpty()) {
3be838c3e4d8 Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 375
diff changeset
127 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
128 if (!mListToInstall.isValid()) {
82
1f27d6db5ee3 Polarssl based certificate handling
Andre Heinecke <aheinecke@intevation.de>
parents: 72
diff changeset
129 mCurState = TransferError;
16
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 11
diff changeset
130 // 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
131 // 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
132 // 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
133 QFile::remove(availableFileName);
16
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 11
diff changeset
134 mSettings.remove("List/available");
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 11
diff changeset
135 mSettings.remove("List/availableDate");
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 11
diff changeset
136 }
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 11
diff changeset
137 } else {
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 11
diff changeset
138 // 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
139 mSettings.remove("List/available");
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 11
diff changeset
140 mSettings.remove("List/availableDate");
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 11
diff changeset
141 }
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 11
diff changeset
142
389
3be838c3e4d8 Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 375
diff changeset
143 if (!installedFileName.isEmpty()) {
3be838c3e4d8 Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 375
diff changeset
144 mInstalledList.readList(installedFileName.toLocal8Bit().constData());
3be838c3e4d8 Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 375
diff changeset
145 if (!mInstalledList.isValid()) {
3be838c3e4d8 Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 375
diff changeset
146 // 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
147 // 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
148 // 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
149 QFile::remove(installedFileName);
3be838c3e4d8 Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 375
diff changeset
150 mSettings.remove("List/installed");
3be838c3e4d8 Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 375
diff changeset
151 mSettings.remove("List/installedDate");
3be838c3e4d8 Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 375
diff changeset
152 }
3be838c3e4d8 Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 375
diff changeset
153 } else {
3be838c3e4d8 Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 375
diff changeset
154 mSettings.remove("List/installed");
3be838c3e4d8 Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 375
diff changeset
155 mSettings.remove("List/installedDate");
3be838c3e4d8 Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 375
diff changeset
156 }
3be838c3e4d8 Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 375
diff changeset
157
16
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 11
diff changeset
158 if (!swFileName.isEmpty()) {
551
15121735805e Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents: 548
diff changeset
159 // TODO Verify integrity of the software
16
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 11
diff changeset
160 } else {
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 11
diff changeset
161 mSettings.remove("Software/available");
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 11
diff changeset
162 mSettings.remove("Software/availableDate");
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 11
diff changeset
163 }
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 11
diff changeset
164 }
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 void MainWindow::handleNewList(const QString& fileName, const QDateTime& modDate) {
71
f22a99f7cb69 Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents: 45
diff changeset
167 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
168 mSettings.setValue("List/availableDate", modDate);
16
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 11
diff changeset
169
71
f22a99f7cb69 Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents: 45
diff changeset
170 verifyAvailableData();
f22a99f7cb69 Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents: 45
diff changeset
171 if (!mListToInstall.isValid()) {
f22a99f7cb69 Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents: 45
diff changeset
172 /* 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
173 /* 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
174 * 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
175
f22a99f7cb69 Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents: 45
diff changeset
176 /* 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
177 QTimer::singleShot(600000 + (qrand() % 60000), this, SLOT(checkUpdates()));
82
1f27d6db5ee3 Polarssl based certificate handling
Andre Heinecke <aheinecke@intevation.de>
parents: 72
diff changeset
178 } else {
1f27d6db5ee3 Polarssl based certificate handling
Andre Heinecke <aheinecke@intevation.de>
parents: 72
diff changeset
179 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
180 setState(NewListAvailable);
1f27d6db5ee3 Polarssl based certificate handling
Andre Heinecke <aheinecke@intevation.de>
parents: 72
diff changeset
181 showMessage();
189
5f0d45ca9de4 Show certificates in the list view and details in the textfield.
Raimund Renkert <rrenkert@intevation.de>
parents: 187
diff changeset
182 loadCertificateList();
71
f22a99f7cb69 Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents: 45
diff changeset
183 }
16
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 11
diff changeset
184 }
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 11
diff changeset
185
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 11
diff changeset
186 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
187 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
188 "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
189 QApplication::applicationName());
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 11
diff changeset
190 setState(NewSoftwareAvailable);
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 11
diff changeset
191 mSettings.setValue("Software/available", fileName);
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 11
diff changeset
192 mSettings.setValue("Software/availableDate", modDate);
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 11
diff changeset
193
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 11
diff changeset
194 mSettings.sync();
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 11
diff changeset
195 showMessage();
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 11
diff changeset
196 }
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 11
diff changeset
197
551
15121735805e Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents: 548
diff changeset
198 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
199 QFileInfo instProcInfo = QFileInfo(fileName);
15121735805e Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents: 548
diff changeset
200 if (!instProcInfo.isExecutable()) {
15121735805e Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents: 548
diff changeset
201 qWarning() << "Downloaded file: " << fileName << " is not executable.";
15121735805e Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents: 548
diff changeset
202 setState(TransferError);
15121735805e Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents: 548
diff changeset
203 return;
15121735805e Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents: 548
diff changeset
204 }
563
aee3eb10bbba Add unit test for sw update execution and fix shell execute params
Andre Heinecke <aheinecke@intevation.de>
parents: 555
diff changeset
205 QString filePath = QDir::toNativeSeparators(instProcInfo.absoluteFilePath());
551
15121735805e Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents: 548
diff changeset
206 #ifdef WIN32
15121735805e Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents: 548
diff changeset
207 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
208 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
209 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
210
aee3eb10bbba Add unit test for sw update execution and fix shell execute params
Andre Heinecke <aheinecke@intevation.de>
parents: 555
diff changeset
211 shExecInfo.lpFile = reinterpret_cast<LPCWSTR> (filePath.utf16());
aee3eb10bbba Add unit test for sw update execution and fix shell execute params
Andre Heinecke <aheinecke@intevation.de>
parents: 555
diff changeset
212
aee3eb10bbba Add unit test for sw update execution and fix shell execute params
Andre Heinecke <aheinecke@intevation.de>
parents: 555
diff changeset
213 shExecInfo.fMask = SEE_MASK_NOASYNC;
551
15121735805e Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents: 548
diff changeset
214
15121735805e Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents: 548
diff changeset
215 if (!is_admin()) {
15121735805e Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents: 548
diff changeset
216 shExecInfo.lpVerb = L"open";
15121735805e Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents: 548
diff changeset
217 } else {
15121735805e Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents: 548
diff changeset
218 shExecInfo.lpVerb = L"runas";
15121735805e Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents: 548
diff changeset
219 }
15121735805e Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents: 548
diff changeset
220
563
aee3eb10bbba Add unit test for sw update execution and fix shell execute params
Andre Heinecke <aheinecke@intevation.de>
parents: 555
diff changeset
221 qDebug() << "Starting process: " << filePath;
551
15121735805e Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents: 548
diff changeset
222
15121735805e Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents: 548
diff changeset
223 if (!ShellExecuteExW(&shExecInfo)) {
15121735805e Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents: 548
diff changeset
224 /* 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
225 char* errmsg = getLastErrorMsg();
15121735805e Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents: 548
diff changeset
226 QString qerrmsg = QString::fromUtf8(errmsg);
15121735805e Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents: 548
diff changeset
227 free(errmsg);
15121735805e Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents: 548
diff changeset
228 qDebug() << "Failed to start process: " << qerrmsg;
15121735805e Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents: 548
diff changeset
229 setState(NewSoftwareAvailable);
15121735805e Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents: 548
diff changeset
230 return;
15121735805e Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents: 548
diff changeset
231 }
15121735805e Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents: 548
diff changeset
232 #else /* WIN32 */
563
aee3eb10bbba Add unit test for sw update execution and fix shell execute params
Andre Heinecke <aheinecke@intevation.de>
parents: 555
diff changeset
233 qDebug() << "Starting process " << filePath;
551
15121735805e Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents: 548
diff changeset
234
563
aee3eb10bbba Add unit test for sw update execution and fix shell execute params
Andre Heinecke <aheinecke@intevation.de>
parents: 555
diff changeset
235 if (!QProcess::startDetached(filePath)) {
551
15121735805e Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents: 548
diff changeset
236 qDebug() << "Failed to start process.";
15121735805e Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents: 548
diff changeset
237 return;
15121735805e Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents: 548
diff changeset
238 }
15121735805e Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents: 548
diff changeset
239 #endif
15121735805e Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents: 548
diff changeset
240 /* Installer process should now be running. We exit */
15121735805e Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents: 548
diff changeset
241
15121735805e Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents: 548
diff changeset
242 closeApp();
15121735805e Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents: 548
diff changeset
243 }
15121735805e Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents: 548
diff changeset
244
461
1ce835c40eb7 Ask the user if software updates should be installed.
Raimund Renkert <rrenkert@intevation.de>
parents: 456
diff changeset
245 void MainWindow::checkUpdates(bool downloadSW)
16
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 verifyAvailableData();
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 11
diff changeset
248
551
15121735805e Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents: 548
diff changeset
249 if (!mSettings.contains("Software/installedDate") ||
15121735805e Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents: 548
diff changeset
250 mSettings.value("Software/installedVersion").toString() != QApplication::applicationVersion()) {
15121735805e Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents: 548
diff changeset
251 /* 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
252 * been installed */
15121735805e Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents: 548
diff changeset
253 getLastModForCurrentVersion();
486
fa56a9403939 Lookup the last modified date for software installer after first installation.
Raimund Renkert <rrenkert@intevation.de>
parents: 481
diff changeset
254 return;
fa56a9403939 Lookup the last modified date for software installer after first installation.
Raimund Renkert <rrenkert@intevation.de>
parents: 481
diff changeset
255 }
17
c12825a651ed Read out content-length and use this to skip existing files
Andre Heinecke <aheinecke@intevation.de>
parents: 16
diff changeset
256 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
257 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
258
389
3be838c3e4d8 Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 375
diff changeset
259 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
260 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
261
3be838c3e4d8 Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 375
diff changeset
262 #ifndef RELEASE_BUILD
3be838c3e4d8 Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 375
diff changeset
263 /* 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
264 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
265 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
266 #endif
3be838c3e4d8 Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 375
diff changeset
267
3be838c3e4d8 Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 375
diff changeset
268
72
7e304573ebd1 Add some testing hacks for interactive testing
Andre Heinecke <aheinecke@intevation.de>
parents: 71
diff changeset
269 Downloader* downloader = new Downloader(this,
7e304573ebd1 Add some testing hacks for interactive testing
Andre Heinecke <aheinecke@intevation.de>
parents: 71
diff changeset
270 QString::fromLatin1(SERVER_URL),
7e304573ebd1 Add some testing hacks for interactive testing
Andre Heinecke <aheinecke@intevation.de>
parents: 71
diff changeset
271 QByteArray(),
551
15121735805e Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents: 548
diff changeset
272 swInstalledLastMod,
72
7e304573ebd1 Add some testing hacks for interactive testing
Andre Heinecke <aheinecke@intevation.de>
parents: 71
diff changeset
273 listInstalledLastMod,
437
4b486a14252f Acutally use the values that can be taken from the config
Andre Heinecke <aheinecke@intevation.de>
parents: 434
diff changeset
274 swResource,
461
1ce835c40eb7 Ask the user if software updates should be installed.
Raimund Renkert <rrenkert@intevation.de>
parents: 456
diff changeset
275 listResource,
1ce835c40eb7 Ask the user if software updates should be installed.
Raimund Renkert <rrenkert@intevation.de>
parents: 456
diff changeset
276 downloadSW);
17
c12825a651ed Read out content-length and use this to skip existing files
Andre Heinecke <aheinecke@intevation.de>
parents: 16
diff changeset
277
16
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 11
diff changeset
278 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
279 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
280 if (!downloadSW) {
1ce835c40eb7 Ask the user if software updates should be installed.
Raimund Renkert <rrenkert@intevation.de>
parents: 456
diff changeset
281 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
282 this, SLOT(handleNewSW(const QString&, const QDateTime&)));
15121735805e Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents: 548
diff changeset
283 } else {
15121735805e Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents: 548
diff changeset
284 connect(downloader, SIGNAL(newSoftwareAvailable(const QString&, const QDateTime&)),
15121735805e Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents: 548
diff changeset
285 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
286 }
551
15121735805e Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents: 548
diff changeset
287
16
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 11
diff changeset
288 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
289 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
290 this, SLOT(downloaderError(const QString &, SSLConnection::ErrorCode)));
10
fe39d93f1261 Start on Downloader component
Andre Heinecke <aheinecke@intevation.de>
parents: 7
diff changeset
291 downloader->start();
0
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
292 }
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
293
551
15121735805e Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents: 548
diff changeset
294 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
295 {
fa56a9403939 Lookup the last modified date for software installer after first installation.
Raimund Renkert <rrenkert@intevation.de>
parents: 481
diff changeset
296 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
297 QApplication::applicationVersion());
fa56a9403939 Lookup the last modified date for software installer after first installation.
Raimund Renkert <rrenkert@intevation.de>
parents: 481
diff changeset
298 qDebug() << softwareVersion;
fa56a9403939 Lookup the last modified date for software installer after first installation.
Raimund Renkert <rrenkert@intevation.de>
parents: 481
diff changeset
299 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
300 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
301 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
302 QByteArray(),
fa56a9403939 Lookup the last modified date for software installer after first installation.
Raimund Renkert <rrenkert@intevation.de>
parents: 481
diff changeset
303 QDateTime::currentDateTime(),
fa56a9403939 Lookup the last modified date for software installer after first installation.
Raimund Renkert <rrenkert@intevation.de>
parents: 481
diff changeset
304 QDateTime::currentDateTime(),
fa56a9403939 Lookup the last modified date for software installer after first installation.
Raimund Renkert <rrenkert@intevation.de>
parents: 481
diff changeset
305 softwareVersion,
fa56a9403939 Lookup the last modified date for software installer after first installation.
Raimund Renkert <rrenkert@intevation.de>
parents: 481
diff changeset
306 listResource,
fa56a9403939 Lookup the last modified date for software installer after first installation.
Raimund Renkert <rrenkert@intevation.de>
parents: 481
diff changeset
307 false);
fa56a9403939 Lookup the last modified date for software installer after first installation.
Raimund Renkert <rrenkert@intevation.de>
parents: 481
diff changeset
308 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
309 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
310 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
311 connect(downloader, SIGNAL(lastModifiedDate(const QDateTime&)),
551
15121735805e Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents: 548
diff changeset
312 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
313
fa56a9403939 Lookup the last modified date for software installer after first installation.
Raimund Renkert <rrenkert@intevation.de>
parents: 481
diff changeset
314 downloader->start();
fa56a9403939 Lookup the last modified date for software installer after first installation.
Raimund Renkert <rrenkert@intevation.de>
parents: 481
diff changeset
315 }
fa56a9403939 Lookup the last modified date for software installer after first installation.
Raimund Renkert <rrenkert@intevation.de>
parents: 481
diff changeset
316
551
15121735805e Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents: 548
diff changeset
317 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
318 {
fa56a9403939 Lookup the last modified date for software installer after first installation.
Raimund Renkert <rrenkert@intevation.de>
parents: 481
diff changeset
319 mSettings.beginGroup("Software");
fa56a9403939 Lookup the last modified date for software installer after first installation.
Raimund Renkert <rrenkert@intevation.de>
parents: 481
diff changeset
320 mSettings.setValue("installedDate", date);
551
15121735805e Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents: 548
diff changeset
321 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
322 mSettings.endGroup();
fa56a9403939 Lookup the last modified date for software installer after first installation.
Raimund Renkert <rrenkert@intevation.de>
parents: 481
diff changeset
323 checkUpdates();
fa56a9403939 Lookup the last modified date for software installer after first installation.
Raimund Renkert <rrenkert@intevation.de>
parents: 481
diff changeset
324 }
fa56a9403939 Lookup the last modified date for software installer after first installation.
Raimund Renkert <rrenkert@intevation.de>
parents: 481
diff changeset
325
45
c6125d73faf4 Move SSLConnection into it's own class
Andre Heinecke <aheinecke@intevation.de>
parents: 31
diff changeset
326 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
327 {
551
15121735805e Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents: 548
diff changeset
328 /* 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
329 mCurMessage = message;
27
62cd56cea09b Start on polarssl Downloader.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 19
diff changeset
330 showMessage();
551
15121735805e Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents: 548
diff changeset
331 setState(TransferError);
16
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 11
diff changeset
332 }
225a5ec20dad Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents: 11
diff changeset
333
0
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
334 void MainWindow::createActions()
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
335 {
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
336 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
337 connect(mCheckUpdates, SIGNAL(triggered()), this, SLOT(checkUpdates()));
2
cf88cc432b9d Add quit action
Andre Heinecke <aheinecke@intevation.de>
parents: 0
diff changeset
338 mQuitAction = new QAction(tr("Quit"), this);
cf88cc432b9d Add quit action
Andre Heinecke <aheinecke@intevation.de>
parents: 0
diff changeset
339 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
340 }
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
341
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
342 void MainWindow::createTrayIcon()
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
343 {
11
7e2f14c7aba2 Split up downloader component and further implement it
Andre Heinecke <aheinecke@intevation.de>
parents: 10
diff changeset
344 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
345
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
346 mTrayMenu = new QMenu(this);
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
347 mTrayMenu->addAction(mCheckUpdates);
2
cf88cc432b9d Add quit action
Andre Heinecke <aheinecke@intevation.de>
parents: 0
diff changeset
348 mTrayMenu->addAction(mQuitAction);
0
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
349
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
350 mTrayIcon = new QSystemTrayIcon(this);
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
351 mTrayIcon->setContextMenu(mTrayMenu);
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
352
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
353 mTrayIcon->setIcon(trayImg);
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
354 setWindowIcon(trayImg);
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
355 mTrayIcon->show();
407
af53c40e74b1 Rename m13ui to TrustBridge
Andre Heinecke <aheinecke@intevation.de>
parents: 404
diff changeset
356 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
357
f22a99f7cb69 Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents: 45
diff changeset
358 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
359 }
155
c0fdb8d336cf Added menubar/menu and method stubs to mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents: 82
diff changeset
360
187
0c06a608e15f Create the mainwindow content.
Raimund Renkert <rrenkert@intevation.de>
parents: 155
diff changeset
361 void MainWindow::createContent()
0c06a608e15f Create the mainwindow content.
Raimund Renkert <rrenkert@intevation.de>
parents: 155
diff changeset
362 {
0c06a608e15f Create the mainwindow content.
Raimund Renkert <rrenkert@intevation.de>
parents: 155
diff changeset
363 // Create a central widget containing the main layout.
0c06a608e15f Create the mainwindow content.
Raimund Renkert <rrenkert@intevation.de>
parents: 155
diff changeset
364 QWidget *base = new QWidget;
0c06a608e15f Create the mainwindow content.
Raimund Renkert <rrenkert@intevation.de>
parents: 155
diff changeset
365
250
1e112cf41e92 Updated the mainwindow layout.
Raimund Renkert <rrenkert@intevation.de>
parents: 249
diff changeset
366 // Layouts and Container
584
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
367 QVBoxLayout *mainLayout = new QVBoxLayout;
205
a3f542bf38f7 Added header for mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents: 200
diff changeset
368 QHBoxLayout *headerLayout = new QHBoxLayout;
a3f542bf38f7 Added header for mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents: 200
diff changeset
369 QVBoxLayout *headerTextLayout = new QVBoxLayout;
584
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
370 QHBoxLayout *centerLayout = new QHBoxLayout;
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
371 QVBoxLayout *buttonBarLayout = new QVBoxLayout;
271
1ae15ea73850 Some GUI desing and layout changes.
Raimund Renkert <rrenkert@intevation.de>
parents: 267
diff changeset
372 QHBoxLayout *bottomLayout = new QHBoxLayout;
584
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
373 QHBoxLayout *containerLayout = new QHBoxLayout;
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
374 QVBoxLayout *updatesPanelLayout = new QVBoxLayout;
187
0c06a608e15f Create the mainwindow content.
Raimund Renkert <rrenkert@intevation.de>
parents: 155
diff changeset
375
584
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
376 // The header (icon, about text)
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
377 QImage *logoImage = new QImage(":/img/logo.png");
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
378 QLabel *logo = new QLabel;
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
379 logo->setBackgroundRole(QPalette::Base);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
380 logo->setPixmap(QPixmap::fromImage(*logoImage));
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
381 QLabel *title = new QLabel("<h1>" + QString::fromLatin1(APPNAME) + "</h1>");
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
382 QLabel *subTitle = new QLabel("This Software installs and removes Certificates");
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
383 headerTextLayout->addWidget(title);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
384 headerTextLayout->addWidget(subTitle);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
385 headerLayout->addWidget(logo);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
386 headerLayout->addLayout(headerTextLayout);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
387 headerLayout->setStretch(0, 0);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
388 headerLayout->setStretch(1, 10);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
389
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
390 // Buttonbar
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
391 mButtonGroup = new QButtonGroup;
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
392
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
393 QToolButton *updatesButton = new QToolButton;
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
394 updatesButton->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
395 updatesButton->setIcon(QIcon(":/img/view-refresh.png"));
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
396 updatesButton->setIconSize(QSize(32, 32));
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
397 updatesButton->setText(tr("Updates"));
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
398 updatesButton->setFixedWidth(90);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
399 updatesButton->setFixedHeight(70);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
400 updatesButton->setCheckable(true);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
401 updatesButton->setChecked(true);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
402
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
403 QToolButton *allInstallButton = new QToolButton;
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
404 allInstallButton->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
405 allInstallButton->setIcon(QIcon(":/img/document-encrypt.png"));
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
406 allInstallButton->setIconSize(QSize(32, 32));
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
407 allInstallButton->setText(tr("Trusted\nCertificates"));
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
408 allInstallButton->setFixedWidth(90);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
409 allInstallButton->setFixedHeight(70);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
410 allInstallButton->setCheckable(true);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
411
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
412 QToolButton *allRemoveButton = new QToolButton;
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
413 allRemoveButton->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
414 allRemoveButton->setIcon(QIcon(":/img/task-attempt.png"));
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
415 allRemoveButton->setIconSize(QSize(32, 32));
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
416 allRemoveButton->setText(tr("Insecure\nCertificates"));
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
417 allRemoveButton->setFixedWidth(90);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
418 allRemoveButton->setFixedHeight(70);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
419 allRemoveButton->setCheckable(true);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
420
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
421 QToolButton *infoButton = new QToolButton;
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
422 infoButton->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
423 infoButton->setIcon(QIcon(":/img/dialog-information.png"));
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
424 infoButton->setIconSize(QSize(32, 32));
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
425 infoButton->setText(tr("Information"));
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
426 infoButton->setFixedWidth(90);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
427 infoButton->setFixedHeight(70);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
428 infoButton->setCheckable(true);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
429
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
430 mButtonGroup->addButton(updatesButton);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
431 mButtonGroup->addButton(allInstallButton);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
432 mButtonGroup->addButton(allRemoveButton);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
433 mButtonGroup->addButton(infoButton);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
434 mButtonGroup->setId(updatesButton, 0);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
435 mButtonGroup->setId(allInstallButton, 1);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
436 mButtonGroup->setId(allRemoveButton, 2);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
437 mButtonGroup->setId(infoButton, 3);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
438
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
439 connect(mButtonGroup, SIGNAL(buttonClicked(int)),
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
440 this, SLOT(togglePages(int)));
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
441 buttonBarLayout->addWidget(updatesButton);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
442 buttonBarLayout->addWidget(allInstallButton);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
443 buttonBarLayout->addWidget(allRemoveButton);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
444 buttonBarLayout->insertStretch(3, 10);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
445 buttonBarLayout->addWidget(infoButton);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
446
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
447 //The main panels.
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
448 //The updates page.
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
449 mUpdatesPanel = new QScrollArea;
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
450 mUpdatesWidget = new QWidget;
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
451 QHBoxLayout *updatesHeaderLayout = new QHBoxLayout;
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
452 QVBoxLayout *updatesHeaderTextLayout = new QVBoxLayout;
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
453 QVBoxLayout *updatesHeaderSettLayout = new QVBoxLayout;
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
454
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
455 QLabel *updatesHeader =
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
456 new QLabel("<h2>" + tr("Updates (%1/%2)").arg(2).arg(4)+ "</h2>");
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
457 QLabel *lastCertUpdate =
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
458 new QLabel(tr("Last certificate update: %1").arg("today"));
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
459 QLabel *lastSWupdate =
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
460 new QLabel(tr("Last Software update: %1").arg("today"));
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
461 updatesHeaderTextLayout->addWidget(updatesHeader);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
462 updatesHeaderTextLayout->addWidget(lastCertUpdate);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
463 updatesHeaderTextLayout->addWidget(lastSWupdate);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
464
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
465 QPushButton *searchUpdates = new QPushButton(tr("Search for Updates"));
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
466 updatesHeaderSettLayout->insertStretch(0, 10);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
467 updatesHeaderSettLayout->addWidget(searchUpdates);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
468 updatesHeaderLayout->addLayout(updatesHeaderTextLayout);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
469 updatesHeaderLayout->insertStretch(1, 10);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
470 updatesHeaderLayout->addLayout(updatesHeaderSettLayout);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
471
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
472 QVBoxLayout *updatesCenterLayout = new QVBoxLayout;
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
473 QHBoxLayout *updatesNewLayout = new QHBoxLayout;
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
474 QHBoxLayout *updatesRemoveLayout = new QHBoxLayout;
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
475 QHBoxLayout *updatesManualLayout = new QHBoxLayout;
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
476 QLabel *updatesTip =
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
477 new QLabel(tr("The following certificate changes are recommended."));
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
478 QLabel *updatesNewCertificates =
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
479 new QLabel("<h3>" +
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
480 tr("Install new Certificates (%1/%2)").arg(2).arg(2) +
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
481 "</h3>");
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
482 QPushButton *updatesDetailsNew = new QPushButton(tr("Details"));
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
483 connect(updatesDetailsNew,
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
484 SIGNAL(clicked()),
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
485 this,
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
486 SLOT(toggleUpdatesNew()));
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
487 updatesNewLayout->addWidget(updatesNewCertificates);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
488 updatesNewLayout->addWidget(updatesDetailsNew);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
489 updatesNewLayout->insertStretch(2, 10);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
490 mUpdatesNew = new CertificateListWidget(this);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
491 mUpdatesNew->hide();
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
492
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
493 QLabel *updatesRemoveCertificates =
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
494 new QLabel("<h3>" +
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
495 tr("Remove insecure Certificates (%1/%2)").arg(2).arg(2) +
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
496 "</h3>");
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
497 QPushButton *updatesDetailsRemove = new QPushButton(tr("Details"));
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
498 connect(updatesDetailsRemove,
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
499 SIGNAL(clicked()),
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
500 this,
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
501 SLOT(toggleUpdatesRemove()));
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
502 updatesRemoveLayout->addWidget(updatesRemoveCertificates);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
503 updatesRemoveLayout->addWidget(updatesDetailsRemove);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
504 updatesRemoveLayout->insertStretch(2, 10);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
505 mUpdatesRemove = new CertificateListWidget(this);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
506 mUpdatesRemove->hide();
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
507
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
508 QLabel *updatesManualCertificates =
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
509 new QLabel("<h3>" +
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
510 tr("Manualy changed Certificates (%1)").arg(2) +
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
511 "</h3>");
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
512 QPushButton *updatesDetailsManual = new QPushButton(tr("Details"));
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
513 connect(updatesDetailsManual,
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
514 SIGNAL(clicked()),
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
515 this,
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
516 SLOT(toggleUpdatesManual()));
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
517 updatesManualLayout->addWidget(updatesManualCertificates);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
518 updatesManualLayout->addWidget(updatesDetailsManual);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
519 updatesManualLayout->insertStretch(2, 10);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
520 mUpdatesManual = new CertificateListWidget(this);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
521 mUpdatesManual->hide();
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
522
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
523 updatesCenterLayout->addWidget(updatesTip);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
524 updatesCenterLayout->addLayout(updatesNewLayout);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
525 updatesCenterLayout->addWidget(mUpdatesNew);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
526 updatesCenterLayout->addLayout(updatesRemoveLayout);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
527 updatesCenterLayout->addWidget(mUpdatesRemove);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
528 updatesCenterLayout->addLayout(updatesManualLayout);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
529 updatesCenterLayout->addWidget(mUpdatesManual);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
530
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
531 QHBoxLayout *updatesBottomLayout = new QHBoxLayout;
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
532 quitButton = new QPushButton(tr("Quit without saving"));
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
533 QPushButton *saveButton = new QPushButton(tr("Update"));
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
534 connect(quitButton, SIGNAL(clicked()), this, SLOT(closeApp()));
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
535 updatesBottomLayout->insertStretch(0, 10);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
536 updatesBottomLayout->addWidget(saveButton);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
537 updatesBottomLayout->addWidget(quitButton);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
538
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
539 QFrame *updatesPanelSeparator = new QFrame();
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
540 updatesPanelSeparator->setFrameShape(QFrame::HLine);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
541 updatesPanelSeparator->setFrameShadow(QFrame::Sunken);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
542 updatesPanelLayout->addLayout(updatesHeaderLayout);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
543 updatesPanelLayout->addWidget(updatesPanelSeparator);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
544 updatesPanelLayout->addLayout(updatesCenterLayout);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
545 updatesPanelLayout->insertStretch(3, 10);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
546 updatesPanelLayout->addLayout(updatesBottomLayout);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
547 mUpdatesWidget->setLayout(updatesPanelLayout);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
548 mUpdatesWidget->setMinimumSize(QSize(820, 440));
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
549 mUpdatesPanel->setWidget(mUpdatesWidget);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
550
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
551 // Panel for trusted certificates.
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
552 mInstallPanel = new QScrollArea;
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
553
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
554 QVBoxLayout *installPanelLayout = new QVBoxLayout;
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
555 QVBoxLayout *installHeaderLayout = new QVBoxLayout;
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
556 QVBoxLayout *installCenterLayout = new QVBoxLayout;
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
557
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
558 QLabel *installHeaderLabel =
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
559 new QLabel("<h2>" + tr("Trusted Certificates") + "</h2>");
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
560 QLabel *installHeaderText = new QLabel(tr("The following list of root"
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
561 " certificates was created by the BSI. The BSI vaidates authenticity,"
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
562 " security and actuality of these certificates"));
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
563 installHeaderLayout->addWidget(installHeaderLabel);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
564 installHeaderLayout->addWidget(installHeaderText);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
565
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
566 QLabel *installCenterText = new QLabel(tr("Please choose the certificates"
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
567 " you want to trust. TrustBridge will install these certificates for"
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
568 " secure communication via email or the internet (e.g. IE, Firefox,"
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
569 " Thunderbird)"));
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
570 installCenterLayout->addWidget(installCenterText);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
571 mInstallList = new CertificateListWidget(this);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
572
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
573 installPanelLayout->addLayout(installHeaderLayout);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
574 installPanelLayout->addLayout(installCenterLayout);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
575 installPanelLayout->addWidget(mInstallList);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
576 mInstallPanel->setLayout(installPanelLayout);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
577
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
578 // Panel for insecure certificates.
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
579 mRemovePanel = new QScrollArea;
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
580 QVBoxLayout *removePanelLayout = new QVBoxLayout;
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
581 QVBoxLayout *removeHeaderLayout = new QVBoxLayout;
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
582 QVBoxLayout *removeCenterLayout = new QVBoxLayout;
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
583
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
584 QLabel *removeHeaderLabel =
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
585 new QLabel("<h2>" + tr("Insecure Certificates") + "</h2>");
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
586 QLabel *removeHeaderText = new QLabel(tr("The following list of root"
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
587 " certificates was created by the BSI. The BSI validates authenticity,"
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
588 " security and actuality of these certificates"));
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
589 removeHeaderLayout->addWidget(removeHeaderLabel);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
590 removeHeaderLayout->addWidget(removeHeaderText);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
591
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
592 QLabel *removeCenterText = new QLabel(tr("Please choose the certificates"
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
593 " you want to remove. TrustBridge will remove these certificates."));
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
594 removeCenterLayout->addWidget(removeCenterText);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
595
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
596 removePanelLayout->addLayout(removeHeaderLayout);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
597 removePanelLayout->addLayout(removeCenterLayout);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
598 mRemovePanel->setLayout(removePanelLayout);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
599
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
600 // Info panel.
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
601 mInfoPanel = new QScrollArea;
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
602
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
603 QVBoxLayout *infoPanelLayout = new QVBoxLayout(this);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
604 QHBoxLayout *infoHeaderLayout = new QHBoxLayout;
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
605 QVBoxLayout *infoHeaderTextLayout = new QVBoxLayout;
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
606 QVBoxLayout *infoCenterLayout = new QVBoxLayout;
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
607
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
608 QImage *infoLogoImage = new QImage(":/img/logo.png");
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
609 QLabel *infoLogo = new QLabel;
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
610 infoLogo->setBackgroundRole(QPalette::Base);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
611 infoLogo->setPixmap(QPixmap::fromImage(*infoLogoImage));
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
612 QLabel *infoTitle = new QLabel("<h1>" + tr("TrustBridge") + "</h1>");
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
613 QString infoVersion = tr("Version: ");
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
614 infoVersion.append(QApplication::applicationVersion());
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
615 QLabel *appVersion = new QLabel(infoVersion);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
616 appVersion->setTextInteractionFlags(
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
617 Qt::TextSelectableByMouse |
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
618 Qt::TextSelectableByKeyboard);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
619
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
620 QFrame *infoHeaderSeparator = new QFrame();
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
621 infoHeaderSeparator->setFrameShape(QFrame::HLine);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
622 infoHeaderSeparator->setFrameShadow(QFrame::Sunken);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
623
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
624 infoHeaderTextLayout->addWidget(infoTitle);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
625 infoHeaderTextLayout->addWidget(appVersion);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
626 infoHeaderLayout->addWidget(infoLogo);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
627 infoHeaderLayout->addLayout(infoHeaderTextLayout);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
628 infoHeaderLayout->insertStretch(2, 10);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
629
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
630 QLabel *textDesc = new QLabel(tr("TrustBridge is a root certificate"
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
631 " installer for Windows and Linux."));
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
632 textDesc->setTextInteractionFlags(
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
633 Qt::TextSelectableByMouse |
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
634 Qt::TextSelectableByKeyboard);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
635 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
636 " by the German <a href=\"https://www.bsi.bund.de\">"
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
637 "Federal Office for Information Security (BSI)</a>.\n\n"));
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
638 textManage->setTextInteractionFlags(
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
639 Qt::TextBrowserInteraction |
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
640 Qt::TextSelectableByKeyboard);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
641 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
642 " <a href=\"http://www.intevation.de\">Intevation GmbH</a> and "
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
643 " <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
644 " 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
645 textDevel->setTextInteractionFlags(
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
646 Qt::TextBrowserInteraction |
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
647 Qt::TextSelectableByKeyboard);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
648 QLabel *textLicense = new QLabel(tr("TrustBridge is Free Software licensed"
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
649 " 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
650 " in der Informationstechnik"));
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
651 textLicense->setTextInteractionFlags(
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
652 Qt::TextSelectableByMouse |
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
653 Qt::TextSelectableByKeyboard);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
654
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
655 infoCenterLayout->addWidget(infoHeaderSeparator);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
656 infoCenterLayout->addWidget(textDesc);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
657 infoCenterLayout->addWidget(textManage);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
658 infoCenterLayout->addWidget(textDevel);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
659 infoCenterLayout->addWidget(textLicense);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
660 infoCenterLayout->insertSpacing(2, 10);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
661 infoCenterLayout->insertSpacing(4, 10);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
662 infoCenterLayout->insertSpacing(6, 10);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
663 infoCenterLayout->insertStretch(8, 10);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
664
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
665 infoPanelLayout->addLayout(infoHeaderLayout);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
666 infoPanelLayout->addLayout(infoCenterLayout);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
667 mInfoPanel->setLayout(infoPanelLayout);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
668
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
669 // The main layout for pages.
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
670 mInstallPanel->hide();
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
671 mRemovePanel->hide();
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
672 mInfoPanel->hide();
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
673 containerLayout->addWidget(mUpdatesPanel);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
674 containerLayout->addWidget(mInstallPanel);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
675 containerLayout->addWidget(mRemovePanel);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
676 containerLayout->addWidget(mInfoPanel);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
677
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
678 centerLayout->addLayout(buttonBarLayout);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
679 centerLayout->addLayout(containerLayout);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
680
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
681
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
682 /*
250
1e112cf41e92 Updated the mainwindow layout.
Raimund Renkert <rrenkert@intevation.de>
parents: 249
diff changeset
683 // The certificate list
1e112cf41e92 Updated the mainwindow layout.
Raimund Renkert <rrenkert@intevation.de>
parents: 249
diff changeset
684 QGroupBox *certBox = new QGroupBox(tr("Managed Certificates"));
365
75f7288ad67b Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents: 274
diff changeset
685 mCertListWidget = new QListWidget;
449
023b565a02fc Update certificate details on item selection change.
Raimund Renkert <rrenkert@intevation.de>
parents: 447
diff changeset
686 connect(mCertListWidget, SIGNAL(currentItemChanged(QListWidgetItem*, QListWidgetItem*)),
250
1e112cf41e92 Updated the mainwindow layout.
Raimund Renkert <rrenkert@intevation.de>
parents: 249
diff changeset
687 this, SLOT(showDetails(QListWidgetItem*)));
365
75f7288ad67b Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents: 274
diff changeset
688 certLayout->addWidget(mCertListWidget);
456
37a97621b466 Added label for current and updated list date.
Raimund Renkert <rrenkert@intevation.de>
parents: 451
diff changeset
689
37a97621b466 Added label for current and updated list date.
Raimund Renkert <rrenkert@intevation.de>
parents: 451
diff changeset
690 mCurrentListDate = new QLabel(tr("Current List Date: %1").arg(""));
37a97621b466 Added label for current and updated list date.
Raimund Renkert <rrenkert@intevation.de>
parents: 451
diff changeset
691 mNewListDate = new QLabel("");
37a97621b466 Added label for current and updated list date.
Raimund Renkert <rrenkert@intevation.de>
parents: 451
diff changeset
692 listInfoLayout->addWidget(mCurrentListDate);
37a97621b466 Added label for current and updated list date.
Raimund Renkert <rrenkert@intevation.de>
parents: 451
diff changeset
693 listInfoLayout->addWidget(mNewListDate);
37a97621b466 Added label for current and updated list date.
Raimund Renkert <rrenkert@intevation.de>
parents: 451
diff changeset
694 certLayout->addLayout(listInfoLayout);
37a97621b466 Added label for current and updated list date.
Raimund Renkert <rrenkert@intevation.de>
parents: 451
diff changeset
695
250
1e112cf41e92 Updated the mainwindow layout.
Raimund Renkert <rrenkert@intevation.de>
parents: 249
diff changeset
696 certBox->setLayout(certLayout);
1e112cf41e92 Updated the mainwindow layout.
Raimund Renkert <rrenkert@intevation.de>
parents: 249
diff changeset
697
205
a3f542bf38f7 Added header for mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents: 200
diff changeset
698
271
1ae15ea73850 Some GUI desing and layout changes.
Raimund Renkert <rrenkert@intevation.de>
parents: 267
diff changeset
699 // The settings.
432
16b5cd858571 Updated layout and certificate details in trustbridge installer.
Raimund Renkert <rrenkert@intevation.de>
parents: 409
diff changeset
700 QGroupBox *settingsBox = new QGroupBox(tr("Settings"));
16b5cd858571 Updated layout and certificate details in trustbridge installer.
Raimund Renkert <rrenkert@intevation.de>
parents: 409
diff changeset
701 mAutoUpdateOption = new QCheckBox(tr("Autoupdate"));
16b5cd858571 Updated layout and certificate details in trustbridge installer.
Raimund Renkert <rrenkert@intevation.de>
parents: 409
diff changeset
702 mAutoStartOption = new QCheckBox(tr("Autostart"));
16b5cd858571 Updated layout and certificate details in trustbridge installer.
Raimund Renkert <rrenkert@intevation.de>
parents: 409
diff changeset
703 settingsLayout->addWidget(mAutoUpdateOption);
16b5cd858571 Updated layout and certificate details in trustbridge installer.
Raimund Renkert <rrenkert@intevation.de>
parents: 409
diff changeset
704 settingsLayout->addWidget(mAutoStartOption);
16b5cd858571 Updated layout and certificate details in trustbridge installer.
Raimund Renkert <rrenkert@intevation.de>
parents: 409
diff changeset
705 settingsBox->setLayout(settingsLayout);
481
9be337ea1e3c Save the autostart and autoupdate settings.
Raimund Renkert <rrenkert@intevation.de>
parents: 480
diff changeset
706 connect(mAutoUpdateOption, SIGNAL(stateChanged(int)),
9be337ea1e3c Save the autostart and autoupdate settings.
Raimund Renkert <rrenkert@intevation.de>
parents: 480
diff changeset
707 this, SLOT(saveAutoUpdate(int)));
9be337ea1e3c Save the autostart and autoupdate settings.
Raimund Renkert <rrenkert@intevation.de>
parents: 480
diff changeset
708 connect(mAutoStartOption, SIGNAL(stateChanged(int)),
9be337ea1e3c Save the autostart and autoupdate settings.
Raimund Renkert <rrenkert@intevation.de>
parents: 480
diff changeset
709 this, SLOT(saveAutoStart(int)));
9be337ea1e3c Save the autostart and autoupdate settings.
Raimund Renkert <rrenkert@intevation.de>
parents: 480
diff changeset
710 mSettings.beginGroup("settings");
499
077b4342d69b Default autostart to true and change setting to bool
Andre Heinecke <aheinecke@intevation.de>
parents: 486
diff changeset
711 bool autoUpdate = mSettings.value("autoupdate", false).toBool();
077b4342d69b Default autostart to true and change setting to bool
Andre Heinecke <aheinecke@intevation.de>
parents: 486
diff changeset
712 bool autoStart = mSettings.value("autostart", true).toBool();
481
9be337ea1e3c Save the autostart and autoupdate settings.
Raimund Renkert <rrenkert@intevation.de>
parents: 480
diff changeset
713 mSettings.endGroup();
499
077b4342d69b Default autostart to true and change setting to bool
Andre Heinecke <aheinecke@intevation.de>
parents: 486
diff changeset
714 mAutoUpdateOption->setCheckState(autoUpdate ? Qt::Checked : Qt::Unchecked);
077b4342d69b Default autostart to true and change setting to bool
Andre Heinecke <aheinecke@intevation.de>
parents: 486
diff changeset
715 mAutoStartOption->setCheckState(autoStart ? Qt::Checked : Qt::Unchecked);
481
9be337ea1e3c Save the autostart and autoupdate settings.
Raimund Renkert <rrenkert@intevation.de>
parents: 480
diff changeset
716
271
1ae15ea73850 Some GUI desing and layout changes.
Raimund Renkert <rrenkert@intevation.de>
parents: 267
diff changeset
717
507
20973a56d5ec Use is_admin to determine if UAC icon should be painted on the button
Andre Heinecke <aheinecke@intevation.de>
parents: 499
diff changeset
718 #ifdef Q_OS_WIN
20973a56d5ec Use is_admin to determine if UAC icon should be painted on the button
Andre Heinecke <aheinecke@intevation.de>
parents: 499
diff changeset
719 if (is_admin()) {
20973a56d5ec Use is_admin to determine if UAC icon should be painted on the button
Andre Heinecke <aheinecke@intevation.de>
parents: 499
diff changeset
720 QIcon uacShield = QApplication::style()->standardIcon(QStyle::SP_VistaShield);
20973a56d5ec Use is_admin to determine if UAC icon should be painted on the button
Andre Heinecke <aheinecke@intevation.de>
parents: 499
diff changeset
721 installButton->setIcon(uacShield);
20973a56d5ec Use is_admin to determine if UAC icon should be painted on the button
Andre Heinecke <aheinecke@intevation.de>
parents: 499
diff changeset
722 }
20973a56d5ec Use is_admin to determine if UAC icon should be painted on the button
Andre Heinecke <aheinecke@intevation.de>
parents: 499
diff changeset
723 #endif
20973a56d5ec Use is_admin to determine if UAC icon should be painted on the button
Andre Heinecke <aheinecke@intevation.de>
parents: 499
diff changeset
724
250
1e112cf41e92 Updated the mainwindow layout.
Raimund Renkert <rrenkert@intevation.de>
parents: 249
diff changeset
725 // The certificate details
271
1ae15ea73850 Some GUI desing and layout changes.
Raimund Renkert <rrenkert@intevation.de>
parents: 267
diff changeset
726 QGroupBox *detailBox = new QGroupBox(tr("Details"));
432
16b5cd858571 Updated layout and certificate details in trustbridge installer.
Raimund Renkert <rrenkert@intevation.de>
parents: 409
diff changeset
727 QLabel *subjectCN = new QLabel(tr("Subject Common Name:"));
16b5cd858571 Updated layout and certificate details in trustbridge installer.
Raimund Renkert <rrenkert@intevation.de>
parents: 409
diff changeset
728 QLabel *subjectOU = new QLabel(tr("Subject Organisation:"));
16b5cd858571 Updated layout and certificate details in trustbridge installer.
Raimund Renkert <rrenkert@intevation.de>
parents: 409
diff changeset
729 QLabel *issuerCN = new QLabel(tr("Issuer Common Name:"));
16b5cd858571 Updated layout and certificate details in trustbridge installer.
Raimund Renkert <rrenkert@intevation.de>
parents: 409
diff changeset
730 QLabel *issuerOU = new QLabel(tr("Issuer Organisation:"));
16b5cd858571 Updated layout and certificate details in trustbridge installer.
Raimund Renkert <rrenkert@intevation.de>
parents: 409
diff changeset
731 QLabel *validFrom = new QLabel(tr("Valid from:"));
16b5cd858571 Updated layout and certificate details in trustbridge installer.
Raimund Renkert <rrenkert@intevation.de>
parents: 409
diff changeset
732 QLabel *validTo = new QLabel(tr("Valid to:"));
16b5cd858571 Updated layout and certificate details in trustbridge installer.
Raimund Renkert <rrenkert@intevation.de>
parents: 409
diff changeset
733 QLabel *fingerprint = new QLabel(tr("Fingerprint:"));
16b5cd858571 Updated layout and certificate details in trustbridge installer.
Raimund Renkert <rrenkert@intevation.de>
parents: 409
diff changeset
734 detailLabelLayout->addWidget(subjectCN);
16b5cd858571 Updated layout and certificate details in trustbridge installer.
Raimund Renkert <rrenkert@intevation.de>
parents: 409
diff changeset
735 detailLabelLayout->addWidget(subjectOU);
16b5cd858571 Updated layout and certificate details in trustbridge installer.
Raimund Renkert <rrenkert@intevation.de>
parents: 409
diff changeset
736 detailLabelLayout->addWidget(issuerCN);
16b5cd858571 Updated layout and certificate details in trustbridge installer.
Raimund Renkert <rrenkert@intevation.de>
parents: 409
diff changeset
737 detailLabelLayout->addWidget(issuerOU);
16b5cd858571 Updated layout and certificate details in trustbridge installer.
Raimund Renkert <rrenkert@intevation.de>
parents: 409
diff changeset
738 detailLabelLayout->addWidget(validFrom);
16b5cd858571 Updated layout and certificate details in trustbridge installer.
Raimund Renkert <rrenkert@intevation.de>
parents: 409
diff changeset
739 detailLabelLayout->addWidget(validTo);
16b5cd858571 Updated layout and certificate details in trustbridge installer.
Raimund Renkert <rrenkert@intevation.de>
parents: 409
diff changeset
740 detailLabelLayout->addWidget(fingerprint);
16b5cd858571 Updated layout and certificate details in trustbridge installer.
Raimund Renkert <rrenkert@intevation.de>
parents: 409
diff changeset
741 mSubjectCN = new QLabel(tr(""));
531
dec797c7230c Fix usage of OU / O
Andre Heinecke <aheinecke@intevation.de>
parents: 525
diff changeset
742 mSubjectO = new QLabel(tr(""));
432
16b5cd858571 Updated layout and certificate details in trustbridge installer.
Raimund Renkert <rrenkert@intevation.de>
parents: 409
diff changeset
743 mIssuerCN = new QLabel(tr(""));
531
dec797c7230c Fix usage of OU / O
Andre Heinecke <aheinecke@intevation.de>
parents: 525
diff changeset
744 mIssuerO = new QLabel(tr(""));
432
16b5cd858571 Updated layout and certificate details in trustbridge installer.
Raimund Renkert <rrenkert@intevation.de>
parents: 409
diff changeset
745 mValidFrom = new QLabel(tr(""));
16b5cd858571 Updated layout and certificate details in trustbridge installer.
Raimund Renkert <rrenkert@intevation.de>
parents: 409
diff changeset
746 mValidTo = new QLabel(tr(""));
16b5cd858571 Updated layout and certificate details in trustbridge installer.
Raimund Renkert <rrenkert@intevation.de>
parents: 409
diff changeset
747 mFingerprint = new QLabel(tr(""));
451
94613c91a3d4 Set mono space font for fingerprint.
Raimund Renkert <rrenkert@intevation.de>
parents: 450
diff changeset
748 mFingerprint->setFont(QFont("DejaVu Sans Mono"));
432
16b5cd858571 Updated layout and certificate details in trustbridge installer.
Raimund Renkert <rrenkert@intevation.de>
parents: 409
diff changeset
749 detailContentLayout->addWidget(mSubjectCN);
531
dec797c7230c Fix usage of OU / O
Andre Heinecke <aheinecke@intevation.de>
parents: 525
diff changeset
750 detailContentLayout->addWidget(mSubjectO);
432
16b5cd858571 Updated layout and certificate details in trustbridge installer.
Raimund Renkert <rrenkert@intevation.de>
parents: 409
diff changeset
751 detailContentLayout->addWidget(mIssuerCN);
531
dec797c7230c Fix usage of OU / O
Andre Heinecke <aheinecke@intevation.de>
parents: 525
diff changeset
752 detailContentLayout->addWidget(mIssuerO);
432
16b5cd858571 Updated layout and certificate details in trustbridge installer.
Raimund Renkert <rrenkert@intevation.de>
parents: 409
diff changeset
753 detailContentLayout->addWidget(mValidFrom);
16b5cd858571 Updated layout and certificate details in trustbridge installer.
Raimund Renkert <rrenkert@intevation.de>
parents: 409
diff changeset
754 detailContentLayout->addWidget(mValidTo);
16b5cd858571 Updated layout and certificate details in trustbridge installer.
Raimund Renkert <rrenkert@intevation.de>
parents: 409
diff changeset
755 detailContentLayout->addWidget(mFingerprint);
16b5cd858571 Updated layout and certificate details in trustbridge installer.
Raimund Renkert <rrenkert@intevation.de>
parents: 409
diff changeset
756 detailLayout->addLayout(detailLabelLayout);
16b5cd858571 Updated layout and certificate details in trustbridge installer.
Raimund Renkert <rrenkert@intevation.de>
parents: 409
diff changeset
757 detailLayout->addLayout(detailContentLayout);
271
1ae15ea73850 Some GUI desing and layout changes.
Raimund Renkert <rrenkert@intevation.de>
parents: 267
diff changeset
758 detailBox->setLayout(detailLayout);
187
0c06a608e15f Create the mainwindow content.
Raimund Renkert <rrenkert@intevation.de>
parents: 155
diff changeset
759
250
1e112cf41e92 Updated the mainwindow layout.
Raimund Renkert <rrenkert@intevation.de>
parents: 249
diff changeset
760 infoLayout->addSpacing(20);
1e112cf41e92 Updated the mainwindow layout.
Raimund Renkert <rrenkert@intevation.de>
parents: 249
diff changeset
761 infoLayout->addLayout(headerLayout);
584
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
762 //infoLayout->addWidget(detailBox);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
763 //infoLayout->addWidget(settingsBox);
271
1ae15ea73850 Some GUI desing and layout changes.
Raimund Renkert <rrenkert@intevation.de>
parents: 267
diff changeset
764 infoLayout->addLayout(bottomLayout);
250
1e112cf41e92 Updated the mainwindow layout.
Raimund Renkert <rrenkert@intevation.de>
parents: 249
diff changeset
765
584
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
766 //mainLayout->addWidget(certBox);
250
1e112cf41e92 Updated the mainwindow layout.
Raimund Renkert <rrenkert@intevation.de>
parents: 249
diff changeset
767 mainLayout->addLayout(infoLayout);
450
4932fc33ee82 Updated window and main layout size.
Raimund Renkert <rrenkert@intevation.de>
parents: 449
diff changeset
768 mainLayout->setStretchFactor(certBox, 37);
4932fc33ee82 Updated window and main layout size.
Raimund Renkert <rrenkert@intevation.de>
parents: 449
diff changeset
769 mainLayout->setStretchFactor(infoLayout, 63);
187
0c06a608e15f Create the mainwindow content.
Raimund Renkert <rrenkert@intevation.de>
parents: 155
diff changeset
770
0c06a608e15f Create the mainwindow content.
Raimund Renkert <rrenkert@intevation.de>
parents: 155
diff changeset
771 // QMainWindow allready has a layout. All child layouts and widgets are
0c06a608e15f Create the mainwindow content.
Raimund Renkert <rrenkert@intevation.de>
parents: 155
diff changeset
772 // managed in the central widget.
584
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
773 */
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
774
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
775 QFrame *topSeparator = new QFrame();
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
776 topSeparator->setFrameShape(QFrame::HLine);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
777 topSeparator->setFrameShadow(QFrame::Sunken);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
778
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
779 mainLayout->addLayout(headerLayout);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
780 mainLayout->addWidget(topSeparator);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
781 mainLayout->addLayout(centerLayout);
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
782 mainLayout->addLayout(bottomLayout);
187
0c06a608e15f Create the mainwindow content.
Raimund Renkert <rrenkert@intevation.de>
parents: 155
diff changeset
783 base->setLayout(mainLayout);
0c06a608e15f Create the mainwindow content.
Raimund Renkert <rrenkert@intevation.de>
parents: 155
diff changeset
784 setCentralWidget(base);
0c06a608e15f Create the mainwindow content.
Raimund Renkert <rrenkert@intevation.de>
parents: 155
diff changeset
785 }
0c06a608e15f Create the mainwindow content.
Raimund Renkert <rrenkert@intevation.de>
parents: 155
diff changeset
786
189
5f0d45ca9de4 Show certificates in the list view and details in the textfield.
Raimund Renkert <rrenkert@intevation.de>
parents: 187
diff changeset
787 void MainWindow::loadCertificateList()
5f0d45ca9de4 Show certificates in the list view and details in the textfield.
Raimund Renkert <rrenkert@intevation.de>
parents: 187
diff changeset
788 {
584
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
789 //mCertListWidget->clear();
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
790 //int i = 0;
389
3be838c3e4d8 Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 375
diff changeset
791
3be838c3e4d8 Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 375
diff changeset
792 /* 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
793 * indication */
445
b3721ded6f5b Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents: 437
diff changeset
794 QList<Certificate> newInstallCerts;
b3721ded6f5b Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents: 437
diff changeset
795 QList<Certificate> newRemoveCerts;
b3721ded6f5b Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents: 437
diff changeset
796 QList<Certificate> oldInstallCerts;
b3721ded6f5b Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents: 437
diff changeset
797 QList<Certificate> oldRemoveCerts;
389
3be838c3e4d8 Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 375
diff changeset
798
445
b3721ded6f5b Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents: 437
diff changeset
799 if (mListToInstall.getCertificates().isEmpty()) {
b3721ded6f5b Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents: 437
diff changeset
800 // 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
801 foreach (const Certificate &cert, mInstalledList.getCertificates()) {
b3721ded6f5b Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents: 437
diff changeset
802 if (cert.isInstallCert()) {
b3721ded6f5b Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents: 437
diff changeset
803 oldInstallCerts.append(cert);
584
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
804 mInstallList->addCertificate(cert);
267
89e8783866f8 Use the certificate item delegate in the mainwind list view.
Raimund Renkert <rrenkert@intevation.de>
parents: 265
diff changeset
805 }
89e8783866f8 Use the certificate item delegate in the mainwind list view.
Raimund Renkert <rrenkert@intevation.de>
parents: 265
diff changeset
806 else {
445
b3721ded6f5b Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents: 437
diff changeset
807 oldRemoveCerts.append(cert);
267
89e8783866f8 Use the certificate item delegate in the mainwind list view.
Raimund Renkert <rrenkert@intevation.de>
parents: 265
diff changeset
808 }
89e8783866f8 Use the certificate item delegate in the mainwind list view.
Raimund Renkert <rrenkert@intevation.de>
parents: 265
diff changeset
809 }
456
37a97621b466 Added label for current and updated list date.
Raimund Renkert <rrenkert@intevation.de>
parents: 451
diff changeset
810 // Set the date of the old list.
37a97621b466 Added label for current and updated list date.
Raimund Renkert <rrenkert@intevation.de>
parents: 451
diff changeset
811 mCurrentListDate->setText(tr("Current List Date: %1")
37a97621b466 Added label for current and updated list date.
Raimund Renkert <rrenkert@intevation.de>
parents: 451
diff changeset
812 .arg(mInstalledList.date().toString()));
445
b3721ded6f5b Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents: 437
diff changeset
813 }
b3721ded6f5b Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents: 437
diff changeset
814 else {
b3721ded6f5b Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents: 437
diff changeset
815 // 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
816 foreach (const Certificate &cert, mListToInstall.getCertificates()) {
b3721ded6f5b Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents: 437
diff changeset
817 if (cert.isInstallCert()) {
b3721ded6f5b Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents: 437
diff changeset
818 // Certificate with status "install".
b3721ded6f5b Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents: 437
diff changeset
819 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
820 // 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
821 oldInstallCerts.append(cert);
b3721ded6f5b Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents: 437
diff changeset
822 }
b3721ded6f5b Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents: 437
diff changeset
823 else {
b3721ded6f5b Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents: 437
diff changeset
824 // 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
825 newInstallCerts.append(cert);
584
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
826 mUpdatesNew->addCertificate(cert);
445
b3721ded6f5b Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents: 437
diff changeset
827 }
267
89e8783866f8 Use the certificate item delegate in the mainwind list view.
Raimund Renkert <rrenkert@intevation.de>
parents: 265
diff changeset
828 }
89e8783866f8 Use the certificate item delegate in the mainwind list view.
Raimund Renkert <rrenkert@intevation.de>
parents: 265
diff changeset
829 else {
445
b3721ded6f5b Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents: 437
diff changeset
830 // Certificate with status "remove".
b3721ded6f5b Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents: 437
diff changeset
831 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
832 // 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
833 oldRemoveCerts.append(cert);
b3721ded6f5b Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents: 437
diff changeset
834 }
b3721ded6f5b Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents: 437
diff changeset
835 else {
b3721ded6f5b Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents: 437
diff changeset
836 // 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
837 // status "remove".
b3721ded6f5b Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents: 437
diff changeset
838 newRemoveCerts.append(cert);
b3721ded6f5b Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents: 437
diff changeset
839 }
267
89e8783866f8 Use the certificate item delegate in the mainwind list view.
Raimund Renkert <rrenkert@intevation.de>
parents: 265
diff changeset
840 }
89e8783866f8 Use the certificate item delegate in the mainwind list view.
Raimund Renkert <rrenkert@intevation.de>
parents: 265
diff changeset
841 }
584
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
842 /* mCurrentListDate->setText(tr("Current List Date: %1")
456
37a97621b466 Added label for current and updated list date.
Raimund Renkert <rrenkert@intevation.de>
parents: 451
diff changeset
843 .arg(mInstalledList.date().toString()));
584
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
844 mNewListDate->setText(tr("New List Date: %1").arg(mListToInstall.date().toString()));*/
189
5f0d45ca9de4 Show certificates in the list view and details in the textfield.
Raimund Renkert <rrenkert@intevation.de>
parents: 187
diff changeset
845 }
584
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
846 /*
445
b3721ded6f5b Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents: 437
diff changeset
847 // Add separators and certificates to list widget.
512
d1812e171d0c Hide empty seperators in list ui
Andre Heinecke <aheinecke@intevation.de>
parents: 507
diff changeset
848 if (!newInstallCerts.isEmpty()) {
d1812e171d0c Hide empty seperators in list ui
Andre Heinecke <aheinecke@intevation.de>
parents: 507
diff changeset
849 mCertListWidget->addItem(createSeparator(tr("New certificates to install"), i++));
d1812e171d0c Hide empty seperators in list ui
Andre Heinecke <aheinecke@intevation.de>
parents: 507
diff changeset
850 foreach (const Certificate &cert, newInstallCerts) {
d1812e171d0c Hide empty seperators in list ui
Andre Heinecke <aheinecke@intevation.de>
parents: 507
diff changeset
851 mCertListWidget->addItem(createListItem(cert, Certificate::InstallNew, i++));
d1812e171d0c Hide empty seperators in list ui
Andre Heinecke <aheinecke@intevation.de>
parents: 507
diff changeset
852 }
445
b3721ded6f5b Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents: 437
diff changeset
853 }
b3721ded6f5b Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents: 437
diff changeset
854
512
d1812e171d0c Hide empty seperators in list ui
Andre Heinecke <aheinecke@intevation.de>
parents: 507
diff changeset
855 if (!newRemoveCerts.isEmpty()) {
d1812e171d0c Hide empty seperators in list ui
Andre Heinecke <aheinecke@intevation.de>
parents: 507
diff changeset
856 mCertListWidget->addItem(createSeparator(tr("New certificates to remove"), i++));
d1812e171d0c Hide empty seperators in list ui
Andre Heinecke <aheinecke@intevation.de>
parents: 507
diff changeset
857 foreach (const Certificate &cert, newRemoveCerts) {
d1812e171d0c Hide empty seperators in list ui
Andre Heinecke <aheinecke@intevation.de>
parents: 507
diff changeset
858 mCertListWidget->addItem(createListItem(cert, Certificate::RemoveNew, i++));
d1812e171d0c Hide empty seperators in list ui
Andre Heinecke <aheinecke@intevation.de>
parents: 507
diff changeset
859 }
445
b3721ded6f5b Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents: 437
diff changeset
860 }
b3721ded6f5b Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents: 437
diff changeset
861
512
d1812e171d0c Hide empty seperators in list ui
Andre Heinecke <aheinecke@intevation.de>
parents: 507
diff changeset
862 if (!oldInstallCerts.isEmpty()) {
d1812e171d0c Hide empty seperators in list ui
Andre Heinecke <aheinecke@intevation.de>
parents: 507
diff changeset
863 mCertListWidget->addItem(createSeparator(tr("Old certificates to install"), i++));
d1812e171d0c Hide empty seperators in list ui
Andre Heinecke <aheinecke@intevation.de>
parents: 507
diff changeset
864 foreach (const Certificate &cert, oldInstallCerts) {
d1812e171d0c Hide empty seperators in list ui
Andre Heinecke <aheinecke@intevation.de>
parents: 507
diff changeset
865 mCertListWidget->addItem(createListItem(cert, Certificate::InstallOld, i++));
d1812e171d0c Hide empty seperators in list ui
Andre Heinecke <aheinecke@intevation.de>
parents: 507
diff changeset
866 }
445
b3721ded6f5b Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents: 437
diff changeset
867 }
b3721ded6f5b Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents: 437
diff changeset
868
512
d1812e171d0c Hide empty seperators in list ui
Andre Heinecke <aheinecke@intevation.de>
parents: 507
diff changeset
869 if (!oldRemoveCerts.isEmpty()) {
d1812e171d0c Hide empty seperators in list ui
Andre Heinecke <aheinecke@intevation.de>
parents: 507
diff changeset
870 mCertListWidget->addItem(createSeparator(tr("Old certificates to remove"), i++));
d1812e171d0c Hide empty seperators in list ui
Andre Heinecke <aheinecke@intevation.de>
parents: 507
diff changeset
871 foreach (const Certificate &cert, oldRemoveCerts) {
d1812e171d0c Hide empty seperators in list ui
Andre Heinecke <aheinecke@intevation.de>
parents: 507
diff changeset
872 mCertListWidget->addItem(createListItem(cert, Certificate::RemoveOld, i++));
d1812e171d0c Hide empty seperators in list ui
Andre Heinecke <aheinecke@intevation.de>
parents: 507
diff changeset
873 }
445
b3721ded6f5b Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents: 437
diff changeset
874 }
584
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
875 */
445
b3721ded6f5b Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents: 437
diff changeset
876 }
b3721ded6f5b Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents: 437
diff changeset
877
b3721ded6f5b Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents: 437
diff changeset
878 QListWidgetItem* MainWindow::createSeparator(const QString &text, int index)
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 SeparatorItemDelegate *separatorDelegate = new SeparatorItemDelegate();
b3721ded6f5b Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents: 437
diff changeset
881 QListWidgetItem *separator = new QListWidgetItem(text);
b3721ded6f5b Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents: 437
diff changeset
882 mCertListWidget->setItemDelegateForRow(index, separatorDelegate);
b3721ded6f5b Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents: 437
diff changeset
883 separator->setFlags(separator->flags() ^ Qt::ItemIsUserCheckable);
b3721ded6f5b Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents: 437
diff changeset
884 return separator;
b3721ded6f5b Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents: 437
diff changeset
885 }
b3721ded6f5b Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents: 437
diff changeset
886
b3721ded6f5b Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents: 437
diff changeset
887 QListWidgetItem* MainWindow::createListItem(const Certificate &certificate,
b3721ded6f5b Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents: 437
diff changeset
888 Certificate::Status status, int index)
b3721ded6f5b Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents: 437
diff changeset
889 {
b3721ded6f5b Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents: 437
diff changeset
890 CertificateItemDelegate *certDelegate = new CertificateItemDelegate();
b3721ded6f5b Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents: 437
diff changeset
891 QListWidgetItem* item = new QListWidgetItem(certificate.shortDescription());
b3721ded6f5b Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents: 437
diff changeset
892 item->setData(CertificateItemDelegate::DataRole,
b3721ded6f5b Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents: 437
diff changeset
893 QVariant::fromValue(certificate));
b3721ded6f5b Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents: 437
diff changeset
894 item->setData(CertificateItemDelegate::StatusRole, status);
b3721ded6f5b Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents: 437
diff changeset
895 if (!mPreviouslyUnselected.contains(certificate.base64Line()) &&
b3721ded6f5b Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents: 437
diff changeset
896 status == Certificate::RemoveOld) {
b3721ded6f5b Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents: 437
diff changeset
897 item->setFlags(item->flags() ^ Qt::ItemIsUserCheckable);
b3721ded6f5b Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents: 437
diff changeset
898 }
b3721ded6f5b Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents: 437
diff changeset
899 else {
b3721ded6f5b Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents: 437
diff changeset
900 Qt::CheckState checkedState =
b3721ded6f5b Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents: 437
diff changeset
901 mPreviouslyUnselected.contains(certificate.base64Line()) ?
b3721ded6f5b Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents: 437
diff changeset
902 Qt::Unchecked : Qt::Checked;
b3721ded6f5b Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents: 437
diff changeset
903 item->setFlags(item->flags() | Qt::ItemIsUserCheckable);
b3721ded6f5b Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents: 437
diff changeset
904 item->setCheckState(checkedState);
b3721ded6f5b Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents: 437
diff changeset
905 }
b3721ded6f5b Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents: 437
diff changeset
906 mCertListWidget->setItemDelegateForRow(index, certDelegate);
b3721ded6f5b Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents: 437
diff changeset
907 return item;
189
5f0d45ca9de4 Show certificates in the list view and details in the textfield.
Raimund Renkert <rrenkert@intevation.de>
parents: 187
diff changeset
908 }
5f0d45ca9de4 Show certificates in the list view and details in the textfield.
Raimund Renkert <rrenkert@intevation.de>
parents: 187
diff changeset
909
155
c0fdb8d336cf Added menubar/menu and method stubs to mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents: 82
diff changeset
910 void MainWindow::showHelp()
c0fdb8d336cf Added menubar/menu and method stubs to mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents: 82
diff changeset
911 {
c0fdb8d336cf Added menubar/menu and method stubs to mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents: 82
diff changeset
912 qDebug() << "show helpdialog";
191
246c21b1727f Show the help dialog.
Raimund Renkert <rrenkert@intevation.de>
parents: 189
diff changeset
913 HelpDialog *help = new HelpDialog(this);
246c21b1727f Show the help dialog.
Raimund Renkert <rrenkert@intevation.de>
parents: 189
diff changeset
914 help->show();
155
c0fdb8d336cf Added menubar/menu and method stubs to mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents: 82
diff changeset
915 }
c0fdb8d336cf Added menubar/menu and method stubs to mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents: 82
diff changeset
916
c0fdb8d336cf Added menubar/menu and method stubs to mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents: 82
diff changeset
917 void MainWindow::showAbout()
c0fdb8d336cf Added menubar/menu and method stubs to mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents: 82
diff changeset
918 {
c0fdb8d336cf Added menubar/menu and method stubs to mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents: 82
diff changeset
919 qDebug() << "show aboutdialog";
200
fe424c5fc875 Show the about dialog.
Raimund Renkert <rrenkert@intevation.de>
parents: 191
diff changeset
920 AboutDialog *about = new AboutDialog(this);
fe424c5fc875 Show the about dialog.
Raimund Renkert <rrenkert@intevation.de>
parents: 191
diff changeset
921 about->show();
155
c0fdb8d336cf Added menubar/menu and method stubs to mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents: 82
diff changeset
922 }
187
0c06a608e15f Create the mainwindow content.
Raimund Renkert <rrenkert@intevation.de>
parents: 155
diff changeset
923
189
5f0d45ca9de4 Show certificates in the list view and details in the textfield.
Raimund Renkert <rrenkert@intevation.de>
parents: 187
diff changeset
924 void MainWindow::showDetails(QListWidgetItem *item)
5f0d45ca9de4 Show certificates in the list view and details in the textfield.
Raimund Renkert <rrenkert@intevation.de>
parents: 187
diff changeset
925 {
449
023b565a02fc Update certificate details on item selection change.
Raimund Renkert <rrenkert@intevation.de>
parents: 447
diff changeset
926 if (item == NULL) {
023b565a02fc Update certificate details on item selection change.
Raimund Renkert <rrenkert@intevation.de>
parents: 447
diff changeset
927 return;
023b565a02fc Update certificate details on item selection change.
Raimund Renkert <rrenkert@intevation.de>
parents: 447
diff changeset
928 }
445
b3721ded6f5b Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents: 437
diff changeset
929 Certificate cert = item->data(CertificateItemDelegate::DataRole).value<Certificate>();
432
16b5cd858571 Updated layout and certificate details in trustbridge installer.
Raimund Renkert <rrenkert@intevation.de>
parents: 409
diff changeset
930 mSubjectCN->setText(cert.subjectCN());
531
dec797c7230c Fix usage of OU / O
Andre Heinecke <aheinecke@intevation.de>
parents: 525
diff changeset
931 mSubjectO->setText(cert.subjectO());
432
16b5cd858571 Updated layout and certificate details in trustbridge installer.
Raimund Renkert <rrenkert@intevation.de>
parents: 409
diff changeset
932 mIssuerCN->setText(cert.issuerCN());
531
dec797c7230c Fix usage of OU / O
Andre Heinecke <aheinecke@intevation.de>
parents: 525
diff changeset
933 mIssuerO->setText(cert.issuerO());
432
16b5cd858571 Updated layout and certificate details in trustbridge installer.
Raimund Renkert <rrenkert@intevation.de>
parents: 409
diff changeset
934 mValidFrom->setText(cert.validFrom().toString());
16b5cd858571 Updated layout and certificate details in trustbridge installer.
Raimund Renkert <rrenkert@intevation.de>
parents: 409
diff changeset
935 mValidTo->setText(cert.validTo().toString());
16b5cd858571 Updated layout and certificate details in trustbridge installer.
Raimund Renkert <rrenkert@intevation.de>
parents: 409
diff changeset
936 mFingerprint->setText(cert.fingerprint());
189
5f0d45ca9de4 Show certificates in the list view and details in the textfield.
Raimund Renkert <rrenkert@intevation.de>
parents: 187
diff changeset
937 }
271
1ae15ea73850 Some GUI desing and layout changes.
Raimund Renkert <rrenkert@intevation.de>
parents: 267
diff changeset
938
1ae15ea73850 Some GUI desing and layout changes.
Raimund Renkert <rrenkert@intevation.de>
parents: 267
diff changeset
939 void MainWindow::resizeButtons()
1ae15ea73850 Some GUI desing and layout changes.
Raimund Renkert <rrenkert@intevation.de>
parents: 267
diff changeset
940 {
1ae15ea73850 Some GUI desing and layout changes.
Raimund Renkert <rrenkert@intevation.de>
parents: 267
diff changeset
941 installButton->setFixedHeight(20);
1ae15ea73850 Some GUI desing and layout changes.
Raimund Renkert <rrenkert@intevation.de>
parents: 267
diff changeset
942 quitButton->setFixedHeight(80);
1ae15ea73850 Some GUI desing and layout changes.
Raimund Renkert <rrenkert@intevation.de>
parents: 267
diff changeset
943 }
365
75f7288ad67b Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents: 274
diff changeset
944
75f7288ad67b Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents: 274
diff changeset
945 void MainWindow::installerError(const QString& errMsg) {
75f7288ad67b Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents: 274
diff changeset
946 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
947 }
75f7288ad67b Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents: 274
diff changeset
948
389
3be838c3e4d8 Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 375
diff changeset
949 void MainWindow::installerSuccess() {
3be838c3e4d8 Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 375
diff changeset
950 if (mCurState == NewListAvailable) {
3be838c3e4d8 Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 375
diff changeset
951 mCurState = NothingChanged;
3be838c3e4d8 Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 375
diff changeset
952 mCurMessage = QString();
3be838c3e4d8 Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 375
diff changeset
953
3be838c3e4d8 Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 375
diff changeset
954 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
955 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
956
3be838c3e4d8 Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 375
diff changeset
957 mSettings.remove("List/available");
3be838c3e4d8 Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 375
diff changeset
958 mSettings.remove("List/availableDate");
3be838c3e4d8 Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 375
diff changeset
959
3be838c3e4d8 Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 375
diff changeset
960 if (listFileName.isEmpty() || !listFileDate.isValid()) {
3be838c3e4d8 Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 375
diff changeset
961 qWarning() << "Error accessing settings";
3be838c3e4d8 Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 375
diff changeset
962 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
963 }
3be838c3e4d8 Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 375
diff changeset
964
3be838c3e4d8 Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 375
diff changeset
965 mSettings.setValue("List/installed", listFileName);
3be838c3e4d8 Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 375
diff changeset
966 mSettings.setValue("List/installedDate", listFileDate);
480
242f2bf5417e Update the certificate list after installing certificates.
Raimund Renkert <rrenkert@intevation.de>
parents: 479
diff changeset
967 mInstalledList = mListToInstall;
242f2bf5417e Update the certificate list after installing certificates.
Raimund Renkert <rrenkert@intevation.de>
parents: 479
diff changeset
968 mListToInstall = CertificateList();
389
3be838c3e4d8 Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 375
diff changeset
969 }
584
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
970 //loadCertificateList();
389
3be838c3e4d8 Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 375
diff changeset
971 }
3be838c3e4d8 Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 375
diff changeset
972
365
75f7288ad67b Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents: 274
diff changeset
973 void MainWindow::installCerts() {
75f7288ad67b Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents: 274
diff changeset
974 QStringList choices;
75f7288ad67b Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents: 274
diff changeset
975
75f7288ad67b Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents: 274
diff changeset
976 for (int i = 0; i < mCertListWidget->count(); i++) {
75f7288ad67b Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents: 274
diff changeset
977 QListWidgetItem *item = mCertListWidget->item(i);
75f7288ad67b Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents: 274
diff changeset
978 if (item->checkState() == Qt::Checked) {
445
b3721ded6f5b Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents: 437
diff changeset
979 choices << item->data(CertificateItemDelegate::DataRole).value<Certificate>().base64Line();
365
75f7288ad67b Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents: 274
diff changeset
980 continue;
75f7288ad67b Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents: 274
diff changeset
981 }
445
b3721ded6f5b Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents: 437
diff changeset
982 QString certLine = item->data(CertificateItemDelegate::DataRole).value<Certificate>().base64Line();
365
75f7288ad67b Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents: 274
diff changeset
983 if (certLine.startsWith("I:")) {
75f7288ad67b Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents: 274
diff changeset
984 certLine[0] = 'R';
75f7288ad67b Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents: 274
diff changeset
985 choices << certLine;
75f7288ad67b Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents: 274
diff changeset
986 }
75f7288ad67b Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents: 274
diff changeset
987 }
75f7288ad67b Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents: 274
diff changeset
988
75f7288ad67b Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents: 274
diff changeset
989 QProgressDialog *progress = new QProgressDialog(this);
75f7288ad67b Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents: 274
diff changeset
990 progress->setWindowModality(Qt::WindowModal);
75f7288ad67b Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents: 274
diff changeset
991 progress->setLabelText(tr("Installing certificates..."));
75f7288ad67b Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents: 274
diff changeset
992 progress->setCancelButton(0);
75f7288ad67b Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents: 274
diff changeset
993 progress->setRange(0,0);
75f7288ad67b Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents: 274
diff changeset
994 progress->setMinimumDuration(0);
75f7288ad67b Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents: 274
diff changeset
995 progress->show();
75f7288ad67b Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents: 274
diff changeset
996
75f7288ad67b Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents: 274
diff changeset
997 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
998 mListToInstall.isValid() ?
ae2ef965a41b Provide installer with old list in case there are no news
Andre Heinecke <andre.heinecke@intevation.de>
parents: 389
diff changeset
999 mListToInstall.fileName() :
ae2ef965a41b Provide installer with old list in case there are no news
Andre Heinecke <andre.heinecke@intevation.de>
parents: 389
diff changeset
1000 mInstalledList.fileName(),
365
75f7288ad67b Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents: 274
diff changeset
1001 choices);
75f7288ad67b Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents: 274
diff changeset
1002 /* Clean up object and progress dialog */
75f7288ad67b Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents: 274
diff changeset
1003 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
1004 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
1005 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
1006 connect(instWrap, SIGNAL(installationSuccessful()),
3be838c3e4d8 Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 375
diff changeset
1007 this, SLOT(installerSuccess()));
365
75f7288ad67b Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents: 274
diff changeset
1008 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
1009 this, SLOT(installerError(const QString &)));
365
75f7288ad67b Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents: 274
diff changeset
1010 instWrap->start();
584
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
1011 /*
372
6cc124e79066 Add save/load unselected and add role enumerator
Andre Heinecke <andre.heinecke@intevation.de>
parents: 365
diff changeset
1012 if (!saveUnselectedCertificates()) {
6cc124e79066 Add save/load unselected and add role enumerator
Andre Heinecke <andre.heinecke@intevation.de>
parents: 365
diff changeset
1013 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
1014 }
584
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
1015 */
365
75f7288ad67b Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents: 274
diff changeset
1016 }
372
6cc124e79066 Add save/load unselected and add role enumerator
Andre Heinecke <andre.heinecke@intevation.de>
parents: 365
diff changeset
1017
6cc124e79066 Add save/load unselected and add role enumerator
Andre Heinecke <andre.heinecke@intevation.de>
parents: 365
diff changeset
1018 void MainWindow::loadUnselectedCertificates()
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 mPreviouslyUnselected.clear();
6cc124e79066 Add save/load unselected and add role enumerator
Andre Heinecke <andre.heinecke@intevation.de>
parents: 365
diff changeset
1021 mSettings.beginGroup("unselected");
6cc124e79066 Add save/load unselected and add role enumerator
Andre Heinecke <andre.heinecke@intevation.de>
parents: 365
diff changeset
1022 QStringList keys = mSettings.allKeys();
6cc124e79066 Add save/load unselected and add role enumerator
Andre Heinecke <andre.heinecke@intevation.de>
parents: 365
diff changeset
1023 foreach (const QString &key, keys) {
6cc124e79066 Add save/load unselected and add role enumerator
Andre Heinecke <andre.heinecke@intevation.de>
parents: 365
diff changeset
1024 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
1025 }
6cc124e79066 Add save/load unselected and add role enumerator
Andre Heinecke <andre.heinecke@intevation.de>
parents: 365
diff changeset
1026 mSettings.endGroup();
6cc124e79066 Add save/load unselected and add role enumerator
Andre Heinecke <andre.heinecke@intevation.de>
parents: 365
diff changeset
1027 }
6cc124e79066 Add save/load unselected and add role enumerator
Andre Heinecke <andre.heinecke@intevation.de>
parents: 365
diff changeset
1028
6cc124e79066 Add save/load unselected and add role enumerator
Andre Heinecke <andre.heinecke@intevation.de>
parents: 365
diff changeset
1029 bool MainWindow::saveUnselectedCertificates()
6cc124e79066 Add save/load unselected and add role enumerator
Andre Heinecke <andre.heinecke@intevation.de>
parents: 365
diff changeset
1030 {
479
a8d56a2846a8 Fill the internal list of previously unselcted certificates when saving in settings.
Raimund Renkert <rrenkert@intevation.de>
parents: 461
diff changeset
1031 mPreviouslyUnselected.clear();
372
6cc124e79066 Add save/load unselected and add role enumerator
Andre Heinecke <andre.heinecke@intevation.de>
parents: 365
diff changeset
1032 mSettings.beginGroup("unselected");
6cc124e79066 Add save/load unselected and add role enumerator
Andre Heinecke <andre.heinecke@intevation.de>
parents: 365
diff changeset
1033 mSettings.remove(""); /* Clears old choices */
6cc124e79066 Add save/load unselected and add role enumerator
Andre Heinecke <andre.heinecke@intevation.de>
parents: 365
diff changeset
1034 for (int i = 0; i < mCertListWidget->count(); i++) {
6cc124e79066 Add save/load unselected and add role enumerator
Andre Heinecke <andre.heinecke@intevation.de>
parents: 365
diff changeset
1035 QListWidgetItem *item = mCertListWidget->item(i);
446
43090637d6ae Check if list item is checkable before adding the item to unselected list.
Raimund Renkert <rrenkert@intevation.de>
parents: 445
diff changeset
1036 if (item->checkState() != Qt::Checked &&
43090637d6ae Check if list item is checkable before adding the item to unselected list.
Raimund Renkert <rrenkert@intevation.de>
parents: 445
diff changeset
1037 (item->flags() & Qt::ItemIsUserCheckable)) {
479
a8d56a2846a8 Fill the internal list of previously unselcted certificates when saving in settings.
Raimund Renkert <rrenkert@intevation.de>
parents: 461
diff changeset
1038 QString key = QString::fromLatin1("cert%1").arg(i);
a8d56a2846a8 Fill the internal list of previously unselcted certificates when saving in settings.
Raimund Renkert <rrenkert@intevation.de>
parents: 461
diff changeset
1039 QString value =
a8d56a2846a8 Fill the internal list of previously unselcted certificates when saving in settings.
Raimund Renkert <rrenkert@intevation.de>
parents: 461
diff changeset
1040 item->data(CertificateItemDelegate::DataRole).value<Certificate>().base64Line();
a8d56a2846a8 Fill the internal list of previously unselcted certificates when saving in settings.
Raimund Renkert <rrenkert@intevation.de>
parents: 461
diff changeset
1041 mSettings.setValue(key, value);
a8d56a2846a8 Fill the internal list of previously unselcted certificates when saving in settings.
Raimund Renkert <rrenkert@intevation.de>
parents: 461
diff changeset
1042 mPreviouslyUnselected << value;
372
6cc124e79066 Add save/load unselected and add role enumerator
Andre Heinecke <andre.heinecke@intevation.de>
parents: 365
diff changeset
1043 }
6cc124e79066 Add save/load unselected and add role enumerator
Andre Heinecke <andre.heinecke@intevation.de>
parents: 365
diff changeset
1044 }
6cc124e79066 Add save/load unselected and add role enumerator
Andre Heinecke <andre.heinecke@intevation.de>
parents: 365
diff changeset
1045 mSettings.endGroup();
6cc124e79066 Add save/load unselected and add role enumerator
Andre Heinecke <andre.heinecke@intevation.de>
parents: 365
diff changeset
1046 mSettings.sync();
6cc124e79066 Add save/load unselected and add role enumerator
Andre Heinecke <andre.heinecke@intevation.de>
parents: 365
diff changeset
1047 return mSettings.status() == QSettings::NoError;
6cc124e79066 Add save/load unselected and add role enumerator
Andre Heinecke <andre.heinecke@intevation.de>
parents: 365
diff changeset
1048 }
447
b1b14daf2116 Save the select state of certificate items when closing the app.
Raimund Renkert <rrenkert@intevation.de>
parents: 446
diff changeset
1049
481
9be337ea1e3c Save the autostart and autoupdate settings.
Raimund Renkert <rrenkert@intevation.de>
parents: 480
diff changeset
1050 void MainWindow::saveAutoUpdate(int state)
9be337ea1e3c Save the autostart and autoupdate settings.
Raimund Renkert <rrenkert@intevation.de>
parents: 480
diff changeset
1051 {
9be337ea1e3c Save the autostart and autoupdate settings.
Raimund Renkert <rrenkert@intevation.de>
parents: 480
diff changeset
1052 mSettings.beginGroup("settings");
499
077b4342d69b Default autostart to true and change setting to bool
Andre Heinecke <aheinecke@intevation.de>
parents: 486
diff changeset
1053 mSettings.setValue("autoupdate", state != Qt::Unchecked);
481
9be337ea1e3c Save the autostart and autoupdate settings.
Raimund Renkert <rrenkert@intevation.de>
parents: 480
diff changeset
1054 mSettings.endGroup();
9be337ea1e3c Save the autostart and autoupdate settings.
Raimund Renkert <rrenkert@intevation.de>
parents: 480
diff changeset
1055 }
9be337ea1e3c Save the autostart and autoupdate settings.
Raimund Renkert <rrenkert@intevation.de>
parents: 480
diff changeset
1056
9be337ea1e3c Save the autostart and autoupdate settings.
Raimund Renkert <rrenkert@intevation.de>
parents: 480
diff changeset
1057 void MainWindow::saveAutoStart(int state)
9be337ea1e3c Save the autostart and autoupdate settings.
Raimund Renkert <rrenkert@intevation.de>
parents: 480
diff changeset
1058 {
9be337ea1e3c Save the autostart and autoupdate settings.
Raimund Renkert <rrenkert@intevation.de>
parents: 480
diff changeset
1059 mSettings.beginGroup("settings");
499
077b4342d69b Default autostart to true and change setting to bool
Andre Heinecke <aheinecke@intevation.de>
parents: 486
diff changeset
1060 mSettings.setValue("autostart", state != Qt::Unchecked);
481
9be337ea1e3c Save the autostart and autoupdate settings.
Raimund Renkert <rrenkert@intevation.de>
parents: 480
diff changeset
1061 mSettings.endGroup();
9be337ea1e3c Save the autostart and autoupdate settings.
Raimund Renkert <rrenkert@intevation.de>
parents: 480
diff changeset
1062 }
9be337ea1e3c Save the autostart and autoupdate settings.
Raimund Renkert <rrenkert@intevation.de>
parents: 480
diff changeset
1063
447
b1b14daf2116 Save the select state of certificate items when closing the app.
Raimund Renkert <rrenkert@intevation.de>
parents: 446
diff changeset
1064 void MainWindow::closeApp()
b1b14daf2116 Save the select state of certificate items when closing the app.
Raimund Renkert <rrenkert@intevation.de>
parents: 446
diff changeset
1065 {
584
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
1066 //saveUnselectedCertificates();
447
b1b14daf2116 Save the select state of certificate items when closing the app.
Raimund Renkert <rrenkert@intevation.de>
parents: 446
diff changeset
1067 qApp->quit();
b1b14daf2116 Save the select state of certificate items when closing the app.
Raimund Renkert <rrenkert@intevation.de>
parents: 446
diff changeset
1068 }
584
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
1069
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
1070 void MainWindow::togglePages(int button)
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
1071 {
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
1072 mUpdatesPanel->hide();
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
1073 mInstallPanel->hide();
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
1074 mRemovePanel->hide();
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
1075 mInfoPanel->hide();
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
1076 switch(button) {
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
1077 case 0: mUpdatesPanel->show(); break;
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
1078 case 1: mInstallPanel->show(); break;
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
1079 case 2: mRemovePanel->show(); break;
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
1080 case 3: mInfoPanel->show(); break;
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
1081 default: mUpdatesPanel->show(); break;
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
1082 }
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
1083 return;
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
1084 }
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
1085
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
1086 void MainWindow::toggleUpdatesNew() {
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
1087 QSize old = mUpdatesWidget->size();
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
1088 if (!mUpdatesNew->isVisible()) {
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
1089 mUpdatesWidget->resize(old.width(), old.height() + mUpdatesNew->height());
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
1090 mUpdatesNew->show();
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
1091 }
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
1092 else {
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
1093 mUpdatesWidget->resize(old.width(), old.height() - mUpdatesNew->height());
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
1094 mUpdatesNew->hide();
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
1095 }
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
1096 }
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 void MainWindow::toggleUpdatesRemove() {
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
1099 QSize old = mUpdatesWidget->size();
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
1100 if (!mUpdatesRemove->isVisible()) {
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
1101 mUpdatesWidget->resize(old.width(), old.height() + mUpdatesRemove->height());
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
1102 mUpdatesRemove->show();
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
1103 }
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
1104 else {
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
1105 mUpdatesWidget->resize(old.width(), old.height() - mUpdatesRemove->height());
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
1106 mUpdatesRemove->hide();
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
1107 }
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
1108 }
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
1109
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
1110 void MainWindow::toggleUpdatesManual() {
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
1111 QSize old = mUpdatesWidget->size();
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
1112 if (!mUpdatesManual->isVisible()) {
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
1113 mUpdatesWidget->resize(old.width(), old.height() + mUpdatesManual->height());
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
1114 mUpdatesManual->show();
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
1115 }
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
1116 else {
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
1117 mUpdatesManual->hide();
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
1118 mUpdatesWidget->resize(old.width(), old.height() - mUpdatesManual->height());
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
1119 }
ebfe1128ee97 Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents: 563
diff changeset
1120 }

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