annotate ui/mainwindow.cpp @ 640:626507197360 trustbridge-refactor

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

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