Mercurial > trustbridge
annotate ui/mainwindow.cpp @ 524:a097dd86cb4d
merged.
author | Raimund Renkert <rrenkert@intevation.de> |
---|---|
date | Tue, 29 Apr 2014 15:26:43 +0200 |
parents | ca583ffe728a d1812e171d0c |
children | 3edbe1af2c85 |
rev | line source |
---|---|
404 | 1 /* Copyright (C) 2014 by Bundesamt für Sicherheit in der Informationstechnik |
2 * Software engineering by Intevation GmbH | |
3 * | |
4 * This file is Free Software under the GNU GPL (v>=2) | |
5 * and comes with ABSOLUTELY NO WARRANTY! | |
6 * See LICENSE.txt for details. | |
7 */ | |
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> |
365
75f7288ad67b
Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents:
274
diff
changeset
|
11 #include <QProgressDialog> |
0
cb0cde2c5eb9
Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
12 #include <QMessageBox> |
cb0cde2c5eb9
Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
13 #include <QSystemTrayIcon> |
cb0cde2c5eb9
Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
14 #include <QAction> |
cb0cde2c5eb9
Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
15 #include <QDialog> |
cb0cde2c5eb9
Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
16 #include <QMenu> |
2 | 17 #include <QApplication> |
16
225a5ec20dad
Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents:
11
diff
changeset
|
18 #include <QFile> |
19
9af6198deb8e
Add timed trigger for the message
Andre Heinecke <aheinecke@intevation.de>
parents:
17
diff
changeset
|
19 #include <QTimer> |
187
0c06a608e15f
Create the mainwindow content.
Raimund Renkert <rrenkert@intevation.de>
parents:
155
diff
changeset
|
20 #include <QHBoxLayout> |
0c06a608e15f
Create the mainwindow content.
Raimund Renkert <rrenkert@intevation.de>
parents:
155
diff
changeset
|
21 #include <QVBoxLayout> |
0c06a608e15f
Create the mainwindow content.
Raimund Renkert <rrenkert@intevation.de>
parents:
155
diff
changeset
|
22 #include <QGroupBox> |
189
5f0d45ca9de4
Show certificates in the list view and details in the textfield.
Raimund Renkert <rrenkert@intevation.de>
parents:
187
diff
changeset
|
23 #include <QSplitter> |
205
a3f542bf38f7
Added header for mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
200
diff
changeset
|
24 #include <QLabel> |
a3f542bf38f7
Added header for mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
200
diff
changeset
|
25 #include <QImage> |
250
1e112cf41e92
Updated the mainwindow layout.
Raimund Renkert <rrenkert@intevation.de>
parents:
249
diff
changeset
|
26 #include <QCheckBox> |
19
9af6198deb8e
Add timed trigger for the message
Andre Heinecke <aheinecke@intevation.de>
parents:
17
diff
changeset
|
27 |
9af6198deb8e
Add timed trigger for the message
Andre Heinecke <aheinecke@intevation.de>
parents:
17
diff
changeset
|
28 // 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
|
29 // something to say |
365
75f7288ad67b
Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents:
274
diff
changeset
|
30 #define NAG_INTERVAL_MINUTES 60 |
0
cb0cde2c5eb9
Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
31 |
409
09bb19e5e369
Remove m13 mentions and change test certificate to intevation.de
Andre Heinecke <aheinecke@intevation.de>
parents:
407
diff
changeset
|
32 #ifndef APPNAME |
09bb19e5e369
Remove m13 mentions and change test certificate to intevation.de
Andre Heinecke <aheinecke@intevation.de>
parents:
407
diff
changeset
|
33 #define APPNAME "TrustBridge" |
09bb19e5e369
Remove m13 mentions and change test certificate to intevation.de
Andre Heinecke <aheinecke@intevation.de>
parents:
407
diff
changeset
|
34 #endif |
09bb19e5e369
Remove m13 mentions and change test certificate to intevation.de
Andre Heinecke <aheinecke@intevation.de>
parents:
407
diff
changeset
|
35 |
09bb19e5e369
Remove m13 mentions and change test certificate to intevation.de
Andre Heinecke <aheinecke@intevation.de>
parents:
407
diff
changeset
|
36 #define SERVER_URL "https://files.intevation.de:443" |
09bb19e5e369
Remove m13 mentions and change test certificate to intevation.de
Andre Heinecke <aheinecke@intevation.de>
parents:
407
diff
changeset
|
37 #define LIST_RESOURCE "/users/aheinecke/zertifikatsliste_1.txt" |
09bb19e5e369
Remove m13 mentions and change test certificate to intevation.de
Andre Heinecke <aheinecke@intevation.de>
parents:
407
diff
changeset
|
38 #define SW_RESOURCE "/users/aheinecke/zertifikatsliste_1.txt" |
486
fa56a9403939
Lookup the last modified date for software installer after first installation.
Raimund Renkert <rrenkert@intevation.de>
parents:
481
diff
changeset
|
39 #ifdef Q_OS_WIN |
fa56a9403939
Lookup the last modified date for software installer after first installation.
Raimund Renkert <rrenkert@intevation.de>
parents:
481
diff
changeset
|
40 #define SW_RESOURCE_VERSION "/users/aheinecke/trustbridge-%1.exe" |
fa56a9403939
Lookup the last modified date for software installer after first installation.
Raimund Renkert <rrenkert@intevation.de>
parents:
481
diff
changeset
|
41 #else |
fa56a9403939
Lookup the last modified date for software installer after first installation.
Raimund Renkert <rrenkert@intevation.de>
parents:
481
diff
changeset
|
42 #define SW_RESOURCE_VERSION "/users/aheinecke/trustbridge-%1.sh" |
fa56a9403939
Lookup the last modified date for software installer after first installation.
Raimund Renkert <rrenkert@intevation.de>
parents:
481
diff
changeset
|
43 #endif |
72
7e304573ebd1
Add some testing hacks for interactive testing
Andre Heinecke <aheinecke@intevation.de>
parents:
71
diff
changeset
|
44 |
7
992c0ec57660
Add unit tests make CertificateList work.
Andre Heinecke <aheinecke@intevation.de>
parents:
2
diff
changeset
|
45 #include "certificatelist.h" |
10
fe39d93f1261
Start on Downloader component
Andre Heinecke <aheinecke@intevation.de>
parents:
7
diff
changeset
|
46 #include "downloader.h" |
191
246c21b1727f
Show the help dialog.
Raimund Renkert <rrenkert@intevation.de>
parents:
189
diff
changeset
|
47 #include "helpdialog.h" |
200
fe424c5fc875
Show the about dialog.
Raimund Renkert <rrenkert@intevation.de>
parents:
191
diff
changeset
|
48 #include "aboutdialog.h" |
212
f7176140d20d
Added menu entry to show the status dialog.
Raimund Renkert <rrenkert@intevation.de>
parents:
210
diff
changeset
|
49 #include "statusdialog.h" |
267
89e8783866f8
Use the certificate item delegate in the mainwind list view.
Raimund Renkert <rrenkert@intevation.de>
parents:
265
diff
changeset
|
50 #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
|
51 #include "separatoritemdelegate.h" |
365
75f7288ad67b
Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents:
274
diff
changeset
|
52 #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
|
53 #include "util.h" |
7
992c0ec57660
Add unit tests make CertificateList work.
Andre Heinecke <aheinecke@intevation.de>
parents:
2
diff
changeset
|
54 |
365
75f7288ad67b
Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents:
274
diff
changeset
|
55 MainWindow::MainWindow(bool trayMode): |
75f7288ad67b
Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents:
274
diff
changeset
|
56 mTrayMode(trayMode) |
75f7288ad67b
Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents:
274
diff
changeset
|
57 { |
0
cb0cde2c5eb9
Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
58 createActions(); |
cb0cde2c5eb9
Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
59 createTrayIcon(); |
155
c0fdb8d336cf
Added menubar/menu and method stubs to mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
82
diff
changeset
|
60 createMenuBar(); |
187
0c06a608e15f
Create the mainwindow content.
Raimund Renkert <rrenkert@intevation.de>
parents:
155
diff
changeset
|
61 createContent(); |
450
4932fc33ee82
Updated window and main layout size.
Raimund Renkert <rrenkert@intevation.de>
parents:
449
diff
changeset
|
62 resize(950, 540); |
45
c6125d73faf4
Move SSLConnection into it's own class
Andre Heinecke <aheinecke@intevation.de>
parents:
31
diff
changeset
|
63 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
|
64 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
|
65 |
cb0cde2c5eb9
Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
66 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
|
67 this, SLOT(iconActivated(QSystemTrayIcon::ActivationReason))); |
19
9af6198deb8e
Add timed trigger for the message
Andre Heinecke <aheinecke@intevation.de>
parents:
17
diff
changeset
|
68 |
9af6198deb8e
Add timed trigger for the message
Andre Heinecke <aheinecke@intevation.de>
parents:
17
diff
changeset
|
69 mMessageTimer = new QTimer(this); |
9af6198deb8e
Add timed trigger for the message
Andre Heinecke <aheinecke@intevation.de>
parents:
17
diff
changeset
|
70 connect(mMessageTimer, SIGNAL(timeout()), this, SLOT(showMessage())); |
9af6198deb8e
Add timed trigger for the message
Andre Heinecke <aheinecke@intevation.de>
parents:
17
diff
changeset
|
71 mMessageTimer->setInterval(NAG_INTERVAL_MINUTES * 60 * 1000); |
9af6198deb8e
Add timed trigger for the message
Andre Heinecke <aheinecke@intevation.de>
parents:
17
diff
changeset
|
72 mMessageTimer->start(); |
71
f22a99f7cb69
Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents:
45
diff
changeset
|
73 checkUpdates(); |
389
3be838c3e4d8
Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
375
diff
changeset
|
74 loadUnselectedCertificates(); |
3be838c3e4d8
Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
375
diff
changeset
|
75 loadCertificateList(); |
365
75f7288ad67b
Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents:
274
diff
changeset
|
76 if (!trayMode) { |
75f7288ad67b
Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents:
274
diff
changeset
|
77 show(); |
75f7288ad67b
Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents:
274
diff
changeset
|
78 } |
0
cb0cde2c5eb9
Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
79 } |
cb0cde2c5eb9
Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
80 |
cb0cde2c5eb9
Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
81 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
|
82 { |
cb0cde2c5eb9
Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
83 switch (reason) { |
cb0cde2c5eb9
Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
84 case QSystemTrayIcon::Trigger: |
cb0cde2c5eb9
Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
85 case QSystemTrayIcon::MiddleClick: |
cb0cde2c5eb9
Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
86 showMessage(); |
cb0cde2c5eb9
Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
87 break; |
16
225a5ec20dad
Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents:
11
diff
changeset
|
88 case QSystemTrayIcon::DoubleClick: |
365
75f7288ad67b
Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents:
274
diff
changeset
|
89 show(); |
16
225a5ec20dad
Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents:
11
diff
changeset
|
90 break; |
0
cb0cde2c5eb9
Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
91 default: |
cb0cde2c5eb9
Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
92 ; |
cb0cde2c5eb9
Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
93 } |
cb0cde2c5eb9
Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
94 } |
cb0cde2c5eb9
Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
95 |
71
f22a99f7cb69
Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents:
45
diff
changeset
|
96 void MainWindow::messageClicked() |
f22a99f7cb69
Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents:
45
diff
changeset
|
97 { |
f22a99f7cb69
Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents:
45
diff
changeset
|
98 if (mCurState == NewListAvailable) { |
365
75f7288ad67b
Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents:
274
diff
changeset
|
99 show(); |
71
f22a99f7cb69
Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents:
45
diff
changeset
|
100 } |
f22a99f7cb69
Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents:
45
diff
changeset
|
101 } |
f22a99f7cb69
Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents:
45
diff
changeset
|
102 |
0
cb0cde2c5eb9
Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
103 void MainWindow::showMessage() |
cb0cde2c5eb9
Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
104 { |
365
75f7288ad67b
Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents:
274
diff
changeset
|
105 if (!isVisible() && !mCurMessage.isEmpty()) { |
16
225a5ec20dad
Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents:
11
diff
changeset
|
106 mTrayIcon->showMessage(QApplication::applicationName(), mCurMessage, |
225a5ec20dad
Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents:
11
diff
changeset
|
107 QSystemTrayIcon::Information, 5000); |
19
9af6198deb8e
Add timed trigger for the message
Andre Heinecke <aheinecke@intevation.de>
parents:
17
diff
changeset
|
108 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
|
109 } |
0
cb0cde2c5eb9
Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
110 } |
16
225a5ec20dad
Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents:
11
diff
changeset
|
111 |
225a5ec20dad
Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents:
11
diff
changeset
|
112 void MainWindow::verifyAvailableData() |
0
cb0cde2c5eb9
Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
113 { |
389
3be838c3e4d8
Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
375
diff
changeset
|
114 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
|
115 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
|
116 QString swFileName = mSettings.value("Software/available").toString(); |
225a5ec20dad
Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents:
11
diff
changeset
|
117 |
389
3be838c3e4d8
Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
375
diff
changeset
|
118 if (!availableFileName.isEmpty()) { |
3be838c3e4d8
Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
375
diff
changeset
|
119 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
|
120 if (!mListToInstall.isValid()) { |
82
1f27d6db5ee3
Polarssl based certificate handling
Andre Heinecke <aheinecke@intevation.de>
parents:
72
diff
changeset
|
121 mCurState = TransferError; |
16
225a5ec20dad
Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents:
11
diff
changeset
|
122 // 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
|
123 // 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
|
124 // 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
|
125 QFile::remove(availableFileName); |
16
225a5ec20dad
Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents:
11
diff
changeset
|
126 mSettings.remove("List/available"); |
225a5ec20dad
Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents:
11
diff
changeset
|
127 mSettings.remove("List/availableDate"); |
225a5ec20dad
Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents:
11
diff
changeset
|
128 } |
225a5ec20dad
Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents:
11
diff
changeset
|
129 } else { |
225a5ec20dad
Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents:
11
diff
changeset
|
130 // 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
|
131 mSettings.remove("List/available"); |
225a5ec20dad
Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents:
11
diff
changeset
|
132 mSettings.remove("List/availableDate"); |
225a5ec20dad
Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents:
11
diff
changeset
|
133 } |
225a5ec20dad
Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents:
11
diff
changeset
|
134 |
389
3be838c3e4d8
Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
375
diff
changeset
|
135 if (!installedFileName.isEmpty()) { |
3be838c3e4d8
Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
375
diff
changeset
|
136 mInstalledList.readList(installedFileName.toLocal8Bit().constData()); |
3be838c3e4d8
Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
375
diff
changeset
|
137 if (!mInstalledList.isValid()) { |
3be838c3e4d8
Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
375
diff
changeset
|
138 // 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
|
139 // 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
|
140 // 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
|
141 QFile::remove(installedFileName); |
3be838c3e4d8
Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
375
diff
changeset
|
142 mSettings.remove("List/installed"); |
3be838c3e4d8
Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
375
diff
changeset
|
143 mSettings.remove("List/installedDate"); |
3be838c3e4d8
Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
375
diff
changeset
|
144 } |
3be838c3e4d8
Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
375
diff
changeset
|
145 } else { |
3be838c3e4d8
Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
375
diff
changeset
|
146 // Make sure the available notation is also removed |
3be838c3e4d8
Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
375
diff
changeset
|
147 mSettings.remove("List/installed"); |
3be838c3e4d8
Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
375
diff
changeset
|
148 mSettings.remove("List/installedDate"); |
3be838c3e4d8
Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
375
diff
changeset
|
149 } |
3be838c3e4d8
Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
375
diff
changeset
|
150 |
16
225a5ec20dad
Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents:
11
diff
changeset
|
151 if (!swFileName.isEmpty()) { |
225a5ec20dad
Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents:
11
diff
changeset
|
152 // TODO |
225a5ec20dad
Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents:
11
diff
changeset
|
153 } else { |
225a5ec20dad
Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents:
11
diff
changeset
|
154 mSettings.remove("Software/available"); |
225a5ec20dad
Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents:
11
diff
changeset
|
155 mSettings.remove("Software/availableDate"); |
225a5ec20dad
Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents:
11
diff
changeset
|
156 } |
225a5ec20dad
Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents:
11
diff
changeset
|
157 } |
225a5ec20dad
Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents:
11
diff
changeset
|
158 |
225a5ec20dad
Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents:
11
diff
changeset
|
159 void MainWindow::handleNewList(const QString& fileName, const QDateTime& modDate) { |
71
f22a99f7cb69
Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents:
45
diff
changeset
|
160 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
|
161 mSettings.setValue("List/availableDate", modDate); |
16
225a5ec20dad
Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents:
11
diff
changeset
|
162 |
71
f22a99f7cb69
Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents:
45
diff
changeset
|
163 verifyAvailableData(); |
f22a99f7cb69
Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents:
45
diff
changeset
|
164 if (!mListToInstall.isValid()) { |
f22a99f7cb69
Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents:
45
diff
changeset
|
165 /* 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
|
166 /* 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
|
167 * 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
|
168 |
f22a99f7cb69
Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents:
45
diff
changeset
|
169 /* 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
|
170 QTimer::singleShot(600000 + (qrand() % 60000), this, SLOT(checkUpdates())); |
82
1f27d6db5ee3
Polarssl based certificate handling
Andre Heinecke <aheinecke@intevation.de>
parents:
72
diff
changeset
|
171 } else { |
1f27d6db5ee3
Polarssl based certificate handling
Andre Heinecke <aheinecke@intevation.de>
parents:
72
diff
changeset
|
172 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
|
173 setState(NewListAvailable); |
1f27d6db5ee3
Polarssl based certificate handling
Andre Heinecke <aheinecke@intevation.de>
parents:
72
diff
changeset
|
174 showMessage(); |
189
5f0d45ca9de4
Show certificates in the list view and details in the textfield.
Raimund Renkert <rrenkert@intevation.de>
parents:
187
diff
changeset
|
175 loadCertificateList(); |
71
f22a99f7cb69
Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents:
45
diff
changeset
|
176 } |
16
225a5ec20dad
Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents:
11
diff
changeset
|
177 } |
225a5ec20dad
Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents:
11
diff
changeset
|
178 |
225a5ec20dad
Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents:
11
diff
changeset
|
179 void MainWindow::handleNewSW(const QString& fileName, const QDateTime& modDate) { |
225a5ec20dad
Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents:
11
diff
changeset
|
180 mCurMessage = tr("An update for %1 is available. Click here to install.").arg( |
225a5ec20dad
Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents:
11
diff
changeset
|
181 QApplication::applicationName()); |
225a5ec20dad
Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents:
11
diff
changeset
|
182 setState(NewSoftwareAvailable); |
225a5ec20dad
Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents:
11
diff
changeset
|
183 mSettings.setValue("Software/available", fileName); |
225a5ec20dad
Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents:
11
diff
changeset
|
184 mSettings.setValue("Software/availableDate", modDate); |
225a5ec20dad
Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents:
11
diff
changeset
|
185 |
225a5ec20dad
Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents:
11
diff
changeset
|
186 mSettings.sync(); |
225a5ec20dad
Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents:
11
diff
changeset
|
187 showMessage(); |
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 |
461
1ce835c40eb7
Ask the user if software updates should be installed.
Raimund Renkert <rrenkert@intevation.de>
parents:
456
diff
changeset
|
190 void MainWindow::checkUpdates(bool downloadSW) |
16
225a5ec20dad
Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents:
11
diff
changeset
|
191 { |
225a5ec20dad
Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents:
11
diff
changeset
|
192 verifyAvailableData(); |
225a5ec20dad
Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents:
11
diff
changeset
|
193 |
486
fa56a9403939
Lookup the last modified date for software installer after first installation.
Raimund Renkert <rrenkert@intevation.de>
parents:
481
diff
changeset
|
194 if (!mSettings.contains("Software/installedDate")) { |
fa56a9403939
Lookup the last modified date for software installer after first installation.
Raimund Renkert <rrenkert@intevation.de>
parents:
481
diff
changeset
|
195 lookUpDateForVersion(); |
fa56a9403939
Lookup the last modified date for software installer after first installation.
Raimund Renkert <rrenkert@intevation.de>
parents:
481
diff
changeset
|
196 return; |
fa56a9403939
Lookup the last modified date for software installer after first installation.
Raimund Renkert <rrenkert@intevation.de>
parents:
481
diff
changeset
|
197 } |
17
c12825a651ed
Read out content-length and use this to skip existing files
Andre Heinecke <aheinecke@intevation.de>
parents:
16
diff
changeset
|
198 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
|
199 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
|
200 |
389
3be838c3e4d8
Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
375
diff
changeset
|
201 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
|
202 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
|
203 |
3be838c3e4d8
Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
375
diff
changeset
|
204 #ifndef RELEASE_BUILD |
3be838c3e4d8
Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
375
diff
changeset
|
205 /* 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
|
206 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
|
207 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
|
208 #endif |
3be838c3e4d8
Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
375
diff
changeset
|
209 |
3be838c3e4d8
Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
375
diff
changeset
|
210 |
72
7e304573ebd1
Add some testing hacks for interactive testing
Andre Heinecke <aheinecke@intevation.de>
parents:
71
diff
changeset
|
211 Downloader* downloader = new Downloader(this, |
7e304573ebd1
Add some testing hacks for interactive testing
Andre Heinecke <aheinecke@intevation.de>
parents:
71
diff
changeset
|
212 QString::fromLatin1(SERVER_URL), |
7e304573ebd1
Add some testing hacks for interactive testing
Andre Heinecke <aheinecke@intevation.de>
parents:
71
diff
changeset
|
213 QByteArray(), |
7e304573ebd1
Add some testing hacks for interactive testing
Andre Heinecke <aheinecke@intevation.de>
parents:
71
diff
changeset
|
214 QDateTime::currentDateTime(), |
389
3be838c3e4d8
Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
375
diff
changeset
|
215 // TODO swInstalledLastMod, |
72
7e304573ebd1
Add some testing hacks for interactive testing
Andre Heinecke <aheinecke@intevation.de>
parents:
71
diff
changeset
|
216 listInstalledLastMod, |
437
4b486a14252f
Acutally use the values that can be taken from the config
Andre Heinecke <aheinecke@intevation.de>
parents:
434
diff
changeset
|
217 swResource, |
461
1ce835c40eb7
Ask the user if software updates should be installed.
Raimund Renkert <rrenkert@intevation.de>
parents:
456
diff
changeset
|
218 listResource, |
1ce835c40eb7
Ask the user if software updates should be installed.
Raimund Renkert <rrenkert@intevation.de>
parents:
456
diff
changeset
|
219 downloadSW); |
17
c12825a651ed
Read out content-length and use this to skip existing files
Andre Heinecke <aheinecke@intevation.de>
parents:
16
diff
changeset
|
220 |
16
225a5ec20dad
Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents:
11
diff
changeset
|
221 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
|
222 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
|
223 if (!downloadSW) { |
1ce835c40eb7
Ask the user if software updates should be installed.
Raimund Renkert <rrenkert@intevation.de>
parents:
456
diff
changeset
|
224 connect(downloader, SIGNAL(newSoftwareAvailable(const QString&, const QDateTime&)), |
1ce835c40eb7
Ask the user if software updates should be installed.
Raimund Renkert <rrenkert@intevation.de>
parents:
456
diff
changeset
|
225 this, SLOT(newSWAvailable(const QString&, const QDateTime&))); |
1ce835c40eb7
Ask the user if software updates should be installed.
Raimund Renkert <rrenkert@intevation.de>
parents:
456
diff
changeset
|
226 } |
1ce835c40eb7
Ask the user if software updates should be installed.
Raimund Renkert <rrenkert@intevation.de>
parents:
456
diff
changeset
|
227 else { |
1ce835c40eb7
Ask the user if software updates should be installed.
Raimund Renkert <rrenkert@intevation.de>
parents:
456
diff
changeset
|
228 connect(downloader, SIGNAL(newSoftwareAvailable(const QString&, const QDateTime&)), |
1ce835c40eb7
Ask the user if software updates should be installed.
Raimund Renkert <rrenkert@intevation.de>
parents:
456
diff
changeset
|
229 this, SLOT(handleNewSW(const QString&, const QDateTime&))); |
1ce835c40eb7
Ask the user if software updates should be installed.
Raimund Renkert <rrenkert@intevation.de>
parents:
456
diff
changeset
|
230 } |
16
225a5ec20dad
Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents:
11
diff
changeset
|
231 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
|
232 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
|
233 this, SLOT(downloaderError(const QString &, SSLConnection::ErrorCode))); |
10
fe39d93f1261
Start on Downloader component
Andre Heinecke <aheinecke@intevation.de>
parents:
7
diff
changeset
|
234 downloader->start(); |
0
cb0cde2c5eb9
Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
235 } |
cb0cde2c5eb9
Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
236 |
486
fa56a9403939
Lookup the last modified date for software installer after first installation.
Raimund Renkert <rrenkert@intevation.de>
parents:
481
diff
changeset
|
237 void MainWindow::lookUpDateForVersion() |
fa56a9403939
Lookup the last modified date for software installer after first installation.
Raimund Renkert <rrenkert@intevation.de>
parents:
481
diff
changeset
|
238 { |
fa56a9403939
Lookup the last modified date for software installer after first installation.
Raimund Renkert <rrenkert@intevation.de>
parents:
481
diff
changeset
|
239 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
|
240 QApplication::applicationVersion()); |
fa56a9403939
Lookup the last modified date for software installer after first installation.
Raimund Renkert <rrenkert@intevation.de>
parents:
481
diff
changeset
|
241 qDebug() << softwareVersion; |
fa56a9403939
Lookup the last modified date for software installer after first installation.
Raimund Renkert <rrenkert@intevation.de>
parents:
481
diff
changeset
|
242 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
|
243 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
|
244 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
|
245 QByteArray(), |
fa56a9403939
Lookup the last modified date for software installer after first installation.
Raimund Renkert <rrenkert@intevation.de>
parents:
481
diff
changeset
|
246 QDateTime::currentDateTime(), |
fa56a9403939
Lookup the last modified date for software installer after first installation.
Raimund Renkert <rrenkert@intevation.de>
parents:
481
diff
changeset
|
247 QDateTime::currentDateTime(), |
fa56a9403939
Lookup the last modified date for software installer after first installation.
Raimund Renkert <rrenkert@intevation.de>
parents:
481
diff
changeset
|
248 softwareVersion, |
fa56a9403939
Lookup the last modified date for software installer after first installation.
Raimund Renkert <rrenkert@intevation.de>
parents:
481
diff
changeset
|
249 listResource, |
fa56a9403939
Lookup the last modified date for software installer after first installation.
Raimund Renkert <rrenkert@intevation.de>
parents:
481
diff
changeset
|
250 false); |
fa56a9403939
Lookup the last modified date for software installer after first installation.
Raimund Renkert <rrenkert@intevation.de>
parents:
481
diff
changeset
|
251 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
|
252 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
|
253 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
|
254 connect(downloader, SIGNAL(lastModifiedDate(const QDateTime&)), |
fa56a9403939
Lookup the last modified date for software installer after first installation.
Raimund Renkert <rrenkert@intevation.de>
parents:
481
diff
changeset
|
255 this, SLOT(setLastModifiedDate(const QDateTime&))); |
fa56a9403939
Lookup the last modified date for software installer after first installation.
Raimund Renkert <rrenkert@intevation.de>
parents:
481
diff
changeset
|
256 |
fa56a9403939
Lookup the last modified date for software installer after first installation.
Raimund Renkert <rrenkert@intevation.de>
parents:
481
diff
changeset
|
257 downloader->start(); |
fa56a9403939
Lookup the last modified date for software installer after first installation.
Raimund Renkert <rrenkert@intevation.de>
parents:
481
diff
changeset
|
258 } |
fa56a9403939
Lookup the last modified date for software installer after first installation.
Raimund Renkert <rrenkert@intevation.de>
parents:
481
diff
changeset
|
259 |
fa56a9403939
Lookup the last modified date for software installer after first installation.
Raimund Renkert <rrenkert@intevation.de>
parents:
481
diff
changeset
|
260 void MainWindow::setLastModifiedDate(const QDateTime &date) |
fa56a9403939
Lookup the last modified date for software installer after first installation.
Raimund Renkert <rrenkert@intevation.de>
parents:
481
diff
changeset
|
261 { |
fa56a9403939
Lookup the last modified date for software installer after first installation.
Raimund Renkert <rrenkert@intevation.de>
parents:
481
diff
changeset
|
262 mSettings.beginGroup("Software"); |
fa56a9403939
Lookup the last modified date for software installer after first installation.
Raimund Renkert <rrenkert@intevation.de>
parents:
481
diff
changeset
|
263 mSettings.setValue("installedDate", date); |
fa56a9403939
Lookup the last modified date for software installer after first installation.
Raimund Renkert <rrenkert@intevation.de>
parents:
481
diff
changeset
|
264 mSettings.endGroup(); |
fa56a9403939
Lookup the last modified date for software installer after first installation.
Raimund Renkert <rrenkert@intevation.de>
parents:
481
diff
changeset
|
265 checkUpdates(); |
fa56a9403939
Lookup the last modified date for software installer after first installation.
Raimund Renkert <rrenkert@intevation.de>
parents:
481
diff
changeset
|
266 } |
fa56a9403939
Lookup the last modified date for software installer after first installation.
Raimund Renkert <rrenkert@intevation.de>
parents:
481
diff
changeset
|
267 |
461
1ce835c40eb7
Ask the user if software updates should be installed.
Raimund Renkert <rrenkert@intevation.de>
parents:
456
diff
changeset
|
268 void MainWindow::newSWAvailable(const QString &fileName, const QDateTime &date) { |
1ce835c40eb7
Ask the user if software updates should be installed.
Raimund Renkert <rrenkert@intevation.de>
parents:
456
diff
changeset
|
269 QMessageBox msgBox; |
1ce835c40eb7
Ask the user if software updates should be installed.
Raimund Renkert <rrenkert@intevation.de>
parents:
456
diff
changeset
|
270 msgBox.setIcon(QMessageBox::Information); |
1ce835c40eb7
Ask the user if software updates should be installed.
Raimund Renkert <rrenkert@intevation.de>
parents:
456
diff
changeset
|
271 msgBox.setText("<h3>" + tr("New Software version is available.") + "</h3>"); |
1ce835c40eb7
Ask the user if software updates should be installed.
Raimund Renkert <rrenkert@intevation.de>
parents:
456
diff
changeset
|
272 msgBox.setInformativeText(tr("Do you want to install the new Version?")); |
1ce835c40eb7
Ask the user if software updates should be installed.
Raimund Renkert <rrenkert@intevation.de>
parents:
456
diff
changeset
|
273 msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::Cancel); |
1ce835c40eb7
Ask the user if software updates should be installed.
Raimund Renkert <rrenkert@intevation.de>
parents:
456
diff
changeset
|
274 msgBox.setDefaultButton(QMessageBox::Yes); |
1ce835c40eb7
Ask the user if software updates should be installed.
Raimund Renkert <rrenkert@intevation.de>
parents:
456
diff
changeset
|
275 int selection = msgBox.exec(); |
1ce835c40eb7
Ask the user if software updates should be installed.
Raimund Renkert <rrenkert@intevation.de>
parents:
456
diff
changeset
|
276 if (selection == QMessageBox::Yes) { |
1ce835c40eb7
Ask the user if software updates should be installed.
Raimund Renkert <rrenkert@intevation.de>
parents:
456
diff
changeset
|
277 checkUpdates(true); |
1ce835c40eb7
Ask the user if software updates should be installed.
Raimund Renkert <rrenkert@intevation.de>
parents:
456
diff
changeset
|
278 } |
1ce835c40eb7
Ask the user if software updates should be installed.
Raimund Renkert <rrenkert@intevation.de>
parents:
456
diff
changeset
|
279 } |
16
225a5ec20dad
Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents:
11
diff
changeset
|
280 |
45
c6125d73faf4
Move SSLConnection into it's own class
Andre Heinecke <aheinecke@intevation.de>
parents:
31
diff
changeset
|
281 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
|
282 { |
225a5ec20dad
Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents:
11
diff
changeset
|
283 mCurMessage = message; |
27
62cd56cea09b
Start on polarssl Downloader.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
19
diff
changeset
|
284 showMessage(); |
16
225a5ec20dad
Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents:
11
diff
changeset
|
285 } |
225a5ec20dad
Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents:
11
diff
changeset
|
286 |
225a5ec20dad
Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents:
11
diff
changeset
|
287 |
0
cb0cde2c5eb9
Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
288 void MainWindow::createActions() |
cb0cde2c5eb9
Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
289 { |
cb0cde2c5eb9
Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
290 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
|
291 connect(mCheckUpdates, SIGNAL(triggered()), this, SLOT(checkUpdates())); |
2 | 292 mQuitAction = new QAction(tr("Quit"), this); |
293 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
|
294 } |
cb0cde2c5eb9
Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
295 |
cb0cde2c5eb9
Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
296 void MainWindow::createTrayIcon() |
cb0cde2c5eb9
Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
297 { |
11
7e2f14c7aba2
Split up downloader component and further implement it
Andre Heinecke <aheinecke@intevation.de>
parents:
10
diff
changeset
|
298 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
|
299 |
cb0cde2c5eb9
Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
300 mTrayMenu = new QMenu(this); |
cb0cde2c5eb9
Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
301 mTrayMenu->addAction(mCheckUpdates); |
2 | 302 mTrayMenu->addAction(mQuitAction); |
0
cb0cde2c5eb9
Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
303 |
cb0cde2c5eb9
Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
304 mTrayIcon = new QSystemTrayIcon(this); |
cb0cde2c5eb9
Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
305 mTrayIcon->setContextMenu(mTrayMenu); |
cb0cde2c5eb9
Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
306 |
cb0cde2c5eb9
Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
307 mTrayIcon->setIcon(trayImg); |
cb0cde2c5eb9
Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
308 setWindowIcon(trayImg); |
cb0cde2c5eb9
Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
309 mTrayIcon->show(); |
407
af53c40e74b1
Rename m13ui to TrustBridge
Andre Heinecke <aheinecke@intevation.de>
parents:
404
diff
changeset
|
310 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
|
311 |
f22a99f7cb69
Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents:
45
diff
changeset
|
312 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
|
313 } |
155
c0fdb8d336cf
Added menubar/menu and method stubs to mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
82
diff
changeset
|
314 |
c0fdb8d336cf
Added menubar/menu and method stubs to mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
82
diff
changeset
|
315 void MainWindow::createMenuBar() |
c0fdb8d336cf
Added menubar/menu and method stubs to mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
82
diff
changeset
|
316 { |
c0fdb8d336cf
Added menubar/menu and method stubs to mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
82
diff
changeset
|
317 mMenuBar = new QMenuBar(this); |
c0fdb8d336cf
Added menubar/menu and method stubs to mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
82
diff
changeset
|
318 QMenu *mMenu = new QMenu(tr("Menu"), mMenuBar); |
c0fdb8d336cf
Added menubar/menu and method stubs to mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
82
diff
changeset
|
319 mMenuBar->addMenu(mMenu); |
c0fdb8d336cf
Added menubar/menu and method stubs to mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
82
diff
changeset
|
320 QAction *update = mMenu->addAction(tr("Force Update")); |
523
ca583ffe728a
Removed menu entries.
Raimund Renkert <rrenkert@intevation.de>
parents:
486
diff
changeset
|
321 // QAction *settings = mMenu->addAction(tr("Settings")); |
ca583ffe728a
Removed menu entries.
Raimund Renkert <rrenkert@intevation.de>
parents:
486
diff
changeset
|
322 // QAction *status = mMenu->addAction(tr("Statusdialog")); |
155
c0fdb8d336cf
Added menubar/menu and method stubs to mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
82
diff
changeset
|
323 mMenu->addSeparator(); |
c0fdb8d336cf
Added menubar/menu and method stubs to mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
82
diff
changeset
|
324 QAction *help = mMenu->addAction(tr("Help")); |
c0fdb8d336cf
Added menubar/menu and method stubs to mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
82
diff
changeset
|
325 QAction *about = mMenu->addAction(tr("About")); |
c0fdb8d336cf
Added menubar/menu and method stubs to mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
82
diff
changeset
|
326 mMenu->addSeparator(); |
c0fdb8d336cf
Added menubar/menu and method stubs to mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
82
diff
changeset
|
327 QAction *quit = mMenu->addAction(tr("Quit")); |
c0fdb8d336cf
Added menubar/menu and method stubs to mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
82
diff
changeset
|
328 connect(update, SIGNAL(triggered()), this, SLOT(checkUpdates())); |
523
ca583ffe728a
Removed menu entries.
Raimund Renkert <rrenkert@intevation.de>
parents:
486
diff
changeset
|
329 // connect(settings, SIGNAL(triggered()), this, SLOT(showSettings())); |
ca583ffe728a
Removed menu entries.
Raimund Renkert <rrenkert@intevation.de>
parents:
486
diff
changeset
|
330 // connect(status, SIGNAL(triggered()), this, SLOT(showStatus())); |
155
c0fdb8d336cf
Added menubar/menu and method stubs to mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
82
diff
changeset
|
331 connect(help, SIGNAL(triggered()), this, SLOT(showHelp())); |
c0fdb8d336cf
Added menubar/menu and method stubs to mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
82
diff
changeset
|
332 connect(about, SIGNAL(triggered()), this, SLOT(showAbout())); |
447
b1b14daf2116
Save the select state of certificate items when closing the app.
Raimund Renkert <rrenkert@intevation.de>
parents:
446
diff
changeset
|
333 connect(quit, SIGNAL(triggered()), this, SLOT(closeApp())); |
155
c0fdb8d336cf
Added menubar/menu and method stubs to mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
82
diff
changeset
|
334 setMenuBar(mMenuBar); |
c0fdb8d336cf
Added menubar/menu and method stubs to mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
82
diff
changeset
|
335 } |
c0fdb8d336cf
Added menubar/menu and method stubs to mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
82
diff
changeset
|
336 |
187
0c06a608e15f
Create the mainwindow content.
Raimund Renkert <rrenkert@intevation.de>
parents:
155
diff
changeset
|
337 void MainWindow::createContent() |
0c06a608e15f
Create the mainwindow content.
Raimund Renkert <rrenkert@intevation.de>
parents:
155
diff
changeset
|
338 { |
0c06a608e15f
Create the mainwindow content.
Raimund Renkert <rrenkert@intevation.de>
parents:
155
diff
changeset
|
339 // Create a central widget containing the main layout. |
0c06a608e15f
Create the mainwindow content.
Raimund Renkert <rrenkert@intevation.de>
parents:
155
diff
changeset
|
340 QWidget *base = new QWidget; |
0c06a608e15f
Create the mainwindow content.
Raimund Renkert <rrenkert@intevation.de>
parents:
155
diff
changeset
|
341 |
250
1e112cf41e92
Updated the mainwindow layout.
Raimund Renkert <rrenkert@intevation.de>
parents:
249
diff
changeset
|
342 // Layouts and Container |
1e112cf41e92
Updated the mainwindow layout.
Raimund Renkert <rrenkert@intevation.de>
parents:
249
diff
changeset
|
343 QHBoxLayout *mainLayout = new QHBoxLayout; |
1e112cf41e92
Updated the mainwindow layout.
Raimund Renkert <rrenkert@intevation.de>
parents:
249
diff
changeset
|
344 QVBoxLayout *infoLayout = new QVBoxLayout; |
1e112cf41e92
Updated the mainwindow layout.
Raimund Renkert <rrenkert@intevation.de>
parents:
249
diff
changeset
|
345 QVBoxLayout *certLayout = new QVBoxLayout; |
432
16b5cd858571
Updated layout and certificate details in trustbridge installer.
Raimund Renkert <rrenkert@intevation.de>
parents:
409
diff
changeset
|
346 QHBoxLayout *detailLayout = new QHBoxLayout; |
16b5cd858571
Updated layout and certificate details in trustbridge installer.
Raimund Renkert <rrenkert@intevation.de>
parents:
409
diff
changeset
|
347 QVBoxLayout *detailLabelLayout = new QVBoxLayout; |
16b5cd858571
Updated layout and certificate details in trustbridge installer.
Raimund Renkert <rrenkert@intevation.de>
parents:
409
diff
changeset
|
348 QVBoxLayout *detailContentLayout = new QVBoxLayout; |
205
a3f542bf38f7
Added header for mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
200
diff
changeset
|
349 QHBoxLayout *headerLayout = new QHBoxLayout; |
a3f542bf38f7
Added header for mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
200
diff
changeset
|
350 QVBoxLayout *headerTextLayout = new QVBoxLayout; |
271
1ae15ea73850
Some GUI desing and layout changes.
Raimund Renkert <rrenkert@intevation.de>
parents:
267
diff
changeset
|
351 QHBoxLayout *bottomLayout = new QHBoxLayout; |
432
16b5cd858571
Updated layout and certificate details in trustbridge installer.
Raimund Renkert <rrenkert@intevation.de>
parents:
409
diff
changeset
|
352 QVBoxLayout *settingsLayout = new QVBoxLayout; |
456
37a97621b466
Added label for current and updated list date.
Raimund Renkert <rrenkert@intevation.de>
parents:
451
diff
changeset
|
353 QVBoxLayout *listInfoLayout = new QVBoxLayout; |
187
0c06a608e15f
Create the mainwindow content.
Raimund Renkert <rrenkert@intevation.de>
parents:
155
diff
changeset
|
354 |
250
1e112cf41e92
Updated the mainwindow layout.
Raimund Renkert <rrenkert@intevation.de>
parents:
249
diff
changeset
|
355 // The certificate list |
1e112cf41e92
Updated the mainwindow layout.
Raimund Renkert <rrenkert@intevation.de>
parents:
249
diff
changeset
|
356 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
|
357 mCertListWidget = new QListWidget; |
449
023b565a02fc
Update certificate details on item selection change.
Raimund Renkert <rrenkert@intevation.de>
parents:
447
diff
changeset
|
358 connect(mCertListWidget, SIGNAL(currentItemChanged(QListWidgetItem*, QListWidgetItem*)), |
250
1e112cf41e92
Updated the mainwindow layout.
Raimund Renkert <rrenkert@intevation.de>
parents:
249
diff
changeset
|
359 this, SLOT(showDetails(QListWidgetItem*))); |
365
75f7288ad67b
Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents:
274
diff
changeset
|
360 certLayout->addWidget(mCertListWidget); |
456
37a97621b466
Added label for current and updated list date.
Raimund Renkert <rrenkert@intevation.de>
parents:
451
diff
changeset
|
361 |
37a97621b466
Added label for current and updated list date.
Raimund Renkert <rrenkert@intevation.de>
parents:
451
diff
changeset
|
362 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
|
363 mNewListDate = new QLabel(""); |
37a97621b466
Added label for current and updated list date.
Raimund Renkert <rrenkert@intevation.de>
parents:
451
diff
changeset
|
364 listInfoLayout->addWidget(mCurrentListDate); |
37a97621b466
Added label for current and updated list date.
Raimund Renkert <rrenkert@intevation.de>
parents:
451
diff
changeset
|
365 listInfoLayout->addWidget(mNewListDate); |
37a97621b466
Added label for current and updated list date.
Raimund Renkert <rrenkert@intevation.de>
parents:
451
diff
changeset
|
366 certLayout->addLayout(listInfoLayout); |
37a97621b466
Added label for current and updated list date.
Raimund Renkert <rrenkert@intevation.de>
parents:
451
diff
changeset
|
367 |
250
1e112cf41e92
Updated the mainwindow layout.
Raimund Renkert <rrenkert@intevation.de>
parents:
249
diff
changeset
|
368 certBox->setLayout(certLayout); |
1e112cf41e92
Updated the mainwindow layout.
Raimund Renkert <rrenkert@intevation.de>
parents:
249
diff
changeset
|
369 |
1e112cf41e92
Updated the mainwindow layout.
Raimund Renkert <rrenkert@intevation.de>
parents:
249
diff
changeset
|
370 // The header (icon, about text) |
205
a3f542bf38f7
Added header for mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
200
diff
changeset
|
371 QImage *logoImage = new QImage(":/img/logo.png"); |
a3f542bf38f7
Added header for mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
200
diff
changeset
|
372 QLabel *logo = new QLabel; |
a3f542bf38f7
Added header for mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
200
diff
changeset
|
373 logo->setBackgroundRole(QPalette::Base); |
a3f542bf38f7
Added header for mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
200
diff
changeset
|
374 logo->setPixmap(QPixmap::fromImage(*logoImage)); |
409
09bb19e5e369
Remove m13 mentions and change test certificate to intevation.de
Andre Heinecke <aheinecke@intevation.de>
parents:
407
diff
changeset
|
375 QLabel *title = new QLabel("<h2>" + QString::fromLatin1(APPNAME) + "</h2>"); |
205
a3f542bf38f7
Added header for mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
200
diff
changeset
|
376 QLabel *subTitle = new QLabel("This Software installs and removes Certificates"); |
a3f542bf38f7
Added header for mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
200
diff
changeset
|
377 headerTextLayout->addWidget(title); |
a3f542bf38f7
Added header for mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
200
diff
changeset
|
378 headerTextLayout->addWidget(subTitle); |
a3f542bf38f7
Added header for mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
200
diff
changeset
|
379 headerLayout->addWidget(logo); |
a3f542bf38f7
Added header for mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
200
diff
changeset
|
380 headerLayout->addLayout(headerTextLayout); |
210
9c51c472e596
Some mainwindow layout improvements and new icons for certificate list.
Raimund Renkert <rrenkert@intevation.de>
parents:
205
diff
changeset
|
381 headerLayout->setStretch(0, 0); |
9c51c472e596
Some mainwindow layout improvements and new icons for certificate list.
Raimund Renkert <rrenkert@intevation.de>
parents:
205
diff
changeset
|
382 headerLayout->setStretch(1, 10); |
205
a3f542bf38f7
Added header for mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
200
diff
changeset
|
383 |
271
1ae15ea73850
Some GUI desing and layout changes.
Raimund Renkert <rrenkert@intevation.de>
parents:
267
diff
changeset
|
384 // The settings. |
432
16b5cd858571
Updated layout and certificate details in trustbridge installer.
Raimund Renkert <rrenkert@intevation.de>
parents:
409
diff
changeset
|
385 QGroupBox *settingsBox = new QGroupBox(tr("Settings")); |
16b5cd858571
Updated layout and certificate details in trustbridge installer.
Raimund Renkert <rrenkert@intevation.de>
parents:
409
diff
changeset
|
386 mAutoUpdateOption = new QCheckBox(tr("Autoupdate")); |
16b5cd858571
Updated layout and certificate details in trustbridge installer.
Raimund Renkert <rrenkert@intevation.de>
parents:
409
diff
changeset
|
387 mAutoStartOption = new QCheckBox(tr("Autostart")); |
16b5cd858571
Updated layout and certificate details in trustbridge installer.
Raimund Renkert <rrenkert@intevation.de>
parents:
409
diff
changeset
|
388 settingsLayout->addWidget(mAutoUpdateOption); |
16b5cd858571
Updated layout and certificate details in trustbridge installer.
Raimund Renkert <rrenkert@intevation.de>
parents:
409
diff
changeset
|
389 settingsLayout->addWidget(mAutoStartOption); |
16b5cd858571
Updated layout and certificate details in trustbridge installer.
Raimund Renkert <rrenkert@intevation.de>
parents:
409
diff
changeset
|
390 settingsBox->setLayout(settingsLayout); |
481
9be337ea1e3c
Save the autostart and autoupdate settings.
Raimund Renkert <rrenkert@intevation.de>
parents:
480
diff
changeset
|
391 connect(mAutoUpdateOption, SIGNAL(stateChanged(int)), |
9be337ea1e3c
Save the autostart and autoupdate settings.
Raimund Renkert <rrenkert@intevation.de>
parents:
480
diff
changeset
|
392 this, SLOT(saveAutoUpdate(int))); |
9be337ea1e3c
Save the autostart and autoupdate settings.
Raimund Renkert <rrenkert@intevation.de>
parents:
480
diff
changeset
|
393 connect(mAutoStartOption, SIGNAL(stateChanged(int)), |
9be337ea1e3c
Save the autostart and autoupdate settings.
Raimund Renkert <rrenkert@intevation.de>
parents:
480
diff
changeset
|
394 this, SLOT(saveAutoStart(int))); |
9be337ea1e3c
Save the autostart and autoupdate settings.
Raimund Renkert <rrenkert@intevation.de>
parents:
480
diff
changeset
|
395 mSettings.beginGroup("settings"); |
499
077b4342d69b
Default autostart to true and change setting to bool
Andre Heinecke <aheinecke@intevation.de>
parents:
486
diff
changeset
|
396 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
|
397 bool autoStart = mSettings.value("autostart", true).toBool(); |
481
9be337ea1e3c
Save the autostart and autoupdate settings.
Raimund Renkert <rrenkert@intevation.de>
parents:
480
diff
changeset
|
398 mSettings.endGroup(); |
499
077b4342d69b
Default autostart to true and change setting to bool
Andre Heinecke <aheinecke@intevation.de>
parents:
486
diff
changeset
|
399 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
|
400 mAutoStartOption->setCheckState(autoStart ? Qt::Checked : Qt::Unchecked); |
481
9be337ea1e3c
Save the autostart and autoupdate settings.
Raimund Renkert <rrenkert@intevation.de>
parents:
480
diff
changeset
|
401 |
271
1ae15ea73850
Some GUI desing and layout changes.
Raimund Renkert <rrenkert@intevation.de>
parents:
267
diff
changeset
|
402 |
1ae15ea73850
Some GUI desing and layout changes.
Raimund Renkert <rrenkert@intevation.de>
parents:
267
diff
changeset
|
403 // The buttons. |
1ae15ea73850
Some GUI desing and layout changes.
Raimund Renkert <rrenkert@intevation.de>
parents:
267
diff
changeset
|
404 bottomLayout->setAlignment(Qt::AlignBottom); |
1ae15ea73850
Some GUI desing and layout changes.
Raimund Renkert <rrenkert@intevation.de>
parents:
267
diff
changeset
|
405 installButton = new QPushButton(tr("Install selected")); |
1ae15ea73850
Some GUI desing and layout changes.
Raimund Renkert <rrenkert@intevation.de>
parents:
267
diff
changeset
|
406 installButton->setFixedHeight(80); |
1ae15ea73850
Some GUI desing and layout changes.
Raimund Renkert <rrenkert@intevation.de>
parents:
267
diff
changeset
|
407 connect(installButton, SIGNAL(clicked()), this, SLOT(resizeButtons())); |
365
75f7288ad67b
Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents:
274
diff
changeset
|
408 connect(installButton, SIGNAL(clicked()), this, SLOT(installCerts())); |
271
1ae15ea73850
Some GUI desing and layout changes.
Raimund Renkert <rrenkert@intevation.de>
parents:
267
diff
changeset
|
409 quitButton = new QPushButton(tr("Quit")); |
1ae15ea73850
Some GUI desing and layout changes.
Raimund Renkert <rrenkert@intevation.de>
parents:
267
diff
changeset
|
410 quitButton->setFixedHeight(20); |
447
b1b14daf2116
Save the select state of certificate items when closing the app.
Raimund Renkert <rrenkert@intevation.de>
parents:
446
diff
changeset
|
411 connect(quitButton, SIGNAL(clicked()), this, SLOT(closeApp())); |
271
1ae15ea73850
Some GUI desing and layout changes.
Raimund Renkert <rrenkert@intevation.de>
parents:
267
diff
changeset
|
412 bottomLayout->insertStretch(0, 10); |
1ae15ea73850
Some GUI desing and layout changes.
Raimund Renkert <rrenkert@intevation.de>
parents:
267
diff
changeset
|
413 bottomLayout->addWidget(installButton); |
1ae15ea73850
Some GUI desing and layout changes.
Raimund Renkert <rrenkert@intevation.de>
parents:
267
diff
changeset
|
414 bottomLayout->setAlignment(installButton, Qt::AlignBottom); |
1ae15ea73850
Some GUI desing and layout changes.
Raimund Renkert <rrenkert@intevation.de>
parents:
267
diff
changeset
|
415 bottomLayout->addWidget(quitButton); |
1ae15ea73850
Some GUI desing and layout changes.
Raimund Renkert <rrenkert@intevation.de>
parents:
267
diff
changeset
|
416 bottomLayout->setAlignment(quitButton, Qt::AlignBottom); |
250
1e112cf41e92
Updated the mainwindow layout.
Raimund Renkert <rrenkert@intevation.de>
parents:
249
diff
changeset
|
417 |
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
|
418 #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
|
419 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
|
420 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
|
421 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
|
422 } |
20973a56d5ec
Use is_admin to determine if UAC icon should be painted on the button
Andre Heinecke <aheinecke@intevation.de>
parents:
499
diff
changeset
|
423 #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
|
424 |
250
1e112cf41e92
Updated the mainwindow layout.
Raimund Renkert <rrenkert@intevation.de>
parents:
249
diff
changeset
|
425 // The certificate details |
271
1ae15ea73850
Some GUI desing and layout changes.
Raimund Renkert <rrenkert@intevation.de>
parents:
267
diff
changeset
|
426 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
|
427 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
|
428 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
|
429 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
|
430 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
|
431 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
|
432 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
|
433 QLabel *fingerprint = new QLabel(tr("Fingerprint:")); |
16b5cd858571
Updated layout and certificate details in trustbridge installer.
Raimund Renkert <rrenkert@intevation.de>
parents:
409
diff
changeset
|
434 detailLabelLayout->addWidget(subjectCN); |
16b5cd858571
Updated layout and certificate details in trustbridge installer.
Raimund Renkert <rrenkert@intevation.de>
parents:
409
diff
changeset
|
435 detailLabelLayout->addWidget(subjectOU); |
16b5cd858571
Updated layout and certificate details in trustbridge installer.
Raimund Renkert <rrenkert@intevation.de>
parents:
409
diff
changeset
|
436 detailLabelLayout->addWidget(issuerCN); |
16b5cd858571
Updated layout and certificate details in trustbridge installer.
Raimund Renkert <rrenkert@intevation.de>
parents:
409
diff
changeset
|
437 detailLabelLayout->addWidget(issuerOU); |
16b5cd858571
Updated layout and certificate details in trustbridge installer.
Raimund Renkert <rrenkert@intevation.de>
parents:
409
diff
changeset
|
438 detailLabelLayout->addWidget(validFrom); |
16b5cd858571
Updated layout and certificate details in trustbridge installer.
Raimund Renkert <rrenkert@intevation.de>
parents:
409
diff
changeset
|
439 detailLabelLayout->addWidget(validTo); |
16b5cd858571
Updated layout and certificate details in trustbridge installer.
Raimund Renkert <rrenkert@intevation.de>
parents:
409
diff
changeset
|
440 detailLabelLayout->addWidget(fingerprint); |
16b5cd858571
Updated layout and certificate details in trustbridge installer.
Raimund Renkert <rrenkert@intevation.de>
parents:
409
diff
changeset
|
441 mSubjectCN = new QLabel(tr("")); |
16b5cd858571
Updated layout and certificate details in trustbridge installer.
Raimund Renkert <rrenkert@intevation.de>
parents:
409
diff
changeset
|
442 mSubjectOU = new QLabel(tr("")); |
16b5cd858571
Updated layout and certificate details in trustbridge installer.
Raimund Renkert <rrenkert@intevation.de>
parents:
409
diff
changeset
|
443 mIssuerCN = new QLabel(tr("")); |
16b5cd858571
Updated layout and certificate details in trustbridge installer.
Raimund Renkert <rrenkert@intevation.de>
parents:
409
diff
changeset
|
444 mIssuerOU = new QLabel(tr("")); |
16b5cd858571
Updated layout and certificate details in trustbridge installer.
Raimund Renkert <rrenkert@intevation.de>
parents:
409
diff
changeset
|
445 mValidFrom = new QLabel(tr("")); |
16b5cd858571
Updated layout and certificate details in trustbridge installer.
Raimund Renkert <rrenkert@intevation.de>
parents:
409
diff
changeset
|
446 mValidTo = new QLabel(tr("")); |
16b5cd858571
Updated layout and certificate details in trustbridge installer.
Raimund Renkert <rrenkert@intevation.de>
parents:
409
diff
changeset
|
447 mFingerprint = new QLabel(tr("")); |
451
94613c91a3d4
Set mono space font for fingerprint.
Raimund Renkert <rrenkert@intevation.de>
parents:
450
diff
changeset
|
448 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
|
449 detailContentLayout->addWidget(mSubjectCN); |
16b5cd858571
Updated layout and certificate details in trustbridge installer.
Raimund Renkert <rrenkert@intevation.de>
parents:
409
diff
changeset
|
450 detailContentLayout->addWidget(mSubjectOU); |
16b5cd858571
Updated layout and certificate details in trustbridge installer.
Raimund Renkert <rrenkert@intevation.de>
parents:
409
diff
changeset
|
451 detailContentLayout->addWidget(mIssuerCN); |
16b5cd858571
Updated layout and certificate details in trustbridge installer.
Raimund Renkert <rrenkert@intevation.de>
parents:
409
diff
changeset
|
452 detailContentLayout->addWidget(mIssuerOU); |
16b5cd858571
Updated layout and certificate details in trustbridge installer.
Raimund Renkert <rrenkert@intevation.de>
parents:
409
diff
changeset
|
453 detailContentLayout->addWidget(mValidFrom); |
16b5cd858571
Updated layout and certificate details in trustbridge installer.
Raimund Renkert <rrenkert@intevation.de>
parents:
409
diff
changeset
|
454 detailContentLayout->addWidget(mValidTo); |
16b5cd858571
Updated layout and certificate details in trustbridge installer.
Raimund Renkert <rrenkert@intevation.de>
parents:
409
diff
changeset
|
455 detailContentLayout->addWidget(mFingerprint); |
16b5cd858571
Updated layout and certificate details in trustbridge installer.
Raimund Renkert <rrenkert@intevation.de>
parents:
409
diff
changeset
|
456 detailLayout->addLayout(detailLabelLayout); |
16b5cd858571
Updated layout and certificate details in trustbridge installer.
Raimund Renkert <rrenkert@intevation.de>
parents:
409
diff
changeset
|
457 detailLayout->addLayout(detailContentLayout); |
271
1ae15ea73850
Some GUI desing and layout changes.
Raimund Renkert <rrenkert@intevation.de>
parents:
267
diff
changeset
|
458 detailBox->setLayout(detailLayout); |
187
0c06a608e15f
Create the mainwindow content.
Raimund Renkert <rrenkert@intevation.de>
parents:
155
diff
changeset
|
459 |
250
1e112cf41e92
Updated the mainwindow layout.
Raimund Renkert <rrenkert@intevation.de>
parents:
249
diff
changeset
|
460 infoLayout->addSpacing(20); |
1e112cf41e92
Updated the mainwindow layout.
Raimund Renkert <rrenkert@intevation.de>
parents:
249
diff
changeset
|
461 infoLayout->addLayout(headerLayout); |
271
1ae15ea73850
Some GUI desing and layout changes.
Raimund Renkert <rrenkert@intevation.de>
parents:
267
diff
changeset
|
462 infoLayout->addWidget(detailBox); |
432
16b5cd858571
Updated layout and certificate details in trustbridge installer.
Raimund Renkert <rrenkert@intevation.de>
parents:
409
diff
changeset
|
463 infoLayout->addWidget(settingsBox); |
271
1ae15ea73850
Some GUI desing and layout changes.
Raimund Renkert <rrenkert@intevation.de>
parents:
267
diff
changeset
|
464 infoLayout->addLayout(bottomLayout); |
250
1e112cf41e92
Updated the mainwindow layout.
Raimund Renkert <rrenkert@intevation.de>
parents:
249
diff
changeset
|
465 |
187
0c06a608e15f
Create the mainwindow content.
Raimund Renkert <rrenkert@intevation.de>
parents:
155
diff
changeset
|
466 mainLayout->addWidget(certBox); |
250
1e112cf41e92
Updated the mainwindow layout.
Raimund Renkert <rrenkert@intevation.de>
parents:
249
diff
changeset
|
467 mainLayout->addLayout(infoLayout); |
450
4932fc33ee82
Updated window and main layout size.
Raimund Renkert <rrenkert@intevation.de>
parents:
449
diff
changeset
|
468 mainLayout->setStretchFactor(certBox, 37); |
4932fc33ee82
Updated window and main layout size.
Raimund Renkert <rrenkert@intevation.de>
parents:
449
diff
changeset
|
469 mainLayout->setStretchFactor(infoLayout, 63); |
187
0c06a608e15f
Create the mainwindow content.
Raimund Renkert <rrenkert@intevation.de>
parents:
155
diff
changeset
|
470 |
0c06a608e15f
Create the mainwindow content.
Raimund Renkert <rrenkert@intevation.de>
parents:
155
diff
changeset
|
471 // 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
|
472 // managed in the central widget. |
0c06a608e15f
Create the mainwindow content.
Raimund Renkert <rrenkert@intevation.de>
parents:
155
diff
changeset
|
473 base->setLayout(mainLayout); |
0c06a608e15f
Create the mainwindow content.
Raimund Renkert <rrenkert@intevation.de>
parents:
155
diff
changeset
|
474 setCentralWidget(base); |
0c06a608e15f
Create the mainwindow content.
Raimund Renkert <rrenkert@intevation.de>
parents:
155
diff
changeset
|
475 } |
0c06a608e15f
Create the mainwindow content.
Raimund Renkert <rrenkert@intevation.de>
parents:
155
diff
changeset
|
476 |
189
5f0d45ca9de4
Show certificates in the list view and details in the textfield.
Raimund Renkert <rrenkert@intevation.de>
parents:
187
diff
changeset
|
477 void MainWindow::loadCertificateList() |
5f0d45ca9de4
Show certificates in the list view and details in the textfield.
Raimund Renkert <rrenkert@intevation.de>
parents:
187
diff
changeset
|
478 { |
365
75f7288ad67b
Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents:
274
diff
changeset
|
479 mCertListWidget->clear(); |
267
89e8783866f8
Use the certificate item delegate in the mainwind list view.
Raimund Renkert <rrenkert@intevation.de>
parents:
265
diff
changeset
|
480 int i = 0; |
389
3be838c3e4d8
Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
375
diff
changeset
|
481 |
3be838c3e4d8
Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
375
diff
changeset
|
482 /* 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
|
483 * indication */ |
445
b3721ded6f5b
Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents:
437
diff
changeset
|
484 QList<Certificate> newInstallCerts; |
b3721ded6f5b
Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents:
437
diff
changeset
|
485 QList<Certificate> newRemoveCerts; |
b3721ded6f5b
Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents:
437
diff
changeset
|
486 QList<Certificate> oldInstallCerts; |
b3721ded6f5b
Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents:
437
diff
changeset
|
487 QList<Certificate> oldRemoveCerts; |
389
3be838c3e4d8
Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
375
diff
changeset
|
488 |
445
b3721ded6f5b
Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents:
437
diff
changeset
|
489 if (mListToInstall.getCertificates().isEmpty()) { |
b3721ded6f5b
Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents:
437
diff
changeset
|
490 // 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
|
491 foreach (const Certificate &cert, mInstalledList.getCertificates()) { |
b3721ded6f5b
Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents:
437
diff
changeset
|
492 if (cert.isInstallCert()) { |
b3721ded6f5b
Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents:
437
diff
changeset
|
493 oldInstallCerts.append(cert); |
267
89e8783866f8
Use the certificate item delegate in the mainwind list view.
Raimund Renkert <rrenkert@intevation.de>
parents:
265
diff
changeset
|
494 } |
89e8783866f8
Use the certificate item delegate in the mainwind list view.
Raimund Renkert <rrenkert@intevation.de>
parents:
265
diff
changeset
|
495 else { |
445
b3721ded6f5b
Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents:
437
diff
changeset
|
496 oldRemoveCerts.append(cert); |
267
89e8783866f8
Use the certificate item delegate in the mainwind list view.
Raimund Renkert <rrenkert@intevation.de>
parents:
265
diff
changeset
|
497 } |
89e8783866f8
Use the certificate item delegate in the mainwind list view.
Raimund Renkert <rrenkert@intevation.de>
parents:
265
diff
changeset
|
498 } |
456
37a97621b466
Added label for current and updated list date.
Raimund Renkert <rrenkert@intevation.de>
parents:
451
diff
changeset
|
499 // Set the date of the old list. |
37a97621b466
Added label for current and updated list date.
Raimund Renkert <rrenkert@intevation.de>
parents:
451
diff
changeset
|
500 mCurrentListDate->setText(tr("Current List Date: %1") |
37a97621b466
Added label for current and updated list date.
Raimund Renkert <rrenkert@intevation.de>
parents:
451
diff
changeset
|
501 .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
|
502 } |
b3721ded6f5b
Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents:
437
diff
changeset
|
503 else { |
b3721ded6f5b
Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents:
437
diff
changeset
|
504 // 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
|
505 foreach (const Certificate &cert, mListToInstall.getCertificates()) { |
b3721ded6f5b
Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents:
437
diff
changeset
|
506 if (cert.isInstallCert()) { |
b3721ded6f5b
Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents:
437
diff
changeset
|
507 // Certificate with status "install". |
b3721ded6f5b
Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents:
437
diff
changeset
|
508 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
|
509 // 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
|
510 oldInstallCerts.append(cert); |
b3721ded6f5b
Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents:
437
diff
changeset
|
511 } |
b3721ded6f5b
Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents:
437
diff
changeset
|
512 else { |
b3721ded6f5b
Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents:
437
diff
changeset
|
513 // 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
|
514 newInstallCerts.append(cert); |
b3721ded6f5b
Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents:
437
diff
changeset
|
515 } |
267
89e8783866f8
Use the certificate item delegate in the mainwind list view.
Raimund Renkert <rrenkert@intevation.de>
parents:
265
diff
changeset
|
516 } |
89e8783866f8
Use the certificate item delegate in the mainwind list view.
Raimund Renkert <rrenkert@intevation.de>
parents:
265
diff
changeset
|
517 else { |
445
b3721ded6f5b
Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents:
437
diff
changeset
|
518 // Certificate with status "remove". |
b3721ded6f5b
Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents:
437
diff
changeset
|
519 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
|
520 // 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
|
521 oldRemoveCerts.append(cert); |
b3721ded6f5b
Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents:
437
diff
changeset
|
522 } |
b3721ded6f5b
Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents:
437
diff
changeset
|
523 else { |
b3721ded6f5b
Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents:
437
diff
changeset
|
524 // 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
|
525 // status "remove". |
b3721ded6f5b
Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents:
437
diff
changeset
|
526 newRemoveCerts.append(cert); |
b3721ded6f5b
Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents:
437
diff
changeset
|
527 } |
267
89e8783866f8
Use the certificate item delegate in the mainwind list view.
Raimund Renkert <rrenkert@intevation.de>
parents:
265
diff
changeset
|
528 } |
89e8783866f8
Use the certificate item delegate in the mainwind list view.
Raimund Renkert <rrenkert@intevation.de>
parents:
265
diff
changeset
|
529 } |
456
37a97621b466
Added label for current and updated list date.
Raimund Renkert <rrenkert@intevation.de>
parents:
451
diff
changeset
|
530 mCurrentListDate->setText(tr("Current List Date: %1") |
37a97621b466
Added label for current and updated list date.
Raimund Renkert <rrenkert@intevation.de>
parents:
451
diff
changeset
|
531 .arg(mInstalledList.date().toString())); |
37a97621b466
Added label for current and updated list date.
Raimund Renkert <rrenkert@intevation.de>
parents:
451
diff
changeset
|
532 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
|
533 } |
445
b3721ded6f5b
Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents:
437
diff
changeset
|
534 |
b3721ded6f5b
Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents:
437
diff
changeset
|
535 // Add separators and certificates to list widget. |
512
d1812e171d0c
Hide empty seperators in list ui
Andre Heinecke <aheinecke@intevation.de>
parents:
507
diff
changeset
|
536 if (!newInstallCerts.isEmpty()) { |
d1812e171d0c
Hide empty seperators in list ui
Andre Heinecke <aheinecke@intevation.de>
parents:
507
diff
changeset
|
537 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
|
538 foreach (const Certificate &cert, newInstallCerts) { |
d1812e171d0c
Hide empty seperators in list ui
Andre Heinecke <aheinecke@intevation.de>
parents:
507
diff
changeset
|
539 mCertListWidget->addItem(createListItem(cert, Certificate::InstallNew, i++)); |
d1812e171d0c
Hide empty seperators in list ui
Andre Heinecke <aheinecke@intevation.de>
parents:
507
diff
changeset
|
540 } |
445
b3721ded6f5b
Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents:
437
diff
changeset
|
541 } |
b3721ded6f5b
Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents:
437
diff
changeset
|
542 |
512
d1812e171d0c
Hide empty seperators in list ui
Andre Heinecke <aheinecke@intevation.de>
parents:
507
diff
changeset
|
543 if (!newRemoveCerts.isEmpty()) { |
d1812e171d0c
Hide empty seperators in list ui
Andre Heinecke <aheinecke@intevation.de>
parents:
507
diff
changeset
|
544 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
|
545 foreach (const Certificate &cert, newRemoveCerts) { |
d1812e171d0c
Hide empty seperators in list ui
Andre Heinecke <aheinecke@intevation.de>
parents:
507
diff
changeset
|
546 mCertListWidget->addItem(createListItem(cert, Certificate::RemoveNew, i++)); |
d1812e171d0c
Hide empty seperators in list ui
Andre Heinecke <aheinecke@intevation.de>
parents:
507
diff
changeset
|
547 } |
445
b3721ded6f5b
Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents:
437
diff
changeset
|
548 } |
b3721ded6f5b
Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents:
437
diff
changeset
|
549 |
512
d1812e171d0c
Hide empty seperators in list ui
Andre Heinecke <aheinecke@intevation.de>
parents:
507
diff
changeset
|
550 if (!oldInstallCerts.isEmpty()) { |
d1812e171d0c
Hide empty seperators in list ui
Andre Heinecke <aheinecke@intevation.de>
parents:
507
diff
changeset
|
551 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
|
552 foreach (const Certificate &cert, oldInstallCerts) { |
d1812e171d0c
Hide empty seperators in list ui
Andre Heinecke <aheinecke@intevation.de>
parents:
507
diff
changeset
|
553 mCertListWidget->addItem(createListItem(cert, Certificate::InstallOld, i++)); |
d1812e171d0c
Hide empty seperators in list ui
Andre Heinecke <aheinecke@intevation.de>
parents:
507
diff
changeset
|
554 } |
445
b3721ded6f5b
Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents:
437
diff
changeset
|
555 } |
b3721ded6f5b
Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents:
437
diff
changeset
|
556 |
512
d1812e171d0c
Hide empty seperators in list ui
Andre Heinecke <aheinecke@intevation.de>
parents:
507
diff
changeset
|
557 if (!oldRemoveCerts.isEmpty()) { |
d1812e171d0c
Hide empty seperators in list ui
Andre Heinecke <aheinecke@intevation.de>
parents:
507
diff
changeset
|
558 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
|
559 foreach (const Certificate &cert, oldRemoveCerts) { |
d1812e171d0c
Hide empty seperators in list ui
Andre Heinecke <aheinecke@intevation.de>
parents:
507
diff
changeset
|
560 mCertListWidget->addItem(createListItem(cert, Certificate::RemoveOld, i++)); |
d1812e171d0c
Hide empty seperators in list ui
Andre Heinecke <aheinecke@intevation.de>
parents:
507
diff
changeset
|
561 } |
445
b3721ded6f5b
Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents:
437
diff
changeset
|
562 } |
b3721ded6f5b
Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents:
437
diff
changeset
|
563 } |
b3721ded6f5b
Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents:
437
diff
changeset
|
564 |
b3721ded6f5b
Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents:
437
diff
changeset
|
565 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
|
566 { |
b3721ded6f5b
Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents:
437
diff
changeset
|
567 SeparatorItemDelegate *separatorDelegate = new SeparatorItemDelegate(); |
b3721ded6f5b
Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents:
437
diff
changeset
|
568 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
|
569 mCertListWidget->setItemDelegateForRow(index, separatorDelegate); |
b3721ded6f5b
Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents:
437
diff
changeset
|
570 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
|
571 return separator; |
b3721ded6f5b
Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents:
437
diff
changeset
|
572 } |
b3721ded6f5b
Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents:
437
diff
changeset
|
573 |
b3721ded6f5b
Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents:
437
diff
changeset
|
574 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
|
575 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
|
576 { |
b3721ded6f5b
Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents:
437
diff
changeset
|
577 CertificateItemDelegate *certDelegate = new CertificateItemDelegate(); |
b3721ded6f5b
Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents:
437
diff
changeset
|
578 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
|
579 item->setData(CertificateItemDelegate::DataRole, |
b3721ded6f5b
Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents:
437
diff
changeset
|
580 QVariant::fromValue(certificate)); |
b3721ded6f5b
Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents:
437
diff
changeset
|
581 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
|
582 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
|
583 status == Certificate::RemoveOld) { |
b3721ded6f5b
Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents:
437
diff
changeset
|
584 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
|
585 } |
b3721ded6f5b
Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents:
437
diff
changeset
|
586 else { |
b3721ded6f5b
Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents:
437
diff
changeset
|
587 Qt::CheckState checkedState = |
b3721ded6f5b
Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents:
437
diff
changeset
|
588 mPreviouslyUnselected.contains(certificate.base64Line()) ? |
b3721ded6f5b
Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents:
437
diff
changeset
|
589 Qt::Unchecked : Qt::Checked; |
b3721ded6f5b
Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents:
437
diff
changeset
|
590 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
|
591 item->setCheckState(checkedState); |
b3721ded6f5b
Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents:
437
diff
changeset
|
592 } |
b3721ded6f5b
Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents:
437
diff
changeset
|
593 mCertListWidget->setItemDelegateForRow(index, certDelegate); |
b3721ded6f5b
Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents:
437
diff
changeset
|
594 return item; |
189
5f0d45ca9de4
Show certificates in the list view and details in the textfield.
Raimund Renkert <rrenkert@intevation.de>
parents:
187
diff
changeset
|
595 } |
5f0d45ca9de4
Show certificates in the list view and details in the textfield.
Raimund Renkert <rrenkert@intevation.de>
parents:
187
diff
changeset
|
596 |
5f0d45ca9de4
Show certificates in the list view and details in the textfield.
Raimund Renkert <rrenkert@intevation.de>
parents:
187
diff
changeset
|
597 void MainWindow::showSettings() |
5f0d45ca9de4
Show certificates in the list view and details in the textfield.
Raimund Renkert <rrenkert@intevation.de>
parents:
187
diff
changeset
|
598 { |
155
c0fdb8d336cf
Added menubar/menu and method stubs to mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
82
diff
changeset
|
599 qDebug() << "show settingsdialog"; |
c0fdb8d336cf
Added menubar/menu and method stubs to mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
82
diff
changeset
|
600 } |
c0fdb8d336cf
Added menubar/menu and method stubs to mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
82
diff
changeset
|
601 |
212
f7176140d20d
Added menu entry to show the status dialog.
Raimund Renkert <rrenkert@intevation.de>
parents:
210
diff
changeset
|
602 void MainWindow::showStatus() |
f7176140d20d
Added menu entry to show the status dialog.
Raimund Renkert <rrenkert@intevation.de>
parents:
210
diff
changeset
|
603 { |
f7176140d20d
Added menu entry to show the status dialog.
Raimund Renkert <rrenkert@intevation.de>
parents:
210
diff
changeset
|
604 qDebug() << "show settingsdialog"; |
f7176140d20d
Added menu entry to show the status dialog.
Raimund Renkert <rrenkert@intevation.de>
parents:
210
diff
changeset
|
605 StatusDialog *status = new StatusDialog(this); |
f7176140d20d
Added menu entry to show the status dialog.
Raimund Renkert <rrenkert@intevation.de>
parents:
210
diff
changeset
|
606 status->show(); |
f7176140d20d
Added menu entry to show the status dialog.
Raimund Renkert <rrenkert@intevation.de>
parents:
210
diff
changeset
|
607 } |
f7176140d20d
Added menu entry to show the status dialog.
Raimund Renkert <rrenkert@intevation.de>
parents:
210
diff
changeset
|
608 |
155
c0fdb8d336cf
Added menubar/menu and method stubs to mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
82
diff
changeset
|
609 void MainWindow::showHelp() |
c0fdb8d336cf
Added menubar/menu and method stubs to mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
82
diff
changeset
|
610 { |
c0fdb8d336cf
Added menubar/menu and method stubs to mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
82
diff
changeset
|
611 qDebug() << "show helpdialog"; |
191
246c21b1727f
Show the help dialog.
Raimund Renkert <rrenkert@intevation.de>
parents:
189
diff
changeset
|
612 HelpDialog *help = new HelpDialog(this); |
246c21b1727f
Show the help dialog.
Raimund Renkert <rrenkert@intevation.de>
parents:
189
diff
changeset
|
613 help->show(); |
155
c0fdb8d336cf
Added menubar/menu and method stubs to mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
82
diff
changeset
|
614 } |
c0fdb8d336cf
Added menubar/menu and method stubs to mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
82
diff
changeset
|
615 |
c0fdb8d336cf
Added menubar/menu and method stubs to mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
82
diff
changeset
|
616 void MainWindow::showAbout() |
c0fdb8d336cf
Added menubar/menu and method stubs to mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
82
diff
changeset
|
617 { |
c0fdb8d336cf
Added menubar/menu and method stubs to mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
82
diff
changeset
|
618 qDebug() << "show aboutdialog"; |
200
fe424c5fc875
Show the about dialog.
Raimund Renkert <rrenkert@intevation.de>
parents:
191
diff
changeset
|
619 AboutDialog *about = new AboutDialog(this); |
fe424c5fc875
Show the about dialog.
Raimund Renkert <rrenkert@intevation.de>
parents:
191
diff
changeset
|
620 about->show(); |
155
c0fdb8d336cf
Added menubar/menu and method stubs to mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
82
diff
changeset
|
621 } |
187
0c06a608e15f
Create the mainwindow content.
Raimund Renkert <rrenkert@intevation.de>
parents:
155
diff
changeset
|
622 |
189
5f0d45ca9de4
Show certificates in the list view and details in the textfield.
Raimund Renkert <rrenkert@intevation.de>
parents:
187
diff
changeset
|
623 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
|
624 { |
449
023b565a02fc
Update certificate details on item selection change.
Raimund Renkert <rrenkert@intevation.de>
parents:
447
diff
changeset
|
625 if (item == NULL) { |
023b565a02fc
Update certificate details on item selection change.
Raimund Renkert <rrenkert@intevation.de>
parents:
447
diff
changeset
|
626 return; |
023b565a02fc
Update certificate details on item selection change.
Raimund Renkert <rrenkert@intevation.de>
parents:
447
diff
changeset
|
627 } |
445
b3721ded6f5b
Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents:
437
diff
changeset
|
628 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
|
629 mSubjectCN->setText(cert.subjectCN()); |
16b5cd858571
Updated layout and certificate details in trustbridge installer.
Raimund Renkert <rrenkert@intevation.de>
parents:
409
diff
changeset
|
630 mSubjectOU->setText(cert.subjectOU()); |
16b5cd858571
Updated layout and certificate details in trustbridge installer.
Raimund Renkert <rrenkert@intevation.de>
parents:
409
diff
changeset
|
631 mIssuerCN->setText(cert.issuerCN()); |
16b5cd858571
Updated layout and certificate details in trustbridge installer.
Raimund Renkert <rrenkert@intevation.de>
parents:
409
diff
changeset
|
632 mIssuerOU->setText(cert.issuerO()); |
16b5cd858571
Updated layout and certificate details in trustbridge installer.
Raimund Renkert <rrenkert@intevation.de>
parents:
409
diff
changeset
|
633 mValidFrom->setText(cert.validFrom().toString()); |
16b5cd858571
Updated layout and certificate details in trustbridge installer.
Raimund Renkert <rrenkert@intevation.de>
parents:
409
diff
changeset
|
634 mValidTo->setText(cert.validTo().toString()); |
16b5cd858571
Updated layout and certificate details in trustbridge installer.
Raimund Renkert <rrenkert@intevation.de>
parents:
409
diff
changeset
|
635 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
|
636 } |
271
1ae15ea73850
Some GUI desing and layout changes.
Raimund Renkert <rrenkert@intevation.de>
parents:
267
diff
changeset
|
637 |
1ae15ea73850
Some GUI desing and layout changes.
Raimund Renkert <rrenkert@intevation.de>
parents:
267
diff
changeset
|
638 void MainWindow::resizeButtons() |
1ae15ea73850
Some GUI desing and layout changes.
Raimund Renkert <rrenkert@intevation.de>
parents:
267
diff
changeset
|
639 { |
1ae15ea73850
Some GUI desing and layout changes.
Raimund Renkert <rrenkert@intevation.de>
parents:
267
diff
changeset
|
640 installButton->setFixedHeight(20); |
1ae15ea73850
Some GUI desing and layout changes.
Raimund Renkert <rrenkert@intevation.de>
parents:
267
diff
changeset
|
641 quitButton->setFixedHeight(80); |
1ae15ea73850
Some GUI desing and layout changes.
Raimund Renkert <rrenkert@intevation.de>
parents:
267
diff
changeset
|
642 } |
365
75f7288ad67b
Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents:
274
diff
changeset
|
643 |
75f7288ad67b
Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents:
274
diff
changeset
|
644 void MainWindow::installerError(const QString& errMsg) { |
75f7288ad67b
Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents:
274
diff
changeset
|
645 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
|
646 } |
75f7288ad67b
Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents:
274
diff
changeset
|
647 |
389
3be838c3e4d8
Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
375
diff
changeset
|
648 void MainWindow::installerSuccess() { |
3be838c3e4d8
Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
375
diff
changeset
|
649 if (mCurState == NewListAvailable) { |
3be838c3e4d8
Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
375
diff
changeset
|
650 mCurState = NothingChanged; |
3be838c3e4d8
Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
375
diff
changeset
|
651 mCurMessage = QString(); |
3be838c3e4d8
Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
375
diff
changeset
|
652 |
3be838c3e4d8
Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
375
diff
changeset
|
653 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
|
654 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
|
655 |
3be838c3e4d8
Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
375
diff
changeset
|
656 mSettings.remove("List/available"); |
3be838c3e4d8
Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
375
diff
changeset
|
657 mSettings.remove("List/availableDate"); |
3be838c3e4d8
Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
375
diff
changeset
|
658 |
3be838c3e4d8
Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
375
diff
changeset
|
659 if (listFileName.isEmpty() || !listFileDate.isValid()) { |
3be838c3e4d8
Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
375
diff
changeset
|
660 qWarning() << "Error accessing settings"; |
3be838c3e4d8
Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
375
diff
changeset
|
661 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
|
662 } |
3be838c3e4d8
Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
375
diff
changeset
|
663 |
3be838c3e4d8
Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
375
diff
changeset
|
664 mSettings.setValue("List/installed", listFileName); |
3be838c3e4d8
Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
375
diff
changeset
|
665 mSettings.setValue("List/installedDate", listFileDate); |
480
242f2bf5417e
Update the certificate list after installing certificates.
Raimund Renkert <rrenkert@intevation.de>
parents:
479
diff
changeset
|
666 mInstalledList = mListToInstall; |
242f2bf5417e
Update the certificate list after installing certificates.
Raimund Renkert <rrenkert@intevation.de>
parents:
479
diff
changeset
|
667 mListToInstall = CertificateList(); |
389
3be838c3e4d8
Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
375
diff
changeset
|
668 } |
480
242f2bf5417e
Update the certificate list after installing certificates.
Raimund Renkert <rrenkert@intevation.de>
parents:
479
diff
changeset
|
669 loadCertificateList(); |
389
3be838c3e4d8
Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
375
diff
changeset
|
670 } |
3be838c3e4d8
Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
375
diff
changeset
|
671 |
365
75f7288ad67b
Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents:
274
diff
changeset
|
672 void MainWindow::installCerts() { |
75f7288ad67b
Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents:
274
diff
changeset
|
673 QStringList choices; |
75f7288ad67b
Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents:
274
diff
changeset
|
674 |
75f7288ad67b
Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents:
274
diff
changeset
|
675 for (int i = 0; i < mCertListWidget->count(); i++) { |
75f7288ad67b
Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents:
274
diff
changeset
|
676 QListWidgetItem *item = mCertListWidget->item(i); |
75f7288ad67b
Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents:
274
diff
changeset
|
677 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
|
678 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
|
679 continue; |
75f7288ad67b
Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents:
274
diff
changeset
|
680 } |
445
b3721ded6f5b
Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents:
437
diff
changeset
|
681 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
|
682 if (certLine.startsWith("I:")) { |
75f7288ad67b
Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents:
274
diff
changeset
|
683 certLine[0] = 'R'; |
75f7288ad67b
Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents:
274
diff
changeset
|
684 choices << certLine; |
75f7288ad67b
Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents:
274
diff
changeset
|
685 } |
75f7288ad67b
Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents:
274
diff
changeset
|
686 } |
75f7288ad67b
Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents:
274
diff
changeset
|
687 |
75f7288ad67b
Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents:
274
diff
changeset
|
688 QProgressDialog *progress = new QProgressDialog(this); |
75f7288ad67b
Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents:
274
diff
changeset
|
689 progress->setWindowModality(Qt::WindowModal); |
75f7288ad67b
Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents:
274
diff
changeset
|
690 progress->setLabelText(tr("Installing certificates...")); |
75f7288ad67b
Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents:
274
diff
changeset
|
691 progress->setCancelButton(0); |
75f7288ad67b
Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents:
274
diff
changeset
|
692 progress->setRange(0,0); |
75f7288ad67b
Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents:
274
diff
changeset
|
693 progress->setMinimumDuration(0); |
75f7288ad67b
Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents:
274
diff
changeset
|
694 progress->show(); |
75f7288ad67b
Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents:
274
diff
changeset
|
695 |
75f7288ad67b
Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents:
274
diff
changeset
|
696 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
|
697 mListToInstall.isValid() ? |
ae2ef965a41b
Provide installer with old list in case there are no news
Andre Heinecke <andre.heinecke@intevation.de>
parents:
389
diff
changeset
|
698 mListToInstall.fileName() : |
ae2ef965a41b
Provide installer with old list in case there are no news
Andre Heinecke <andre.heinecke@intevation.de>
parents:
389
diff
changeset
|
699 mInstalledList.fileName(), |
365
75f7288ad67b
Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents:
274
diff
changeset
|
700 choices); |
75f7288ad67b
Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents:
274
diff
changeset
|
701 /* Clean up object and progress dialog */ |
75f7288ad67b
Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents:
274
diff
changeset
|
702 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
|
703 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
|
704 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
|
705 connect(instWrap, SIGNAL(installationSuccessful()), |
3be838c3e4d8
Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
375
diff
changeset
|
706 this, SLOT(installerSuccess())); |
365
75f7288ad67b
Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents:
274
diff
changeset
|
707 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
|
708 this, SLOT(installerError(const QString &))); |
365
75f7288ad67b
Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents:
274
diff
changeset
|
709 instWrap->start(); |
75f7288ad67b
Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents:
274
diff
changeset
|
710 |
372
6cc124e79066
Add save/load unselected and add role enumerator
Andre Heinecke <andre.heinecke@intevation.de>
parents:
365
diff
changeset
|
711 if (!saveUnselectedCertificates()) { |
6cc124e79066
Add save/load unselected and add role enumerator
Andre Heinecke <andre.heinecke@intevation.de>
parents:
365
diff
changeset
|
712 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
|
713 } |
365
75f7288ad67b
Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents:
274
diff
changeset
|
714 } |
372
6cc124e79066
Add save/load unselected and add role enumerator
Andre Heinecke <andre.heinecke@intevation.de>
parents:
365
diff
changeset
|
715 |
6cc124e79066
Add save/load unselected and add role enumerator
Andre Heinecke <andre.heinecke@intevation.de>
parents:
365
diff
changeset
|
716 void MainWindow::loadUnselectedCertificates() |
6cc124e79066
Add save/load unselected and add role enumerator
Andre Heinecke <andre.heinecke@intevation.de>
parents:
365
diff
changeset
|
717 { |
6cc124e79066
Add save/load unselected and add role enumerator
Andre Heinecke <andre.heinecke@intevation.de>
parents:
365
diff
changeset
|
718 mPreviouslyUnselected.clear(); |
6cc124e79066
Add save/load unselected and add role enumerator
Andre Heinecke <andre.heinecke@intevation.de>
parents:
365
diff
changeset
|
719 mSettings.beginGroup("unselected"); |
6cc124e79066
Add save/load unselected and add role enumerator
Andre Heinecke <andre.heinecke@intevation.de>
parents:
365
diff
changeset
|
720 QStringList keys = mSettings.allKeys(); |
6cc124e79066
Add save/load unselected and add role enumerator
Andre Heinecke <andre.heinecke@intevation.de>
parents:
365
diff
changeset
|
721 foreach (const QString &key, keys) { |
6cc124e79066
Add save/load unselected and add role enumerator
Andre Heinecke <andre.heinecke@intevation.de>
parents:
365
diff
changeset
|
722 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
|
723 } |
6cc124e79066
Add save/load unselected and add role enumerator
Andre Heinecke <andre.heinecke@intevation.de>
parents:
365
diff
changeset
|
724 mSettings.endGroup(); |
6cc124e79066
Add save/load unselected and add role enumerator
Andre Heinecke <andre.heinecke@intevation.de>
parents:
365
diff
changeset
|
725 } |
6cc124e79066
Add save/load unselected and add role enumerator
Andre Heinecke <andre.heinecke@intevation.de>
parents:
365
diff
changeset
|
726 |
6cc124e79066
Add save/load unselected and add role enumerator
Andre Heinecke <andre.heinecke@intevation.de>
parents:
365
diff
changeset
|
727 bool MainWindow::saveUnselectedCertificates() |
6cc124e79066
Add save/load unselected and add role enumerator
Andre Heinecke <andre.heinecke@intevation.de>
parents:
365
diff
changeset
|
728 { |
479
a8d56a2846a8
Fill the internal list of previously unselcted certificates when saving in settings.
Raimund Renkert <rrenkert@intevation.de>
parents:
461
diff
changeset
|
729 mPreviouslyUnselected.clear(); |
372
6cc124e79066
Add save/load unselected and add role enumerator
Andre Heinecke <andre.heinecke@intevation.de>
parents:
365
diff
changeset
|
730 mSettings.beginGroup("unselected"); |
6cc124e79066
Add save/load unselected and add role enumerator
Andre Heinecke <andre.heinecke@intevation.de>
parents:
365
diff
changeset
|
731 mSettings.remove(""); /* Clears old choices */ |
6cc124e79066
Add save/load unselected and add role enumerator
Andre Heinecke <andre.heinecke@intevation.de>
parents:
365
diff
changeset
|
732 for (int i = 0; i < mCertListWidget->count(); i++) { |
6cc124e79066
Add save/load unselected and add role enumerator
Andre Heinecke <andre.heinecke@intevation.de>
parents:
365
diff
changeset
|
733 QListWidgetItem *item = mCertListWidget->item(i); |
446
43090637d6ae
Check if list item is checkable before adding the item to unselected list.
Raimund Renkert <rrenkert@intevation.de>
parents:
445
diff
changeset
|
734 if (item->checkState() != Qt::Checked && |
43090637d6ae
Check if list item is checkable before adding the item to unselected list.
Raimund Renkert <rrenkert@intevation.de>
parents:
445
diff
changeset
|
735 (item->flags() & Qt::ItemIsUserCheckable)) { |
479
a8d56a2846a8
Fill the internal list of previously unselcted certificates when saving in settings.
Raimund Renkert <rrenkert@intevation.de>
parents:
461
diff
changeset
|
736 QString key = QString::fromLatin1("cert%1").arg(i); |
a8d56a2846a8
Fill the internal list of previously unselcted certificates when saving in settings.
Raimund Renkert <rrenkert@intevation.de>
parents:
461
diff
changeset
|
737 QString value = |
a8d56a2846a8
Fill the internal list of previously unselcted certificates when saving in settings.
Raimund Renkert <rrenkert@intevation.de>
parents:
461
diff
changeset
|
738 item->data(CertificateItemDelegate::DataRole).value<Certificate>().base64Line(); |
a8d56a2846a8
Fill the internal list of previously unselcted certificates when saving in settings.
Raimund Renkert <rrenkert@intevation.de>
parents:
461
diff
changeset
|
739 mSettings.setValue(key, value); |
a8d56a2846a8
Fill the internal list of previously unselcted certificates when saving in settings.
Raimund Renkert <rrenkert@intevation.de>
parents:
461
diff
changeset
|
740 mPreviouslyUnselected << value; |
372
6cc124e79066
Add save/load unselected and add role enumerator
Andre Heinecke <andre.heinecke@intevation.de>
parents:
365
diff
changeset
|
741 } |
6cc124e79066
Add save/load unselected and add role enumerator
Andre Heinecke <andre.heinecke@intevation.de>
parents:
365
diff
changeset
|
742 } |
6cc124e79066
Add save/load unselected and add role enumerator
Andre Heinecke <andre.heinecke@intevation.de>
parents:
365
diff
changeset
|
743 mSettings.endGroup(); |
6cc124e79066
Add save/load unselected and add role enumerator
Andre Heinecke <andre.heinecke@intevation.de>
parents:
365
diff
changeset
|
744 mSettings.sync(); |
6cc124e79066
Add save/load unselected and add role enumerator
Andre Heinecke <andre.heinecke@intevation.de>
parents:
365
diff
changeset
|
745 return mSettings.status() == QSettings::NoError; |
6cc124e79066
Add save/load unselected and add role enumerator
Andre Heinecke <andre.heinecke@intevation.de>
parents:
365
diff
changeset
|
746 } |
447
b1b14daf2116
Save the select state of certificate items when closing the app.
Raimund Renkert <rrenkert@intevation.de>
parents:
446
diff
changeset
|
747 |
481
9be337ea1e3c
Save the autostart and autoupdate settings.
Raimund Renkert <rrenkert@intevation.de>
parents:
480
diff
changeset
|
748 void MainWindow::saveAutoUpdate(int state) |
9be337ea1e3c
Save the autostart and autoupdate settings.
Raimund Renkert <rrenkert@intevation.de>
parents:
480
diff
changeset
|
749 { |
9be337ea1e3c
Save the autostart and autoupdate settings.
Raimund Renkert <rrenkert@intevation.de>
parents:
480
diff
changeset
|
750 mSettings.beginGroup("settings"); |
499
077b4342d69b
Default autostart to true and change setting to bool
Andre Heinecke <aheinecke@intevation.de>
parents:
486
diff
changeset
|
751 mSettings.setValue("autoupdate", state != Qt::Unchecked); |
481
9be337ea1e3c
Save the autostart and autoupdate settings.
Raimund Renkert <rrenkert@intevation.de>
parents:
480
diff
changeset
|
752 mSettings.endGroup(); |
9be337ea1e3c
Save the autostart and autoupdate settings.
Raimund Renkert <rrenkert@intevation.de>
parents:
480
diff
changeset
|
753 } |
9be337ea1e3c
Save the autostart and autoupdate settings.
Raimund Renkert <rrenkert@intevation.de>
parents:
480
diff
changeset
|
754 |
9be337ea1e3c
Save the autostart and autoupdate settings.
Raimund Renkert <rrenkert@intevation.de>
parents:
480
diff
changeset
|
755 void MainWindow::saveAutoStart(int state) |
9be337ea1e3c
Save the autostart and autoupdate settings.
Raimund Renkert <rrenkert@intevation.de>
parents:
480
diff
changeset
|
756 { |
9be337ea1e3c
Save the autostart and autoupdate settings.
Raimund Renkert <rrenkert@intevation.de>
parents:
480
diff
changeset
|
757 mSettings.beginGroup("settings"); |
499
077b4342d69b
Default autostart to true and change setting to bool
Andre Heinecke <aheinecke@intevation.de>
parents:
486
diff
changeset
|
758 mSettings.setValue("autostart", state != Qt::Unchecked); |
481
9be337ea1e3c
Save the autostart and autoupdate settings.
Raimund Renkert <rrenkert@intevation.de>
parents:
480
diff
changeset
|
759 mSettings.endGroup(); |
9be337ea1e3c
Save the autostart and autoupdate settings.
Raimund Renkert <rrenkert@intevation.de>
parents:
480
diff
changeset
|
760 } |
9be337ea1e3c
Save the autostart and autoupdate settings.
Raimund Renkert <rrenkert@intevation.de>
parents:
480
diff
changeset
|
761 |
447
b1b14daf2116
Save the select state of certificate items when closing the app.
Raimund Renkert <rrenkert@intevation.de>
parents:
446
diff
changeset
|
762 void MainWindow::closeApp() |
b1b14daf2116
Save the select state of certificate items when closing the app.
Raimund Renkert <rrenkert@intevation.de>
parents:
446
diff
changeset
|
763 { |
b1b14daf2116
Save the select state of certificate items when closing the app.
Raimund Renkert <rrenkert@intevation.de>
parents:
446
diff
changeset
|
764 saveUnselectedCertificates(); |
b1b14daf2116
Save the select state of certificate items when closing the app.
Raimund Renkert <rrenkert@intevation.de>
parents:
446
diff
changeset
|
765 qApp->quit(); |
b1b14daf2116
Save the select state of certificate items when closing the app.
Raimund Renkert <rrenkert@intevation.de>
parents:
446
diff
changeset
|
766 } |