Mercurial > trustbridge
annotate ui/mainwindow.cpp @ 1387:c64b6c56ce96 0.9.8
(issue95) Change keys for release build. Fix release build usage.
author | Andre Heinecke <andre.heinecke@intevation.de> |
---|---|
date | Thu, 15 Jan 2015 16:46:36 +0100 |
parents | 831d28c2291d |
children | 8d27c6d226cd |
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> |
551
15121735805e
Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents:
548
diff
changeset
|
11 #include <QProcess> |
365
75f7288ad67b
Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents:
274
diff
changeset
|
12 #include <QProgressDialog> |
0
cb0cde2c5eb9
Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
13 #include <QMessageBox> |
cb0cde2c5eb9
Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
14 #include <QAction> |
cb0cde2c5eb9
Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
15 #include <QDialog> |
563
aee3eb10bbba
Add unit test for sw update execution and fix shell execute params
Andre Heinecke <aheinecke@intevation.de>
parents:
555
diff
changeset
|
16 #include <QDir> |
0
cb0cde2c5eb9
Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
17 #include <QMenu> |
2 | 18 #include <QApplication> |
16
225a5ec20dad
Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents:
11
diff
changeset
|
19 #include <QFile> |
1116
df2297e741ad
(issue127) Rename the installer to a pretty name before execution.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1110
diff
changeset
|
20 #include <QTemporaryDir> |
19
9af6198deb8e
Add timed trigger for the message
Andre Heinecke <aheinecke@intevation.de>
parents:
17
diff
changeset
|
21 #include <QTimer> |
187
0c06a608e15f
Create the mainwindow content.
Raimund Renkert <rrenkert@intevation.de>
parents:
155
diff
changeset
|
22 #include <QHBoxLayout> |
0c06a608e15f
Create the mainwindow content.
Raimund Renkert <rrenkert@intevation.de>
parents:
155
diff
changeset
|
23 #include <QVBoxLayout> |
709
8f110e6b8295
(UI) Changed update header to GridLayout and moved action buttons to bottom left.
Emanuel Schuetze <emanuel@intevation.de>
parents:
708
diff
changeset
|
24 #include <QGridLayout> |
187
0c06a608e15f
Create the mainwindow content.
Raimund Renkert <rrenkert@intevation.de>
parents:
155
diff
changeset
|
25 #include <QGroupBox> |
189
5f0d45ca9de4
Show certificates in the list view and details in the textfield.
Raimund Renkert <rrenkert@intevation.de>
parents:
187
diff
changeset
|
26 #include <QSplitter> |
205
a3f542bf38f7
Added header for mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
200
diff
changeset
|
27 #include <QLabel> |
a3f542bf38f7
Added header for mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
200
diff
changeset
|
28 #include <QImage> |
250
1e112cf41e92
Updated the mainwindow layout.
Raimund Renkert <rrenkert@intevation.de>
parents:
249
diff
changeset
|
29 #include <QCheckBox> |
584
ebfe1128ee97
Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents:
563
diff
changeset
|
30 #include <QButtonGroup> |
ebfe1128ee97
Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents:
563
diff
changeset
|
31 #include <QToolButton> |
857
9bab4fc3a1fe
Delete old lists and rename the currently installed list to list-installed.txt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
845
diff
changeset
|
32 #include <QStandardPaths> |
940
7c89c5dc2200
(issue89) Add ui to open help in browser
Andre Heinecke <andre.heinecke@intevation.de>
parents:
932
diff
changeset
|
33 #include <QDesktopServices> |
19
9af6198deb8e
Add timed trigger for the message
Andre Heinecke <aheinecke@intevation.de>
parents:
17
diff
changeset
|
34 |
609
292c590ba9cb
Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents:
607
diff
changeset
|
35 #include "certificatelist.h" |
1234
ad4fc3649ffb
(issue146) Always draw certificate item buttons as unchecked
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1233
diff
changeset
|
36 #include "certificateitemwidget.h" |
609
292c590ba9cb
Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents:
607
diff
changeset
|
37 #include "downloader.h" |
292c590ba9cb
Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents:
607
diff
changeset
|
38 #include "helpdialog.h" |
292c590ba9cb
Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents:
607
diff
changeset
|
39 #include "aboutdialog.h" |
292c590ba9cb
Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents:
607
diff
changeset
|
40 #include "separatoritemdelegate.h" |
292c590ba9cb
Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents:
607
diff
changeset
|
41 #include "installwrapper.h" |
292c590ba9cb
Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents:
607
diff
changeset
|
42 #include "util.h" |
292c590ba9cb
Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents:
607
diff
changeset
|
43 #include "logging.h" |
292c590ba9cb
Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents:
607
diff
changeset
|
44 #include "binverify.h" |
292c590ba9cb
Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents:
607
diff
changeset
|
45 #include "processhelp.h" |
292c590ba9cb
Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents:
607
diff
changeset
|
46 #include "processwaitdialog.h" |
871
4efd6378c001
(issue51) Add fallback in case systemtray is unavailable.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
857
diff
changeset
|
47 #include "trayicon.h" |
956
879a634d0a40
(issue41) Add proxy support
Andre Heinecke <andre.heinecke@intevation.de>
parents:
940
diff
changeset
|
48 #include "proxysettingsdlg.h" |
609
292c590ba9cb
Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents:
607
diff
changeset
|
49 |
19
9af6198deb8e
Add timed trigger for the message
Andre Heinecke <aheinecke@intevation.de>
parents:
17
diff
changeset
|
50 // 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
|
51 // something to say |
548
c84dc8f6d017
Increase nag interval to 70 minutes
Andre Heinecke <aheinecke@intevation.de>
parents:
531
diff
changeset
|
52 #define NAG_INTERVAL_MINUTES 70 |
0
cb0cde2c5eb9
Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
53 |
1104
a7a72353d6d2
(issue111) Wording and German translation.
Emanuel Schuetze <emanuel@intevation.de>
parents:
1103
diff
changeset
|
54 #define DATETIME_FORMAT "d. MMM yyyy HH:mm" |
714
57bd73145e48
(Issue25) Fix typos change order and add better date formating
Andre Heinecke <andre.heinecke@intevation.de>
parents:
713
diff
changeset
|
55 |
409
09bb19e5e369
Remove m13 mentions and change test certificate to intevation.de
Andre Heinecke <aheinecke@intevation.de>
parents:
407
diff
changeset
|
56 #ifndef APPNAME |
09bb19e5e369
Remove m13 mentions and change test certificate to intevation.de
Andre Heinecke <aheinecke@intevation.de>
parents:
407
diff
changeset
|
57 #define APPNAME "TrustBridge" |
09bb19e5e369
Remove m13 mentions and change test certificate to intevation.de
Andre Heinecke <aheinecke@intevation.de>
parents:
407
diff
changeset
|
58 #endif |
09bb19e5e369
Remove m13 mentions and change test certificate to intevation.de
Andre Heinecke <aheinecke@intevation.de>
parents:
407
diff
changeset
|
59 |
994
8fb1b912fd8e
Add test using the default download server used by the software
Andre Heinecke <andre.heinecke@intevation.de>
parents:
987
diff
changeset
|
60 #ifndef SERVER_URL |
8fb1b912fd8e
Add test using the default download server used by the software
Andre Heinecke <andre.heinecke@intevation.de>
parents:
987
diff
changeset
|
61 #error "DOWNLOAD_SERVER option not set or invalid." |
8fb1b912fd8e
Add test using the default download server used by the software
Andre Heinecke <andre.heinecke@intevation.de>
parents:
987
diff
changeset
|
62 #endif |
72
7e304573ebd1
Add some testing hacks for interactive testing
Andre Heinecke <aheinecke@intevation.de>
parents:
71
diff
changeset
|
63 |
885
1cc85fd3daa5
(issue70) Handle i386 and amd64 packages
Andre Heinecke <andre.heinecke@intevation.de>
parents:
871
diff
changeset
|
64 #if defined(_X86_) || defined(__i386__) |
1cc85fd3daa5
(issue70) Handle i386 and amd64 packages
Andre Heinecke <andre.heinecke@intevation.de>
parents:
871
diff
changeset
|
65 #define TB_ARCH_STRING "-i386" |
1cc85fd3daa5
(issue70) Handle i386 and amd64 packages
Andre Heinecke <andre.heinecke@intevation.de>
parents:
871
diff
changeset
|
66 #else |
1cc85fd3daa5
(issue70) Handle i386 and amd64 packages
Andre Heinecke <andre.heinecke@intevation.de>
parents:
871
diff
changeset
|
67 #define TB_ARCH_STRING "-amd64" |
1cc85fd3daa5
(issue70) Handle i386 and amd64 packages
Andre Heinecke <andre.heinecke@intevation.de>
parents:
871
diff
changeset
|
68 #endif |
1cc85fd3daa5
(issue70) Handle i386 and amd64 packages
Andre Heinecke <andre.heinecke@intevation.de>
parents:
871
diff
changeset
|
69 |
1127
1a5f9e260099
(issue130) Remove USE_REAL_RESOURCE option and implement behavior as descript in the issue
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1126
diff
changeset
|
70 #ifdef IS_TAG_BUILD |
1088
508c96e72f62
(issue124) Switch server URL and remove some RELEASE_BUILD options
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1082
diff
changeset
|
71 # define LIST_RESOURCE "/zertifikatsliste.txt" |
607
e83589f1fd7f
Use different URI's for development
Andre Heinecke <andre.heinecke@intevation.de>
parents:
594
diff
changeset
|
72 # ifdef Q_OS_WIN |
1088
508c96e72f62
(issue124) Switch server URL and remove some RELEASE_BUILD options
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1082
diff
changeset
|
73 # define SW_RESOURCE_VERSION "/TrustBridge-%1.exe" |
508c96e72f62
(issue124) Switch server URL and remove some RELEASE_BUILD options
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1082
diff
changeset
|
74 # define SW_RESOURCE "/TrustBridge.exe" |
607
e83589f1fd7f
Use different URI's for development
Andre Heinecke <andre.heinecke@intevation.de>
parents:
594
diff
changeset
|
75 # else |
1088
508c96e72f62
(issue124) Switch server URL and remove some RELEASE_BUILD options
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1082
diff
changeset
|
76 # define SW_RESOURCE_VERSION "/TrustBridge-%1" TB_ARCH_STRING ".sh" |
508c96e72f62
(issue124) Switch server URL and remove some RELEASE_BUILD options
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1082
diff
changeset
|
77 # define SW_RESOURCE "/TrustBridge" TB_ARCH_STRING ".sh" |
607
e83589f1fd7f
Use different URI's for development
Andre Heinecke <andre.heinecke@intevation.de>
parents:
594
diff
changeset
|
78 # endif |
1127
1a5f9e260099
(issue130) Remove USE_REAL_RESOURCE option and implement behavior as descript in the issue
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1126
diff
changeset
|
79 #else // Not tag build means develpment build |
1088
508c96e72f62
(issue124) Switch server URL and remove some RELEASE_BUILD options
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1082
diff
changeset
|
80 # define LIST_RESOURCE "/zertifikatsliste.txt" |
607
e83589f1fd7f
Use different URI's for development
Andre Heinecke <andre.heinecke@intevation.de>
parents:
594
diff
changeset
|
81 # ifdef Q_OS_WIN |
1127
1a5f9e260099
(issue130) Remove USE_REAL_RESOURCE option and implement behavior as descript in the issue
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1126
diff
changeset
|
82 # define SW_RESOURCE_VERSION "/development/TrustBridge-%1.exe" |
1088
508c96e72f62
(issue124) Switch server URL and remove some RELEASE_BUILD options
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1082
diff
changeset
|
83 # define SW_RESOURCE "/development/TrustBridge.exe" |
607
e83589f1fd7f
Use different URI's for development
Andre Heinecke <andre.heinecke@intevation.de>
parents:
594
diff
changeset
|
84 # else |
1127
1a5f9e260099
(issue130) Remove USE_REAL_RESOURCE option and implement behavior as descript in the issue
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1126
diff
changeset
|
85 # define SW_RESOURCE_VERSION "/development/TrustBridge-%1" TB_ARCH_STRING ".sh" |
1088
508c96e72f62
(issue124) Switch server URL and remove some RELEASE_BUILD options
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1082
diff
changeset
|
86 # define SW_RESOURCE "/development/TrustBridge" TB_ARCH_STRING ".sh" |
607
e83589f1fd7f
Use different URI's for development
Andre Heinecke <andre.heinecke@intevation.de>
parents:
594
diff
changeset
|
87 # endif |
486
fa56a9403939
Lookup the last modified date for software installer after first installation.
Raimund Renkert <rrenkert@intevation.de>
parents:
481
diff
changeset
|
88 #endif |
7
992c0ec57660
Add unit tests make CertificateList work.
Andre Heinecke <aheinecke@intevation.de>
parents:
2
diff
changeset
|
89 |
940
7c89c5dc2200
(issue89) Add ui to open help in browser
Andre Heinecke <andre.heinecke@intevation.de>
parents:
932
diff
changeset
|
90 /* Help installation path the path relative to the installation directory where |
7c89c5dc2200
(issue89) Add ui to open help in browser
Andre Heinecke <andre.heinecke@intevation.de>
parents:
932
diff
changeset
|
91 * the help is placed.*/ |
7c89c5dc2200
(issue89) Add ui to open help in browser
Andre Heinecke <andre.heinecke@intevation.de>
parents:
932
diff
changeset
|
92 #ifdef WIN32 |
7c89c5dc2200
(issue89) Add ui to open help in browser
Andre Heinecke <andre.heinecke@intevation.de>
parents:
932
diff
changeset
|
93 #define HELP_PATH "/doc/index.html" |
7c89c5dc2200
(issue89) Add ui to open help in browser
Andre Heinecke <andre.heinecke@intevation.de>
parents:
932
diff
changeset
|
94 #else |
7c89c5dc2200
(issue89) Add ui to open help in browser
Andre Heinecke <andre.heinecke@intevation.de>
parents:
932
diff
changeset
|
95 #define HELP_PATH "/../share/doc/trustbridge/index.html" |
7c89c5dc2200
(issue89) Add ui to open help in browser
Andre Heinecke <andre.heinecke@intevation.de>
parents:
932
diff
changeset
|
96 #endif |
7c89c5dc2200
(issue89) Add ui to open help in browser
Andre Heinecke <andre.heinecke@intevation.de>
parents:
932
diff
changeset
|
97 |
1109
6594e8e63a25
(issue115) Add tooltips and fix manual changes handling
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1107
diff
changeset
|
98 static void activateDetailsButton(QPushButton *); |
6594e8e63a25
(issue115) Add tooltips and fix manual changes handling
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1107
diff
changeset
|
99 static void deactivateDetailsButton(QPushButton *); |
6594e8e63a25
(issue115) Add tooltips and fix manual changes handling
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1107
diff
changeset
|
100 |
1339
64f812a63de6
(issue170) Keep checking for updates in intervals
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1334
diff
changeset
|
101 /** @brief get the interval in milliseconds until the next update try. |
64f812a63de6
(issue170) Keep checking for updates in intervals
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1334
diff
changeset
|
102 * |
64f812a63de6
(issue170) Keep checking for updates in intervals
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1334
diff
changeset
|
103 * @param [in] tries the number of unsuccessful tries already done. |
64f812a63de6
(issue170) Keep checking for updates in intervals
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1334
diff
changeset
|
104 * |
64f812a63de6
(issue170) Keep checking for updates in intervals
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1334
diff
changeset
|
105 * @returns a positive value for the time in ms that should be waited. |
64f812a63de6
(issue170) Keep checking for updates in intervals
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1334
diff
changeset
|
106 * -1 in case the software should abort. */ |
64f812a63de6
(issue170) Keep checking for updates in intervals
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1334
diff
changeset
|
107 static int getNextUpdateInterval(int tries) |
64f812a63de6
(issue170) Keep checking for updates in intervals
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1334
diff
changeset
|
108 { |
64f812a63de6
(issue170) Keep checking for updates in intervals
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1334
diff
changeset
|
109 if (tries < 2) { |
64f812a63de6
(issue170) Keep checking for updates in intervals
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1334
diff
changeset
|
110 // 5-10 minutes for the first two checks |
64f812a63de6
(issue170) Keep checking for updates in intervals
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1334
diff
changeset
|
111 return ((5 + (qrand() % 5)) * 60 * 1000); |
64f812a63de6
(issue170) Keep checking for updates in intervals
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1334
diff
changeset
|
112 } |
64f812a63de6
(issue170) Keep checking for updates in intervals
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1334
diff
changeset
|
113 if (tries < 4) { |
64f812a63de6
(issue170) Keep checking for updates in intervals
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1334
diff
changeset
|
114 // 15 minutes |
64f812a63de6
(issue170) Keep checking for updates in intervals
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1334
diff
changeset
|
115 return 15 * 60 * 1000; |
64f812a63de6
(issue170) Keep checking for updates in intervals
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1334
diff
changeset
|
116 } |
64f812a63de6
(issue170) Keep checking for updates in intervals
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1334
diff
changeset
|
117 if (tries < 6) { |
64f812a63de6
(issue170) Keep checking for updates in intervals
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1334
diff
changeset
|
118 // 30 minutes |
64f812a63de6
(issue170) Keep checking for updates in intervals
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1334
diff
changeset
|
119 return 30 * 60 * 1000; |
64f812a63de6
(issue170) Keep checking for updates in intervals
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1334
diff
changeset
|
120 } |
64f812a63de6
(issue170) Keep checking for updates in intervals
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1334
diff
changeset
|
121 if (tries < 7) { |
64f812a63de6
(issue170) Keep checking for updates in intervals
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1334
diff
changeset
|
122 return 60; |
64f812a63de6
(issue170) Keep checking for updates in intervals
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1334
diff
changeset
|
123 } |
64f812a63de6
(issue170) Keep checking for updates in intervals
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1334
diff
changeset
|
124 return -1; |
64f812a63de6
(issue170) Keep checking for updates in intervals
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1334
diff
changeset
|
125 } |
64f812a63de6
(issue170) Keep checking for updates in intervals
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1334
diff
changeset
|
126 |
1371
23df332b2a4c
(issue179) Read install signature timestamp from config
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1365
diff
changeset
|
127 MainWindow::MainWindow(bool trayMode, const QDateTime& sigDt): |
1109
6594e8e63a25
(issue115) Add tooltips and fix manual changes handling
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1107
diff
changeset
|
128 mTrayMode(trayMode), |
1339
64f812a63de6
(issue170) Keep checking for updates in intervals
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1334
diff
changeset
|
129 mManualDetailsShown(false), |
1371
23df332b2a4c
(issue179) Read install signature timestamp from config
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1365
diff
changeset
|
130 mFailedConnections(0), |
1373
00fcb9c4d16b
(issue179) Handle SW verify failures and try to redownload the update
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1371
diff
changeset
|
131 mSigDt(sigDt), |
00fcb9c4d16b
(issue179) Handle SW verify failures and try to redownload the update
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1371
diff
changeset
|
132 mDownloadSWAccepted(false) |
365
75f7288ad67b
Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents:
274
diff
changeset
|
133 { |
0
cb0cde2c5eb9
Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
134 createActions(); |
cb0cde2c5eb9
Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
135 createTrayIcon(); |
739
5f0fca113ff4
Factor out Info Panel creation.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
732
diff
changeset
|
136 setupGUI(); |
790
399bc0df073d
(issue60) Make windows smaller and change details buttons to icon only
Andre Heinecke <andre.heinecke@intevation.de>
parents:
787
diff
changeset
|
137 resize(900, 600); |
709
8f110e6b8295
(UI) Changed update header to GridLayout and moved action buttons to bottom left.
Emanuel Schuetze <emanuel@intevation.de>
parents:
708
diff
changeset
|
138 setMinimumWidth(760); |
45
c6125d73faf4
Move SSLConnection into it's own class
Andre Heinecke <aheinecke@intevation.de>
parents:
31
diff
changeset
|
139 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
|
140 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
|
141 |
cb0cde2c5eb9
Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
142 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
|
143 this, SLOT(iconActivated(QSystemTrayIcon::ActivationReason))); |
19
9af6198deb8e
Add timed trigger for the message
Andre Heinecke <aheinecke@intevation.de>
parents:
17
diff
changeset
|
144 |
9af6198deb8e
Add timed trigger for the message
Andre Heinecke <aheinecke@intevation.de>
parents:
17
diff
changeset
|
145 mMessageTimer = new QTimer(this); |
9af6198deb8e
Add timed trigger for the message
Andre Heinecke <aheinecke@intevation.de>
parents:
17
diff
changeset
|
146 connect(mMessageTimer, SIGNAL(timeout()), this, SLOT(showMessage())); |
9af6198deb8e
Add timed trigger for the message
Andre Heinecke <aheinecke@intevation.de>
parents:
17
diff
changeset
|
147 mMessageTimer->setInterval(NAG_INTERVAL_MINUTES * 60 * 1000); |
9af6198deb8e
Add timed trigger for the message
Andre Heinecke <aheinecke@intevation.de>
parents:
17
diff
changeset
|
148 mMessageTimer->start(); |
1339
64f812a63de6
(issue170) Keep checking for updates in intervals
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1334
diff
changeset
|
149 checkUpdates(); |
389
3be838c3e4d8
Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
375
diff
changeset
|
150 loadUnselectedCertificates(); |
3be838c3e4d8
Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
375
diff
changeset
|
151 loadCertificateList(); |
1125
dd9094d92899
(issue54) If the MainWindows is visible when an update is triggered start it visible after upadte
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1116
diff
changeset
|
152 |
dd9094d92899
(issue54) If the MainWindows is visible when an update is triggered start it visible after upadte
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1116
diff
changeset
|
153 if (mSettings.value("ShowOnNextStart").toBool()) { |
dd9094d92899
(issue54) If the MainWindows is visible when an update is triggered start it visible after upadte
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1116
diff
changeset
|
154 mSettings.remove("ShowOnNextStart"); |
dd9094d92899
(issue54) If the MainWindows is visible when an update is triggered start it visible after upadte
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1116
diff
changeset
|
155 show(); |
dd9094d92899
(issue54) If the MainWindows is visible when an update is triggered start it visible after upadte
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1116
diff
changeset
|
156 } else if (!trayMode) { |
365
75f7288ad67b
Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents:
274
diff
changeset
|
157 show(); |
75f7288ad67b
Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents:
274
diff
changeset
|
158 } |
0
cb0cde2c5eb9
Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
159 } |
cb0cde2c5eb9
Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
160 |
cb0cde2c5eb9
Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
161 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
|
162 { |
cb0cde2c5eb9
Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
163 switch (reason) { |
cb0cde2c5eb9
Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
164 case QSystemTrayIcon::Trigger: |
cb0cde2c5eb9
Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
165 case QSystemTrayIcon::MiddleClick: |
cb0cde2c5eb9
Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
166 showMessage(); |
cb0cde2c5eb9
Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
167 break; |
16
225a5ec20dad
Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents:
11
diff
changeset
|
168 case QSystemTrayIcon::DoubleClick: |
365
75f7288ad67b
Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents:
274
diff
changeset
|
169 show(); |
16
225a5ec20dad
Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents:
11
diff
changeset
|
170 break; |
0
cb0cde2c5eb9
Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
171 default: |
cb0cde2c5eb9
Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
172 ; |
cb0cde2c5eb9
Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
173 } |
cb0cde2c5eb9
Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
174 } |
cb0cde2c5eb9
Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
175 |
71
f22a99f7cb69
Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents:
45
diff
changeset
|
176 void MainWindow::messageClicked() |
f22a99f7cb69
Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents:
45
diff
changeset
|
177 { |
551
15121735805e
Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents:
548
diff
changeset
|
178 if (mCurState == NewSoftwareAvailable) { |
1373
00fcb9c4d16b
(issue179) Handle SW verify failures and try to redownload the update
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1371
diff
changeset
|
179 mDownloadSWAccepted = true; |
587
02a89710a7cd
Split up list and software verification and use it
Andre Heinecke <aheinecke@intevation.de>
parents:
563
diff
changeset
|
180 verifySWData(); |
1373
00fcb9c4d16b
(issue179) Handle SW verify failures and try to redownload the update
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1371
diff
changeset
|
181 if (mFailedConnections == 0) { |
00fcb9c4d16b
(issue179) Handle SW verify failures and try to redownload the update
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1371
diff
changeset
|
182 /* If we have a failed connection cound verifySWData has |
00fcb9c4d16b
(issue179) Handle SW verify failures and try to redownload the update
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1371
diff
changeset
|
183 * triggered an invalid software recovery and an update is already |
00fcb9c4d16b
(issue179) Handle SW verify failures and try to redownload the update
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1371
diff
changeset
|
184 * scheduled. */ |
00fcb9c4d16b
(issue179) Handle SW verify failures and try to redownload the update
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1371
diff
changeset
|
185 QString swFileName = mSettings.value("Software/available").toString(); |
00fcb9c4d16b
(issue179) Handle SW verify failures and try to redownload the update
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1371
diff
changeset
|
186 if (swFileName.isEmpty()) { |
00fcb9c4d16b
(issue179) Handle SW verify failures and try to redownload the update
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1371
diff
changeset
|
187 checkUpdates(); |
00fcb9c4d16b
(issue179) Handle SW verify failures and try to redownload the update
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1371
diff
changeset
|
188 mCurState = DownloadingSW; |
00fcb9c4d16b
(issue179) Handle SW verify failures and try to redownload the update
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1371
diff
changeset
|
189 return; |
00fcb9c4d16b
(issue179) Handle SW verify failures and try to redownload the update
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1371
diff
changeset
|
190 } |
00fcb9c4d16b
(issue179) Handle SW verify failures and try to redownload the update
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1371
diff
changeset
|
191 installNewSW(swFileName, |
00fcb9c4d16b
(issue179) Handle SW verify failures and try to redownload the update
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1371
diff
changeset
|
192 mSettings.value("Software/availableDate").toDateTime()); |
587
02a89710a7cd
Split up list and software verification and use it
Andre Heinecke <aheinecke@intevation.de>
parents:
563
diff
changeset
|
193 } |
965
013ca910589a
Open main window in case of error message.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
964
diff
changeset
|
194 } else { |
013ca910589a
Open main window in case of error message.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
964
diff
changeset
|
195 show(); |
551
15121735805e
Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents:
548
diff
changeset
|
196 } |
71
f22a99f7cb69
Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents:
45
diff
changeset
|
197 } |
f22a99f7cb69
Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents:
45
diff
changeset
|
198 |
0
cb0cde2c5eb9
Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
199 void MainWindow::showMessage() |
cb0cde2c5eb9
Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
200 { |
591
26a18e3c3db4
Cleanups and coding style.
Andre Heinecke <aheinecke@intevation.de>
parents:
587
diff
changeset
|
201 if (mCurMessage.isEmpty()) { |
26a18e3c3db4
Cleanups and coding style.
Andre Heinecke <aheinecke@intevation.de>
parents:
587
diff
changeset
|
202 return; |
26a18e3c3db4
Cleanups and coding style.
Andre Heinecke <aheinecke@intevation.de>
parents:
587
diff
changeset
|
203 } |
961
423e31ac656e
Delay the tray icon after the download
Andre Heinecke <andre.heinecke@intevation.de>
parents:
956
diff
changeset
|
204 |
423e31ac656e
Delay the tray icon after the download
Andre Heinecke <andre.heinecke@intevation.de>
parents:
956
diff
changeset
|
205 if (!mTrayIcon->isVisible() && !mTrayIcon->isAlternative()) { |
423e31ac656e
Delay the tray icon after the download
Andre Heinecke <andre.heinecke@intevation.de>
parents:
956
diff
changeset
|
206 mTrayIcon->show(); |
423e31ac656e
Delay the tray icon after the download
Andre Heinecke <andre.heinecke@intevation.de>
parents:
956
diff
changeset
|
207 /* When the message is shown before the tray icon is fully visble |
423e31ac656e
Delay the tray icon after the download
Andre Heinecke <andre.heinecke@intevation.de>
parents:
956
diff
changeset
|
208 * and becoming visible may be delayed on some desktop environments |
423e31ac656e
Delay the tray icon after the download
Andre Heinecke <andre.heinecke@intevation.de>
parents:
956
diff
changeset
|
209 * the message will pop up somehere on the screen and not over |
423e31ac656e
Delay the tray icon after the download
Andre Heinecke <andre.heinecke@intevation.de>
parents:
956
diff
changeset
|
210 * the trayicon. So we delay here.*/ |
423e31ac656e
Delay the tray icon after the download
Andre Heinecke <andre.heinecke@intevation.de>
parents:
956
diff
changeset
|
211 QTimer::singleShot(2000, this, SLOT(showMessage())); |
423e31ac656e
Delay the tray icon after the download
Andre Heinecke <andre.heinecke@intevation.de>
parents:
956
diff
changeset
|
212 } else if (mCurState == NewSoftwareAvailable || !isVisible()) { |
1144
a4282bc67a8b
(issue99) Make OK button in message box notification configurable and change it for list updates
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1127
diff
changeset
|
213 if (mCurState == NewListAvailable) { |
a4282bc67a8b
(issue99) Make OK button in message box notification configurable and change it for list updates
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1127
diff
changeset
|
214 mTrayIcon->showMessage(QApplication::applicationName(), mCurMessage, |
a4282bc67a8b
(issue99) Make OK button in message box notification configurable and change it for list updates
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1127
diff
changeset
|
215 QSystemTrayIcon::Information, 10000, |
a4282bc67a8b
(issue99) Make OK button in message box notification configurable and change it for list updates
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1127
diff
changeset
|
216 tr("Show recommendations")); |
a4282bc67a8b
(issue99) Make OK button in message box notification configurable and change it for list updates
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1127
diff
changeset
|
217 } else if (mCurState == NewSoftwareAvailable || !mTrayIcon->isAlternative()) { |
a4282bc67a8b
(issue99) Make OK button in message box notification configurable and change it for list updates
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1127
diff
changeset
|
218 /* Only show new list or new software in alternative as |
a4282bc67a8b
(issue99) Make OK button in message box notification configurable and change it for list updates
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1127
diff
changeset
|
219 * the current tray icon alternative is too invasive for pure |
a4282bc67a8b
(issue99) Make OK button in message box notification configurable and change it for list updates
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1127
diff
changeset
|
220 * informational messages. */ |
a4282bc67a8b
(issue99) Make OK button in message box notification configurable and change it for list updates
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1127
diff
changeset
|
221 mTrayIcon->showMessage(QApplication::applicationName(), mCurMessage, |
a4282bc67a8b
(issue99) Make OK button in message box notification configurable and change it for list updates
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1127
diff
changeset
|
222 QSystemTrayIcon::Information, 10000); |
a4282bc67a8b
(issue99) Make OK button in message box notification configurable and change it for list updates
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1127
diff
changeset
|
223 } |
19
9af6198deb8e
Add timed trigger for the message
Andre Heinecke <aheinecke@intevation.de>
parents:
17
diff
changeset
|
224 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
|
225 } |
0
cb0cde2c5eb9
Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
226 } |
16
225a5ec20dad
Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents:
11
diff
changeset
|
227 |
587
02a89710a7cd
Split up list and software verification and use it
Andre Heinecke <aheinecke@intevation.de>
parents:
563
diff
changeset
|
228 void MainWindow::verifyListData() |
0
cb0cde2c5eb9
Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
229 { |
389
3be838c3e4d8
Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
375
diff
changeset
|
230 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
|
231 QString installedFileName = mSettings.value("List/installed").toString(); |
3be838c3e4d8
Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
375
diff
changeset
|
232 if (!availableFileName.isEmpty()) { |
1153
0495f9187c4b
(issue36) read_and_verify_list expects utf8 filenames.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1148
diff
changeset
|
233 mListToInstall.readList(availableFileName.toUtf8().constData()); |
71
f22a99f7cb69
Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents:
45
diff
changeset
|
234 if (!mListToInstall.isValid()) { |
1227
a1e990947172
(issue38) Add long time error handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1215
diff
changeset
|
235 handleLTE(lteInvalidList); |
82
1f27d6db5ee3
Polarssl based certificate handling
Andre Heinecke <aheinecke@intevation.de>
parents:
72
diff
changeset
|
236 mCurState = TransferError; |
389
3be838c3e4d8
Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
375
diff
changeset
|
237 QFile::remove(availableFileName); |
16
225a5ec20dad
Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents:
11
diff
changeset
|
238 mSettings.remove("List/available"); |
225a5ec20dad
Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents:
11
diff
changeset
|
239 mSettings.remove("List/availableDate"); |
1227
a1e990947172
(issue38) Add long time error handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1215
diff
changeset
|
240 } else { |
a1e990947172
(issue38) Add long time error handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1215
diff
changeset
|
241 handleLTE(lteInvalidList, true); |
16
225a5ec20dad
Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents:
11
diff
changeset
|
242 } |
225a5ec20dad
Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents:
11
diff
changeset
|
243 } else { |
225a5ec20dad
Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents:
11
diff
changeset
|
244 // 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
|
245 mSettings.remove("List/available"); |
225a5ec20dad
Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents:
11
diff
changeset
|
246 mSettings.remove("List/availableDate"); |
225a5ec20dad
Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents:
11
diff
changeset
|
247 } |
225a5ec20dad
Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents:
11
diff
changeset
|
248 |
389
3be838c3e4d8
Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
375
diff
changeset
|
249 if (!installedFileName.isEmpty()) { |
1153
0495f9187c4b
(issue36) read_and_verify_list expects utf8 filenames.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1148
diff
changeset
|
250 mInstalledList.readList(installedFileName.toUtf8().constData()); |
389
3be838c3e4d8
Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
375
diff
changeset
|
251 if (!mInstalledList.isValid()) { |
3be838c3e4d8
Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
375
diff
changeset
|
252 // 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
|
253 // 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
|
254 // 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
|
255 QFile::remove(installedFileName); |
3be838c3e4d8
Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
375
diff
changeset
|
256 mSettings.remove("List/installed"); |
3be838c3e4d8
Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
375
diff
changeset
|
257 mSettings.remove("List/installedDate"); |
3be838c3e4d8
Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
375
diff
changeset
|
258 } |
3be838c3e4d8
Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
375
diff
changeset
|
259 } else { |
3be838c3e4d8
Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
375
diff
changeset
|
260 mSettings.remove("List/installed"); |
3be838c3e4d8
Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
375
diff
changeset
|
261 mSettings.remove("List/installedDate"); |
3be838c3e4d8
Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
375
diff
changeset
|
262 } |
587
02a89710a7cd
Split up list and software verification and use it
Andre Heinecke <aheinecke@intevation.de>
parents:
563
diff
changeset
|
263 } |
389
3be838c3e4d8
Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
375
diff
changeset
|
264 |
587
02a89710a7cd
Split up list and software verification and use it
Andre Heinecke <aheinecke@intevation.de>
parents:
563
diff
changeset
|
265 void MainWindow::verifySWData() |
02a89710a7cd
Split up list and software verification and use it
Andre Heinecke <aheinecke@intevation.de>
parents:
563
diff
changeset
|
266 { |
02a89710a7cd
Split up list and software verification and use it
Andre Heinecke <aheinecke@intevation.de>
parents:
563
diff
changeset
|
267 QString swFileName = mSettings.value("Software/available").toString(); |
389
3be838c3e4d8
Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
375
diff
changeset
|
268 |
591
26a18e3c3db4
Cleanups and coding style.
Andre Heinecke <aheinecke@intevation.de>
parents:
587
diff
changeset
|
269 if (swFileName.isEmpty()) { |
1127
1a5f9e260099
(issue130) Remove USE_REAL_RESOURCE option and implement behavior as descript in the issue
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1126
diff
changeset
|
270 qDebug() << "Date set but no fileName"; |
591
26a18e3c3db4
Cleanups and coding style.
Andre Heinecke <aheinecke@intevation.de>
parents:
587
diff
changeset
|
271 mSettings.remove("Software/availableDate"); |
26a18e3c3db4
Cleanups and coding style.
Andre Heinecke <aheinecke@intevation.de>
parents:
587
diff
changeset
|
272 return; |
26a18e3c3db4
Cleanups and coding style.
Andre Heinecke <aheinecke@intevation.de>
parents:
587
diff
changeset
|
273 } |
26a18e3c3db4
Cleanups and coding style.
Andre Heinecke <aheinecke@intevation.de>
parents:
587
diff
changeset
|
274 |
26a18e3c3db4
Cleanups and coding style.
Andre Heinecke <aheinecke@intevation.de>
parents:
587
diff
changeset
|
275 QFileInfo fi(swFileName); |
26a18e3c3db4
Cleanups and coding style.
Andre Heinecke <aheinecke@intevation.de>
parents:
587
diff
changeset
|
276 if (!fi.exists()) { |
16
225a5ec20dad
Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents:
11
diff
changeset
|
277 mSettings.remove("Software/available"); |
225a5ec20dad
Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents:
11
diff
changeset
|
278 mSettings.remove("Software/availableDate"); |
591
26a18e3c3db4
Cleanups and coding style.
Andre Heinecke <aheinecke@intevation.de>
parents:
587
diff
changeset
|
279 qDebug() << "Software does not yet exist."; |
26a18e3c3db4
Cleanups and coding style.
Andre Heinecke <aheinecke@intevation.de>
parents:
587
diff
changeset
|
280 return; |
26a18e3c3db4
Cleanups and coding style.
Andre Heinecke <aheinecke@intevation.de>
parents:
587
diff
changeset
|
281 } |
26a18e3c3db4
Cleanups and coding style.
Andre Heinecke <aheinecke@intevation.de>
parents:
587
diff
changeset
|
282 if (!fi.isExecutable()) { |
26a18e3c3db4
Cleanups and coding style.
Andre Heinecke <aheinecke@intevation.de>
parents:
587
diff
changeset
|
283 qWarning() << "Downloaded file: " << swFileName << " is not executable."; |
26a18e3c3db4
Cleanups and coding style.
Andre Heinecke <aheinecke@intevation.de>
parents:
587
diff
changeset
|
284 QFile::remove(swFileName); |
26a18e3c3db4
Cleanups and coding style.
Andre Heinecke <aheinecke@intevation.de>
parents:
587
diff
changeset
|
285 mSettings.remove("Software/available"); |
26a18e3c3db4
Cleanups and coding style.
Andre Heinecke <aheinecke@intevation.de>
parents:
587
diff
changeset
|
286 mSettings.remove("Software/availableDate"); |
26a18e3c3db4
Cleanups and coding style.
Andre Heinecke <aheinecke@intevation.de>
parents:
587
diff
changeset
|
287 return; |
26a18e3c3db4
Cleanups and coding style.
Andre Heinecke <aheinecke@intevation.de>
parents:
587
diff
changeset
|
288 } |
26a18e3c3db4
Cleanups and coding style.
Andre Heinecke <aheinecke@intevation.de>
parents:
587
diff
changeset
|
289 bin_verify_result verifyResult = verify_binary(swFileName.toUtf8().constData(), |
26a18e3c3db4
Cleanups and coding style.
Andre Heinecke <aheinecke@intevation.de>
parents:
587
diff
changeset
|
290 swFileName.toUtf8().size()); |
1365
3d7ddf698480
(issue177) Only install updates with a newer signature on windows
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1362
diff
changeset
|
291 QDateTime sigDt = QDateTime::fromTime_t (verifyResult.sig_time); |
3d7ddf698480
(issue177) Only install updates with a newer signature on windows
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1362
diff
changeset
|
292 |
1371
23df332b2a4c
(issue179) Read install signature timestamp from config
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1365
diff
changeset
|
293 if (verifyResult.result != VerifyValid || (mSigDt.isValid() && sigDt <= mSigDt)) { |
1227
a1e990947172
(issue38) Add long time error handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1215
diff
changeset
|
294 handleLTE(lteInvalidSoftware); |
1365
3d7ddf698480
(issue177) Only install updates with a newer signature on windows
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1362
diff
changeset
|
295 if (verifyResult.result != VerifyValid) { |
3d7ddf698480
(issue177) Only install updates with a newer signature on windows
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1362
diff
changeset
|
296 qDebug() << "Failed to verify downloaded data."; |
3d7ddf698480
(issue177) Only install updates with a newer signature on windows
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1362
diff
changeset
|
297 } else { |
3d7ddf698480
(issue177) Only install updates with a newer signature on windows
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1362
diff
changeset
|
298 qDebug() << "Software update was signed at: " << sigDt; |
1371
23df332b2a4c
(issue179) Read install signature timestamp from config
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1365
diff
changeset
|
299 qDebug() << "But the installed software was signed on: " << mSigDt; |
1365
3d7ddf698480
(issue177) Only install updates with a newer signature on windows
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1362
diff
changeset
|
300 if (verifyResult.fptr) { |
3d7ddf698480
(issue177) Only install updates with a newer signature on windows
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1362
diff
changeset
|
301 fclose(verifyResult.fptr); |
3d7ddf698480
(issue177) Only install updates with a newer signature on windows
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1362
diff
changeset
|
302 } |
1373
00fcb9c4d16b
(issue179) Handle SW verify failures and try to redownload the update
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1371
diff
changeset
|
303 scheduleFailureRetryOrClose(!isVisible()); |
1365
3d7ddf698480
(issue177) Only install updates with a newer signature on windows
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1362
diff
changeset
|
304 } |
591
26a18e3c3db4
Cleanups and coding style.
Andre Heinecke <aheinecke@intevation.de>
parents:
587
diff
changeset
|
305 QFile::remove(swFileName); |
26a18e3c3db4
Cleanups and coding style.
Andre Heinecke <aheinecke@intevation.de>
parents:
587
diff
changeset
|
306 mSettings.remove("Software/available"); |
26a18e3c3db4
Cleanups and coding style.
Andre Heinecke <aheinecke@intevation.de>
parents:
587
diff
changeset
|
307 mSettings.remove("Software/availableDate"); |
26a18e3c3db4
Cleanups and coding style.
Andre Heinecke <aheinecke@intevation.de>
parents:
587
diff
changeset
|
308 return; |
16
225a5ec20dad
Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents:
11
diff
changeset
|
309 } |
1227
a1e990947172
(issue38) Add long time error handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1215
diff
changeset
|
310 handleLTE(lteInvalidSoftware, true); /* Reset error state */ |
1081
edbf5e5e88f4
(issue118) Extend verify_binary to carry an open file
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1067
diff
changeset
|
311 fclose(verifyResult.fptr); |
16
225a5ec20dad
Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents:
11
diff
changeset
|
312 } |
225a5ec20dad
Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents:
11
diff
changeset
|
313 |
225a5ec20dad
Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents:
11
diff
changeset
|
314 void MainWindow::handleNewList(const QString& fileName, const QDateTime& modDate) { |
1232
f7e890c4dac6
(issue148) Only update list widgets when something new is available.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1231
diff
changeset
|
315 |
f7e890c4dac6
(issue148) Only update list widgets when something new is available.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1231
diff
changeset
|
316 if (mSettings.value("List/available").toString() == fileName && |
f7e890c4dac6
(issue148) Only update list widgets when something new is available.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1231
diff
changeset
|
317 getState() == NewListAvailable) { |
f7e890c4dac6
(issue148) Only update list widgets when something new is available.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1231
diff
changeset
|
318 qDebug() << "List already handled"; |
f7e890c4dac6
(issue148) Only update list widgets when something new is available.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1231
diff
changeset
|
319 return; |
f7e890c4dac6
(issue148) Only update list widgets when something new is available.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1231
diff
changeset
|
320 } else { |
f7e890c4dac6
(issue148) Only update list widgets when something new is available.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1231
diff
changeset
|
321 qDebug() << "Handling list"; |
f7e890c4dac6
(issue148) Only update list widgets when something new is available.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1231
diff
changeset
|
322 } |
71
f22a99f7cb69
Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents:
45
diff
changeset
|
323 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
|
324 mSettings.setValue("List/availableDate", modDate); |
16
225a5ec20dad
Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents:
11
diff
changeset
|
325 |
587
02a89710a7cd
Split up list and software verification and use it
Andre Heinecke <aheinecke@intevation.de>
parents:
563
diff
changeset
|
326 verifyListData(); |
1362
c2b76c8a8b82
(issue177) Only install certificate lists which are newer
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1339
diff
changeset
|
327 if (!mListToInstall.isValid() || mListToInstall.date() <= mInstalledList.date()) { |
c2b76c8a8b82
(issue177) Only install certificate lists which are newer
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1339
diff
changeset
|
328 if ( mListToInstall.date() <= mInstalledList.date()) { |
c2b76c8a8b82
(issue177) Only install certificate lists which are newer
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1339
diff
changeset
|
329 qDebug() << "Newest list on the server is older then the installed list. "; |
c2b76c8a8b82
(issue177) Only install certificate lists which are newer
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1339
diff
changeset
|
330 qDebug() << "Installed: " << mInstalledList.date(); |
c2b76c8a8b82
(issue177) Only install certificate lists which are newer
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1339
diff
changeset
|
331 qDebug() << "Available: " << mListToInstall.date(); |
c2b76c8a8b82
(issue177) Only install certificate lists which are newer
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1339
diff
changeset
|
332 } else { |
c2b76c8a8b82
(issue177) Only install certificate lists which are newer
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1339
diff
changeset
|
333 qDebug() << "Failed to verify list."; |
c2b76c8a8b82
(issue177) Only install certificate lists which are newer
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1339
diff
changeset
|
334 } |
1227
a1e990947172
(issue38) Add long time error handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1215
diff
changeset
|
335 handleLTE(lteInvalidList); |
71
f22a99f7cb69
Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents:
45
diff
changeset
|
336 /* 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
|
337 |
f22a99f7cb69
Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents:
45
diff
changeset
|
338 /* 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
|
339 QTimer::singleShot(600000 + (qrand() % 60000), this, SLOT(checkUpdates())); |
82
1f27d6db5ee3
Polarssl based certificate handling
Andre Heinecke <aheinecke@intevation.de>
parents:
72
diff
changeset
|
340 } else { |
1154
98e0712e790b
Indentation fix
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1153
diff
changeset
|
341 if (mTrayIcon->isAlternative()) { |
98e0712e790b
Indentation fix
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1153
diff
changeset
|
342 mCurMessage = tr("An updated certificate list is available."); |
98e0712e790b
Indentation fix
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1153
diff
changeset
|
343 } else { |
98e0712e790b
Indentation fix
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1153
diff
changeset
|
344 mCurMessage = tr("An updated certificate list is available.") +" " + tr("Click here to install."); |
98e0712e790b
Indentation fix
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1153
diff
changeset
|
345 } |
82
1f27d6db5ee3
Polarssl based certificate handling
Andre Heinecke <aheinecke@intevation.de>
parents:
72
diff
changeset
|
346 setState(NewListAvailable); |
1f27d6db5ee3
Polarssl based certificate handling
Andre Heinecke <aheinecke@intevation.de>
parents:
72
diff
changeset
|
347 showMessage(); |
189
5f0d45ca9de4
Show certificates in the list view and details in the textfield.
Raimund Renkert <rrenkert@intevation.de>
parents:
187
diff
changeset
|
348 loadCertificateList(); |
71
f22a99f7cb69
Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents:
45
diff
changeset
|
349 } |
16
225a5ec20dad
Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents:
11
diff
changeset
|
350 } |
225a5ec20dad
Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents:
11
diff
changeset
|
351 |
225a5ec20dad
Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents:
11
diff
changeset
|
352 void MainWindow::handleNewSW(const QString& fileName, const QDateTime& modDate) { |
871
4efd6378c001
(issue51) Add fallback in case systemtray is unavailable.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
857
diff
changeset
|
353 if (mTrayIcon->isAlternative()) { |
4efd6378c001
(issue51) Add fallback in case systemtray is unavailable.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
857
diff
changeset
|
354 mCurMessage = tr("An update for %1 is available.").arg( |
16
225a5ec20dad
Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents:
11
diff
changeset
|
355 QApplication::applicationName()); |
871
4efd6378c001
(issue51) Add fallback in case systemtray is unavailable.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
857
diff
changeset
|
356 } else { |
904
f89b41fa7048
Fix whitespace errors
Andre Heinecke <andre.heinecke@intevation.de>
parents:
900
diff
changeset
|
357 mCurMessage = QString(tr("An update for %1 is available.") + "\n" + |
871
4efd6378c001
(issue51) Add fallback in case systemtray is unavailable.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
857
diff
changeset
|
358 tr("Click here to download and install the update.")).arg( |
4efd6378c001
(issue51) Add fallback in case systemtray is unavailable.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
857
diff
changeset
|
359 QApplication::applicationName()); |
4efd6378c001
(issue51) Add fallback in case systemtray is unavailable.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
857
diff
changeset
|
360 } |
16
225a5ec20dad
Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents:
11
diff
changeset
|
361 setState(NewSoftwareAvailable); |
225a5ec20dad
Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents:
11
diff
changeset
|
362 mSettings.setValue("Software/available", fileName); |
225a5ec20dad
Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents:
11
diff
changeset
|
363 mSettings.setValue("Software/availableDate", modDate); |
225a5ec20dad
Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents:
11
diff
changeset
|
364 |
225a5ec20dad
Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents:
11
diff
changeset
|
365 mSettings.sync(); |
225a5ec20dad
Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents:
11
diff
changeset
|
366 showMessage(); |
225a5ec20dad
Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents:
11
diff
changeset
|
367 } |
225a5ec20dad
Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents:
11
diff
changeset
|
368 |
1227
a1e990947172
(issue38) Add long time error handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1215
diff
changeset
|
369 QString MainWindow::getPrettyInstallerName(QString realFileName) { |
1116
df2297e741ad
(issue127) Rename the installer to a pretty name before execution.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1110
diff
changeset
|
370 QTemporaryDir tDir; |
df2297e741ad
(issue127) Rename the installer to a pretty name before execution.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1110
diff
changeset
|
371 if (!tDir.isValid()) { |
df2297e741ad
(issue127) Rename the installer to a pretty name before execution.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1110
diff
changeset
|
372 qDebug () << "Failed to create temporary directory."; |
1227
a1e990947172
(issue38) Add long time error handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1215
diff
changeset
|
373 showErrorMessage (tr("Failed to create temporary directory.") + "\n" + |
a1e990947172
(issue38) Add long time error handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1215
diff
changeset
|
374 tr("Please ensure that you have the access rights to write in " |
a1e990947172
(issue38) Add long time error handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1215
diff
changeset
|
375 "the temporary directory and that there is at least 20MB free " |
a1e990947172
(issue38) Add long time error handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1215
diff
changeset
|
376 "disk space available.")); |
1116
df2297e741ad
(issue127) Rename the installer to a pretty name before execution.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1110
diff
changeset
|
377 return QString(); |
df2297e741ad
(issue127) Rename the installer to a pretty name before execution.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1110
diff
changeset
|
378 } |
1126
a07030035349
(issue96) Add progressbar during download if window is visible.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1125
diff
changeset
|
379 QString targetPath = tDir.path() + "/" + QObject::tr("TrustBridge-Updater", |
1116
df2297e741ad
(issue127) Rename the installer to a pretty name before execution.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1110
diff
changeset
|
380 "Used as filename for the updater. Only use ASCII please."); |
df2297e741ad
(issue127) Rename the installer to a pretty name before execution.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1110
diff
changeset
|
381 |
df2297e741ad
(issue127) Rename the installer to a pretty name before execution.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1110
diff
changeset
|
382 tDir.setAutoRemove(false); |
df2297e741ad
(issue127) Rename the installer to a pretty name before execution.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1110
diff
changeset
|
383 #ifdef WIN32 |
df2297e741ad
(issue127) Rename the installer to a pretty name before execution.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1110
diff
changeset
|
384 targetPath += ".exe"; |
df2297e741ad
(issue127) Rename the installer to a pretty name before execution.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1110
diff
changeset
|
385 #endif |
df2297e741ad
(issue127) Rename the installer to a pretty name before execution.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1110
diff
changeset
|
386 if (!QFile::copy(realFileName, targetPath)) { |
1227
a1e990947172
(issue38) Add long time error handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1215
diff
changeset
|
387 showErrorMessage (tr("Failed to create a temporary copy of the installer.") + "\n" + |
a1e990947172
(issue38) Add long time error handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1215
diff
changeset
|
388 tr("Please ensure that you have the access rights to write in " |
a1e990947172
(issue38) Add long time error handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1215
diff
changeset
|
389 "the temporary directory and that there is at least 20MB free " |
a1e990947172
(issue38) Add long time error handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1215
diff
changeset
|
390 "disk space available.")); |
1116
df2297e741ad
(issue127) Rename the installer to a pretty name before execution.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1110
diff
changeset
|
391 qDebug() << "Failed to create temporary copy of installer."; |
df2297e741ad
(issue127) Rename the installer to a pretty name before execution.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1110
diff
changeset
|
392 } |
df2297e741ad
(issue127) Rename the installer to a pretty name before execution.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1110
diff
changeset
|
393 return targetPath; |
df2297e741ad
(issue127) Rename the installer to a pretty name before execution.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1110
diff
changeset
|
394 } |
df2297e741ad
(issue127) Rename the installer to a pretty name before execution.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1110
diff
changeset
|
395 |
1252
9a482182f80f
(issue54) Monitor update installation and restart afterwards on Linux
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1246
diff
changeset
|
396 void MainWindow::updaterFinished(int exitCode, QProcess::ExitStatus status) |
9a482182f80f
(issue54) Monitor update installation and restart afterwards on Linux
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1246
diff
changeset
|
397 { |
9a482182f80f
(issue54) Monitor update installation and restart afterwards on Linux
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1246
diff
changeset
|
398 if (status != QProcess::NormalExit) { |
9a482182f80f
(issue54) Monitor update installation and restart afterwards on Linux
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1246
diff
changeset
|
399 syslog_error_printf("Update failed.\n"); |
9a482182f80f
(issue54) Monitor update installation and restart afterwards on Linux
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1246
diff
changeset
|
400 qDebug() << "Failed to install update."; |
9a482182f80f
(issue54) Monitor update installation and restart afterwards on Linux
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1246
diff
changeset
|
401 return; |
9a482182f80f
(issue54) Monitor update installation and restart afterwards on Linux
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1246
diff
changeset
|
402 } |
9a482182f80f
(issue54) Monitor update installation and restart afterwards on Linux
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1246
diff
changeset
|
403 if (exitCode != 0) { |
9a482182f80f
(issue54) Monitor update installation and restart afterwards on Linux
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1246
diff
changeset
|
404 qDebug() << "Update not installed with error: " << exitCode; |
9a482182f80f
(issue54) Monitor update installation and restart afterwards on Linux
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1246
diff
changeset
|
405 return; |
9a482182f80f
(issue54) Monitor update installation and restart afterwards on Linux
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1246
diff
changeset
|
406 } |
9a482182f80f
(issue54) Monitor update installation and restart afterwards on Linux
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1246
diff
changeset
|
407 qDebug() << "Restarting"; |
9a482182f80f
(issue54) Monitor update installation and restart afterwards on Linux
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1246
diff
changeset
|
408 ProcessHelp::cleanUp(); |
9a482182f80f
(issue54) Monitor update installation and restart afterwards on Linux
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1246
diff
changeset
|
409 QProcess::startDetached(qApp->applicationFilePath()); |
9a482182f80f
(issue54) Monitor update installation and restart afterwards on Linux
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1246
diff
changeset
|
410 qApp->quit(); |
9a482182f80f
(issue54) Monitor update installation and restart afterwards on Linux
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1246
diff
changeset
|
411 } |
9a482182f80f
(issue54) Monitor update installation and restart afterwards on Linux
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1246
diff
changeset
|
412 |
551
15121735805e
Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents:
548
diff
changeset
|
413 void MainWindow::installNewSW(const QString& fileName, const QDateTime& modDate) { |
15121735805e
Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents:
548
diff
changeset
|
414 QFileInfo instProcInfo = QFileInfo(fileName); |
563
aee3eb10bbba
Add unit test for sw update execution and fix shell execute params
Andre Heinecke <aheinecke@intevation.de>
parents:
555
diff
changeset
|
415 QString filePath = QDir::toNativeSeparators(instProcInfo.absoluteFilePath()); |
1116
df2297e741ad
(issue127) Rename the installer to a pretty name before execution.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1110
diff
changeset
|
416 |
1292
87b3886aca69
(issue44) Also set available information when sw was dowloaded.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1276
diff
changeset
|
417 /* Reset available information. */ |
87b3886aca69
(issue44) Also set available information when sw was dowloaded.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1276
diff
changeset
|
418 mSettings.setValue("Software/available", fileName); |
87b3886aca69
(issue44) Also set available information when sw was dowloaded.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1276
diff
changeset
|
419 mSettings.setValue("Software/availableDate", modDate); |
87b3886aca69
(issue44) Also set available information when sw was dowloaded.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1276
diff
changeset
|
420 |
1116
df2297e741ad
(issue127) Rename the installer to a pretty name before execution.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1110
diff
changeset
|
421 /* Copy the file to a temporary name for installation */ |
df2297e741ad
(issue127) Rename the installer to a pretty name before execution.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1110
diff
changeset
|
422 filePath = getPrettyInstallerName(filePath); |
df2297e741ad
(issue127) Rename the installer to a pretty name before execution.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1110
diff
changeset
|
423 |
df2297e741ad
(issue127) Rename the installer to a pretty name before execution.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1110
diff
changeset
|
424 if (filePath.isEmpty()) { |
df2297e741ad
(issue127) Rename the installer to a pretty name before execution.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1110
diff
changeset
|
425 qDebug() << "Failed to copy updater to temporary location."; |
df2297e741ad
(issue127) Rename the installer to a pretty name before execution.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1110
diff
changeset
|
426 return; |
df2297e741ad
(issue127) Rename the installer to a pretty name before execution.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1110
diff
changeset
|
427 } |
df2297e741ad
(issue127) Rename the installer to a pretty name before execution.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1110
diff
changeset
|
428 mSettings.setValue("Software/Updater", filePath); /* So it can be deleted |
df2297e741ad
(issue127) Rename the installer to a pretty name before execution.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1110
diff
changeset
|
429 on next start */ |
df2297e741ad
(issue127) Rename the installer to a pretty name before execution.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1110
diff
changeset
|
430 mSettings.sync(); |
df2297e741ad
(issue127) Rename the installer to a pretty name before execution.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1110
diff
changeset
|
431 |
1081
edbf5e5e88f4
(issue118) Extend verify_binary to carry an open file
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1067
diff
changeset
|
432 bin_verify_result vres = verify_binary(filePath.toUtf8().constData(), |
edbf5e5e88f4
(issue118) Extend verify_binary to carry an open file
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1067
diff
changeset
|
433 filePath.toUtf8().size()); |
592
778f74d0706f
Verify the binary directly without relying on settings (which might differ)
Andre Heinecke <aheinecke@intevation.de>
parents:
591
diff
changeset
|
434 |
1365
3d7ddf698480
(issue177) Only install updates with a newer signature on windows
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1362
diff
changeset
|
435 QDateTime sigDt = QDateTime::fromTime_t (vres.sig_time); |
3d7ddf698480
(issue177) Only install updates with a newer signature on windows
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1362
diff
changeset
|
436 |
1371
23df332b2a4c
(issue179) Read install signature timestamp from config
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1365
diff
changeset
|
437 if (vres.result != VerifyValid || (mSigDt.isValid() && sigDt <= mSigDt)) { |
1227
a1e990947172
(issue38) Add long time error handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1215
diff
changeset
|
438 handleLTE(lteInvalidSoftware); |
1365
3d7ddf698480
(issue177) Only install updates with a newer signature on windows
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1362
diff
changeset
|
439 if (vres.result != VerifyValid) { |
3d7ddf698480
(issue177) Only install updates with a newer signature on windows
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1362
diff
changeset
|
440 qDebug() << "Failed to verify installer."; |
3d7ddf698480
(issue177) Only install updates with a newer signature on windows
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1362
diff
changeset
|
441 } else { |
3d7ddf698480
(issue177) Only install updates with a newer signature on windows
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1362
diff
changeset
|
442 qDebug() << "Software update was signed at: " << sigDt; |
1371
23df332b2a4c
(issue179) Read install signature timestamp from config
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1365
diff
changeset
|
443 qDebug() << "But the installed software was signed on: " << mSigDt; |
1365
3d7ddf698480
(issue177) Only install updates with a newer signature on windows
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1362
diff
changeset
|
444 if (vres.fptr) { |
3d7ddf698480
(issue177) Only install updates with a newer signature on windows
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1362
diff
changeset
|
445 fclose(vres.fptr); |
3d7ddf698480
(issue177) Only install updates with a newer signature on windows
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1362
diff
changeset
|
446 } |
1373
00fcb9c4d16b
(issue179) Handle SW verify failures and try to redownload the update
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1371
diff
changeset
|
447 scheduleFailureRetryOrClose(!isVisible()); |
1365
3d7ddf698480
(issue177) Only install updates with a newer signature on windows
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1362
diff
changeset
|
448 } |
3d7ddf698480
(issue177) Only install updates with a newer signature on windows
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1362
diff
changeset
|
449 QFile::remove(filePath); |
3d7ddf698480
(issue177) Only install updates with a newer signature on windows
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1362
diff
changeset
|
450 mSettings.remove("Software/available"); |
3d7ddf698480
(issue177) Only install updates with a newer signature on windows
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1362
diff
changeset
|
451 mSettings.remove("Software/availableDate"); |
551
15121735805e
Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents:
548
diff
changeset
|
452 return; |
1227
a1e990947172
(issue38) Add long time error handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1215
diff
changeset
|
453 } |
a1e990947172
(issue38) Add long time error handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1215
diff
changeset
|
454 handleLTE(lteInvalidSoftware, true); |
592
778f74d0706f
Verify the binary directly without relying on settings (which might differ)
Andre Heinecke <aheinecke@intevation.de>
parents:
591
diff
changeset
|
455 QFileInfo fi(QCoreApplication::applicationFilePath()); |
778f74d0706f
Verify the binary directly without relying on settings (which might differ)
Andre Heinecke <aheinecke@intevation.de>
parents:
591
diff
changeset
|
456 QDir installDir = fi.absoluteDir(); |
778f74d0706f
Verify the binary directly without relying on settings (which might differ)
Andre Heinecke <aheinecke@intevation.de>
parents:
591
diff
changeset
|
457 |
551
15121735805e
Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents:
548
diff
changeset
|
458 #ifdef WIN32 |
594
c944de9900de
Add installation parameters with correct quoting
Andre Heinecke <aheinecke@intevation.de>
parents:
592
diff
changeset
|
459 QString parameters = QString::fromLatin1("/S /UPDATE=1 /D=") + |
c944de9900de
Add installation parameters with correct quoting
Andre Heinecke <aheinecke@intevation.de>
parents:
592
diff
changeset
|
460 installDir.path().replace("/", "\\") + ""; |
c944de9900de
Add installation parameters with correct quoting
Andre Heinecke <aheinecke@intevation.de>
parents:
592
diff
changeset
|
461 |
551
15121735805e
Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents:
548
diff
changeset
|
462 SHELLEXECUTEINFOW shExecInfo; |
563
aee3eb10bbba
Add unit test for sw update execution and fix shell execute params
Andre Heinecke <aheinecke@intevation.de>
parents:
555
diff
changeset
|
463 memset (&shExecInfo, 0, sizeof(SHELLEXECUTEINFOW)); |
aee3eb10bbba
Add unit test for sw update execution and fix shell execute params
Andre Heinecke <aheinecke@intevation.de>
parents:
555
diff
changeset
|
464 shExecInfo.cbSize = sizeof(SHELLEXECUTEINFOW); |
aee3eb10bbba
Add unit test for sw update execution and fix shell execute params
Andre Heinecke <aheinecke@intevation.de>
parents:
555
diff
changeset
|
465 |
aee3eb10bbba
Add unit test for sw update execution and fix shell execute params
Andre Heinecke <aheinecke@intevation.de>
parents:
555
diff
changeset
|
466 shExecInfo.lpFile = reinterpret_cast<LPCWSTR> (filePath.utf16()); |
594
c944de9900de
Add installation parameters with correct quoting
Andre Heinecke <aheinecke@intevation.de>
parents:
592
diff
changeset
|
467 shExecInfo.lpParameters = reinterpret_cast<LPCWSTR> (parameters.utf16()); |
563
aee3eb10bbba
Add unit test for sw update execution and fix shell execute params
Andre Heinecke <aheinecke@intevation.de>
parents:
555
diff
changeset
|
468 |
594
c944de9900de
Add installation parameters with correct quoting
Andre Heinecke <aheinecke@intevation.de>
parents:
592
diff
changeset
|
469 // shExecInfo.fMask = SEE_MASK_NOASYNC; |
c944de9900de
Add installation parameters with correct quoting
Andre Heinecke <aheinecke@intevation.de>
parents:
592
diff
changeset
|
470 shExecInfo.nShow = SW_SHOWDEFAULT; |
551
15121735805e
Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents:
548
diff
changeset
|
471 |
1003
db7e7156c824
(issue66) Only depend on is_system_install on windows to decide privilege raise
Andre Heinecke <andre.heinecke@intevation.de>
parents:
997
diff
changeset
|
472 if (!is_system_install()) { |
551
15121735805e
Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents:
548
diff
changeset
|
473 shExecInfo.lpVerb = L"open"; |
15121735805e
Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents:
548
diff
changeset
|
474 } else { |
15121735805e
Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents:
548
diff
changeset
|
475 shExecInfo.lpVerb = L"runas"; |
15121735805e
Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents:
548
diff
changeset
|
476 } |
15121735805e
Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents:
548
diff
changeset
|
477 |
594
c944de9900de
Add installation parameters with correct quoting
Andre Heinecke <aheinecke@intevation.de>
parents:
592
diff
changeset
|
478 qDebug() << "Starting process: " << filePath |
c944de9900de
Add installation parameters with correct quoting
Andre Heinecke <aheinecke@intevation.de>
parents:
592
diff
changeset
|
479 << " with arguments: " << parameters; |
551
15121735805e
Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents:
548
diff
changeset
|
480 |
15121735805e
Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents:
548
diff
changeset
|
481 if (!ShellExecuteExW(&shExecInfo)) { |
15121735805e
Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents:
548
diff
changeset
|
482 /* Execution failed, maybe the user aborted the UAC check? */ |
15121735805e
Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents:
548
diff
changeset
|
483 char* errmsg = getLastErrorMsg(); |
15121735805e
Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents:
548
diff
changeset
|
484 QString qerrmsg = QString::fromUtf8(errmsg); |
15121735805e
Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents:
548
diff
changeset
|
485 free(errmsg); |
15121735805e
Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents:
548
diff
changeset
|
486 qDebug() << "Failed to start process: " << qerrmsg; |
15121735805e
Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents:
548
diff
changeset
|
487 setState(NewSoftwareAvailable); |
1081
edbf5e5e88f4
(issue118) Extend verify_binary to carry an open file
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1067
diff
changeset
|
488 fclose(vres.fptr); |
551
15121735805e
Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents:
548
diff
changeset
|
489 return; |
15121735805e
Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents:
548
diff
changeset
|
490 } |
15121735805e
Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents:
548
diff
changeset
|
491 #else /* WIN32 */ |
894
2e7fff9d195a
Update in the real prefix
Andre Heinecke <andre.heinecke@intevation.de>
parents:
893
diff
changeset
|
492 /* On linux installDir is <prefix>/bin */ |
594
c944de9900de
Add installation parameters with correct quoting
Andre Heinecke <aheinecke@intevation.de>
parents:
592
diff
changeset
|
493 QStringList parameters; |
894
2e7fff9d195a
Update in the real prefix
Andre Heinecke <andre.heinecke@intevation.de>
parents:
893
diff
changeset
|
494 installDir.cdUp(); |
810
ee75e236843c
Use sudo to install software in case of is_admin
Andre Heinecke <andre.heinecke@intevation.de>
parents:
807
diff
changeset
|
495 parameters << "--prefix" << installDir.path(); |
1067
51b97ebc5b06
(issue54) Launch depending on visibility either as tray or full after installation
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1061
diff
changeset
|
496 parameters << "--update"; |
810
ee75e236843c
Use sudo to install software in case of is_admin
Andre Heinecke <andre.heinecke@intevation.de>
parents:
807
diff
changeset
|
497 bool sudo_started = false; |
841
216a65d7fc4b
(issue66) Implement is_system_install and use it
Andre Heinecke <andre.heinecke@intevation.de>
parents:
838
diff
changeset
|
498 bool use_sudo = is_admin() && is_system_install(); |
1252
9a482182f80f
(issue54) Monitor update installation and restart afterwards on Linux
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1246
diff
changeset
|
499 |
9a482182f80f
(issue54) Monitor update installation and restart afterwards on Linux
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1246
diff
changeset
|
500 QProcess *updaterProcess = new QProcess(); |
9a482182f80f
(issue54) Monitor update installation and restart afterwards on Linux
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1246
diff
changeset
|
501 |
810
ee75e236843c
Use sudo to install software in case of is_admin
Andre Heinecke <andre.heinecke@intevation.de>
parents:
807
diff
changeset
|
502 if (use_sudo) { |
ee75e236843c
Use sudo to install software in case of is_admin
Andre Heinecke <andre.heinecke@intevation.de>
parents:
807
diff
changeset
|
503 QStringList sudoPrograms; |
987
b8ae69bcc540
Use pkexec instead of gksudo.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
970
diff
changeset
|
504 sudoPrograms << "pkexec" << "kdesudo" << "sudo"; |
810
ee75e236843c
Use sudo to install software in case of is_admin
Andre Heinecke <andre.heinecke@intevation.de>
parents:
807
diff
changeset
|
505 QStringList sudoParams; |
1252
9a482182f80f
(issue54) Monitor update installation and restart afterwards on Linux
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1246
diff
changeset
|
506 sudoParams << filePath; |
9a482182f80f
(issue54) Monitor update installation and restart afterwards on Linux
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1246
diff
changeset
|
507 sudoParams << parameters; |
9a482182f80f
(issue54) Monitor update installation and restart afterwards on Linux
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1246
diff
changeset
|
508 updaterProcess->setArguments(sudoParams); |
551
15121735805e
Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents:
548
diff
changeset
|
509 |
1260
82792b3a16bd
Add inactive debug code for update installation
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1259
diff
changeset
|
510 #if 0 |
82792b3a16bd
Add inactive debug code for update installation
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1259
diff
changeset
|
511 updaterProcess->setStandardErrorFile("/tmp/tb-inst-err.log"); |
82792b3a16bd
Add inactive debug code for update installation
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1259
diff
changeset
|
512 updaterProcess->setStandardOutputFile("/tmp/tb-inst-out.log"); |
82792b3a16bd
Add inactive debug code for update installation
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1259
diff
changeset
|
513 #endif |
82792b3a16bd
Add inactive debug code for update installation
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1259
diff
changeset
|
514 |
810
ee75e236843c
Use sudo to install software in case of is_admin
Andre Heinecke <andre.heinecke@intevation.de>
parents:
807
diff
changeset
|
515 foreach (const QString &sProg, sudoPrograms) { |
ee75e236843c
Use sudo to install software in case of is_admin
Andre Heinecke <andre.heinecke@intevation.de>
parents:
807
diff
changeset
|
516 qDebug() << "Starting process " << sProg <<" params: " << sudoParams; |
1252
9a482182f80f
(issue54) Monitor update installation and restart afterwards on Linux
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1246
diff
changeset
|
517 updaterProcess->setProgram(sProg); |
9a482182f80f
(issue54) Monitor update installation and restart afterwards on Linux
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1246
diff
changeset
|
518 updaterProcess->start(); |
9a482182f80f
(issue54) Monitor update installation and restart afterwards on Linux
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1246
diff
changeset
|
519 if (!updaterProcess->waitForStarted() || |
9a482182f80f
(issue54) Monitor update installation and restart afterwards on Linux
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1246
diff
changeset
|
520 updaterProcess->state() == QProcess::NotRunning) { |
810
ee75e236843c
Use sudo to install software in case of is_admin
Andre Heinecke <andre.heinecke@intevation.de>
parents:
807
diff
changeset
|
521 continue; |
ee75e236843c
Use sudo to install software in case of is_admin
Andre Heinecke <andre.heinecke@intevation.de>
parents:
807
diff
changeset
|
522 } else { |
ee75e236843c
Use sudo to install software in case of is_admin
Andre Heinecke <andre.heinecke@intevation.de>
parents:
807
diff
changeset
|
523 sudo_started = true; |
1252
9a482182f80f
(issue54) Monitor update installation and restart afterwards on Linux
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1246
diff
changeset
|
524 connect(updaterProcess, SIGNAL(finished(int, QProcess::ExitStatus)), |
9a482182f80f
(issue54) Monitor update installation and restart afterwards on Linux
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1246
diff
changeset
|
525 this, SLOT(updaterFinished(int, QProcess::ExitStatus))); |
810
ee75e236843c
Use sudo to install software in case of is_admin
Andre Heinecke <andre.heinecke@intevation.de>
parents:
807
diff
changeset
|
526 break; |
ee75e236843c
Use sudo to install software in case of is_admin
Andre Heinecke <andre.heinecke@intevation.de>
parents:
807
diff
changeset
|
527 } |
ee75e236843c
Use sudo to install software in case of is_admin
Andre Heinecke <andre.heinecke@intevation.de>
parents:
807
diff
changeset
|
528 } |
ee75e236843c
Use sudo to install software in case of is_admin
Andre Heinecke <andre.heinecke@intevation.de>
parents:
807
diff
changeset
|
529 } |
1252
9a482182f80f
(issue54) Monitor update installation and restart afterwards on Linux
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1246
diff
changeset
|
530 if (!sudo_started) { |
9a482182f80f
(issue54) Monitor update installation and restart afterwards on Linux
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1246
diff
changeset
|
531 qDebug() << "Starting process " << filePath <<" params: " << parameters; |
9a482182f80f
(issue54) Monitor update installation and restart afterwards on Linux
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1246
diff
changeset
|
532 updaterProcess->setArguments(parameters); |
9a482182f80f
(issue54) Monitor update installation and restart afterwards on Linux
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1246
diff
changeset
|
533 updaterProcess->setProgram(filePath); |
9a482182f80f
(issue54) Monitor update installation and restart afterwards on Linux
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1246
diff
changeset
|
534 updaterProcess->start(); |
9a482182f80f
(issue54) Monitor update installation and restart afterwards on Linux
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1246
diff
changeset
|
535 |
9a482182f80f
(issue54) Monitor update installation and restart afterwards on Linux
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1246
diff
changeset
|
536 if (!updaterProcess->waitForStarted() || |
9a482182f80f
(issue54) Monitor update installation and restart afterwards on Linux
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1246
diff
changeset
|
537 updaterProcess->state() == QProcess::NotRunning) { |
9a482182f80f
(issue54) Monitor update installation and restart afterwards on Linux
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1246
diff
changeset
|
538 qDebug() << "Failed to start process."; |
9a482182f80f
(issue54) Monitor update installation and restart afterwards on Linux
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1246
diff
changeset
|
539 } |
9a482182f80f
(issue54) Monitor update installation and restart afterwards on Linux
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1246
diff
changeset
|
540 connect(updaterProcess, SIGNAL(finished(int, QProcess::ExitStatus)), |
1272
520d8e6f14a4
(issue44) Fix slot parameters
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1270
diff
changeset
|
541 this, SLOT(updaterFinished(int, QProcess::ExitStatus))); |
551
15121735805e
Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents:
548
diff
changeset
|
542 return; |
15121735805e
Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents:
548
diff
changeset
|
543 } |
810
ee75e236843c
Use sudo to install software in case of is_admin
Andre Heinecke <andre.heinecke@intevation.de>
parents:
807
diff
changeset
|
544 |
551
15121735805e
Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents:
548
diff
changeset
|
545 #endif |
1125
dd9094d92899
(issue54) If the MainWindows is visible when an update is triggered start it visible after upadte
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1116
diff
changeset
|
546 if (isVisible()) { |
dd9094d92899
(issue54) If the MainWindows is visible when an update is triggered start it visible after upadte
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1116
diff
changeset
|
547 mSettings.setValue("ShowOnNextStart", true); |
dd9094d92899
(issue54) If the MainWindows is visible when an update is triggered start it visible after upadte
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1116
diff
changeset
|
548 mSettings.sync(); |
dd9094d92899
(issue54) If the MainWindows is visible when an update is triggered start it visible after upadte
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1116
diff
changeset
|
549 } |
1081
edbf5e5e88f4
(issue118) Extend verify_binary to carry an open file
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1067
diff
changeset
|
550 |
edbf5e5e88f4
(issue118) Extend verify_binary to carry an open file
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1067
diff
changeset
|
551 syslog_info_printf ("Installing update: %s\n", fileName.toUtf8().constData()); |
551
15121735805e
Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents:
548
diff
changeset
|
552 /* Installer process should now be running. We exit */ |
1081
edbf5e5e88f4
(issue118) Extend verify_binary to carry an open file
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1067
diff
changeset
|
553 fclose(vres.fptr); |
1252
9a482182f80f
(issue54) Monitor update installation and restart afterwards on Linux
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1246
diff
changeset
|
554 #ifdef WIN32 |
551
15121735805e
Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents:
548
diff
changeset
|
555 closeApp(); |
1252
9a482182f80f
(issue54) Monitor update installation and restart afterwards on Linux
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1246
diff
changeset
|
556 #endif |
551
15121735805e
Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents:
548
diff
changeset
|
557 } |
15121735805e
Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents:
548
diff
changeset
|
558 |
1373
00fcb9c4d16b
(issue179) Handle SW verify failures and try to redownload the update
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1371
diff
changeset
|
559 void MainWindow::checkUpdates() |
16
225a5ec20dad
Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents:
11
diff
changeset
|
560 { |
587
02a89710a7cd
Split up list and software verification and use it
Andre Heinecke <aheinecke@intevation.de>
parents:
563
diff
changeset
|
561 verifyListData(); |
1373
00fcb9c4d16b
(issue179) Handle SW verify failures and try to redownload the update
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1371
diff
changeset
|
562 bool downloadSW = false; |
00fcb9c4d16b
(issue179) Handle SW verify failures and try to redownload the update
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1371
diff
changeset
|
563 |
00fcb9c4d16b
(issue179) Handle SW verify failures and try to redownload the update
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1371
diff
changeset
|
564 if (mDownloadSWAccepted == true) { |
00fcb9c4d16b
(issue179) Handle SW verify failures and try to redownload the update
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1371
diff
changeset
|
565 downloadSW = true; |
00fcb9c4d16b
(issue179) Handle SW verify failures and try to redownload the update
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1371
diff
changeset
|
566 } |
16
225a5ec20dad
Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents:
11
diff
changeset
|
567 |
1116
df2297e741ad
(issue127) Rename the installer to a pretty name before execution.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1110
diff
changeset
|
568 /* Delete old temporary installers if they exist */ |
df2297e741ad
(issue127) Rename the installer to a pretty name before execution.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1110
diff
changeset
|
569 QString oldUpdater = mSettings.value("Software/Updater").toString(); |
df2297e741ad
(issue127) Rename the installer to a pretty name before execution.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1110
diff
changeset
|
570 |
df2297e741ad
(issue127) Rename the installer to a pretty name before execution.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1110
diff
changeset
|
571 if (!oldUpdater.isEmpty()) { |
df2297e741ad
(issue127) Rename the installer to a pretty name before execution.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1110
diff
changeset
|
572 qDebug() << "Removing old updater: " << oldUpdater; |
df2297e741ad
(issue127) Rename the installer to a pretty name before execution.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1110
diff
changeset
|
573 QFileInfo fiUpdater(oldUpdater); |
df2297e741ad
(issue127) Rename the installer to a pretty name before execution.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1110
diff
changeset
|
574 if (!QFile::remove(fiUpdater.absoluteFilePath())) { |
df2297e741ad
(issue127) Rename the installer to a pretty name before execution.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1110
diff
changeset
|
575 qDebug() << "Failed to remove file"; |
df2297e741ad
(issue127) Rename the installer to a pretty name before execution.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1110
diff
changeset
|
576 } else { |
df2297e741ad
(issue127) Rename the installer to a pretty name before execution.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1110
diff
changeset
|
577 if (!fiUpdater.absoluteDir().rmdir(fiUpdater.absoluteDir().absolutePath())) { |
df2297e741ad
(issue127) Rename the installer to a pretty name before execution.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1110
diff
changeset
|
578 qDebug() << "Failed to remove temporary directory."; |
df2297e741ad
(issue127) Rename the installer to a pretty name before execution.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1110
diff
changeset
|
579 } |
df2297e741ad
(issue127) Rename the installer to a pretty name before execution.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1110
diff
changeset
|
580 } |
df2297e741ad
(issue127) Rename the installer to a pretty name before execution.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1110
diff
changeset
|
581 mSettings.remove("Software/Updater"); |
df2297e741ad
(issue127) Rename the installer to a pretty name before execution.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1110
diff
changeset
|
582 } |
df2297e741ad
(issue127) Rename the installer to a pretty name before execution.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1110
diff
changeset
|
583 |
551
15121735805e
Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents:
548
diff
changeset
|
584 if (!mSettings.contains("Software/installedDate") || |
15121735805e
Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents:
548
diff
changeset
|
585 mSettings.value("Software/installedVersion").toString() != QApplication::applicationVersion()) { |
15121735805e
Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents:
548
diff
changeset
|
586 /* This should only happen on initial startup and after an update has |
15121735805e
Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents:
548
diff
changeset
|
587 * been installed */ |
15121735805e
Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents:
548
diff
changeset
|
588 getLastModForCurrentVersion(); |
486
fa56a9403939
Lookup the last modified date for software installer after first installation.
Raimund Renkert <rrenkert@intevation.de>
parents:
481
diff
changeset
|
589 return; |
fa56a9403939
Lookup the last modified date for software installer after first installation.
Raimund Renkert <rrenkert@intevation.de>
parents:
481
diff
changeset
|
590 } |
17
c12825a651ed
Read out content-length and use this to skip existing files
Andre Heinecke <aheinecke@intevation.de>
parents:
16
diff
changeset
|
591 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
|
592 QDateTime swInstalledLastMod = mSettings.value("Software/installedDate").toDateTime(); |
389
3be838c3e4d8
Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
375
diff
changeset
|
593 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
|
594 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
|
595 |
3be838c3e4d8
Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
375
diff
changeset
|
596 #ifndef RELEASE_BUILD |
3be838c3e4d8
Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
375
diff
changeset
|
597 /* 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
|
598 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
|
599 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
|
600 #endif |
3be838c3e4d8
Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
375
diff
changeset
|
601 |
72
7e304573ebd1
Add some testing hacks for interactive testing
Andre Heinecke <aheinecke@intevation.de>
parents:
71
diff
changeset
|
602 Downloader* downloader = new Downloader(this, |
7e304573ebd1
Add some testing hacks for interactive testing
Andre Heinecke <aheinecke@intevation.de>
parents:
71
diff
changeset
|
603 QString::fromLatin1(SERVER_URL), |
7e304573ebd1
Add some testing hacks for interactive testing
Andre Heinecke <aheinecke@intevation.de>
parents:
71
diff
changeset
|
604 QByteArray(), |
551
15121735805e
Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents:
548
diff
changeset
|
605 swInstalledLastMod, |
72
7e304573ebd1
Add some testing hacks for interactive testing
Andre Heinecke <aheinecke@intevation.de>
parents:
71
diff
changeset
|
606 listInstalledLastMod, |
437
4b486a14252f
Acutally use the values that can be taken from the config
Andre Heinecke <aheinecke@intevation.de>
parents:
434
diff
changeset
|
607 swResource, |
461
1ce835c40eb7
Ask the user if software updates should be installed.
Raimund Renkert <rrenkert@intevation.de>
parents:
456
diff
changeset
|
608 listResource, |
1ce835c40eb7
Ask the user if software updates should be installed.
Raimund Renkert <rrenkert@intevation.de>
parents:
456
diff
changeset
|
609 downloadSW); |
17
c12825a651ed
Read out content-length and use this to skip existing files
Andre Heinecke <aheinecke@intevation.de>
parents:
16
diff
changeset
|
610 |
16
225a5ec20dad
Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents:
11
diff
changeset
|
611 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
|
612 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
|
613 if (!downloadSW) { |
1ce835c40eb7
Ask the user if software updates should be installed.
Raimund Renkert <rrenkert@intevation.de>
parents:
456
diff
changeset
|
614 connect(downloader, SIGNAL(newSoftwareAvailable(const QString&, const QDateTime&)), |
551
15121735805e
Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents:
548
diff
changeset
|
615 this, SLOT(handleNewSW(const QString&, const QDateTime&))); |
15121735805e
Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents:
548
diff
changeset
|
616 } else { |
708
bd48fae793b6
(Issue25) Log update check success, change header labels.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
703
diff
changeset
|
617 setState(DownloadingSW); |
551
15121735805e
Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents:
548
diff
changeset
|
618 connect(downloader, SIGNAL(newSoftwareAvailable(const QString&, const QDateTime&)), |
15121735805e
Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents:
548
diff
changeset
|
619 this, SLOT(installNewSW(const QString&, const QDateTime&))); |
461
1ce835c40eb7
Ask the user if software updates should be installed.
Raimund Renkert <rrenkert@intevation.de>
parents:
456
diff
changeset
|
620 } |
551
15121735805e
Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents:
548
diff
changeset
|
621 |
16
225a5ec20dad
Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents:
11
diff
changeset
|
622 connect(downloader, SIGNAL(finished()), downloader, SLOT(deleteLater())); |
708
bd48fae793b6
(Issue25) Log update check success, change header labels.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
703
diff
changeset
|
623 connect(downloader, SIGNAL(finished()), this, SLOT(updateCheckSuccess())); |
45
c6125d73faf4
Move SSLConnection into it's own class
Andre Heinecke <aheinecke@intevation.de>
parents:
31
diff
changeset
|
624 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
|
625 this, SLOT(downloaderError(const QString &, SSLConnection::ErrorCode))); |
10
fe39d93f1261
Start on Downloader component
Andre Heinecke <aheinecke@intevation.de>
parents:
7
diff
changeset
|
626 downloader->start(); |
1126
a07030035349
(issue96) Add progressbar during download if window is visible.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1125
diff
changeset
|
627 |
a07030035349
(issue96) Add progressbar during download if window is visible.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1125
diff
changeset
|
628 if (downloadSW && getState() == DownloadingSW && isVisible()) { |
a07030035349
(issue96) Add progressbar during download if window is visible.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1125
diff
changeset
|
629 QProgressDialog *progDlg = new QProgressDialog(this); |
a07030035349
(issue96) Add progressbar during download if window is visible.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1125
diff
changeset
|
630 progDlg->setCancelButton(0); |
a07030035349
(issue96) Add progressbar during download if window is visible.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1125
diff
changeset
|
631 progDlg->setRange(0,0); |
a07030035349
(issue96) Add progressbar during download if window is visible.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1125
diff
changeset
|
632 progDlg->setMinimumDuration(0); |
a07030035349
(issue96) Add progressbar during download if window is visible.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1125
diff
changeset
|
633 progDlg->setLabelText(tr("Downloading update...")); |
a07030035349
(issue96) Add progressbar during download if window is visible.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1125
diff
changeset
|
634 progDlg->show(); |
a07030035349
(issue96) Add progressbar during download if window is visible.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1125
diff
changeset
|
635 connect(downloader, SIGNAL(finished()), progDlg, SLOT(deleteLater())); |
a07030035349
(issue96) Add progressbar during download if window is visible.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1125
diff
changeset
|
636 connect(downloader, SIGNAL(finished()), progDlg, SLOT(cancel())); |
a07030035349
(issue96) Add progressbar during download if window is visible.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1125
diff
changeset
|
637 } |
0
cb0cde2c5eb9
Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
638 } |
cb0cde2c5eb9
Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
639 |
551
15121735805e
Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents:
548
diff
changeset
|
640 void MainWindow::getLastModForCurrentVersion() |
486
fa56a9403939
Lookup the last modified date for software installer after first installation.
Raimund Renkert <rrenkert@intevation.de>
parents:
481
diff
changeset
|
641 { |
fa56a9403939
Lookup the last modified date for software installer after first installation.
Raimund Renkert <rrenkert@intevation.de>
parents:
481
diff
changeset
|
642 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
|
643 QApplication::applicationVersion()); |
1292
87b3886aca69
(issue44) Also set available information when sw was dowloaded.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1276
diff
changeset
|
644 qDebug() << "Getting last modified date for: " << softwareVersion; |
486
fa56a9403939
Lookup the last modified date for software installer after first installation.
Raimund Renkert <rrenkert@intevation.de>
parents:
481
diff
changeset
|
645 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
|
646 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
|
647 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
|
648 QByteArray(), |
fa56a9403939
Lookup the last modified date for software installer after first installation.
Raimund Renkert <rrenkert@intevation.de>
parents:
481
diff
changeset
|
649 QDateTime::currentDateTime(), |
fa56a9403939
Lookup the last modified date for software installer after first installation.
Raimund Renkert <rrenkert@intevation.de>
parents:
481
diff
changeset
|
650 QDateTime::currentDateTime(), |
fa56a9403939
Lookup the last modified date for software installer after first installation.
Raimund Renkert <rrenkert@intevation.de>
parents:
481
diff
changeset
|
651 softwareVersion, |
fa56a9403939
Lookup the last modified date for software installer after first installation.
Raimund Renkert <rrenkert@intevation.de>
parents:
481
diff
changeset
|
652 listResource, |
fa56a9403939
Lookup the last modified date for software installer after first installation.
Raimund Renkert <rrenkert@intevation.de>
parents:
481
diff
changeset
|
653 false); |
fa56a9403939
Lookup the last modified date for software installer after first installation.
Raimund Renkert <rrenkert@intevation.de>
parents:
481
diff
changeset
|
654 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
|
655 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
|
656 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
|
657 connect(downloader, SIGNAL(lastModifiedDate(const QDateTime&)), |
551
15121735805e
Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents:
548
diff
changeset
|
658 this, SLOT(setLastModifiedSWDate(const QDateTime&))); |
1155
5f5880cca5cf
Fix connect syntax in downloader destroy notification.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1154
diff
changeset
|
659 connect(this, SIGNAL(destroyed(QObject*)), downloader, SLOT(quit())); |
486
fa56a9403939
Lookup the last modified date for software installer after first installation.
Raimund Renkert <rrenkert@intevation.de>
parents:
481
diff
changeset
|
660 downloader->start(); |
fa56a9403939
Lookup the last modified date for software installer after first installation.
Raimund Renkert <rrenkert@intevation.de>
parents:
481
diff
changeset
|
661 } |
fa56a9403939
Lookup the last modified date for software installer after first installation.
Raimund Renkert <rrenkert@intevation.de>
parents:
481
diff
changeset
|
662 |
551
15121735805e
Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents:
548
diff
changeset
|
663 void MainWindow::setLastModifiedSWDate(const QDateTime &date) |
486
fa56a9403939
Lookup the last modified date for software installer after first installation.
Raimund Renkert <rrenkert@intevation.de>
parents:
481
diff
changeset
|
664 { |
1259
f1e461340ede
(issue44) Move check if the SW was updated into setLastModifiedSWDate
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1252
diff
changeset
|
665 QDateTime swAvailableLastMod = mSettings.value("Software/availableDate").toDateTime(); |
f1e461340ede
(issue44) Move check if the SW was updated into setLastModifiedSWDate
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1252
diff
changeset
|
666 |
1379
831d28c2291d
(issue179) Handle software update even if new version can't be found on server
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1373
diff
changeset
|
667 qDebug() << "Set last modified date: " << date << " available: " << swAvailableLastMod; |
831d28c2291d
(issue179) Handle software update even if new version can't be found on server
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1373
diff
changeset
|
668 if (swAvailableLastMod.isValid() && (!date.isValid() || date >= swAvailableLastMod)) { |
831d28c2291d
(issue179) Handle software update even if new version can't be found on server
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1373
diff
changeset
|
669 qDebug() << "Installed an update: " << date << |
831d28c2291d
(issue179) Handle software update even if new version can't be found on server
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1373
diff
changeset
|
670 " available was " << swAvailableLastMod; |
831d28c2291d
(issue179) Handle software update even if new version can't be found on server
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1373
diff
changeset
|
671 syslog_info_printf ("Software has been updated to version: %s\n", |
831d28c2291d
(issue179) Handle software update even if new version can't be found on server
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1373
diff
changeset
|
672 QApplication::applicationVersion().toUtf8().constData()); |
831d28c2291d
(issue179) Handle software update even if new version can't be found on server
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1373
diff
changeset
|
673 QString fileName = mSettings.value("Software/available").toString(); |
831d28c2291d
(issue179) Handle software update even if new version can't be found on server
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1373
diff
changeset
|
674 if (fileName.isEmpty()) { |
831d28c2291d
(issue179) Handle software update even if new version can't be found on server
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1373
diff
changeset
|
675 qDebug() << "Software marked as available but no filename set."; |
831d28c2291d
(issue179) Handle software update even if new version can't be found on server
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1373
diff
changeset
|
676 } else { |
831d28c2291d
(issue179) Handle software update even if new version can't be found on server
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1373
diff
changeset
|
677 if (QFile::remove(fileName)) { |
831d28c2291d
(issue179) Handle software update even if new version can't be found on server
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1373
diff
changeset
|
678 qDebug() << "Removed: " << fileName; |
1259
f1e461340ede
(issue44) Move check if the SW was updated into setLastModifiedSWDate
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1252
diff
changeset
|
679 } else { |
1379
831d28c2291d
(issue179) Handle software update even if new version can't be found on server
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1373
diff
changeset
|
680 qDebug() << "Failed to remove: " << fileName; |
1259
f1e461340ede
(issue44) Move check if the SW was updated into setLastModifiedSWDate
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1252
diff
changeset
|
681 } |
f1e461340ede
(issue44) Move check if the SW was updated into setLastModifiedSWDate
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1252
diff
changeset
|
682 } |
1379
831d28c2291d
(issue179) Handle software update even if new version can't be found on server
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1373
diff
changeset
|
683 /* Clear out available data. */ |
831d28c2291d
(issue179) Handle software update even if new version can't be found on server
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1373
diff
changeset
|
684 mSettings.remove("Software/available"); |
831d28c2291d
(issue179) Handle software update even if new version can't be found on server
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1373
diff
changeset
|
685 mSettings.remove("Software/availableDate"); |
1259
f1e461340ede
(issue44) Move check if the SW was updated into setLastModifiedSWDate
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1252
diff
changeset
|
686 } |
f1e461340ede
(issue44) Move check if the SW was updated into setLastModifiedSWDate
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1252
diff
changeset
|
687 |
486
fa56a9403939
Lookup the last modified date for software installer after first installation.
Raimund Renkert <rrenkert@intevation.de>
parents:
481
diff
changeset
|
688 mSettings.beginGroup("Software"); |
1145
a41338b18273
(issue130) Do not show error when software was not found and handle it in setLastMod
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1144
diff
changeset
|
689 #ifdef IS_TAG_BUILD |
a41338b18273
(issue130) Do not show error when software was not found and handle it in setLastMod
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1144
diff
changeset
|
690 /* We accept an invalid date to force installing any avialable update |
a41338b18273
(issue130) Do not show error when software was not found and handle it in setLastMod
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1144
diff
changeset
|
691 * in release mode. Otherwise we default to current datetime when we |
a41338b18273
(issue130) Do not show error when software was not found and handle it in setLastMod
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1144
diff
changeset
|
692 * did not find out version.*/ |
486
fa56a9403939
Lookup the last modified date for software installer after first installation.
Raimund Renkert <rrenkert@intevation.de>
parents:
481
diff
changeset
|
693 mSettings.setValue("installedDate", date); |
1145
a41338b18273
(issue130) Do not show error when software was not found and handle it in setLastMod
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1144
diff
changeset
|
694 #else |
a41338b18273
(issue130) Do not show error when software was not found and handle it in setLastMod
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1144
diff
changeset
|
695 mSettings.setValue("installedDate", date.isValid() ? date : QDateTime::currentDateTime()); |
a41338b18273
(issue130) Do not show error when software was not found and handle it in setLastMod
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1144
diff
changeset
|
696 #endif |
551
15121735805e
Start implementation of software update installation
Andre Heinecke <aheinecke@intevation.de>
parents:
548
diff
changeset
|
697 mSettings.setValue("installedVersion", QApplication::applicationVersion()); |
486
fa56a9403939
Lookup the last modified date for software installer after first installation.
Raimund Renkert <rrenkert@intevation.de>
parents:
481
diff
changeset
|
698 mSettings.endGroup(); |
fa56a9403939
Lookup the last modified date for software installer after first installation.
Raimund Renkert <rrenkert@intevation.de>
parents:
481
diff
changeset
|
699 checkUpdates(); |
fa56a9403939
Lookup the last modified date for software installer after first installation.
Raimund Renkert <rrenkert@intevation.de>
parents:
481
diff
changeset
|
700 } |
fa56a9403939
Lookup the last modified date for software installer after first installation.
Raimund Renkert <rrenkert@intevation.de>
parents:
481
diff
changeset
|
701 |
45
c6125d73faf4
Move SSLConnection into it's own class
Andre Heinecke <aheinecke@intevation.de>
parents:
31
diff
changeset
|
702 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
|
703 { |
708
bd48fae793b6
(Issue25) Log update check success, change header labels.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
703
diff
changeset
|
704 syslog_error_printf ("Failed to check for updates: %s", message.toUtf8().constData()); |
1230
05b938021a24
(issue38) A bit debug output for LTE handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1227
diff
changeset
|
705 qDebug() << "Downloader error: " << error; |
1227
a1e990947172
(issue38) Add long time error handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1215
diff
changeset
|
706 if (error == SSLConnection::InvalidCertificate) { |
a1e990947172
(issue38) Add long time error handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1215
diff
changeset
|
707 handleLTE(lteInvalidCertificate); |
a1e990947172
(issue38) Add long time error handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1215
diff
changeset
|
708 } else { |
a1e990947172
(issue38) Add long time error handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1215
diff
changeset
|
709 handleLTE(lteNoConnection); |
a1e990947172
(issue38) Add long time error handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1215
diff
changeset
|
710 } |
1339
64f812a63de6
(issue170) Keep checking for updates in intervals
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1334
diff
changeset
|
711 setState(TransferError); |
1145
a41338b18273
(issue130) Do not show error when software was not found and handle it in setLastMod
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1144
diff
changeset
|
712 #ifdef IS_TAG_BUILD |
a41338b18273
(issue130) Do not show error when software was not found and handle it in setLastMod
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1144
diff
changeset
|
713 /* During tag build it should never happen that an url checked is not available |
a41338b18273
(issue130) Do not show error when software was not found and handle it in setLastMod
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1144
diff
changeset
|
714 * during development this is normal as each revision produces a new url. */ |
1061
db831a204a6b
(issue38) Show error message as messagebox if the window is visible
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1056
diff
changeset
|
715 if (!isVisible()) { |
db831a204a6b
(issue38) Show error message as messagebox if the window is visible
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1056
diff
changeset
|
716 mCurMessage = message; |
db831a204a6b
(issue38) Show error message as messagebox if the window is visible
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1056
diff
changeset
|
717 mTrayIcon->show(); |
db831a204a6b
(issue38) Show error message as messagebox if the window is visible
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1056
diff
changeset
|
718 showMessage(); |
db831a204a6b
(issue38) Show error message as messagebox if the window is visible
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1056
diff
changeset
|
719 } else { |
db831a204a6b
(issue38) Show error message as messagebox if the window is visible
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1056
diff
changeset
|
720 showErrorMessage(tr("Failed to check for updates:") + "\n" + message); |
db831a204a6b
(issue38) Show error message as messagebox if the window is visible
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1056
diff
changeset
|
721 } |
1127
1a5f9e260099
(issue130) Remove USE_REAL_RESOURCE option and implement behavior as descript in the issue
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1126
diff
changeset
|
722 #endif |
16
225a5ec20dad
Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents:
11
diff
changeset
|
723 } |
225a5ec20dad
Use QSettings and manage downloader from mainwindow.
Andre Heinecke <aheinecke@intevation.de>
parents:
11
diff
changeset
|
724 |
0
cb0cde2c5eb9
Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
725 void MainWindow::createActions() |
cb0cde2c5eb9
Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
726 { |
cb0cde2c5eb9
Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
727 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
|
728 connect(mCheckUpdates, SIGNAL(triggered()), this, SLOT(checkUpdates())); |
2 | 729 mQuitAction = new QAction(tr("Quit"), this); |
730 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
|
731 } |
cb0cde2c5eb9
Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
732 |
cb0cde2c5eb9
Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
733 void MainWindow::createTrayIcon() |
cb0cde2c5eb9
Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
734 { |
11
7e2f14c7aba2
Split up downloader component and further implement it
Andre Heinecke <aheinecke@intevation.de>
parents:
10
diff
changeset
|
735 QIcon trayImg(":/img/tray_22.png"); |
970
c80777457133
(issue50) Add window icon and icon for 48x48px
Andre Heinecke <andre.heinecke@intevation.de>
parents:
966
diff
changeset
|
736 trayImg.addFile(":/img/tray_48.png", QSize(48,48)); |
0
cb0cde2c5eb9
Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
737 |
cb0cde2c5eb9
Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
738 mTrayMenu = new QMenu(this); |
cb0cde2c5eb9
Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
739 mTrayMenu->addAction(mCheckUpdates); |
2 | 740 mTrayMenu->addAction(mQuitAction); |
0
cb0cde2c5eb9
Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
741 |
871
4efd6378c001
(issue51) Add fallback in case systemtray is unavailable.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
857
diff
changeset
|
742 mTrayIcon = new TrayIcon(this); |
0
cb0cde2c5eb9
Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
743 mTrayIcon->setContextMenu(mTrayMenu); |
cb0cde2c5eb9
Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
744 |
cb0cde2c5eb9
Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
745 mTrayIcon->setIcon(trayImg); |
1326
dd3eefda8503
(issue155) Set window icon to the logo on unity
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1313
diff
changeset
|
746 |
dd3eefda8503
(issue155) Set window icon to the logo on unity
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1313
diff
changeset
|
747 if (mTrayIcon->isAlternative()) { |
dd3eefda8503
(issue155) Set window icon to the logo on unity
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1313
diff
changeset
|
748 /* On unity (the alternative notification usage) |
dd3eefda8503
(issue155) Set window icon to the logo on unity
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1313
diff
changeset
|
749 * we want to use the logo as window icon.*/ |
dd3eefda8503
(issue155) Set window icon to the logo on unity
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1313
diff
changeset
|
750 setWindowIcon(QIcon(":/img/logo.png")); |
dd3eefda8503
(issue155) Set window icon to the logo on unity
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1313
diff
changeset
|
751 } else { |
dd3eefda8503
(issue155) Set window icon to the logo on unity
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1313
diff
changeset
|
752 setWindowIcon(trayImg); |
dd3eefda8503
(issue155) Set window icon to the logo on unity
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1313
diff
changeset
|
753 } |
407
af53c40e74b1
Rename m13ui to TrustBridge
Andre Heinecke <aheinecke@intevation.de>
parents:
404
diff
changeset
|
754 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
|
755 |
f22a99f7cb69
Add certificatelist to install as member. Look for updates on startup
Andre Heinecke <aheinecke@intevation.de>
parents:
45
diff
changeset
|
756 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
|
757 } |
155
c0fdb8d336cf
Added menubar/menu and method stubs to mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
82
diff
changeset
|
758 |
743
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
759 QWidget * MainWindow::createInfoWidget() |
739
5f0fca113ff4
Factor out Info Panel creation.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
732
diff
changeset
|
760 { |
743
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
761 QWidget *theWidget = new QWidget; |
739
5f0fca113ff4
Factor out Info Panel creation.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
732
diff
changeset
|
762 QVBoxLayout *infoPanelLayout = new QVBoxLayout; |
5f0fca113ff4
Factor out Info Panel creation.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
732
diff
changeset
|
763 QHBoxLayout *infoHeaderLayout = new QHBoxLayout; |
5f0fca113ff4
Factor out Info Panel creation.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
732
diff
changeset
|
764 QVBoxLayout *infoHeaderTextLayout = new QVBoxLayout; |
5f0fca113ff4
Factor out Info Panel creation.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
732
diff
changeset
|
765 QVBoxLayout *infoCenterLayout = new QVBoxLayout; |
5f0fca113ff4
Factor out Info Panel creation.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
732
diff
changeset
|
766 |
743
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
767 QString infoVersion = tr("Version: "); |
739
5f0fca113ff4
Factor out Info Panel creation.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
732
diff
changeset
|
768 infoVersion.append(QApplication::applicationVersion()); |
5f0fca113ff4
Factor out Info Panel creation.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
732
diff
changeset
|
769 QLabel *appVersion = new QLabel(infoVersion); |
5f0fca113ff4
Factor out Info Panel creation.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
732
diff
changeset
|
770 appVersion->setTextInteractionFlags( |
5f0fca113ff4
Factor out Info Panel creation.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
732
diff
changeset
|
771 Qt::TextSelectableByMouse | |
5f0fca113ff4
Factor out Info Panel creation.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
732
diff
changeset
|
772 Qt::TextSelectableByKeyboard); |
5f0fca113ff4
Factor out Info Panel creation.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
732
diff
changeset
|
773 |
5f0fca113ff4
Factor out Info Panel creation.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
732
diff
changeset
|
774 QFrame *infoHeaderSeparator = new QFrame(); |
5f0fca113ff4
Factor out Info Panel creation.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
732
diff
changeset
|
775 infoHeaderSeparator->setFrameShape(QFrame::HLine); |
5f0fca113ff4
Factor out Info Panel creation.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
732
diff
changeset
|
776 infoHeaderSeparator->setFrameShadow(QFrame::Sunken); |
5f0fca113ff4
Factor out Info Panel creation.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
732
diff
changeset
|
777 |
5f0fca113ff4
Factor out Info Panel creation.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
732
diff
changeset
|
778 infoHeaderTextLayout->addWidget(appVersion); |
5f0fca113ff4
Factor out Info Panel creation.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
732
diff
changeset
|
779 infoHeaderLayout->addLayout(infoHeaderTextLayout); |
5f0fca113ff4
Factor out Info Panel creation.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
732
diff
changeset
|
780 infoHeaderLayout->insertStretch(2, 10); |
5f0fca113ff4
Factor out Info Panel creation.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
732
diff
changeset
|
781 |
743
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
782 QLabel *textDesc = new QLabel(tr("TrustBridge is a root certificate" |
807
1e18d4c1932a
Unify about dialog labels and Remove Trustbridge header
Andre Heinecke <andre.heinecke@intevation.de>
parents:
805
diff
changeset
|
783 " installer for Windows and GNU/Linux.<br/>") + |
1e18d4c1932a
Unify about dialog labels and Remove Trustbridge header
Andre Heinecke <andre.heinecke@intevation.de>
parents:
805
diff
changeset
|
784 tr("The root certificate lists are managed" |
739
5f0fca113ff4
Factor out Info Panel creation.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
732
diff
changeset
|
785 " by the German <a href=\"https://www.bsi.bund.de\">" |
807
1e18d4c1932a
Unify about dialog labels and Remove Trustbridge header
Andre Heinecke <andre.heinecke@intevation.de>
parents:
805
diff
changeset
|
786 "Federal Office for Information Security (BSI)</a>.<br/><br/>") + |
1e18d4c1932a
Unify about dialog labels and Remove Trustbridge header
Andre Heinecke <andre.heinecke@intevation.de>
parents:
805
diff
changeset
|
787 tr("The software was developed by the companies" |
739
5f0fca113ff4
Factor out Info Panel creation.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
732
diff
changeset
|
788 " <a href=\"http://www.intevation.de\">Intevation GmbH</a> and " |
5f0fca113ff4
Factor out Info Panel creation.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
732
diff
changeset
|
789 " <a href=\"http://www.dn-systems.de\">DN-Systems GmbH</a>, <br>" |
1215
1171a4778562
(issue68) Added license note to about dialog of client and admin application.
Emanuel Schuetze <emanuel@intevation.de>
parents:
1211
diff
changeset
|
790 " contracted by the BSI.<br/><br/>") + |
807
1e18d4c1932a
Unify about dialog labels and Remove Trustbridge header
Andre Heinecke <andre.heinecke@intevation.de>
parents:
805
diff
changeset
|
791 tr("TrustBridge is Free Software licensed" |
1215
1171a4778562
(issue68) Added license note to about dialog of client and admin application.
Emanuel Schuetze <emanuel@intevation.de>
parents:
1211
diff
changeset
|
792 " under GNU GPL v>=3.<br/>Copyright (C) 2014 by Bundesamt für Sicherheit" |
1171a4778562
(issue68) Added license note to about dialog of client and admin application.
Emanuel Schuetze <emanuel@intevation.de>
parents:
1211
diff
changeset
|
793 " in der Informationstechnik<br/><br/>") + |
1171a4778562
(issue68) Added license note to about dialog of client and admin application.
Emanuel Schuetze <emanuel@intevation.de>
parents:
1211
diff
changeset
|
794 tr("TrustBridge uses several Free Software components with different licenses:") + |
1171a4778562
(issue68) Added license note to about dialog of client and admin application.
Emanuel Schuetze <emanuel@intevation.de>
parents:
1211
diff
changeset
|
795 "<ul><li>TrustBridge source code (GPL v>=2)" + |
1171a4778562
(issue68) Added license note to about dialog of client and admin application.
Emanuel Schuetze <emanuel@intevation.de>
parents:
1211
diff
changeset
|
796 "<li>Qt (LGPL v==2.1)" + |
1171a4778562
(issue68) Added license note to about dialog of client and admin application.
Emanuel Schuetze <emanuel@intevation.de>
parents:
1211
diff
changeset
|
797 "<li>PolarSSL (GPL v>=2)" + |
1171a4778562
(issue68) Added license note to about dialog of client and admin application.
Emanuel Schuetze <emanuel@intevation.de>
parents:
1211
diff
changeset
|
798 "<li>Oxygen-Icons (LGPL v==3)" + |
1171a4778562
(issue68) Added license note to about dialog of client and admin application.
Emanuel Schuetze <emanuel@intevation.de>
parents:
1211
diff
changeset
|
799 "<li>Mozilla NSS (Mozilla Public License v2)" + |
1171a4778562
(issue68) Added license note to about dialog of client and admin application.
Emanuel Schuetze <emanuel@intevation.de>
parents:
1211
diff
changeset
|
800 "<li>libcurl (The curl license)</ul>" + |
1275
be989e9d49a4
Translations updated.
Emanuel Schuetze <emanuel@intevation.de>
parents:
1261
diff
changeset
|
801 tr("You will find the legally binding details in the 'licenses' directory " |
be989e9d49a4
Translations updated.
Emanuel Schuetze <emanuel@intevation.de>
parents:
1261
diff
changeset
|
802 "where TrustBridge is installed<br/>" |
be989e9d49a4
Translations updated.
Emanuel Schuetze <emanuel@intevation.de>
parents:
1261
diff
changeset
|
803 "or in the corresponding revision of the " |
1215
1171a4778562
(issue68) Added license note to about dialog of client and admin application.
Emanuel Schuetze <emanuel@intevation.de>
parents:
1211
diff
changeset
|
804 "<a href=\"https://wald.intevation.org/hg/trustbridge/file/tip/licenses\">TrustBridge code repository</a>.")); |
807
1e18d4c1932a
Unify about dialog labels and Remove Trustbridge header
Andre Heinecke <andre.heinecke@intevation.de>
parents:
805
diff
changeset
|
805 textDesc->setTextFormat(Qt::RichText); |
1e18d4c1932a
Unify about dialog labels and Remove Trustbridge header
Andre Heinecke <andre.heinecke@intevation.de>
parents:
805
diff
changeset
|
806 textDesc->setTextInteractionFlags( |
739
5f0fca113ff4
Factor out Info Panel creation.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
732
diff
changeset
|
807 Qt::TextSelectableByMouse | |
844
fa68e5aeeaac
Make links clickable and also change the about info in mainwindow.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
842
diff
changeset
|
808 Qt::TextSelectableByKeyboard | |
fa68e5aeeaac
Make links clickable and also change the about info in mainwindow.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
842
diff
changeset
|
809 Qt::LinksAccessibleByMouse); |
fa68e5aeeaac
Make links clickable and also change the about info in mainwindow.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
842
diff
changeset
|
810 textDesc->setOpenExternalLinks(true); |
739
5f0fca113ff4
Factor out Info Panel creation.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
732
diff
changeset
|
811 |
5f0fca113ff4
Factor out Info Panel creation.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
732
diff
changeset
|
812 infoCenterLayout->addWidget(infoHeaderSeparator); |
5f0fca113ff4
Factor out Info Panel creation.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
732
diff
changeset
|
813 infoCenterLayout->addWidget(textDesc); |
5f0fca113ff4
Factor out Info Panel creation.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
732
diff
changeset
|
814 infoCenterLayout->insertSpacing(2, 10); |
5f0fca113ff4
Factor out Info Panel creation.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
732
diff
changeset
|
815 infoCenterLayout->insertSpacing(4, 10); |
5f0fca113ff4
Factor out Info Panel creation.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
732
diff
changeset
|
816 infoCenterLayout->insertSpacing(6, 10); |
940
7c89c5dc2200
(issue89) Add ui to open help in browser
Andre Heinecke <andre.heinecke@intevation.de>
parents:
932
diff
changeset
|
817 |
7c89c5dc2200
(issue89) Add ui to open help in browser
Andre Heinecke <andre.heinecke@intevation.de>
parents:
932
diff
changeset
|
818 QHBoxLayout *helpButtonLayout = new QHBoxLayout(); |
996
29783ef4da62
(UI) Added space in QPushButton on about page.
Emanuel Schuetze <emanuel@intevation.de>
parents:
995
diff
changeset
|
819 QPushButton *helpButton = new QPushButton(" " + tr("Show Help")); |
964
706405a2f3e8
(issue89) Add help icon to help button
Andre Heinecke <andre.heinecke@intevation.de>
parents:
962
diff
changeset
|
820 helpButton->setIcon(QIcon(":/img/show-help_16.png")); |
940
7c89c5dc2200
(issue89) Add ui to open help in browser
Andre Heinecke <andre.heinecke@intevation.de>
parents:
932
diff
changeset
|
821 connect(helpButton, SIGNAL(clicked()), this, SLOT(showHelp())); |
7c89c5dc2200
(issue89) Add ui to open help in browser
Andre Heinecke <andre.heinecke@intevation.de>
parents:
932
diff
changeset
|
822 helpButtonLayout->addWidget(helpButton); |
956
879a634d0a40
(issue41) Add proxy support
Andre Heinecke <andre.heinecke@intevation.de>
parents:
940
diff
changeset
|
823 #ifdef USE_CURL |
996
29783ef4da62
(UI) Added space in QPushButton on about page.
Emanuel Schuetze <emanuel@intevation.de>
parents:
995
diff
changeset
|
824 QPushButton *proxySettingsButton = new QPushButton(" " + tr("Proxy settings")); |
956
879a634d0a40
(issue41) Add proxy support
Andre Heinecke <andre.heinecke@intevation.de>
parents:
940
diff
changeset
|
825 proxySettingsButton->setIcon(QIcon(":/img/preferences-network_16.png")); |
879a634d0a40
(issue41) Add proxy support
Andre Heinecke <andre.heinecke@intevation.de>
parents:
940
diff
changeset
|
826 connect(proxySettingsButton, SIGNAL(clicked()), this, SLOT(showProxySettings())); |
879a634d0a40
(issue41) Add proxy support
Andre Heinecke <andre.heinecke@intevation.de>
parents:
940
diff
changeset
|
827 helpButtonLayout->addWidget(proxySettingsButton); |
879a634d0a40
(issue41) Add proxy support
Andre Heinecke <andre.heinecke@intevation.de>
parents:
940
diff
changeset
|
828 #endif |
940
7c89c5dc2200
(issue89) Add ui to open help in browser
Andre Heinecke <andre.heinecke@intevation.de>
parents:
932
diff
changeset
|
829 helpButtonLayout->addStretch(); |
7c89c5dc2200
(issue89) Add ui to open help in browser
Andre Heinecke <andre.heinecke@intevation.de>
parents:
932
diff
changeset
|
830 infoCenterLayout->addLayout(helpButtonLayout); |
7c89c5dc2200
(issue89) Add ui to open help in browser
Andre Heinecke <andre.heinecke@intevation.de>
parents:
932
diff
changeset
|
831 |
739
5f0fca113ff4
Factor out Info Panel creation.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
732
diff
changeset
|
832 infoCenterLayout->insertStretch(8, 10); |
5f0fca113ff4
Factor out Info Panel creation.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
732
diff
changeset
|
833 |
5f0fca113ff4
Factor out Info Panel creation.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
732
diff
changeset
|
834 infoPanelLayout->addLayout(infoHeaderLayout); |
5f0fca113ff4
Factor out Info Panel creation.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
732
diff
changeset
|
835 infoPanelLayout->addLayout(infoCenterLayout); |
743
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
836 theWidget->setLayout(infoPanelLayout); |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
837 |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
838 return theWidget; |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
839 } |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
840 |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
841 QWidget * MainWindow::createUpdatesWidget() |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
842 { |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
843 QWidget * theWidget = new QWidget; |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
844 QVBoxLayout *updatesMainLayout = new QVBoxLayout; |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
845 |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
846 /* The header */ |
1096
10f0efd197c7
(issue111) Rework header to be simpler and left bound.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1095
diff
changeset
|
847 QVBoxLayout *updatesHeaderLayout = new QVBoxLayout; |
10f0efd197c7
(issue111) Rework header to be simpler and left bound.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1095
diff
changeset
|
848 |
1098
75a5bfe0525e
(issue111) Rework Updates ui
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1097
diff
changeset
|
849 QGridLayout *detailsLayout = new QGridLayout; |
743
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
850 |
1098
75a5bfe0525e
(issue111) Rework Updates ui
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1097
diff
changeset
|
851 /* Header 1: Action buttons and summary*/ |
743
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
852 mUpdatesHeader = |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
853 new QLabel("<h2>" + tr("Certificates unchanged")+ "</h2>"); |
1098
75a5bfe0525e
(issue111) Rework Updates ui
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1097
diff
changeset
|
854 updatesHeaderLayout->addWidget(mUpdatesHeader); |
743
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
855 |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
856 QHBoxLayout *updatesHeaderActionButtonLayout = new QHBoxLayout; |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
857 mQuitButton = new QPushButton(" " + tr("Quit without saving")); |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
858 mQuitButton->setIcon(QIcon(":/img/application-exit.png")); |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
859 mQuitButton->setFixedHeight(30); |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
860 |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
861 mInstallButton = new QPushButton(" " + tr("Install certificates again")); |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
862 mInstallButton->setFixedHeight(30); |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
863 #ifdef Q_OS_WIN |
1003
db7e7156c824
(issue66) Only depend on is_system_install on windows to decide privilege raise
Andre Heinecke <andre.heinecke@intevation.de>
parents:
997
diff
changeset
|
864 if (is_system_install()) { |
743
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
865 QIcon uacShield = QApplication::style()->standardIcon(QStyle::SP_VistaShield); |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
866 mInstallButton->setIcon(uacShield); |
1313
f9f2c92969d2
(issue161) Set do-changes icon also on windows when UAC shield is not neccessary.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1311
diff
changeset
|
867 } else { |
f9f2c92969d2
(issue161) Set do-changes icon also on windows when UAC shield is not neccessary.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1311
diff
changeset
|
868 mInstallButton->setIcon(QIcon(":/img/do-changes-16.png")); |
743
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
869 } |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
870 #else |
1211
b64f847bde09
(issue121) icon, new version for the do-changes button.
Bernhard Reiter <bernhard@intevation.de>
parents:
1209
diff
changeset
|
871 mInstallButton->setIcon(QIcon(":/img/do-changes-16.png")); |
743
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
872 #endif |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
873 connect(mQuitButton, SIGNAL(clicked()), this, SLOT(closeApp())); |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
874 connect(mInstallButton, SIGNAL(clicked()), this, SLOT(checkAndInstallCerts())); |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
875 |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
876 updatesHeaderActionButtonLayout->addWidget(mInstallButton); |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
877 updatesHeaderActionButtonLayout->addWidget(mQuitButton); |
1096
10f0efd197c7
(issue111) Rework header to be simpler and left bound.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1095
diff
changeset
|
878 updatesHeaderActionButtonLayout->addStretch(-1); |
1098
75a5bfe0525e
(issue111) Rework Updates ui
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1097
diff
changeset
|
879 |
1096
10f0efd197c7
(issue111) Rework header to be simpler and left bound.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1095
diff
changeset
|
880 updatesHeaderLayout->addLayout(updatesHeaderActionButtonLayout); |
10f0efd197c7
(issue111) Rework header to be simpler and left bound.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1095
diff
changeset
|
881 updatesHeaderLayout->addSpacing(20); |
10f0efd197c7
(issue111) Rework header to be simpler and left bound.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1095
diff
changeset
|
882 |
10f0efd197c7
(issue111) Rework header to be simpler and left bound.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1095
diff
changeset
|
883 /* The splitter line */ |
10f0efd197c7
(issue111) Rework header to be simpler and left bound.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1095
diff
changeset
|
884 QFrame *line = new QFrame(); |
10f0efd197c7
(issue111) Rework header to be simpler and left bound.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1095
diff
changeset
|
885 line->setFrameShape(QFrame::HLine); |
10f0efd197c7
(issue111) Rework header to be simpler and left bound.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1095
diff
changeset
|
886 line->setFrameShadow(QFrame::Sunken); |
10f0efd197c7
(issue111) Rework header to be simpler and left bound.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1095
diff
changeset
|
887 updatesHeaderLayout->addWidget(line); |
743
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
888 |
1098
75a5bfe0525e
(issue111) Rework Updates ui
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1097
diff
changeset
|
889 updatesMainLayout->addLayout(updatesHeaderLayout); |
1103
c4e3498e716f
(issue111) Move detailed header into the scrollarea
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1102
diff
changeset
|
890 |
c4e3498e716f
(issue111) Move detailed header into the scrollarea
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1102
diff
changeset
|
891 /* Central Header Details and update button. Part of the scroll area */ |
c4e3498e716f
(issue111) Move detailed header into the scrollarea
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1102
diff
changeset
|
892 QScrollArea *centralScrollArea = new QScrollArea; |
c4e3498e716f
(issue111) Move detailed header into the scrollarea
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1102
diff
changeset
|
893 QVBoxLayout *updatesCenterLayout = new QVBoxLayout; |
1098
75a5bfe0525e
(issue111) Rework Updates ui
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1097
diff
changeset
|
894 mUpdatesDetailsHeader = new QLabel(QString()); |
75a5bfe0525e
(issue111) Rework Updates ui
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1097
diff
changeset
|
895 |
75a5bfe0525e
(issue111) Rework Updates ui
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1097
diff
changeset
|
896 QHBoxLayout *updateDateAndSearchButton = new QHBoxLayout; |
75a5bfe0525e
(issue111) Rework Updates ui
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1097
diff
changeset
|
897 mCertListVersion = |
75a5bfe0525e
(issue111) Rework Updates ui
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1097
diff
changeset
|
898 new QLabel(QString()); |
75a5bfe0525e
(issue111) Rework Updates ui
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1097
diff
changeset
|
899 mCertListVersionContents = new QLabel(QString()); |
75a5bfe0525e
(issue111) Rework Updates ui
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1097
diff
changeset
|
900 const QDateTime lastCheck = mSettings.value("lastUpdateCheck").toDateTime().toLocalTime(); |
1104
a7a72353d6d2
(issue111) Wording and German translation.
Emanuel Schuetze <emanuel@intevation.de>
parents:
1103
diff
changeset
|
901 mLastUpdateCheck = new QLabel(tr("Last update check:")); |
1098
75a5bfe0525e
(issue111) Rework Updates ui
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1097
diff
changeset
|
902 if (lastCheck.isValid()) { |
75a5bfe0525e
(issue111) Rework Updates ui
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1097
diff
changeset
|
903 const QString lastUpdateCheck = QLocale::system().toString(lastCheck, DATETIME_FORMAT); |
75a5bfe0525e
(issue111) Rework Updates ui
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1097
diff
changeset
|
904 mLastUpdateCheckContents = new QLabel(lastUpdateCheck); |
75a5bfe0525e
(issue111) Rework Updates ui
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1097
diff
changeset
|
905 } else { |
75a5bfe0525e
(issue111) Rework Updates ui
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1097
diff
changeset
|
906 mLastUpdateCheckContents = new QLabel(tr("No connection with the updateserver.")); |
75a5bfe0525e
(issue111) Rework Updates ui
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1097
diff
changeset
|
907 } |
75a5bfe0525e
(issue111) Rework Updates ui
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1097
diff
changeset
|
908 QPushButton *searchUpdates = new QPushButton(" " + tr("Update")); |
1104
a7a72353d6d2
(issue111) Wording and German translation.
Emanuel Schuetze <emanuel@intevation.de>
parents:
1103
diff
changeset
|
909 searchUpdates->setFixedHeight(22); |
1098
75a5bfe0525e
(issue111) Rework Updates ui
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1097
diff
changeset
|
910 searchUpdates->setToolTip(tr("Check for Updates")); |
75a5bfe0525e
(issue111) Rework Updates ui
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1097
diff
changeset
|
911 searchUpdates->setStyleSheet("font-size: 10px;"); |
75a5bfe0525e
(issue111) Rework Updates ui
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1097
diff
changeset
|
912 searchUpdates->setIcon(QIcon(":/img/update-list.png")); |
75a5bfe0525e
(issue111) Rework Updates ui
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1097
diff
changeset
|
913 connect(searchUpdates, SIGNAL(clicked()), this, SLOT(checkUpdates())); |
75a5bfe0525e
(issue111) Rework Updates ui
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1097
diff
changeset
|
914 updateDateAndSearchButton->addWidget(mLastUpdateCheckContents); |
75a5bfe0525e
(issue111) Rework Updates ui
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1097
diff
changeset
|
915 updateDateAndSearchButton->addWidget(searchUpdates); |
75a5bfe0525e
(issue111) Rework Updates ui
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1097
diff
changeset
|
916 |
75a5bfe0525e
(issue111) Rework Updates ui
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1097
diff
changeset
|
917 mUpdatesTip = |
75a5bfe0525e
(issue111) Rework Updates ui
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1097
diff
changeset
|
918 new QLabel(QString()); |
75a5bfe0525e
(issue111) Rework Updates ui
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1097
diff
changeset
|
919 mUpdatesTip->setWordWrap(true); |
75a5bfe0525e
(issue111) Rework Updates ui
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1097
diff
changeset
|
920 |
75a5bfe0525e
(issue111) Rework Updates ui
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1097
diff
changeset
|
921 // addWidget(*Widget, row, column, rowspan, colspan) |
1103
c4e3498e716f
(issue111) Move detailed header into the scrollarea
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1102
diff
changeset
|
922 updatesCenterLayout->addWidget(mUpdatesDetailsHeader); |
1098
75a5bfe0525e
(issue111) Rework Updates ui
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1097
diff
changeset
|
923 detailsLayout->addWidget(mLastUpdateCheck, 0, 0, 1, 1); |
75a5bfe0525e
(issue111) Rework Updates ui
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1097
diff
changeset
|
924 detailsLayout->addLayout(updateDateAndSearchButton, 0, 1, 1, 1); |
75a5bfe0525e
(issue111) Rework Updates ui
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1097
diff
changeset
|
925 detailsLayout->addWidget(mCertListVersion, 1, 0, 1, 1); |
75a5bfe0525e
(issue111) Rework Updates ui
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1097
diff
changeset
|
926 detailsLayout->addWidget(mCertListVersionContents, 1, 1, 1, 1); |
75a5bfe0525e
(issue111) Rework Updates ui
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1097
diff
changeset
|
927 detailsLayout->addItem(new QSpacerItem(1, 1, QSizePolicy::Expanding, QSizePolicy::Minimum), 2, 2, 1, 1); |
75a5bfe0525e
(issue111) Rework Updates ui
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1097
diff
changeset
|
928 detailsLayout->setColumnStretch(2, 1); |
75a5bfe0525e
(issue111) Rework Updates ui
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1097
diff
changeset
|
929 |
1103
c4e3498e716f
(issue111) Move detailed header into the scrollarea
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1102
diff
changeset
|
930 updatesCenterLayout->addLayout(detailsLayout); |
1098
75a5bfe0525e
(issue111) Rework Updates ui
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1097
diff
changeset
|
931 |
1103
c4e3498e716f
(issue111) Move detailed header into the scrollarea
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1102
diff
changeset
|
932 updatesCenterLayout->addItem(new QSpacerItem(100, 10)); |
c4e3498e716f
(issue111) Move detailed header into the scrollarea
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1102
diff
changeset
|
933 updatesCenterLayout->addWidget(mUpdatesTip); |
1098
75a5bfe0525e
(issue111) Rework Updates ui
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1097
diff
changeset
|
934 |
743
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
935 /* The central panels. */ |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
936 QHBoxLayout *updatesNewLayout = new QHBoxLayout; |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
937 QHBoxLayout *updatesRemoveLayout = new QHBoxLayout; |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
938 QHBoxLayout *updatesManualLayout = new QHBoxLayout; |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
939 mUpdatesNewCertificates = |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
940 new QLabel("<h3>" + |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
941 tr("Install new trusted certificates (%1/%2)").arg(0).arg(0) + |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
942 "</h3>"); |
790
399bc0df073d
(issue60) Make windows smaller and change details buttons to icon only
Andre Heinecke <andre.heinecke@intevation.de>
parents:
787
diff
changeset
|
943 mUpdatesDetailsNew = new QPushButton(); |
845
d33834129d2a
(issue59) Improve details button.
Emanuel Schuetze <emanuel@intevation.de>
parents:
844
diff
changeset
|
944 mUpdatesDetailsNew->setText(" " + tr("Details")); |
790
399bc0df073d
(issue60) Make windows smaller and change details buttons to icon only
Andre Heinecke <andre.heinecke@intevation.de>
parents:
787
diff
changeset
|
945 mUpdatesDetailsNew->setToolTip(tr("Show details")); |
845
d33834129d2a
(issue59) Improve details button.
Emanuel Schuetze <emanuel@intevation.de>
parents:
844
diff
changeset
|
946 mUpdatesDetailsNew->setStyleSheet("font-size: 10px;"); |
d33834129d2a
(issue59) Improve details button.
Emanuel Schuetze <emanuel@intevation.de>
parents:
844
diff
changeset
|
947 mUpdatesDetailsNew->setFixedHeight(22); |
d33834129d2a
(issue59) Improve details button.
Emanuel Schuetze <emanuel@intevation.de>
parents:
844
diff
changeset
|
948 mUpdatesDetailsNew->setIcon(QIcon(":/img/dialog-information_16px.png")); |
743
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
949 connect(mUpdatesDetailsNew, |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
950 SIGNAL(clicked()), |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
951 this, |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
952 SLOT(toggleUpdatesNew())); |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
953 updatesNewLayout->addWidget(mUpdatesNewCertificates); |
790
399bc0df073d
(issue60) Make windows smaller and change details buttons to icon only
Andre Heinecke <andre.heinecke@intevation.de>
parents:
787
diff
changeset
|
954 updatesNewLayout->addWidget(mUpdatesDetailsNew); |
743
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
955 updatesNewLayout->addStretch(1); |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
956 mUpdatesNew = new CertificateListWidget(this); |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
957 connect(mUpdatesNew, SIGNAL(certListChanged(int)), |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
958 this, SLOT(listChanged(int))); |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
959 mUpdatesNew->hide(); |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
960 |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
961 mUpdatesRemoveCertificates = |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
962 new QLabel("<h3>" + |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
963 tr("Remove revoked certificates (%1/%2)").arg(0).arg(0) + |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
964 "</h3>"); |
790
399bc0df073d
(issue60) Make windows smaller and change details buttons to icon only
Andre Heinecke <andre.heinecke@intevation.de>
parents:
787
diff
changeset
|
965 mUpdatesDetailsRemove = new QPushButton(); |
845
d33834129d2a
(issue59) Improve details button.
Emanuel Schuetze <emanuel@intevation.de>
parents:
844
diff
changeset
|
966 mUpdatesDetailsRemove->setText(" " + tr("Details")); |
790
399bc0df073d
(issue60) Make windows smaller and change details buttons to icon only
Andre Heinecke <andre.heinecke@intevation.de>
parents:
787
diff
changeset
|
967 mUpdatesDetailsRemove->setToolTip(tr("Show details")); |
845
d33834129d2a
(issue59) Improve details button.
Emanuel Schuetze <emanuel@intevation.de>
parents:
844
diff
changeset
|
968 mUpdatesDetailsRemove->setStyleSheet("font-size: 10px;"); |
d33834129d2a
(issue59) Improve details button.
Emanuel Schuetze <emanuel@intevation.de>
parents:
844
diff
changeset
|
969 mUpdatesDetailsRemove->setFixedHeight(22); |
d33834129d2a
(issue59) Improve details button.
Emanuel Schuetze <emanuel@intevation.de>
parents:
844
diff
changeset
|
970 mUpdatesDetailsRemove->setIcon(QIcon(":/img/dialog-information_16px.png")); |
743
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
971 connect(mUpdatesDetailsRemove, |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
972 SIGNAL(clicked()), |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
973 this, |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
974 SLOT(toggleUpdatesRemove())); |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
975 updatesRemoveLayout->addWidget(mUpdatesRemoveCertificates); |
790
399bc0df073d
(issue60) Make windows smaller and change details buttons to icon only
Andre Heinecke <andre.heinecke@intevation.de>
parents:
787
diff
changeset
|
976 updatesRemoveLayout->addWidget(mUpdatesDetailsRemove); |
746
d73f4e58d117
Add strecht also between remove button
Andre Heinecke <andre.heinecke@intevation.de>
parents:
743
diff
changeset
|
977 updatesRemoveLayout->addStretch(1); |
743
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
978 mUpdatesRemove = new CertificateListWidget(this); |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
979 connect(mUpdatesRemove, SIGNAL(certListChanged(int)), |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
980 this, SLOT(listChanged(int))); |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
981 mUpdatesRemove->hide(); |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
982 |
1098
75a5bfe0525e
(issue111) Rework Updates ui
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1097
diff
changeset
|
983 mUpdatesManualCertificates = new QLabel(QString()); |
790
399bc0df073d
(issue60) Make windows smaller and change details buttons to icon only
Andre Heinecke <andre.heinecke@intevation.de>
parents:
787
diff
changeset
|
984 mUpdatesDetailsManual = new QPushButton(); |
845
d33834129d2a
(issue59) Improve details button.
Emanuel Schuetze <emanuel@intevation.de>
parents:
844
diff
changeset
|
985 mUpdatesDetailsManual->setText(" " + tr("Details")); |
790
399bc0df073d
(issue60) Make windows smaller and change details buttons to icon only
Andre Heinecke <andre.heinecke@intevation.de>
parents:
787
diff
changeset
|
986 mUpdatesDetailsManual->setToolTip(tr("Show details")); |
845
d33834129d2a
(issue59) Improve details button.
Emanuel Schuetze <emanuel@intevation.de>
parents:
844
diff
changeset
|
987 mUpdatesDetailsManual->setStyleSheet("font-size: 10px;"); |
d33834129d2a
(issue59) Improve details button.
Emanuel Schuetze <emanuel@intevation.de>
parents:
844
diff
changeset
|
988 mUpdatesDetailsManual->setFixedHeight(22); |
d33834129d2a
(issue59) Improve details button.
Emanuel Schuetze <emanuel@intevation.de>
parents:
844
diff
changeset
|
989 mUpdatesDetailsManual->setIcon(QIcon(":/img/dialog-information_16px.png")); |
743
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
990 connect(mUpdatesDetailsManual, |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
991 SIGNAL(clicked()), |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
992 this, |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
993 SLOT(toggleUpdatesManual())); |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
994 mUpdatesDetailsManual->hide(); |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
995 updatesManualLayout->addWidget(mUpdatesManualCertificates); |
790
399bc0df073d
(issue60) Make windows smaller and change details buttons to icon only
Andre Heinecke <andre.heinecke@intevation.de>
parents:
787
diff
changeset
|
996 updatesManualLayout->addWidget(mUpdatesDetailsManual); |
747
b959304d6ecf
Also space away the manual details button
Andre Heinecke <andre.heinecke@intevation.de>
parents:
746
diff
changeset
|
997 updatesManualLayout->addStretch(1); |
743
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
998 mUpdatesManual = new CertificateListWidget(this); |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
999 mUpdatesManual->hide(); |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1000 connect(mUpdatesManual, SIGNAL(certChanged(bool, const Certificate&)), |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1001 this, SLOT(removeFromManual(bool, const Certificate&))); |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1002 connect(mUpdatesManual, SIGNAL(certListChanged(int)), |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1003 this, SLOT(listChanged(int))); |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1004 |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1005 updatesNewLayout->setAlignment(Qt::AlignTop); |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1006 updatesRemoveLayout->setAlignment(Qt::AlignTop); |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1007 updatesManualLayout->setAlignment(Qt::AlignTop); |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1008 updatesCenterLayout->addLayout(updatesNewLayout); |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1009 updatesCenterLayout->addWidget(mUpdatesNew); |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1010 updatesCenterLayout->addLayout(updatesRemoveLayout); |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1011 updatesCenterLayout->addWidget(mUpdatesRemove); |
1098
75a5bfe0525e
(issue111) Rework Updates ui
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1097
diff
changeset
|
1012 updatesCenterLayout->addSpacing(10); |
743
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1013 updatesCenterLayout->addLayout(updatesManualLayout); |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1014 updatesCenterLayout->addWidget(mUpdatesManual); |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1015 |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1016 QWidget *dummyWidget = new QWidget; |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1017 dummyWidget->setLayout(updatesCenterLayout); |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1018 centralScrollArea->setWidgetResizable(true); |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1019 centralScrollArea->setWidget(dummyWidget); |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1020 centralScrollArea->setFrameShape(QFrame::NoFrame); |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1021 centralScrollArea->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1022 |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1023 updatesMainLayout->addWidget(centralScrollArea); |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1024 updatesCenterLayout->addSpacerItem(new QSpacerItem(0, 0, |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1025 QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1026 theWidget->setLayout(updatesMainLayout); |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1027 return theWidget; |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1028 } |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1029 |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1030 |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1031 QWidget *MainWindow::createInstallWidget() |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1032 { |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1033 QWidget *theWidget = new QWidget; |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1034 QScrollArea *scrollArea = new QScrollArea; |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1035 QVBoxLayout *installPanelLayout = new QVBoxLayout; |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1036 QVBoxLayout *installHeaderLayout = new QVBoxLayout; |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1037 QVBoxLayout *installCenterLayout = new QVBoxLayout; |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1038 |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1039 QLabel *installHeaderLabel = |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1040 new QLabel("<h2>" + tr("Trusted certificates") + "</h2>"); |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1041 QLabel *installHeaderText = new QLabel(tr("The following list of trusted root" |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1042 " certificates is managed by the BSI. The BSI validates independently the" |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1043 " authenticity, security and actuality of these certificates.")); |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1044 installHeaderText->setWordWrap(true); |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1045 installHeaderLayout->addWidget(installHeaderLabel); |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1046 installHeaderLayout->addWidget(installHeaderText); |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1047 |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1048 QLabel *installCenterText = new QLabel(tr("Please choose the certificates" |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1049 " you want to trust or untrust. TrustBridge will install these certificates for your" |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1050 " secure communication for email and internet.")); |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1051 installCenterText->setWordWrap(true); |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1052 installCenterLayout->addWidget(installCenterText); |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1053 |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1054 installPanelLayout->addLayout(installHeaderLayout); |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1055 installPanelLayout->addLayout(installCenterLayout); |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1056 |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1057 mInstallList = new CertificateListWidget(this); |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1058 connect(mInstallList, SIGNAL(certChanged(bool, const Certificate&)), |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1059 this, SLOT(toggleInManual(bool, const Certificate&))); |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1060 |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1061 scrollArea->setWidgetResizable(true); |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1062 scrollArea->setWidget(mInstallList); |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1063 scrollArea->setFrameShape(QFrame::NoFrame); |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1064 |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1065 installPanelLayout->addWidget(scrollArea); |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1066 |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1067 theWidget->setLayout(installPanelLayout); |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1068 |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1069 return theWidget; |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1070 } |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1071 |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1072 QWidget *MainWindow::createRemoveWidget() |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1073 { |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1074 QWidget * theWidget = new QWidget; |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1075 QScrollArea *scrollArea = new QScrollArea; |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1076 QVBoxLayout *removePanelLayout = new QVBoxLayout; |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1077 QVBoxLayout *removeHeaderLayout = new QVBoxLayout; |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1078 QVBoxLayout *removeCenterLayout = new QVBoxLayout; |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1079 |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1080 QLabel *removeHeaderLabel = |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1081 new QLabel("<h2>" + tr("Revoked certificates") + "</h2>"); |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1082 QLabel *removeHeaderText = new QLabel(tr("Certificates can be corrupted" |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1083 " or stolen and misused in many ways. Therefore the BSI recommends" |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1084 " to remove all revoked certificates from your system.")); |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1085 removeHeaderText->setWordWrap(true); |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1086 removeHeaderLayout->addWidget(removeHeaderLabel); |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1087 removeHeaderLayout->addWidget(removeHeaderText); |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1088 |
805 | 1089 QLabel *removeCenterText = new QLabel(tr("The following unsecure certificates were" |
743
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1090 " revoked by the BSI. Already uninstalled certificates cannot be reinstalled." |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1091 " It is recommended that you select all certificates to uninstall if you still" |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1092 " have revoked certificates installed.")); |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1093 removeCenterText->setWordWrap(true); |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1094 removeCenterLayout->addWidget(removeCenterText); |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1095 mRemoveList = new CertificateListWidget(this); |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1096 connect(mRemoveList, SIGNAL(certChanged(bool, const Certificate&)), |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1097 this, SLOT(toggleInManual(bool, const Certificate&))); |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1098 |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1099 removePanelLayout->addLayout(removeHeaderLayout); |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1100 removePanelLayout->addLayout(removeCenterLayout); |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1101 |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1102 scrollArea->setWidgetResizable(true); |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1103 scrollArea->setWidget(mRemoveList); |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1104 scrollArea->setFrameShape(QFrame::NoFrame); |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1105 removePanelLayout->addWidget(scrollArea); |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1106 theWidget->setLayout(removePanelLayout); |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1107 |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1108 return theWidget; |
739
5f0fca113ff4
Factor out Info Panel creation.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
732
diff
changeset
|
1109 } |
5f0fca113ff4
Factor out Info Panel creation.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
732
diff
changeset
|
1110 |
5f0fca113ff4
Factor out Info Panel creation.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
732
diff
changeset
|
1111 void MainWindow::setupGUI() |
187
0c06a608e15f
Create the mainwindow content.
Raimund Renkert <rrenkert@intevation.de>
parents:
155
diff
changeset
|
1112 { |
0c06a608e15f
Create the mainwindow content.
Raimund Renkert <rrenkert@intevation.de>
parents:
155
diff
changeset
|
1113 // Create a central widget containing the main layout. |
0c06a608e15f
Create the mainwindow content.
Raimund Renkert <rrenkert@intevation.de>
parents:
155
diff
changeset
|
1114 QWidget *base = new QWidget; |
0c06a608e15f
Create the mainwindow content.
Raimund Renkert <rrenkert@intevation.de>
parents:
155
diff
changeset
|
1115 |
250
1e112cf41e92
Updated the mainwindow layout.
Raimund Renkert <rrenkert@intevation.de>
parents:
249
diff
changeset
|
1116 // Layouts and Container |
584
ebfe1128ee97
Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents:
563
diff
changeset
|
1117 QVBoxLayout *mainLayout = new QVBoxLayout; |
205
a3f542bf38f7
Added header for mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
200
diff
changeset
|
1118 QHBoxLayout *headerLayout = new QHBoxLayout; |
a3f542bf38f7
Added header for mainwindow.
Raimund Renkert <rrenkert@intevation.de>
parents:
200
diff
changeset
|
1119 QVBoxLayout *headerTextLayout = new QVBoxLayout; |
1094
03a1f3761f45
(issue111) Move Version label into header.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1093
diff
changeset
|
1120 QHBoxLayout *headerSubtitleLayout = new QHBoxLayout; |
584
ebfe1128ee97
Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents:
563
diff
changeset
|
1121 QHBoxLayout *centerLayout = new QHBoxLayout; |
ebfe1128ee97
Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents:
563
diff
changeset
|
1122 QVBoxLayout *buttonBarLayout = new QVBoxLayout; |
271
1ae15ea73850
Some GUI desing and layout changes.
Raimund Renkert <rrenkert@intevation.de>
parents:
267
diff
changeset
|
1123 QHBoxLayout *bottomLayout = new QHBoxLayout; |
584
ebfe1128ee97
Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents:
563
diff
changeset
|
1124 QHBoxLayout *containerLayout = new QHBoxLayout; |
187
0c06a608e15f
Create the mainwindow content.
Raimund Renkert <rrenkert@intevation.de>
parents:
155
diff
changeset
|
1125 |
584
ebfe1128ee97
Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents:
563
diff
changeset
|
1126 // The header (icon, about text) |
ebfe1128ee97
Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents:
563
diff
changeset
|
1127 QImage *logoImage = new QImage(":/img/logo.png"); |
ebfe1128ee97
Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents:
563
diff
changeset
|
1128 QLabel *logo = new QLabel; |
ebfe1128ee97
Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents:
563
diff
changeset
|
1129 logo->setBackgroundRole(QPalette::Base); |
ebfe1128ee97
Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents:
563
diff
changeset
|
1130 logo->setPixmap(QPixmap::fromImage(*logoImage)); |
ebfe1128ee97
Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents:
563
diff
changeset
|
1131 QLabel *title = new QLabel("<h1>" + QString::fromLatin1(APPNAME) + "</h1>"); |
1104
a7a72353d6d2
(issue111) Wording and German translation.
Emanuel Schuetze <emanuel@intevation.de>
parents:
1103
diff
changeset
|
1132 QLabel *subTitle = new QLabel(tr("Trust in your digital communication")); |
1094
03a1f3761f45
(issue111) Move Version label into header.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1093
diff
changeset
|
1133 QLabel *swVersion = new QLabel(QString::fromLatin1("<i>") + |
03a1f3761f45
(issue111) Move Version label into header.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1093
diff
changeset
|
1134 tr("Version") + " " + QApplication::applicationVersion() + |
1095
a0fb21625cf3
(issue111) Avoid clipping the last charcter in italic font.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1094
diff
changeset
|
1135 QString::fromLatin1(" </i>")); |
1094
03a1f3761f45
(issue111) Move Version label into header.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1093
diff
changeset
|
1136 |
03a1f3761f45
(issue111) Move Version label into header.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1093
diff
changeset
|
1137 swVersion->setTextInteractionFlags(Qt::TextSelectableByKeyboard | Qt::TextSelectableByMouse); |
03a1f3761f45
(issue111) Move Version label into header.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1093
diff
changeset
|
1138 swVersion->setTextFormat(Qt::RichText); |
03a1f3761f45
(issue111) Move Version label into header.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1093
diff
changeset
|
1139 |
03a1f3761f45
(issue111) Move Version label into header.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1093
diff
changeset
|
1140 headerSubtitleLayout->addWidget(subTitle); |
03a1f3761f45
(issue111) Move Version label into header.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1093
diff
changeset
|
1141 headerSubtitleLayout->addStretch(-1); |
03a1f3761f45
(issue111) Move Version label into header.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1093
diff
changeset
|
1142 headerSubtitleLayout->addWidget(swVersion); |
03a1f3761f45
(issue111) Move Version label into header.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1093
diff
changeset
|
1143 |
584
ebfe1128ee97
Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents:
563
diff
changeset
|
1144 headerTextLayout->addWidget(title); |
1094
03a1f3761f45
(issue111) Move Version label into header.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1093
diff
changeset
|
1145 headerTextLayout->addLayout(headerSubtitleLayout); |
584
ebfe1128ee97
Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents:
563
diff
changeset
|
1146 headerLayout->addWidget(logo); |
ebfe1128ee97
Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents:
563
diff
changeset
|
1147 headerLayout->addLayout(headerTextLayout); |
ebfe1128ee97
Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents:
563
diff
changeset
|
1148 headerLayout->setStretch(0, 0); |
ebfe1128ee97
Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents:
563
diff
changeset
|
1149 headerLayout->setStretch(1, 10); |
ebfe1128ee97
Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents:
563
diff
changeset
|
1150 |
652
f65503c1833b
Updated mainwindow layout and removed obsolete code.
Raimund Renkert <rrenkert@intevation.de>
parents:
643
diff
changeset
|
1151 /*********************************** |
f65503c1833b
Updated mainwindow layout and removed obsolete code.
Raimund Renkert <rrenkert@intevation.de>
parents:
643
diff
changeset
|
1152 * The Buttonbar on the left side. |
f65503c1833b
Updated mainwindow layout and removed obsolete code.
Raimund Renkert <rrenkert@intevation.de>
parents:
643
diff
changeset
|
1153 ***********************************/ |
584
ebfe1128ee97
Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents:
563
diff
changeset
|
1154 mButtonGroup = new QButtonGroup; |
ebfe1128ee97
Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents:
563
diff
changeset
|
1155 |
722
b0929968562a
(Issue31) Add textoverlaybutton to show a text in the button.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
719
diff
changeset
|
1156 TextOverlayButton *updatesButton = new TextOverlayButton; |
584
ebfe1128ee97
Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents:
563
diff
changeset
|
1157 updatesButton->setToolButtonStyle(Qt::ToolButtonTextUnderIcon); |
932
57371f2e8dae
(issue72) Set background image as pixmap in textoverlayicon
Andre Heinecke <andre.heinecke@intevation.de>
parents:
926
diff
changeset
|
1158 updatesButton->setBackgroundIcon(":/img/red-circle.png"); |
1202
407f2c1286ae
(issue121) better Icon for the pending changes.
Bernhard Reiter <bernhard@intevation.de>
parents:
1201
diff
changeset
|
1159 updatesButton->setIcon(QIcon(":/img/pending-changes-overview-48.png")); |
732
d39b5b65366e
(UI) Updated png icons in correct sizes.
Emanuel Schuetze <emanuel@intevation.de>
parents:
722
diff
changeset
|
1160 updatesButton->setIconSize(QSize(48, 48)); |
1099
3d4a81eff3fd
(issue111) Rename updates button to pending changes
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1098
diff
changeset
|
1161 updatesButton->setText(tr("Pending\nchanges")); |
663
b00c26fbc695
(UI) linebreak and bigger buttons for German translations.
Emanuel Schuetze <emanuel@intevation.de>
parents:
661
diff
changeset
|
1162 updatesButton->setFixedWidth(120); |
732
d39b5b65366e
(UI) Updated png icons in correct sizes.
Emanuel Schuetze <emanuel@intevation.de>
parents:
722
diff
changeset
|
1163 updatesButton->setFixedHeight(90); |
584
ebfe1128ee97
Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents:
563
diff
changeset
|
1164 updatesButton->setCheckable(true); |
ebfe1128ee97
Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents:
563
diff
changeset
|
1165 updatesButton->setChecked(true); |
ebfe1128ee97
Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents:
563
diff
changeset
|
1166 |
722
b0929968562a
(Issue31) Add textoverlaybutton to show a text in the button.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
719
diff
changeset
|
1167 connect(this, SIGNAL(changesChanged(const QString&)), |
b0929968562a
(Issue31) Add textoverlaybutton to show a text in the button.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
719
diff
changeset
|
1168 updatesButton, SLOT(setOverlay(const QString&))); |
b0929968562a
(Issue31) Add textoverlaybutton to show a text in the button.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
719
diff
changeset
|
1169 |
584
ebfe1128ee97
Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents:
563
diff
changeset
|
1170 QToolButton *allInstallButton = new QToolButton; |
ebfe1128ee97
Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents:
563
diff
changeset
|
1171 allInstallButton->setToolButtonStyle(Qt::ToolButtonTextUnderIcon); |
ebfe1128ee97
Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents:
563
diff
changeset
|
1172 allInstallButton->setIcon(QIcon(":/img/document-encrypt.png")); |
732
d39b5b65366e
(UI) Updated png icons in correct sizes.
Emanuel Schuetze <emanuel@intevation.de>
parents:
722
diff
changeset
|
1173 allInstallButton->setIconSize(QSize(48, 48)); |
659
c7405d526ead
(UI) Updated English strings.
Emanuel Schuetze <emanuel@intevation.de>
parents:
657
diff
changeset
|
1174 allInstallButton->setText(tr("Trusted\ncertificates")); |
663
b00c26fbc695
(UI) linebreak and bigger buttons for German translations.
Emanuel Schuetze <emanuel@intevation.de>
parents:
661
diff
changeset
|
1175 allInstallButton->setFixedWidth(120); |
732
d39b5b65366e
(UI) Updated png icons in correct sizes.
Emanuel Schuetze <emanuel@intevation.de>
parents:
722
diff
changeset
|
1176 allInstallButton->setFixedHeight(90); |
584
ebfe1128ee97
Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents:
563
diff
changeset
|
1177 allInstallButton->setCheckable(true); |
ebfe1128ee97
Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents:
563
diff
changeset
|
1178 |
ebfe1128ee97
Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents:
563
diff
changeset
|
1179 QToolButton *allRemoveButton = new QToolButton; |
ebfe1128ee97
Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents:
563
diff
changeset
|
1180 allRemoveButton->setToolButtonStyle(Qt::ToolButtonTextUnderIcon); |
673
e8bc1215904e
(UI) Changed some icons.
Emanuel Schuetze <emanuel@intevation.de>
parents:
669
diff
changeset
|
1181 allRemoveButton->setIcon(QIcon(":/img/dialog-warning.png")); |
732
d39b5b65366e
(UI) Updated png icons in correct sizes.
Emanuel Schuetze <emanuel@intevation.de>
parents:
722
diff
changeset
|
1182 allRemoveButton->setIconSize(QSize(48, 48)); |
661
320a64d58e62
(UI) Updated English strings. Removed Issuer fields.
Emanuel Schuetze <emanuel@intevation.de>
parents:
659
diff
changeset
|
1183 allRemoveButton->setText(tr("Revoked\ncertificates")); |
663
b00c26fbc695
(UI) linebreak and bigger buttons for German translations.
Emanuel Schuetze <emanuel@intevation.de>
parents:
661
diff
changeset
|
1184 allRemoveButton->setFixedWidth(120); |
732
d39b5b65366e
(UI) Updated png icons in correct sizes.
Emanuel Schuetze <emanuel@intevation.de>
parents:
722
diff
changeset
|
1185 allRemoveButton->setFixedHeight(90); |
584
ebfe1128ee97
Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents:
563
diff
changeset
|
1186 allRemoveButton->setCheckable(true); |
ebfe1128ee97
Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents:
563
diff
changeset
|
1187 |
ebfe1128ee97
Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents:
563
diff
changeset
|
1188 QToolButton *infoButton = new QToolButton; |
ebfe1128ee97
Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents:
563
diff
changeset
|
1189 infoButton->setToolButtonStyle(Qt::ToolButtonTextUnderIcon); |
ebfe1128ee97
Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents:
563
diff
changeset
|
1190 infoButton->setIcon(QIcon(":/img/dialog-information.png")); |
732
d39b5b65366e
(UI) Updated png icons in correct sizes.
Emanuel Schuetze <emanuel@intevation.de>
parents:
722
diff
changeset
|
1191 infoButton->setIconSize(QSize(48, 48)); |
659
c7405d526ead
(UI) Updated English strings.
Emanuel Schuetze <emanuel@intevation.de>
parents:
657
diff
changeset
|
1192 infoButton->setText(tr("Information\nand help")); |
663
b00c26fbc695
(UI) linebreak and bigger buttons for German translations.
Emanuel Schuetze <emanuel@intevation.de>
parents:
661
diff
changeset
|
1193 infoButton->setFixedWidth(120); |
732
d39b5b65366e
(UI) Updated png icons in correct sizes.
Emanuel Schuetze <emanuel@intevation.de>
parents:
722
diff
changeset
|
1194 infoButton->setFixedHeight(90); |
584
ebfe1128ee97
Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents:
563
diff
changeset
|
1195 infoButton->setCheckable(true); |
ebfe1128ee97
Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents:
563
diff
changeset
|
1196 |
ebfe1128ee97
Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents:
563
diff
changeset
|
1197 mButtonGroup->addButton(updatesButton); |
ebfe1128ee97
Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents:
563
diff
changeset
|
1198 mButtonGroup->addButton(allInstallButton); |
ebfe1128ee97
Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents:
563
diff
changeset
|
1199 mButtonGroup->addButton(allRemoveButton); |
ebfe1128ee97
Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents:
563
diff
changeset
|
1200 mButtonGroup->addButton(infoButton); |
ebfe1128ee97
Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents:
563
diff
changeset
|
1201 mButtonGroup->setId(updatesButton, 0); |
ebfe1128ee97
Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents:
563
diff
changeset
|
1202 mButtonGroup->setId(allInstallButton, 1); |
ebfe1128ee97
Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents:
563
diff
changeset
|
1203 mButtonGroup->setId(allRemoveButton, 2); |
ebfe1128ee97
Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents:
563
diff
changeset
|
1204 mButtonGroup->setId(infoButton, 3); |
ebfe1128ee97
Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents:
563
diff
changeset
|
1205 |
ebfe1128ee97
Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents:
563
diff
changeset
|
1206 connect(mButtonGroup, SIGNAL(buttonClicked(int)), |
ebfe1128ee97
Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents:
563
diff
changeset
|
1207 this, SLOT(togglePages(int))); |
ebfe1128ee97
Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents:
563
diff
changeset
|
1208 buttonBarLayout->addWidget(updatesButton); |
ebfe1128ee97
Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents:
563
diff
changeset
|
1209 buttonBarLayout->addWidget(allInstallButton); |
ebfe1128ee97
Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents:
563
diff
changeset
|
1210 buttonBarLayout->addWidget(allRemoveButton); |
ebfe1128ee97
Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents:
563
diff
changeset
|
1211 buttonBarLayout->insertStretch(3, 10); |
ebfe1128ee97
Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents:
563
diff
changeset
|
1212 buttonBarLayout->addWidget(infoButton); |
ebfe1128ee97
Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents:
563
diff
changeset
|
1213 |
743
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1214 /* The main pages.*/ |
584
ebfe1128ee97
Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents:
563
diff
changeset
|
1215 |
743
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1216 /* The updates page. */ |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1217 mUpdatesWidget = createUpdatesWidget(); |
584
ebfe1128ee97
Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents:
563
diff
changeset
|
1218 |
743
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1219 /* Install (trusted certs) Page */ |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1220 mInstallWidget = createInstallWidget(); |
584
ebfe1128ee97
Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents:
563
diff
changeset
|
1221 |
652
f65503c1833b
Updated mainwindow layout and removed obsolete code.
Raimund Renkert <rrenkert@intevation.de>
parents:
643
diff
changeset
|
1222 /********************************** |
743
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1223 * Page for certificates to be removed. |
652
f65503c1833b
Updated mainwindow layout and removed obsolete code.
Raimund Renkert <rrenkert@intevation.de>
parents:
643
diff
changeset
|
1224 **********************************/ |
743
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1225 mRemoveWidget = createRemoveWidget(); |
584
ebfe1128ee97
Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents:
563
diff
changeset
|
1226 |
652
f65503c1833b
Updated mainwindow layout and removed obsolete code.
Raimund Renkert <rrenkert@intevation.de>
parents:
643
diff
changeset
|
1227 /********************************** |
743
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1228 * The info page. |
652
f65503c1833b
Updated mainwindow layout and removed obsolete code.
Raimund Renkert <rrenkert@intevation.de>
parents:
643
diff
changeset
|
1229 **********************************/ |
743
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1230 mInfoWidget = createInfoWidget(); |
584
ebfe1128ee97
Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents:
563
diff
changeset
|
1231 |
652
f65503c1833b
Updated mainwindow layout and removed obsolete code.
Raimund Renkert <rrenkert@intevation.de>
parents:
643
diff
changeset
|
1232 /******************************** |
f65503c1833b
Updated mainwindow layout and removed obsolete code.
Raimund Renkert <rrenkert@intevation.de>
parents:
643
diff
changeset
|
1233 * The main layout for pages. |
f65503c1833b
Updated mainwindow layout and removed obsolete code.
Raimund Renkert <rrenkert@intevation.de>
parents:
643
diff
changeset
|
1234 ********************************/ |
743
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1235 mInstallWidget->hide(); |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1236 mRemoveWidget->hide(); |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1237 mInfoWidget->hide(); |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1238 containerLayout->addWidget(mUpdatesWidget); |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1239 containerLayout->addWidget(mInstallWidget); |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1240 containerLayout->addWidget(mRemoveWidget); |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1241 containerLayout->addWidget(mInfoWidget); |
584
ebfe1128ee97
Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents:
563
diff
changeset
|
1242 |
ebfe1128ee97
Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents:
563
diff
changeset
|
1243 centerLayout->addLayout(buttonBarLayout); |
ebfe1128ee97
Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents:
563
diff
changeset
|
1244 centerLayout->addLayout(containerLayout); |
ebfe1128ee97
Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents:
563
diff
changeset
|
1245 |
ebfe1128ee97
Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents:
563
diff
changeset
|
1246 mainLayout->addLayout(headerLayout); |
ebfe1128ee97
Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents:
563
diff
changeset
|
1247 mainLayout->addLayout(centerLayout); |
ebfe1128ee97
Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents:
563
diff
changeset
|
1248 mainLayout->addLayout(bottomLayout); |
187
0c06a608e15f
Create the mainwindow content.
Raimund Renkert <rrenkert@intevation.de>
parents:
155
diff
changeset
|
1249 base->setLayout(mainLayout); |
0c06a608e15f
Create the mainwindow content.
Raimund Renkert <rrenkert@intevation.de>
parents:
155
diff
changeset
|
1250 setCentralWidget(base); |
0c06a608e15f
Create the mainwindow content.
Raimund Renkert <rrenkert@intevation.de>
parents:
155
diff
changeset
|
1251 } |
0c06a608e15f
Create the mainwindow content.
Raimund Renkert <rrenkert@intevation.de>
parents:
155
diff
changeset
|
1252 |
628
3a9c0f38bbad
Made certificate lists member of mainwindow and added some temporary debug msgs.
Raimund Renkert <rrenkert@intevation.de>
parents:
584
diff
changeset
|
1253 void MainWindow::listChanged(int selected) |
3a9c0f38bbad
Made certificate lists member of mainwindow and added some temporary debug msgs.
Raimund Renkert <rrenkert@intevation.de>
parents:
584
diff
changeset
|
1254 { |
716
929c3db85eb7
Add central place to obtain current change count.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
714
diff
changeset
|
1255 Q_UNUSED (selected); |
722
b0929968562a
(Issue31) Add textoverlaybutton to show a text in the button.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
719
diff
changeset
|
1256 setChangeCount(mUpdatesRemove->selectedCertCount() + |
1107
51d3b361f17a
Revert commit 1102
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1106
diff
changeset
|
1257 mUpdatesNew->selectedCertCount() + mUpdatesManual->certificates().size()); |
696
55f78c4166fb
(Issue32) Change Updates to Changes and track changes.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
694
diff
changeset
|
1258 |
718
e7a070e64b80
(Issue26) Make updates tip and install button depend on changes
Andre Heinecke <andre.heinecke@intevation.de>
parents:
717
diff
changeset
|
1259 /* Show a different tip in case of manual changes, updates aviailable, updates and manual |
e7a070e64b80
(Issue26) Make updates tip and install button depend on changes
Andre Heinecke <andre.heinecke@intevation.de>
parents:
717
diff
changeset
|
1260 * changes available */ |
1107
51d3b361f17a
Revert commit 1102
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1106
diff
changeset
|
1261 if (changeCount() && !mUpdatesManual->certificates().size()) { |
718
e7a070e64b80
(Issue26) Make updates tip and install button depend on changes
Andre Heinecke <andre.heinecke@intevation.de>
parents:
717
diff
changeset
|
1262 mUpdatesTip->setText( |
1104
a7a72353d6d2
(issue111) Wording and German translation.
Emanuel Schuetze <emanuel@intevation.de>
parents:
1103
diff
changeset
|
1263 tr("You should apply the following, recommended changes to your certificate stores:")); |
718
e7a070e64b80
(Issue26) Make updates tip and install button depend on changes
Andre Heinecke <andre.heinecke@intevation.de>
parents:
717
diff
changeset
|
1264 } else { |
1236
33a17569812a
(issue111) Remove unecessary update tips
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1234
diff
changeset
|
1265 mUpdatesTip->setText(""); |
718
e7a070e64b80
(Issue26) Make updates tip and install button depend on changes
Andre Heinecke <andre.heinecke@intevation.de>
parents:
717
diff
changeset
|
1266 } |
e7a070e64b80
(Issue26) Make updates tip and install button depend on changes
Andre Heinecke <andre.heinecke@intevation.de>
parents:
717
diff
changeset
|
1267 |
716
929c3db85eb7
Add central place to obtain current change count.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
714
diff
changeset
|
1268 if (!changeCount()) { |
693
0fc1a20adaff
(Issue 27) Change Quit button text depending on changes or no changes.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
692
diff
changeset
|
1269 /* No changes */ |
702
9dea3d895f53
(Issue22) Add a space between button icon and text.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
696
diff
changeset
|
1270 mQuitButton->setText(" " + tr("Quit")); |
696
55f78c4166fb
(Issue32) Change Updates to Changes and track changes.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
694
diff
changeset
|
1271 mUpdatesHeader->setText("<h2>" + tr("Certificates unchanged") + |
55f78c4166fb
(Issue32) Change Updates to Changes and track changes.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
694
diff
changeset
|
1272 "</h2>"); |
718
e7a070e64b80
(Issue26) Make updates tip and install button depend on changes
Andre Heinecke <andre.heinecke@intevation.de>
parents:
717
diff
changeset
|
1273 mInstallButton->setText(" " + tr("Install certificates again")); |
693
0fc1a20adaff
(Issue 27) Change Quit button text depending on changes or no changes.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
692
diff
changeset
|
1274 } else { |
702
9dea3d895f53
(Issue22) Add a space between button icon and text.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
696
diff
changeset
|
1275 mQuitButton->setText(" " + tr("Quit without saving")); |
1104
a7a72353d6d2
(issue111) Wording and German translation.
Emanuel Schuetze <emanuel@intevation.de>
parents:
1103
diff
changeset
|
1276 mUpdatesHeader->setText("<h2>" + tr("Pending changes (%1)") |
716
929c3db85eb7
Add central place to obtain current change count.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
714
diff
changeset
|
1277 .arg(changeCount()) + |
696
55f78c4166fb
(Issue32) Change Updates to Changes and track changes.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
694
diff
changeset
|
1278 "</h2>"); |
718
e7a070e64b80
(Issue26) Make updates tip and install button depend on changes
Andre Heinecke <andre.heinecke@intevation.de>
parents:
717
diff
changeset
|
1279 mInstallButton->setText(" " + tr("Apply changes")); |
693
0fc1a20adaff
(Issue 27) Change Quit button text depending on changes or no changes.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
692
diff
changeset
|
1280 } |
0fc1a20adaff
(Issue 27) Change Quit button text depending on changes or no changes.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
692
diff
changeset
|
1281 |
719
49bf73b5c7de
(Issue34) Show / hide details area depending on available changes
Andre Heinecke <andre.heinecke@intevation.de>
parents:
718
diff
changeset
|
1282 if (mUpdatesManual->certificates().size()) { |
49bf73b5c7de
(Issue34) Show / hide details area depending on available changes
Andre Heinecke <andre.heinecke@intevation.de>
parents:
718
diff
changeset
|
1283 mUpdatesDetailsManual->show(); |
1109
6594e8e63a25
(issue115) Add tooltips and fix manual changes handling
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1107
diff
changeset
|
1284 if (mManualDetailsShown) { |
6594e8e63a25
(issue115) Add tooltips and fix manual changes handling
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1107
diff
changeset
|
1285 mUpdatesManual->show(); |
6594e8e63a25
(issue115) Add tooltips and fix manual changes handling
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1107
diff
changeset
|
1286 deactivateDetailsButton(mUpdatesDetailsManual); |
6594e8e63a25
(issue115) Add tooltips and fix manual changes handling
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1107
diff
changeset
|
1287 } else { |
6594e8e63a25
(issue115) Add tooltips and fix manual changes handling
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1107
diff
changeset
|
1288 activateDetailsButton(mUpdatesDetailsManual); |
6594e8e63a25
(issue115) Add tooltips and fix manual changes handling
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1107
diff
changeset
|
1289 } |
719
49bf73b5c7de
(Issue34) Show / hide details area depending on available changes
Andre Heinecke <andre.heinecke@intevation.de>
parents:
718
diff
changeset
|
1290 } else { |
49bf73b5c7de
(Issue34) Show / hide details area depending on available changes
Andre Heinecke <andre.heinecke@intevation.de>
parents:
718
diff
changeset
|
1291 mUpdatesDetailsManual->hide(); |
49bf73b5c7de
(Issue34) Show / hide details area depending on available changes
Andre Heinecke <andre.heinecke@intevation.de>
parents:
718
diff
changeset
|
1292 mUpdatesManual->hide(); |
49bf73b5c7de
(Issue34) Show / hide details area depending on available changes
Andre Heinecke <andre.heinecke@intevation.de>
parents:
718
diff
changeset
|
1293 } |
1098
75a5bfe0525e
(issue111) Rework Updates ui
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1097
diff
changeset
|
1294 mUpdatesManualCertificates->setText("<h2>" + |
1109
6594e8e63a25
(issue115) Add tooltips and fix manual changes handling
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1107
diff
changeset
|
1295 tr("Manual changes (%1)").arg(mUpdatesManual->certificates().size()) + |
1098
75a5bfe0525e
(issue111) Rework Updates ui
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1097
diff
changeset
|
1296 "</h2>"); |
719
49bf73b5c7de
(Issue34) Show / hide details area depending on available changes
Andre Heinecke <andre.heinecke@intevation.de>
parents:
718
diff
changeset
|
1297 |
717
77c9c2dfc8ac
(Issue26) Hide update lists if no updates are available
Andre Heinecke <andre.heinecke@intevation.de>
parents:
716
diff
changeset
|
1298 if (mUpdatesNew->certificates().size()) { |
77c9c2dfc8ac
(Issue26) Hide update lists if no updates are available
Andre Heinecke <andre.heinecke@intevation.de>
parents:
716
diff
changeset
|
1299 mUpdatesNewCertificates->setText("<h3>" + |
77c9c2dfc8ac
(Issue26) Hide update lists if no updates are available
Andre Heinecke <andre.heinecke@intevation.de>
parents:
716
diff
changeset
|
1300 tr("Install new trusted certificates (%1/%2)") |
77c9c2dfc8ac
(Issue26) Hide update lists if no updates are available
Andre Heinecke <andre.heinecke@intevation.de>
parents:
716
diff
changeset
|
1301 .arg(mUpdatesNew->selectedCertCount()) |
77c9c2dfc8ac
(Issue26) Hide update lists if no updates are available
Andre Heinecke <andre.heinecke@intevation.de>
parents:
716
diff
changeset
|
1302 .arg(mUpdatesNew->certificates().size()) + |
77c9c2dfc8ac
(Issue26) Hide update lists if no updates are available
Andre Heinecke <andre.heinecke@intevation.de>
parents:
716
diff
changeset
|
1303 "</h3>"); |
1311
135891f1c8f4
(issue154) Do not force the details button to be active if a certificate changes
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1308
diff
changeset
|
1304 if (!mUpdatesNew->isVisible()) { |
135891f1c8f4
(issue154) Do not force the details button to be active if a certificate changes
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1308
diff
changeset
|
1305 activateDetailsButton(mUpdatesDetailsNew); |
135891f1c8f4
(issue154) Do not force the details button to be active if a certificate changes
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1308
diff
changeset
|
1306 } |
717
77c9c2dfc8ac
(Issue26) Hide update lists if no updates are available
Andre Heinecke <andre.heinecke@intevation.de>
parents:
716
diff
changeset
|
1307 mUpdatesNewCertificates->show(); |
77c9c2dfc8ac
(Issue26) Hide update lists if no updates are available
Andre Heinecke <andre.heinecke@intevation.de>
parents:
716
diff
changeset
|
1308 } else { |
77c9c2dfc8ac
(Issue26) Hide update lists if no updates are available
Andre Heinecke <andre.heinecke@intevation.de>
parents:
716
diff
changeset
|
1309 mUpdatesDetailsNew->hide(); |
719
49bf73b5c7de
(Issue34) Show / hide details area depending on available changes
Andre Heinecke <andre.heinecke@intevation.de>
parents:
718
diff
changeset
|
1310 mUpdatesNew->hide(); |
717
77c9c2dfc8ac
(Issue26) Hide update lists if no updates are available
Andre Heinecke <andre.heinecke@intevation.de>
parents:
716
diff
changeset
|
1311 mUpdatesNewCertificates->hide(); |
77c9c2dfc8ac
(Issue26) Hide update lists if no updates are available
Andre Heinecke <andre.heinecke@intevation.de>
parents:
716
diff
changeset
|
1312 } |
77c9c2dfc8ac
(Issue26) Hide update lists if no updates are available
Andre Heinecke <andre.heinecke@intevation.de>
parents:
716
diff
changeset
|
1313 |
77c9c2dfc8ac
(Issue26) Hide update lists if no updates are available
Andre Heinecke <andre.heinecke@intevation.de>
parents:
716
diff
changeset
|
1314 if (mUpdatesRemove->certificates().size()) { |
77c9c2dfc8ac
(Issue26) Hide update lists if no updates are available
Andre Heinecke <andre.heinecke@intevation.de>
parents:
716
diff
changeset
|
1315 mUpdatesRemoveCertificates->setText("<h3>" + |
77c9c2dfc8ac
(Issue26) Hide update lists if no updates are available
Andre Heinecke <andre.heinecke@intevation.de>
parents:
716
diff
changeset
|
1316 tr("Remove revoked certificates (%1/%2)") |
77c9c2dfc8ac
(Issue26) Hide update lists if no updates are available
Andre Heinecke <andre.heinecke@intevation.de>
parents:
716
diff
changeset
|
1317 .arg(mUpdatesRemove->selectedCertCount()) |
77c9c2dfc8ac
(Issue26) Hide update lists if no updates are available
Andre Heinecke <andre.heinecke@intevation.de>
parents:
716
diff
changeset
|
1318 .arg(mUpdatesRemove->certificates().size()) + |
77c9c2dfc8ac
(Issue26) Hide update lists if no updates are available
Andre Heinecke <andre.heinecke@intevation.de>
parents:
716
diff
changeset
|
1319 "</h3>"); |
77c9c2dfc8ac
(Issue26) Hide update lists if no updates are available
Andre Heinecke <andre.heinecke@intevation.de>
parents:
716
diff
changeset
|
1320 mUpdatesRemoveCertificates->show(); |
1311
135891f1c8f4
(issue154) Do not force the details button to be active if a certificate changes
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1308
diff
changeset
|
1321 if (!mUpdatesRemove->isVisible()) { |
135891f1c8f4
(issue154) Do not force the details button to be active if a certificate changes
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1308
diff
changeset
|
1322 activateDetailsButton(mUpdatesDetailsRemove); |
135891f1c8f4
(issue154) Do not force the details button to be active if a certificate changes
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1308
diff
changeset
|
1323 } |
717
77c9c2dfc8ac
(Issue26) Hide update lists if no updates are available
Andre Heinecke <andre.heinecke@intevation.de>
parents:
716
diff
changeset
|
1324 } else { |
77c9c2dfc8ac
(Issue26) Hide update lists if no updates are available
Andre Heinecke <andre.heinecke@intevation.de>
parents:
716
diff
changeset
|
1325 mUpdatesRemoveCertificates->hide(); |
77c9c2dfc8ac
(Issue26) Hide update lists if no updates are available
Andre Heinecke <andre.heinecke@intevation.de>
parents:
716
diff
changeset
|
1326 mUpdatesDetailsRemove->hide(); |
719
49bf73b5c7de
(Issue34) Show / hide details area depending on available changes
Andre Heinecke <andre.heinecke@intevation.de>
parents:
718
diff
changeset
|
1327 mUpdatesRemove->hide(); |
717
77c9c2dfc8ac
(Issue26) Hide update lists if no updates are available
Andre Heinecke <andre.heinecke@intevation.de>
parents:
716
diff
changeset
|
1328 } |
1098
75a5bfe0525e
(issue111) Rework Updates ui
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1097
diff
changeset
|
1329 |
75a5bfe0525e
(issue111) Rework Updates ui
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1097
diff
changeset
|
1330 /* Update the details header */ |
75a5bfe0525e
(issue111) Rework Updates ui
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1097
diff
changeset
|
1331 if (mUpdatesRemove->certificates().size() || |
75a5bfe0525e
(issue111) Rework Updates ui
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1097
diff
changeset
|
1332 mUpdatesNew->certificates().size()) { |
75a5bfe0525e
(issue111) Rework Updates ui
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1097
diff
changeset
|
1333 mUpdatesDetailsHeader->setText("<h2>" + |
75a5bfe0525e
(issue111) Rework Updates ui
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1097
diff
changeset
|
1334 tr("New, recommended changes (%1/%2)") |
75a5bfe0525e
(issue111) Rework Updates ui
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1097
diff
changeset
|
1335 .arg(mUpdatesRemove->selectedCertCount() + |
75a5bfe0525e
(issue111) Rework Updates ui
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1097
diff
changeset
|
1336 mUpdatesNew->selectedCertCount()) |
75a5bfe0525e
(issue111) Rework Updates ui
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1097
diff
changeset
|
1337 .arg(mUpdatesRemove->certificates().size() + |
75a5bfe0525e
(issue111) Rework Updates ui
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1097
diff
changeset
|
1338 mUpdatesNew->certificates().size()) + |
75a5bfe0525e
(issue111) Rework Updates ui
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1097
diff
changeset
|
1339 "</h2>"); |
75a5bfe0525e
(issue111) Rework Updates ui
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1097
diff
changeset
|
1340 } else { |
75a5bfe0525e
(issue111) Rework Updates ui
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1097
diff
changeset
|
1341 mUpdatesDetailsHeader->setText(QString::fromLatin1("<h2>") + |
75a5bfe0525e
(issue111) Rework Updates ui
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1097
diff
changeset
|
1342 tr("No new recommendations") + QString::fromLatin1("</h2>")); |
75a5bfe0525e
(issue111) Rework Updates ui
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1097
diff
changeset
|
1343 } |
75a5bfe0525e
(issue111) Rework Updates ui
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1097
diff
changeset
|
1344 |
75a5bfe0525e
(issue111) Rework Updates ui
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1097
diff
changeset
|
1345 if (mListToInstall.isValid()) { |
1104
a7a72353d6d2
(issue111) Wording and German translation.
Emanuel Schuetze <emanuel@intevation.de>
parents:
1103
diff
changeset
|
1346 mCertListVersion->setText(tr("Certificate list from:")); |
1098
75a5bfe0525e
(issue111) Rework Updates ui
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1097
diff
changeset
|
1347 mCertListVersionContents->setText(QLocale::system().toString( |
75a5bfe0525e
(issue111) Rework Updates ui
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1097
diff
changeset
|
1348 mListToInstall.date().toLocalTime(), DATETIME_FORMAT)); |
75a5bfe0525e
(issue111) Rework Updates ui
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1097
diff
changeset
|
1349 } else { |
75a5bfe0525e
(issue111) Rework Updates ui
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1097
diff
changeset
|
1350 if (mInstalledList.isValid()) { |
1104
a7a72353d6d2
(issue111) Wording and German translation.
Emanuel Schuetze <emanuel@intevation.de>
parents:
1103
diff
changeset
|
1351 mCertListVersion->setText(tr("Currently installed certificate list:")); |
1098
75a5bfe0525e
(issue111) Rework Updates ui
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1097
diff
changeset
|
1352 mCertListVersionContents->setText(QLocale::system().toString( |
75a5bfe0525e
(issue111) Rework Updates ui
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1097
diff
changeset
|
1353 mInstalledList.date().toLocalTime(), DATETIME_FORMAT)); |
75a5bfe0525e
(issue111) Rework Updates ui
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1097
diff
changeset
|
1354 } else { |
1104
a7a72353d6d2
(issue111) Wording and German translation.
Emanuel Schuetze <emanuel@intevation.de>
parents:
1103
diff
changeset
|
1355 mCertListVersion->setText(tr("No certificate list installed.")); |
1098
75a5bfe0525e
(issue111) Rework Updates ui
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1097
diff
changeset
|
1356 mCertListVersionContents->setText(""); |
75a5bfe0525e
(issue111) Rework Updates ui
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1097
diff
changeset
|
1357 } |
75a5bfe0525e
(issue111) Rework Updates ui
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1097
diff
changeset
|
1358 } |
628
3a9c0f38bbad
Made certificate lists member of mainwindow and added some temporary debug msgs.
Raimund Renkert <rrenkert@intevation.de>
parents:
584
diff
changeset
|
1359 } |
3a9c0f38bbad
Made certificate lists member of mainwindow and added some temporary debug msgs.
Raimund Renkert <rrenkert@intevation.de>
parents:
584
diff
changeset
|
1360 |
189
5f0d45ca9de4
Show certificates in the list view and details in the textfield.
Raimund Renkert <rrenkert@intevation.de>
parents:
187
diff
changeset
|
1361 void MainWindow::loadCertificateList() |
5f0d45ca9de4
Show certificates in the list view and details in the textfield.
Raimund Renkert <rrenkert@intevation.de>
parents:
187
diff
changeset
|
1362 { |
1162
2a1206932f53
(issue107) Comment all TODO's and FIXME's with issues as documented in issue107
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1155
diff
changeset
|
1363 /* TODO (issue134): if nothing is available (neither old nor new) add some progress |
389
3be838c3e4d8
Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
375
diff
changeset
|
1364 * indication */ |
1233
7da9ec20eae4
(issue148) Disable UI Updates while loading the list.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1232
diff
changeset
|
1365 setUpdatesEnabled(false); |
628
3a9c0f38bbad
Made certificate lists member of mainwindow and added some temporary debug msgs.
Raimund Renkert <rrenkert@intevation.de>
parents:
584
diff
changeset
|
1366 mInstallList->clear(); |
684
69def231f5ac
(issue28) clear manual updates after installation.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
673
diff
changeset
|
1367 mRemoveList->clear(); |
628
3a9c0f38bbad
Made certificate lists member of mainwindow and added some temporary debug msgs.
Raimund Renkert <rrenkert@intevation.de>
parents:
584
diff
changeset
|
1368 mUpdatesNew->clear(); |
3a9c0f38bbad
Made certificate lists member of mainwindow and added some temporary debug msgs.
Raimund Renkert <rrenkert@intevation.de>
parents:
584
diff
changeset
|
1369 mUpdatesRemove->clear(); |
445
b3721ded6f5b
Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents:
437
diff
changeset
|
1370 QList<Certificate> newInstallCerts; |
b3721ded6f5b
Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents:
437
diff
changeset
|
1371 QList<Certificate> newRemoveCerts; |
b3721ded6f5b
Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents:
437
diff
changeset
|
1372 QList<Certificate> oldInstallCerts; |
b3721ded6f5b
Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents:
437
diff
changeset
|
1373 QList<Certificate> oldRemoveCerts; |
389
3be838c3e4d8
Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
375
diff
changeset
|
1374 |
445
b3721ded6f5b
Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents:
437
diff
changeset
|
1375 if (mListToInstall.getCertificates().isEmpty()) { |
b3721ded6f5b
Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents:
437
diff
changeset
|
1376 // 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
|
1377 foreach (const Certificate &cert, mInstalledList.getCertificates()) { |
640
626507197360
Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
628
diff
changeset
|
1378 bool state = !mPreviouslyUnselected.contains(cert.base64Line()); |
445
b3721ded6f5b
Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents:
437
diff
changeset
|
1379 if (cert.isInstallCert()) { |
b3721ded6f5b
Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents:
437
diff
changeset
|
1380 oldInstallCerts.append(cert); |
1234
ad4fc3649ffb
(issue146) Always draw certificate item buttons as unchecked
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1233
diff
changeset
|
1381 CheckLessToolBtn* actionBtn = new CheckLessToolBtn(); |
1106
6f7b7d88f048
(issue115) Rework CertificateListWidgets to have a ToolButton instead of a combobox
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1104
diff
changeset
|
1382 QIcon btnIcon; |
6f7b7d88f048
(issue115) Rework CertificateListWidgets to have a ToolButton instead of a combobox
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1104
diff
changeset
|
1383 if (!state) { |
1209
3815a0d2017b
(issue115) icons, new for cert-to-be* with color.
Bernhard Reiter <bernhard@intevation.de>
parents:
1202
diff
changeset
|
1384 btnIcon.addFile(":/img/cert-to-be-installed-good-48.png", QSize(48, 48), QIcon::Normal, QIcon::Off); |
1148
6ec64a30fd5f
(issue115) Use updated icons.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1146
diff
changeset
|
1385 btnIcon.addFile(":/img/cert-not-installed-bad-48.png", QSize(48, 48), QIcon::Normal, QIcon::On); |
1110
b6cb4fd7ee20
(issue115) Move tooltips into body to make qt tr work
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1109
diff
changeset
|
1386 actionBtn->setProperty("ToolTip_Off", tr("Certificate will be installed.")); |
b6cb4fd7ee20
(issue115) Move tooltips into body to make qt tr work
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1109
diff
changeset
|
1387 actionBtn->setProperty("ToolTip_On", tr("Certifcate is not installed.")); |
1106
6f7b7d88f048
(issue115) Rework CertificateListWidgets to have a ToolButton instead of a combobox
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1104
diff
changeset
|
1388 } else { |
1110
b6cb4fd7ee20
(issue115) Move tooltips into body to make qt tr work
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1109
diff
changeset
|
1389 actionBtn->setProperty("ToolTip_Off", tr("Certificate is installed.")); |
b6cb4fd7ee20
(issue115) Move tooltips into body to make qt tr work
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1109
diff
changeset
|
1390 actionBtn->setProperty("ToolTip_On", tr("Certificate will be removed.")); |
1148
6ec64a30fd5f
(issue115) Use updated icons.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1146
diff
changeset
|
1391 btnIcon.addFile(":/img/cert-is-installed-good-48.png", QSize(48, 48), QIcon::Normal, QIcon::Off); |
1209
3815a0d2017b
(issue115) icons, new for cert-to-be* with color.
Bernhard Reiter <bernhard@intevation.de>
parents:
1202
diff
changeset
|
1392 btnIcon.addFile(":/img/cert-to-be-removed-bad-48.png", QSize(48, 48), QIcon::Normal, QIcon::On); |
1106
6f7b7d88f048
(issue115) Rework CertificateListWidgets to have a ToolButton instead of a combobox
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1104
diff
changeset
|
1393 } |
6f7b7d88f048
(issue115) Rework CertificateListWidgets to have a ToolButton instead of a combobox
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1104
diff
changeset
|
1394 actionBtn->setIcon(btnIcon); |
6f7b7d88f048
(issue115) Rework CertificateListWidgets to have a ToolButton instead of a combobox
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1104
diff
changeset
|
1395 mInstallList->addCertificate(cert, state, actionBtn); |
267
89e8783866f8
Use the certificate item delegate in the mainwind list view.
Raimund Renkert <rrenkert@intevation.de>
parents:
265
diff
changeset
|
1396 } |
89e8783866f8
Use the certificate item delegate in the mainwind list view.
Raimund Renkert <rrenkert@intevation.de>
parents:
265
diff
changeset
|
1397 else { |
445
b3721ded6f5b
Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents:
437
diff
changeset
|
1398 oldRemoveCerts.append(cert); |
1234
ad4fc3649ffb
(issue146) Always draw certificate item buttons as unchecked
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1233
diff
changeset
|
1399 CheckLessToolBtn* actionBtn = new CheckLessToolBtn(); |
1106
6f7b7d88f048
(issue115) Rework CertificateListWidgets to have a ToolButton instead of a combobox
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1104
diff
changeset
|
1400 QIcon btnIcon; |
1110
b6cb4fd7ee20
(issue115) Move tooltips into body to make qt tr work
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1109
diff
changeset
|
1401 actionBtn->setProperty("ToolTip_Off", tr("Certificate will be removed.")); |
b6cb4fd7ee20
(issue115) Move tooltips into body to make qt tr work
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1109
diff
changeset
|
1402 actionBtn->setProperty("ToolTip_On", tr("Certificate has not been removed.")); |
1209
3815a0d2017b
(issue115) icons, new for cert-to-be* with color.
Bernhard Reiter <bernhard@intevation.de>
parents:
1202
diff
changeset
|
1403 btnIcon.addFile(":/img/cert-to-be-removed-good-48.png", QSize(48, 48), QIcon::Normal, QIcon::Off); |
1148
6ec64a30fd5f
(issue115) Use updated icons.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1146
diff
changeset
|
1404 btnIcon.addFile(":/img/cert-is-installed-bad-48.png", QSize(48, 48), QIcon::Normal, QIcon::On); |
6ec64a30fd5f
(issue115) Use updated icons.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1146
diff
changeset
|
1405 btnIcon.addFile(":/img/cert-not-installed-good-48.png", QSize(48, 48), QIcon::Disabled, QIcon::Off); |
1106
6f7b7d88f048
(issue115) Rework CertificateListWidgets to have a ToolButton instead of a combobox
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1104
diff
changeset
|
1406 actionBtn->setIcon(btnIcon); |
6f7b7d88f048
(issue115) Rework CertificateListWidgets to have a ToolButton instead of a combobox
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1104
diff
changeset
|
1407 if (state) { |
6f7b7d88f048
(issue115) Rework CertificateListWidgets to have a ToolButton instead of a combobox
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1104
diff
changeset
|
1408 actionBtn->setEnabled(false); |
1110
b6cb4fd7ee20
(issue115) Move tooltips into body to make qt tr work
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1109
diff
changeset
|
1409 actionBtn->setToolTip(tr("Certificate has been removed.")); |
1106
6f7b7d88f048
(issue115) Rework CertificateListWidgets to have a ToolButton instead of a combobox
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1104
diff
changeset
|
1410 } |
6f7b7d88f048
(issue115) Rework CertificateListWidgets to have a ToolButton instead of a combobox
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1104
diff
changeset
|
1411 mRemoveList->addCertificate(cert, state, actionBtn); |
267
89e8783866f8
Use the certificate item delegate in the mainwind list view.
Raimund Renkert <rrenkert@intevation.de>
parents:
265
diff
changeset
|
1412 } |
89e8783866f8
Use the certificate item delegate in the mainwind list view.
Raimund Renkert <rrenkert@intevation.de>
parents:
265
diff
changeset
|
1413 } |
445
b3721ded6f5b
Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents:
437
diff
changeset
|
1414 } |
b3721ded6f5b
Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents:
437
diff
changeset
|
1415 else { |
b3721ded6f5b
Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents:
437
diff
changeset
|
1416 // 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
|
1417 foreach (const Certificate &cert, mListToInstall.getCertificates()) { |
640
626507197360
Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
628
diff
changeset
|
1418 bool state = !mPreviouslyUnselected.contains(cert.base64Line()); |
445
b3721ded6f5b
Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents:
437
diff
changeset
|
1419 if (cert.isInstallCert()) { |
b3721ded6f5b
Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents:
437
diff
changeset
|
1420 // Certificate with status "install". |
b3721ded6f5b
Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents:
437
diff
changeset
|
1421 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
|
1422 // 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
|
1423 oldInstallCerts.append(cert); |
1234
ad4fc3649ffb
(issue146) Always draw certificate item buttons as unchecked
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1233
diff
changeset
|
1424 CheckLessToolBtn* actionBtn = new CheckLessToolBtn(); |
1106
6f7b7d88f048
(issue115) Rework CertificateListWidgets to have a ToolButton instead of a combobox
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1104
diff
changeset
|
1425 QIcon btnIcon; |
1110
b6cb4fd7ee20
(issue115) Move tooltips into body to make qt tr work
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1109
diff
changeset
|
1426 actionBtn->setProperty("ToolTip_Off", tr("Certificate is installed.")); |
b6cb4fd7ee20
(issue115) Move tooltips into body to make qt tr work
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1109
diff
changeset
|
1427 actionBtn->setProperty("ToolTip_On", tr("Certifcate is not installed.")); |
1148
6ec64a30fd5f
(issue115) Use updated icons.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1146
diff
changeset
|
1428 btnIcon.addFile(":/img/cert-is-installed-good-48.png", QSize(48, 48), QIcon::Normal, QIcon::Off); |
6ec64a30fd5f
(issue115) Use updated icons.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1146
diff
changeset
|
1429 btnIcon.addFile(":/img/cert-not-installed-bad-48.png", QSize(48, 48), QIcon::Normal, QIcon::On); |
1106
6f7b7d88f048
(issue115) Rework CertificateListWidgets to have a ToolButton instead of a combobox
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1104
diff
changeset
|
1430 actionBtn->setIcon(btnIcon); |
6f7b7d88f048
(issue115) Rework CertificateListWidgets to have a ToolButton instead of a combobox
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1104
diff
changeset
|
1431 mInstallList->addCertificate(cert, state, actionBtn); |
445
b3721ded6f5b
Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents:
437
diff
changeset
|
1432 } |
b3721ded6f5b
Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents:
437
diff
changeset
|
1433 else { |
b3721ded6f5b
Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents:
437
diff
changeset
|
1434 // 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
|
1435 newInstallCerts.append(cert); |
1234
ad4fc3649ffb
(issue146) Always draw certificate item buttons as unchecked
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1233
diff
changeset
|
1436 CheckLessToolBtn* actionBtn = new CheckLessToolBtn(); |
1106
6f7b7d88f048
(issue115) Rework CertificateListWidgets to have a ToolButton instead of a combobox
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1104
diff
changeset
|
1437 QIcon btnIcon; |
1110
b6cb4fd7ee20
(issue115) Move tooltips into body to make qt tr work
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1109
diff
changeset
|
1438 actionBtn->setProperty("ToolTip_Off", tr("Certificate will be installed.")); |
b6cb4fd7ee20
(issue115) Move tooltips into body to make qt tr work
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1109
diff
changeset
|
1439 actionBtn->setProperty("ToolTip_On", tr("Certificate will not be installed.")); |
1209
3815a0d2017b
(issue115) icons, new for cert-to-be* with color.
Bernhard Reiter <bernhard@intevation.de>
parents:
1202
diff
changeset
|
1440 btnIcon.addFile(":/img/cert-to-be-installed-good-48.png", QSize(48, 48), QIcon::Normal, QIcon::Off); |
1148
6ec64a30fd5f
(issue115) Use updated icons.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1146
diff
changeset
|
1441 btnIcon.addFile(":/img/cert-not-installed-bad-48.png", QSize(48, 48), QIcon::Normal, QIcon::On); |
1106
6f7b7d88f048
(issue115) Rework CertificateListWidgets to have a ToolButton instead of a combobox
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1104
diff
changeset
|
1442 actionBtn->setIcon(btnIcon); |
6f7b7d88f048
(issue115) Rework CertificateListWidgets to have a ToolButton instead of a combobox
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1104
diff
changeset
|
1443 mUpdatesNew->addCertificate(cert, state, actionBtn); |
445
b3721ded6f5b
Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents:
437
diff
changeset
|
1444 } |
267
89e8783866f8
Use the certificate item delegate in the mainwind list view.
Raimund Renkert <rrenkert@intevation.de>
parents:
265
diff
changeset
|
1445 } |
89e8783866f8
Use the certificate item delegate in the mainwind list view.
Raimund Renkert <rrenkert@intevation.de>
parents:
265
diff
changeset
|
1446 else { |
445
b3721ded6f5b
Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents:
437
diff
changeset
|
1447 // Certificate with status "remove". |
b3721ded6f5b
Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents:
437
diff
changeset
|
1448 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
|
1449 // 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
|
1450 oldRemoveCerts.append(cert); |
640
626507197360
Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
628
diff
changeset
|
1451 // Is removed, so set editable to false. |
1234
ad4fc3649ffb
(issue146) Always draw certificate item buttons as unchecked
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1233
diff
changeset
|
1452 CheckLessToolBtn* actionBtn = new CheckLessToolBtn(); |
1106
6f7b7d88f048
(issue115) Rework CertificateListWidgets to have a ToolButton instead of a combobox
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1104
diff
changeset
|
1453 QIcon btnIcon; |
1110
b6cb4fd7ee20
(issue115) Move tooltips into body to make qt tr work
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1109
diff
changeset
|
1454 actionBtn->setProperty("ToolTip_Off", tr("Certificate will be removed.")); |
b6cb4fd7ee20
(issue115) Move tooltips into body to make qt tr work
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1109
diff
changeset
|
1455 actionBtn->setProperty("ToolTip_On", tr("Certificate has not been removed.")); |
1209
3815a0d2017b
(issue115) icons, new for cert-to-be* with color.
Bernhard Reiter <bernhard@intevation.de>
parents:
1202
diff
changeset
|
1456 btnIcon.addFile(":/img/cert-to-be-removed-good-48.png", QSize(48, 48), QIcon::Normal, QIcon::Off); |
1148
6ec64a30fd5f
(issue115) Use updated icons.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1146
diff
changeset
|
1457 btnIcon.addFile(":/img/cert-is-installed-bad-48.png", QSize(48, 48), QIcon::Normal, QIcon::On); |
6ec64a30fd5f
(issue115) Use updated icons.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1146
diff
changeset
|
1458 btnIcon.addFile(":/img/cert-not-installed-good-48.png", QSize(48, 48), QIcon::Disabled, QIcon::Off); |
1106
6f7b7d88f048
(issue115) Rework CertificateListWidgets to have a ToolButton instead of a combobox
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1104
diff
changeset
|
1459 actionBtn->setIcon(btnIcon); |
6f7b7d88f048
(issue115) Rework CertificateListWidgets to have a ToolButton instead of a combobox
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1104
diff
changeset
|
1460 if (state) { |
6f7b7d88f048
(issue115) Rework CertificateListWidgets to have a ToolButton instead of a combobox
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1104
diff
changeset
|
1461 actionBtn->setEnabled(false); |
1110
b6cb4fd7ee20
(issue115) Move tooltips into body to make qt tr work
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1109
diff
changeset
|
1462 actionBtn->setToolTip(tr("Certificate has been removed.")); |
1106
6f7b7d88f048
(issue115) Rework CertificateListWidgets to have a ToolButton instead of a combobox
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1104
diff
changeset
|
1463 } |
6f7b7d88f048
(issue115) Rework CertificateListWidgets to have a ToolButton instead of a combobox
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1104
diff
changeset
|
1464 mRemoveList->addCertificate(cert, state, actionBtn); |
445
b3721ded6f5b
Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents:
437
diff
changeset
|
1465 } |
b3721ded6f5b
Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents:
437
diff
changeset
|
1466 else { |
b3721ded6f5b
Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents:
437
diff
changeset
|
1467 // 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
|
1468 // status "remove". |
b3721ded6f5b
Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents:
437
diff
changeset
|
1469 newRemoveCerts.append(cert); |
1234
ad4fc3649ffb
(issue146) Always draw certificate item buttons as unchecked
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1233
diff
changeset
|
1470 CheckLessToolBtn* actionBtn = new CheckLessToolBtn(); |
1106
6f7b7d88f048
(issue115) Rework CertificateListWidgets to have a ToolButton instead of a combobox
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1104
diff
changeset
|
1471 QIcon btnIcon; |
1110
b6cb4fd7ee20
(issue115) Move tooltips into body to make qt tr work
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1109
diff
changeset
|
1472 actionBtn->setProperty("ToolTip_Off", tr("Certificate will be removed.")); |
b6cb4fd7ee20
(issue115) Move tooltips into body to make qt tr work
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1109
diff
changeset
|
1473 actionBtn->setProperty("ToolTip_On", tr("Certificate will not be removed.")); |
1209
3815a0d2017b
(issue115) icons, new for cert-to-be* with color.
Bernhard Reiter <bernhard@intevation.de>
parents:
1202
diff
changeset
|
1474 btnIcon.addFile(":/img/cert-to-be-removed-good-48.png", QSize(48, 48), QIcon::Normal, QIcon::Off); |
1148
6ec64a30fd5f
(issue115) Use updated icons.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1146
diff
changeset
|
1475 btnIcon.addFile(":/img/cert-is-installed-bad-48.png", QSize(48, 48), QIcon::Normal, QIcon::On); |
1106
6f7b7d88f048
(issue115) Rework CertificateListWidgets to have a ToolButton instead of a combobox
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1104
diff
changeset
|
1476 actionBtn->setIcon(btnIcon); |
6f7b7d88f048
(issue115) Rework CertificateListWidgets to have a ToolButton instead of a combobox
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1104
diff
changeset
|
1477 mUpdatesRemove->addCertificate(cert, state, actionBtn); |
445
b3721ded6f5b
Sort and filter the certificate list, changed certificate item roles.
Raimund Renkert <rrenkert@intevation.de>
parents:
437
diff
changeset
|
1478 } |
267
89e8783866f8
Use the certificate item delegate in the mainwind list view.
Raimund Renkert <rrenkert@intevation.de>
parents:
265
diff
changeset
|
1479 } |
89e8783866f8
Use the certificate item delegate in the mainwind list view.
Raimund Renkert <rrenkert@intevation.de>
parents:
265
diff
changeset
|
1480 } |
691
315103410002
(Issue 32) Move updates header text generation out of update avialable block
Andre Heinecke <andre.heinecke@intevation.de>
parents:
690
diff
changeset
|
1481 } |
692
3791a277f00b
Remove code duplication and calculate headers only in listchanged
Andre Heinecke <andre.heinecke@intevation.de>
parents:
691
diff
changeset
|
1482 |
3791a277f00b
Remove code duplication and calculate headers only in listchanged
Andre Heinecke <andre.heinecke@intevation.de>
parents:
691
diff
changeset
|
1483 listChanged(0); |
1233
7da9ec20eae4
(issue148) Disable UI Updates while loading the list.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1232
diff
changeset
|
1484 setUpdatesEnabled(true); |
271
1ae15ea73850
Some GUI desing and layout changes.
Raimund Renkert <rrenkert@intevation.de>
parents:
267
diff
changeset
|
1485 } |
365
75f7288ad67b
Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents:
274
diff
changeset
|
1486 |
75f7288ad67b
Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents:
274
diff
changeset
|
1487 void MainWindow::installerError(const QString& errMsg) { |
75f7288ad67b
Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents:
274
diff
changeset
|
1488 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
|
1489 } |
75f7288ad67b
Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents:
274
diff
changeset
|
1490 |
389
3be838c3e4d8
Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
375
diff
changeset
|
1491 void MainWindow::installerSuccess() { |
997
405c97ca4ab0
Save installation success independet of state.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
996
diff
changeset
|
1492 if (mCurState == NewListAvailable ) { |
389
3be838c3e4d8
Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
375
diff
changeset
|
1493 mCurState = NothingChanged; |
3be838c3e4d8
Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
375
diff
changeset
|
1494 mCurMessage = QString(); |
997
405c97ca4ab0
Save installation success independet of state.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
996
diff
changeset
|
1495 } |
389
3be838c3e4d8
Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
375
diff
changeset
|
1496 |
997
405c97ca4ab0
Save installation success independet of state.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
996
diff
changeset
|
1497 QString listFileName = mSettings.value("List/available").toString(); |
405c97ca4ab0
Save installation success independet of state.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
996
diff
changeset
|
1498 QDateTime listFileDate = mSettings.value("List/availableDate").toDateTime(); |
405c97ca4ab0
Save installation success independet of state.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
996
diff
changeset
|
1499 if (!listFileName.isEmpty() && listFileDate.isValid()) { |
389
3be838c3e4d8
Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
375
diff
changeset
|
1500 mSettings.remove("List/available"); |
3be838c3e4d8
Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
375
diff
changeset
|
1501 mSettings.remove("List/availableDate"); |
3be838c3e4d8
Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
375
diff
changeset
|
1502 |
857
9bab4fc3a1fe
Delete old lists and rename the currently installed list to list-installed.txt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
845
diff
changeset
|
1503 /* Rename the installed list to list-installed.txt so that external |
9bab4fc3a1fe
Delete old lists and rename the currently installed list to list-installed.txt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
845
diff
changeset
|
1504 * programs (like the uninstaller can easily recognize it). */ |
9bab4fc3a1fe
Delete old lists and rename the currently installed list to list-installed.txt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
845
diff
changeset
|
1505 QString dataLoc = |
9bab4fc3a1fe
Delete old lists and rename the currently installed list to list-installed.txt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
845
diff
changeset
|
1506 QStandardPaths::writableLocation(QStandardPaths::DataLocation); |
9bab4fc3a1fe
Delete old lists and rename the currently installed list to list-installed.txt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
845
diff
changeset
|
1507 QDir dataDir(dataLoc); |
9bab4fc3a1fe
Delete old lists and rename the currently installed list to list-installed.txt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
845
diff
changeset
|
1508 if (!dataDir.exists()) { |
9bab4fc3a1fe
Delete old lists and rename the currently installed list to list-installed.txt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
845
diff
changeset
|
1509 /* Should not happen */ |
9bab4fc3a1fe
Delete old lists and rename the currently installed list to list-installed.txt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
845
diff
changeset
|
1510 qWarning() << "Data dir removed."; |
9bab4fc3a1fe
Delete old lists and rename the currently installed list to list-installed.txt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
845
diff
changeset
|
1511 return; |
9bab4fc3a1fe
Delete old lists and rename the currently installed list to list-installed.txt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
845
diff
changeset
|
1512 } |
389
3be838c3e4d8
Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
375
diff
changeset
|
1513 |
857
9bab4fc3a1fe
Delete old lists and rename the currently installed list to list-installed.txt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
845
diff
changeset
|
1514 QFileInfo oldList (dataDir.absoluteFilePath("list-installed.txt")); |
9bab4fc3a1fe
Delete old lists and rename the currently installed list to list-installed.txt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
845
diff
changeset
|
1515 if (oldList.exists()) { |
9bab4fc3a1fe
Delete old lists and rename the currently installed list to list-installed.txt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
845
diff
changeset
|
1516 qDebug() << "Removing old list: " << oldList.filePath(); |
9bab4fc3a1fe
Delete old lists and rename the currently installed list to list-installed.txt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
845
diff
changeset
|
1517 if (!QFile::remove(oldList.filePath())) { |
9bab4fc3a1fe
Delete old lists and rename the currently installed list to list-installed.txt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
845
diff
changeset
|
1518 qWarning() << "Removal of old list failed."; |
9bab4fc3a1fe
Delete old lists and rename the currently installed list to list-installed.txt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
845
diff
changeset
|
1519 return; |
9bab4fc3a1fe
Delete old lists and rename the currently installed list to list-installed.txt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
845
diff
changeset
|
1520 } |
9bab4fc3a1fe
Delete old lists and rename the currently installed list to list-installed.txt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
845
diff
changeset
|
1521 } |
9bab4fc3a1fe
Delete old lists and rename the currently installed list to list-installed.txt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
845
diff
changeset
|
1522 QFile newList(listFileName); |
9bab4fc3a1fe
Delete old lists and rename the currently installed list to list-installed.txt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
845
diff
changeset
|
1523 if (!newList.rename(oldList.filePath())) { |
9bab4fc3a1fe
Delete old lists and rename the currently installed list to list-installed.txt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
845
diff
changeset
|
1524 qWarning() << "Failed to rename new list."; |
9bab4fc3a1fe
Delete old lists and rename the currently installed list to list-installed.txt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
845
diff
changeset
|
1525 return; |
9bab4fc3a1fe
Delete old lists and rename the currently installed list to list-installed.txt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
845
diff
changeset
|
1526 } |
9bab4fc3a1fe
Delete old lists and rename the currently installed list to list-installed.txt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
845
diff
changeset
|
1527 |
9bab4fc3a1fe
Delete old lists and rename the currently installed list to list-installed.txt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
845
diff
changeset
|
1528 mSettings.setValue("List/installed", oldList.filePath()); |
389
3be838c3e4d8
Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
375
diff
changeset
|
1529 mSettings.setValue("List/installedDate", listFileDate); |
857
9bab4fc3a1fe
Delete old lists and rename the currently installed list to list-installed.txt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
845
diff
changeset
|
1530 mInstalledList = CertificateList(oldList.filePath().toUtf8().constData()); |
9bab4fc3a1fe
Delete old lists and rename the currently installed list to list-installed.txt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
845
diff
changeset
|
1531 if (!mInstalledList.isValid()) { |
9bab4fc3a1fe
Delete old lists and rename the currently installed list to list-installed.txt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
845
diff
changeset
|
1532 /* Something went wrong. Go back to square one. */ |
9bab4fc3a1fe
Delete old lists and rename the currently installed list to list-installed.txt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
845
diff
changeset
|
1533 qWarning () << "List corrupted after installation"; |
9bab4fc3a1fe
Delete old lists and rename the currently installed list to list-installed.txt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
845
diff
changeset
|
1534 mInstalledList = CertificateList(); |
9bab4fc3a1fe
Delete old lists and rename the currently installed list to list-installed.txt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
845
diff
changeset
|
1535 QFile::remove(oldList.filePath()); |
9bab4fc3a1fe
Delete old lists and rename the currently installed list to list-installed.txt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
845
diff
changeset
|
1536 mSettings.remove("List/installed"); |
9bab4fc3a1fe
Delete old lists and rename the currently installed list to list-installed.txt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
845
diff
changeset
|
1537 mSettings.remove("List/installedDate"); |
9bab4fc3a1fe
Delete old lists and rename the currently installed list to list-installed.txt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
845
diff
changeset
|
1538 } |
389
3be838c3e4d8
Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
375
diff
changeset
|
1539 } |
997
405c97ca4ab0
Save installation success independet of state.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
996
diff
changeset
|
1540 mListToInstall = CertificateList(); |
684
69def231f5ac
(issue28) clear manual updates after installation.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
673
diff
changeset
|
1541 mUpdatesManual->clear(); |
628
3a9c0f38bbad
Made certificate lists member of mainwindow and added some temporary debug msgs.
Raimund Renkert <rrenkert@intevation.de>
parents:
584
diff
changeset
|
1542 loadCertificateList(); |
389
3be838c3e4d8
Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
375
diff
changeset
|
1543 } |
3be838c3e4d8
Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
375
diff
changeset
|
1544 |
365
75f7288ad67b
Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents:
274
diff
changeset
|
1545 void MainWindow::installCerts() { |
75f7288ad67b
Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents:
274
diff
changeset
|
1546 QStringList choices; |
640
626507197360
Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
628
diff
changeset
|
1547 QStringList unselected; |
365
75f7288ad67b
Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents:
274
diff
changeset
|
1548 |
640
626507197360
Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
628
diff
changeset
|
1549 choices << mUpdatesNew->selectedCertificates(); |
626507197360
Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
628
diff
changeset
|
1550 choices << mUpdatesRemove->selectedCertificates(); |
626507197360
Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
628
diff
changeset
|
1551 |
1308
fce8c122cbc4
(issue165) Invert manual states. Manual changes are inverted as the action should be the opposite of
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1292
diff
changeset
|
1552 choices << mUpdatesManual->unselectedCertificates(); |
669
7147550ee15d
Always include previous certificates in choices for the installer
Andre Heinecke <andre.heinecke@intevation.de>
parents:
664
diff
changeset
|
1553 |
7147550ee15d
Always include previous certificates in choices for the installer
Andre Heinecke <andre.heinecke@intevation.de>
parents:
664
diff
changeset
|
1554 /* Also include the old certificates */ |
7147550ee15d
Always include previous certificates in choices for the installer
Andre Heinecke <andre.heinecke@intevation.de>
parents:
664
diff
changeset
|
1555 choices << mInstallList->selectedCertificates(); |
7147550ee15d
Always include previous certificates in choices for the installer
Andre Heinecke <andre.heinecke@intevation.de>
parents:
664
diff
changeset
|
1556 choices << mRemoveList->selectedCertificates(); |
7147550ee15d
Always include previous certificates in choices for the installer
Andre Heinecke <andre.heinecke@intevation.de>
parents:
664
diff
changeset
|
1557 |
1308
fce8c122cbc4
(issue165) Invert manual states. Manual changes are inverted as the action should be the opposite of
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1292
diff
changeset
|
1558 QStringList selectedManuals = mUpdatesManual->selectedCertificates(); |
fce8c122cbc4
(issue165) Invert manual states. Manual changes are inverted as the action should be the opposite of
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1292
diff
changeset
|
1559 for(int i = 0; i < selectedManuals.size(); i++) { |
fce8c122cbc4
(issue165) Invert manual states. Manual changes are inverted as the action should be the opposite of
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1292
diff
changeset
|
1560 if (selectedManuals.at(i).startsWith("I:")) { |
fce8c122cbc4
(issue165) Invert manual states. Manual changes are inverted as the action should be the opposite of
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1292
diff
changeset
|
1561 QString certLine = selectedManuals.at(i); |
640
626507197360
Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
628
diff
changeset
|
1562 certLine[0] = 'R'; |
626507197360
Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
628
diff
changeset
|
1563 choices << certLine; |
626507197360
Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
628
diff
changeset
|
1564 } |
626507197360
Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
628
diff
changeset
|
1565 } |
626507197360
Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
628
diff
changeset
|
1566 |
626507197360
Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
628
diff
changeset
|
1567 unselected << mUpdatesNew->unselectedCertificates(); |
626507197360
Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
628
diff
changeset
|
1568 unselected << mUpdatesRemove->unselectedCertificates(); |
626507197360
Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
628
diff
changeset
|
1569 unselected << mInstallList->unselectedCertificates(); |
626507197360
Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
628
diff
changeset
|
1570 unselected << mRemoveList->unselectedCertificates(); |
628
3a9c0f38bbad
Made certificate lists member of mainwindow and added some temporary debug msgs.
Raimund Renkert <rrenkert@intevation.de>
parents:
584
diff
changeset
|
1571 |
918
e5fd2d0cf42f
(issue63) Add warning message when installation is not as admin
Andre Heinecke <andre.heinecke@intevation.de>
parents:
904
diff
changeset
|
1572 #ifdef Q_OS_WIN |
1003
db7e7156c824
(issue66) Only depend on is_system_install on windows to decide privilege raise
Andre Heinecke <andre.heinecke@intevation.de>
parents:
997
diff
changeset
|
1573 if (!is_system_install()) { |
db7e7156c824
(issue66) Only depend on is_system_install on windows to decide privilege raise
Andre Heinecke <andre.heinecke@intevation.de>
parents:
997
diff
changeset
|
1574 QMessageBox::warning(this, |
926
ca997bc0f790
(issue63) Updated message box text for normal user.
Emanuel Schuetze <emanuel@intevation.de>
parents:
918
diff
changeset
|
1575 tr("Installation with standard user account"), |
1006
6aa115b206df
Updated translations.
Emanuel Schuetze <emanuel@intevation.de>
parents:
1003
diff
changeset
|
1576 tr("Windows will now ask you to confirm each root certificate modification " |
926
ca997bc0f790
(issue63) Updated message box text for normal user.
Emanuel Schuetze <emanuel@intevation.de>
parents:
918
diff
changeset
|
1577 "because TrustBridge does not have the necessary privileges to install " |
ca997bc0f790
(issue63) Updated message box text for normal user.
Emanuel Schuetze <emanuel@intevation.de>
parents:
918
diff
changeset
|
1578 "root certificates into the Windows certificate store silently.")); |
918
e5fd2d0cf42f
(issue63) Add warning message when installation is not as admin
Andre Heinecke <andre.heinecke@intevation.de>
parents:
904
diff
changeset
|
1579 } |
e5fd2d0cf42f
(issue63) Add warning message when installation is not as admin
Andre Heinecke <andre.heinecke@intevation.de>
parents:
904
diff
changeset
|
1580 #endif |
e5fd2d0cf42f
(issue63) Add warning message when installation is not as admin
Andre Heinecke <andre.heinecke@intevation.de>
parents:
904
diff
changeset
|
1581 |
365
75f7288ad67b
Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents:
274
diff
changeset
|
1582 QProgressDialog *progress = new QProgressDialog(this); |
75f7288ad67b
Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents:
274
diff
changeset
|
1583 progress->setWindowModality(Qt::WindowModal); |
75f7288ad67b
Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents:
274
diff
changeset
|
1584 progress->setLabelText(tr("Installing certificates...")); |
75f7288ad67b
Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents:
274
diff
changeset
|
1585 progress->setCancelButton(0); |
75f7288ad67b
Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents:
274
diff
changeset
|
1586 progress->setRange(0,0); |
75f7288ad67b
Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents:
274
diff
changeset
|
1587 progress->setMinimumDuration(0); |
75f7288ad67b
Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents:
274
diff
changeset
|
1588 progress->show(); |
75f7288ad67b
Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents:
274
diff
changeset
|
1589 |
1082
a12e6172d82c
Extend logging to all choices and SW updates.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1081
diff
changeset
|
1590 CertificateList *instList = mListToInstall.isValid() ? |
a12e6172d82c
Extend logging to all choices and SW updates.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1081
diff
changeset
|
1591 &mListToInstall : |
a12e6172d82c
Extend logging to all choices and SW updates.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1081
diff
changeset
|
1592 &mInstalledList; |
a12e6172d82c
Extend logging to all choices and SW updates.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1081
diff
changeset
|
1593 |
365
75f7288ad67b
Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents:
274
diff
changeset
|
1594 InstallWrapper *instWrap = new InstallWrapper(this, |
1082
a12e6172d82c
Extend logging to all choices and SW updates.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1081
diff
changeset
|
1595 instList->fileName(), |
365
75f7288ad67b
Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents:
274
diff
changeset
|
1596 choices); |
1082
a12e6172d82c
Extend logging to all choices and SW updates.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1081
diff
changeset
|
1597 |
a12e6172d82c
Extend logging to all choices and SW updates.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1081
diff
changeset
|
1598 syslog_info_printf ("Installing certificate list: '%s' Version '%s'\n", |
a12e6172d82c
Extend logging to all choices and SW updates.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1081
diff
changeset
|
1599 instList->fileName().toUtf8().constData(), |
a12e6172d82c
Extend logging to all choices and SW updates.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1081
diff
changeset
|
1600 instList->date().toString().toUtf8().constData()); |
365
75f7288ad67b
Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents:
274
diff
changeset
|
1601 /* Clean up object and progress dialog */ |
75f7288ad67b
Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents:
274
diff
changeset
|
1602 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
|
1603 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
|
1604 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
|
1605 connect(instWrap, SIGNAL(installationSuccessful()), |
3be838c3e4d8
Handle installation success. Save / load last installed list.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
375
diff
changeset
|
1606 this, SLOT(installerSuccess())); |
365
75f7288ad67b
Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents:
274
diff
changeset
|
1607 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
|
1608 this, SLOT(installerError(const QString &))); |
365
75f7288ad67b
Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents:
274
diff
changeset
|
1609 instWrap->start(); |
640
626507197360
Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
628
diff
changeset
|
1610 |
626507197360
Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
628
diff
changeset
|
1611 if (!saveUnselectedCertificates(unselected)) { |
372
6cc124e79066
Add save/load unselected and add role enumerator
Andre Heinecke <andre.heinecke@intevation.de>
parents:
365
diff
changeset
|
1612 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
|
1613 } |
640
626507197360
Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
628
diff
changeset
|
1614 |
365
75f7288ad67b
Switch from listupdatedialog to installwrapper. Minor UI improvements
Andre Heinecke <aheinecke@intevation.de>
parents:
274
diff
changeset
|
1615 } |
372
6cc124e79066
Add save/load unselected and add role enumerator
Andre Heinecke <andre.heinecke@intevation.de>
parents:
365
diff
changeset
|
1616 |
6cc124e79066
Add save/load unselected and add role enumerator
Andre Heinecke <andre.heinecke@intevation.de>
parents:
365
diff
changeset
|
1617 void MainWindow::loadUnselectedCertificates() |
6cc124e79066
Add save/load unselected and add role enumerator
Andre Heinecke <andre.heinecke@intevation.de>
parents:
365
diff
changeset
|
1618 { |
6cc124e79066
Add save/load unselected and add role enumerator
Andre Heinecke <andre.heinecke@intevation.de>
parents:
365
diff
changeset
|
1619 mPreviouslyUnselected.clear(); |
6cc124e79066
Add save/load unselected and add role enumerator
Andre Heinecke <andre.heinecke@intevation.de>
parents:
365
diff
changeset
|
1620 mSettings.beginGroup("unselected"); |
6cc124e79066
Add save/load unselected and add role enumerator
Andre Heinecke <andre.heinecke@intevation.de>
parents:
365
diff
changeset
|
1621 QStringList keys = mSettings.allKeys(); |
6cc124e79066
Add save/load unselected and add role enumerator
Andre Heinecke <andre.heinecke@intevation.de>
parents:
365
diff
changeset
|
1622 foreach (const QString &key, keys) { |
6cc124e79066
Add save/load unselected and add role enumerator
Andre Heinecke <andre.heinecke@intevation.de>
parents:
365
diff
changeset
|
1623 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
|
1624 } |
6cc124e79066
Add save/load unselected and add role enumerator
Andre Heinecke <andre.heinecke@intevation.de>
parents:
365
diff
changeset
|
1625 mSettings.endGroup(); |
6cc124e79066
Add save/load unselected and add role enumerator
Andre Heinecke <andre.heinecke@intevation.de>
parents:
365
diff
changeset
|
1626 } |
6cc124e79066
Add save/load unselected and add role enumerator
Andre Heinecke <andre.heinecke@intevation.de>
parents:
365
diff
changeset
|
1627 |
640
626507197360
Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
628
diff
changeset
|
1628 bool MainWindow::saveUnselectedCertificates(QStringList unselected) |
372
6cc124e79066
Add save/load unselected and add role enumerator
Andre Heinecke <andre.heinecke@intevation.de>
parents:
365
diff
changeset
|
1629 { |
479
a8d56a2846a8
Fill the internal list of previously unselcted certificates when saving in settings.
Raimund Renkert <rrenkert@intevation.de>
parents:
461
diff
changeset
|
1630 mPreviouslyUnselected.clear(); |
372
6cc124e79066
Add save/load unselected and add role enumerator
Andre Heinecke <andre.heinecke@intevation.de>
parents:
365
diff
changeset
|
1631 mSettings.beginGroup("unselected"); |
6cc124e79066
Add save/load unselected and add role enumerator
Andre Heinecke <andre.heinecke@intevation.de>
parents:
365
diff
changeset
|
1632 mSettings.remove(""); /* Clears old choices */ |
640
626507197360
Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
628
diff
changeset
|
1633 for (int i = 0; i < unselected.size(); i++) { |
626507197360
Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
628
diff
changeset
|
1634 QString key = QString::fromLatin1("cert%1").arg(i); |
626507197360
Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
628
diff
changeset
|
1635 QString value = unselected.at(i); |
626507197360
Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
628
diff
changeset
|
1636 mSettings.setValue(key, value); |
626507197360
Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
628
diff
changeset
|
1637 mPreviouslyUnselected << value; |
372
6cc124e79066
Add save/load unselected and add role enumerator
Andre Heinecke <andre.heinecke@intevation.de>
parents:
365
diff
changeset
|
1638 } |
6cc124e79066
Add save/load unselected and add role enumerator
Andre Heinecke <andre.heinecke@intevation.de>
parents:
365
diff
changeset
|
1639 mSettings.endGroup(); |
6cc124e79066
Add save/load unselected and add role enumerator
Andre Heinecke <andre.heinecke@intevation.de>
parents:
365
diff
changeset
|
1640 mSettings.sync(); |
6cc124e79066
Add save/load unselected and add role enumerator
Andre Heinecke <andre.heinecke@intevation.de>
parents:
365
diff
changeset
|
1641 return mSettings.status() == QSettings::NoError; |
6cc124e79066
Add save/load unselected and add role enumerator
Andre Heinecke <andre.heinecke@intevation.de>
parents:
365
diff
changeset
|
1642 } |
447
b1b14daf2116
Save the select state of certificate items when closing the app.
Raimund Renkert <rrenkert@intevation.de>
parents:
446
diff
changeset
|
1643 |
640
626507197360
Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
628
diff
changeset
|
1644 void MainWindow::toggleInManual(bool state, const Certificate &cert) |
626507197360
Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
628
diff
changeset
|
1645 { |
626507197360
Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
628
diff
changeset
|
1646 if (!mUpdatesManual->contains(cert)) { |
1106
6f7b7d88f048
(issue115) Rework CertificateListWidgets to have a ToolButton instead of a combobox
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1104
diff
changeset
|
1647 QToolButton* actionBtn = new QToolButton(); |
6f7b7d88f048
(issue115) Rework CertificateListWidgets to have a ToolButton instead of a combobox
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1104
diff
changeset
|
1648 QIcon btnIcon; |
1201
9bdce8d6fd43
(issue144) Handle removal certificates differently in manual changes.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1162
diff
changeset
|
1649 if (mRemoveList->contains(cert)) { |
1209
3815a0d2017b
(issue115) icons, new for cert-to-be* with color.
Bernhard Reiter <bernhard@intevation.de>
parents:
1202
diff
changeset
|
1650 btnIcon.addFile(":/img/cert-to-be-removed-good-48.png", QSize(48, 48), QIcon::Normal, QIcon::On); |
1201
9bdce8d6fd43
(issue144) Handle removal certificates differently in manual changes.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1162
diff
changeset
|
1651 btnIcon.addFile(":/img/cert-is-installed-bad-48.png", QSize(48, 48), QIcon::Normal, QIcon::Off); |
9bdce8d6fd43
(issue144) Handle removal certificates differently in manual changes.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1162
diff
changeset
|
1652 actionBtn->setProperty("ToolTip_On", tr("Certificate will be removed.")); |
9bdce8d6fd43
(issue144) Handle removal certificates differently in manual changes.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1162
diff
changeset
|
1653 /* Off should never be possible here |
9bdce8d6fd43
(issue144) Handle removal certificates differently in manual changes.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1162
diff
changeset
|
1654 * As the manual change of removed certificates is disabled */ |
9bdce8d6fd43
(issue144) Handle removal certificates differently in manual changes.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1162
diff
changeset
|
1655 actionBtn->setProperty("ToolTip_Off", tr("Certificate will not be removed.")); |
9bdce8d6fd43
(issue144) Handle removal certificates differently in manual changes.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1162
diff
changeset
|
1656 } else { |
1209
3815a0d2017b
(issue115) icons, new for cert-to-be* with color.
Bernhard Reiter <bernhard@intevation.de>
parents:
1202
diff
changeset
|
1657 btnIcon.addFile(":/img/cert-to-be-installed-good-48.png", QSize(48, 48), QIcon::Normal, QIcon::On); |
3815a0d2017b
(issue115) icons, new for cert-to-be* with color.
Bernhard Reiter <bernhard@intevation.de>
parents:
1202
diff
changeset
|
1658 btnIcon.addFile(":/img/cert-to-be-removed-bad-48.png", QSize(48, 48), QIcon::Normal, QIcon::Off); |
1201
9bdce8d6fd43
(issue144) Handle removal certificates differently in manual changes.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1162
diff
changeset
|
1659 actionBtn->setProperty("ToolTip_On", tr("Certificate will be installed.")); |
9bdce8d6fd43
(issue144) Handle removal certificates differently in manual changes.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1162
diff
changeset
|
1660 actionBtn->setProperty("ToolTip_Off", tr("Certificate will be removed.")); |
9bdce8d6fd43
(issue144) Handle removal certificates differently in manual changes.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1162
diff
changeset
|
1661 } |
1106
6f7b7d88f048
(issue115) Rework CertificateListWidgets to have a ToolButton instead of a combobox
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1104
diff
changeset
|
1662 actionBtn->setIcon(btnIcon); |
6f7b7d88f048
(issue115) Rework CertificateListWidgets to have a ToolButton instead of a combobox
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1104
diff
changeset
|
1663 mUpdatesManual->addCertificate(cert, state, actionBtn); |
640
626507197360
Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
628
diff
changeset
|
1664 } |
626507197360
Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
628
diff
changeset
|
1665 else { |
1107
51d3b361f17a
Revert commit 1102
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1106
diff
changeset
|
1666 mUpdatesManual->removeCertificate(cert); |
640
626507197360
Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
628
diff
changeset
|
1667 } |
626507197360
Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
628
diff
changeset
|
1668 } |
626507197360
Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
628
diff
changeset
|
1669 |
626507197360
Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
628
diff
changeset
|
1670 void MainWindow::removeFromManual(bool state, const Certificate &cert) |
626507197360
Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
628
diff
changeset
|
1671 { |
1107
51d3b361f17a
Revert commit 1102
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1106
diff
changeset
|
1672 mUpdatesManual->removeCertificate(cert); |
640
626507197360
Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
628
diff
changeset
|
1673 |
626507197360
Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
628
diff
changeset
|
1674 if (cert.isInstallCert()) { |
626507197360
Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
628
diff
changeset
|
1675 mInstallList->setCertState(state, cert); |
626507197360
Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
628
diff
changeset
|
1676 } |
626507197360
Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
628
diff
changeset
|
1677 else { |
626507197360
Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
628
diff
changeset
|
1678 mRemoveList->setCertState(state, cert); |
626507197360
Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
628
diff
changeset
|
1679 } |
626507197360
Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
628
diff
changeset
|
1680 } |
626507197360
Updated mainwindow and handle certificate lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
628
diff
changeset
|
1681 |
447
b1b14daf2116
Save the select state of certificate items when closing the app.
Raimund Renkert <rrenkert@intevation.de>
parents:
446
diff
changeset
|
1682 void MainWindow::closeApp() |
b1b14daf2116
Save the select state of certificate items when closing the app.
Raimund Renkert <rrenkert@intevation.de>
parents:
446
diff
changeset
|
1683 { |
782
20ca94680003
Implemented detection of running instance on linux using a lock file.
Sascha Wilde <wilde@intevation.de>
parents:
754
diff
changeset
|
1684 ProcessHelp::cleanUp(); |
447
b1b14daf2116
Save the select state of certificate items when closing the app.
Raimund Renkert <rrenkert@intevation.de>
parents:
446
diff
changeset
|
1685 qApp->quit(); |
b1b14daf2116
Save the select state of certificate items when closing the app.
Raimund Renkert <rrenkert@intevation.de>
parents:
446
diff
changeset
|
1686 } |
584
ebfe1128ee97
Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents:
563
diff
changeset
|
1687 |
609
292c590ba9cb
Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents:
607
diff
changeset
|
1688 void MainWindow::checkAndInstallCerts() |
292c590ba9cb
Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents:
607
diff
changeset
|
1689 { |
1246
8748223990eb
(issue39) Show generic warning on installation for firefox/thunderbird instances
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1236
diff
changeset
|
1690 #ifdef WIN32 |
609
292c590ba9cb
Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents:
607
diff
changeset
|
1691 /* Checking before opening the dialog should be cheaper */ |
292c590ba9cb
Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents:
607
diff
changeset
|
1692 QList<int> pids = ProcessHelp::getProcessesIdForName("firefox"); |
292c590ba9cb
Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents:
607
diff
changeset
|
1693 pids.append(ProcessHelp::getProcessesIdForName("thunderbird")); |
292c590ba9cb
Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents:
607
diff
changeset
|
1694 |
292c590ba9cb
Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents:
607
diff
changeset
|
1695 if (pids.isEmpty()) { |
292c590ba9cb
Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents:
607
diff
changeset
|
1696 installCerts(); |
292c590ba9cb
Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents:
607
diff
changeset
|
1697 return; |
292c590ba9cb
Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents:
607
diff
changeset
|
1698 } |
292c590ba9cb
Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents:
607
diff
changeset
|
1699 |
292c590ba9cb
Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents:
607
diff
changeset
|
1700 QStringList pNames; |
292c590ba9cb
Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents:
607
diff
changeset
|
1701 pNames << "firefox" << "thunderbird"; |
292c590ba9cb
Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents:
607
diff
changeset
|
1702 |
292c590ba9cb
Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents:
607
diff
changeset
|
1703 ProcessWaitDialog *waitDialog = new ProcessWaitDialog(this, pNames); |
292c590ba9cb
Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents:
607
diff
changeset
|
1704 |
292c590ba9cb
Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents:
607
diff
changeset
|
1705 connect(waitDialog, SIGNAL(accepted()), this, SLOT(installCerts())); |
292c590ba9cb
Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents:
607
diff
changeset
|
1706 connect(waitDialog, SIGNAL(accepted()), waitDialog, SLOT(deleteLater())); |
292c590ba9cb
Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents:
607
diff
changeset
|
1707 |
292c590ba9cb
Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents:
607
diff
changeset
|
1708 waitDialog->exec(); |
292c590ba9cb
Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents:
607
diff
changeset
|
1709 return; |
1246
8748223990eb
(issue39) Show generic warning on installation for firefox/thunderbird instances
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1236
diff
changeset
|
1710 #else |
8748223990eb
(issue39) Show generic warning on installation for firefox/thunderbird instances
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1236
diff
changeset
|
1711 /* On GNU Linux finding all firefox / thunderbird instances which |
8748223990eb
(issue39) Show generic warning on installation for firefox/thunderbird instances
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1236
diff
changeset
|
1712 * could be found on the filesystem is more difficult. So |
8748223990eb
(issue39) Show generic warning on installation for firefox/thunderbird instances
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1236
diff
changeset
|
1713 * for now we just show a generic warning dialog. */ |
8748223990eb
(issue39) Show generic warning on installation for firefox/thunderbird instances
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1236
diff
changeset
|
1714 QMessageBox* warnMessage = new QMessageBox (QMessageBox::Information, |
8748223990eb
(issue39) Show generic warning on installation for firefox/thunderbird instances
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1236
diff
changeset
|
1715 tr("Firefox and Thunderbird certificate installation."), |
8748223990eb
(issue39) Show generic warning on installation for firefox/thunderbird instances
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1236
diff
changeset
|
1716 tr("Please close all running Firefox and Thunderbird instances " |
8748223990eb
(issue39) Show generic warning on installation for firefox/thunderbird instances
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1236
diff
changeset
|
1717 "before continuing with the installation."), QMessageBox::Ok | QMessageBox::No, |
8748223990eb
(issue39) Show generic warning on installation for firefox/thunderbird instances
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1236
diff
changeset
|
1718 this); |
8748223990eb
(issue39) Show generic warning on installation for firefox/thunderbird instances
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1236
diff
changeset
|
1719 warnMessage->button(QMessageBox::Ok)->setText(tr("Continue")); |
8748223990eb
(issue39) Show generic warning on installation for firefox/thunderbird instances
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1236
diff
changeset
|
1720 warnMessage->setDefaultButton(QMessageBox::Ok); |
8748223990eb
(issue39) Show generic warning on installation for firefox/thunderbird instances
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1236
diff
changeset
|
1721 warnMessage->button(QMessageBox::No)->setText(tr("Cancel")); |
8748223990eb
(issue39) Show generic warning on installation for firefox/thunderbird instances
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1236
diff
changeset
|
1722 warnMessage->setWindowIcon(windowIcon()); |
8748223990eb
(issue39) Show generic warning on installation for firefox/thunderbird instances
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1236
diff
changeset
|
1723 warnMessage->setIconPixmap(QIcon(":/img/dialog-warning.png").pixmap(QSize(48,48))); |
8748223990eb
(issue39) Show generic warning on installation for firefox/thunderbird instances
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1236
diff
changeset
|
1724 |
8748223990eb
(issue39) Show generic warning on installation for firefox/thunderbird instances
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1236
diff
changeset
|
1725 connect(warnMessage->button(QMessageBox::Ok), SIGNAL(clicked()), this, SLOT(installCerts())); |
8748223990eb
(issue39) Show generic warning on installation for firefox/thunderbird instances
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1236
diff
changeset
|
1726 warnMessage->exec(); |
8748223990eb
(issue39) Show generic warning on installation for firefox/thunderbird instances
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1236
diff
changeset
|
1727 return; |
8748223990eb
(issue39) Show generic warning on installation for firefox/thunderbird instances
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1236
diff
changeset
|
1728 #endif |
609
292c590ba9cb
Add warning dialog for running firefox and tunderbird processes
Andre Heinecke <andre.heinecke@intevation.de>
parents:
607
diff
changeset
|
1729 } |
654
129e611eaf50
Merge branch trustbridge-refactor
Andre Heinecke <andre.heinecke@intevation.de>
diff
changeset
|
1730 |
584
ebfe1128ee97
Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents:
563
diff
changeset
|
1731 void MainWindow::togglePages(int button) |
ebfe1128ee97
Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents:
563
diff
changeset
|
1732 { |
743
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1733 mUpdatesWidget->hide(); |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1734 mInstallWidget->hide(); |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1735 mRemoveWidget->hide(); |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1736 mInfoWidget->hide(); |
584
ebfe1128ee97
Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents:
563
diff
changeset
|
1737 switch(button) { |
743
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1738 case 0: mUpdatesWidget->show(); break; |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1739 case 1: mInstallWidget->show(); break; |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1740 case 2: mRemoveWidget->show(); break; |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1741 case 3: mInfoWidget->show(); break; |
a467204a35f5
Rework User Interface.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
740
diff
changeset
|
1742 default: mUpdatesWidget->show(); break; |
584
ebfe1128ee97
Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents:
563
diff
changeset
|
1743 } |
ebfe1128ee97
Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents:
563
diff
changeset
|
1744 return; |
ebfe1128ee97
Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents:
563
diff
changeset
|
1745 } |
ebfe1128ee97
Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents:
563
diff
changeset
|
1746 |
1098
75a5bfe0525e
(issue111) Rework Updates ui
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1097
diff
changeset
|
1747 static void deactivateDetailsButton(QPushButton *btn) { |
75a5bfe0525e
(issue111) Rework Updates ui
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1097
diff
changeset
|
1748 btn->setToolTip(QObject::tr("Hide details")); |
1104
a7a72353d6d2
(issue111) Wording and German translation.
Emanuel Schuetze <emanuel@intevation.de>
parents:
1103
diff
changeset
|
1749 btn->setText(" " + QObject::tr("Less")); |
1098
75a5bfe0525e
(issue111) Rework Updates ui
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1097
diff
changeset
|
1750 btn->setIcon(QIcon(":/img/dialog-information_grey_16px.png")); |
75a5bfe0525e
(issue111) Rework Updates ui
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1097
diff
changeset
|
1751 } |
75a5bfe0525e
(issue111) Rework Updates ui
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1097
diff
changeset
|
1752 |
75a5bfe0525e
(issue111) Rework Updates ui
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1097
diff
changeset
|
1753 static void activateDetailsButton(QPushButton *btn) { |
75a5bfe0525e
(issue111) Rework Updates ui
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1097
diff
changeset
|
1754 btn->setToolTip(QObject::tr("Show details")); |
1104
a7a72353d6d2
(issue111) Wording and German translation.
Emanuel Schuetze <emanuel@intevation.de>
parents:
1103
diff
changeset
|
1755 btn->setText(" " + QObject::tr("Details")); |
1098
75a5bfe0525e
(issue111) Rework Updates ui
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1097
diff
changeset
|
1756 btn->setIcon(QIcon(":/img/dialog-information_16px.png")); |
1311
135891f1c8f4
(issue154) Do not force the details button to be active if a certificate changes
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1308
diff
changeset
|
1757 btn->show(); |
1098
75a5bfe0525e
(issue111) Rework Updates ui
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1097
diff
changeset
|
1758 } |
75a5bfe0525e
(issue111) Rework Updates ui
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1097
diff
changeset
|
1759 |
584
ebfe1128ee97
Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents:
563
diff
changeset
|
1760 void MainWindow::toggleUpdatesNew() { |
ebfe1128ee97
Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents:
563
diff
changeset
|
1761 if (!mUpdatesNew->isVisible()) { |
ebfe1128ee97
Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents:
563
diff
changeset
|
1762 mUpdatesNew->show(); |
1098
75a5bfe0525e
(issue111) Rework Updates ui
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1097
diff
changeset
|
1763 deactivateDetailsButton(mUpdatesDetailsNew); |
584
ebfe1128ee97
Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents:
563
diff
changeset
|
1764 } |
ebfe1128ee97
Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents:
563
diff
changeset
|
1765 else { |
653
39f03316f675
Change button text when toggling details and select the first list item.
Raimund Renkert <rrenkert@intevation.de>
parents:
652
diff
changeset
|
1766 mUpdatesNew->hide(); |
1098
75a5bfe0525e
(issue111) Rework Updates ui
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1097
diff
changeset
|
1767 activateDetailsButton(mUpdatesDetailsNew); |
584
ebfe1128ee97
Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents:
563
diff
changeset
|
1768 } |
ebfe1128ee97
Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents:
563
diff
changeset
|
1769 } |
ebfe1128ee97
Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents:
563
diff
changeset
|
1770 |
ebfe1128ee97
Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents:
563
diff
changeset
|
1771 void MainWindow::toggleUpdatesRemove() { |
ebfe1128ee97
Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents:
563
diff
changeset
|
1772 if (!mUpdatesRemove->isVisible()) { |
ebfe1128ee97
Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents:
563
diff
changeset
|
1773 mUpdatesRemove->show(); |
1098
75a5bfe0525e
(issue111) Rework Updates ui
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1097
diff
changeset
|
1774 deactivateDetailsButton(mUpdatesDetailsRemove); |
584
ebfe1128ee97
Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents:
563
diff
changeset
|
1775 } |
ebfe1128ee97
Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents:
563
diff
changeset
|
1776 else { |
653
39f03316f675
Change button text when toggling details and select the first list item.
Raimund Renkert <rrenkert@intevation.de>
parents:
652
diff
changeset
|
1777 mUpdatesRemove->hide(); |
1098
75a5bfe0525e
(issue111) Rework Updates ui
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1097
diff
changeset
|
1778 activateDetailsButton(mUpdatesDetailsRemove); |
584
ebfe1128ee97
Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents:
563
diff
changeset
|
1779 } |
ebfe1128ee97
Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents:
563
diff
changeset
|
1780 } |
ebfe1128ee97
Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents:
563
diff
changeset
|
1781 |
ebfe1128ee97
Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents:
563
diff
changeset
|
1782 void MainWindow::toggleUpdatesManual() { |
ebfe1128ee97
Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents:
563
diff
changeset
|
1783 if (!mUpdatesManual->isVisible()) { |
ebfe1128ee97
Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents:
563
diff
changeset
|
1784 mUpdatesManual->show(); |
1109
6594e8e63a25
(issue115) Add tooltips and fix manual changes handling
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1107
diff
changeset
|
1785 mManualDetailsShown = true; |
1098
75a5bfe0525e
(issue111) Rework Updates ui
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1097
diff
changeset
|
1786 deactivateDetailsButton(mUpdatesDetailsManual); |
584
ebfe1128ee97
Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents:
563
diff
changeset
|
1787 } |
ebfe1128ee97
Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents:
563
diff
changeset
|
1788 else { |
653
39f03316f675
Change button text when toggling details and select the first list item.
Raimund Renkert <rrenkert@intevation.de>
parents:
652
diff
changeset
|
1789 mUpdatesManual->hide(); |
1109
6594e8e63a25
(issue115) Add tooltips and fix manual changes handling
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1107
diff
changeset
|
1790 mManualDetailsShown = false; |
1098
75a5bfe0525e
(issue111) Rework Updates ui
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1097
diff
changeset
|
1791 activateDetailsButton(mUpdatesDetailsManual); |
584
ebfe1128ee97
Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents:
563
diff
changeset
|
1792 } |
ebfe1128ee97
Started trustbridge mainwindow refactoring.
Raimund Renkert <rrenkert@intevation.de>
parents:
563
diff
changeset
|
1793 } |
690
e4abb41484a0
(issue 27)Only close if no new list is available
Andre Heinecke <andre.heinecke@intevation.de>
parents:
689
diff
changeset
|
1794 |
e4abb41484a0
(issue 27)Only close if no new list is available
Andre Heinecke <andre.heinecke@intevation.de>
parents:
689
diff
changeset
|
1795 void MainWindow::closeEvent(QCloseEvent *event) |
e4abb41484a0
(issue 27)Only close if no new list is available
Andre Heinecke <andre.heinecke@intevation.de>
parents:
689
diff
changeset
|
1796 { |
e4abb41484a0
(issue 27)Only close if no new list is available
Andre Heinecke <andre.heinecke@intevation.de>
parents:
689
diff
changeset
|
1797 if (getState() == NewListAvailable) { |
e4abb41484a0
(issue 27)Only close if no new list is available
Andre Heinecke <andre.heinecke@intevation.de>
parents:
689
diff
changeset
|
1798 /* Only minimize to tray if there is a new list */ |
e4abb41484a0
(issue 27)Only close if no new list is available
Andre Heinecke <andre.heinecke@intevation.de>
parents:
689
diff
changeset
|
1799 QMainWindow::closeEvent(event); |
965
013ca910589a
Open main window in case of error message.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
964
diff
changeset
|
1800 mTrayIcon->show(); |
690
e4abb41484a0
(issue 27)Only close if no new list is available
Andre Heinecke <andre.heinecke@intevation.de>
parents:
689
diff
changeset
|
1801 return; |
e4abb41484a0
(issue 27)Only close if no new list is available
Andre Heinecke <andre.heinecke@intevation.de>
parents:
689
diff
changeset
|
1802 } |
e4abb41484a0
(issue 27)Only close if no new list is available
Andre Heinecke <andre.heinecke@intevation.de>
parents:
689
diff
changeset
|
1803 return closeApp(); |
e4abb41484a0
(issue 27)Only close if no new list is available
Andre Heinecke <andre.heinecke@intevation.de>
parents:
689
diff
changeset
|
1804 } |
708
bd48fae793b6
(Issue25) Log update check success, change header labels.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
703
diff
changeset
|
1805 |
1373
00fcb9c4d16b
(issue179) Handle SW verify failures and try to redownload the update
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1371
diff
changeset
|
1806 void MainWindow::scheduleFailureRetryOrClose(bool close) { |
00fcb9c4d16b
(issue179) Handle SW verify failures and try to redownload the update
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1371
diff
changeset
|
1807 int waitInterval = getNextUpdateInterval(mFailedConnections++); |
00fcb9c4d16b
(issue179) Handle SW verify failures and try to redownload the update
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1371
diff
changeset
|
1808 if (waitInterval <= 0 && close) { |
00fcb9c4d16b
(issue179) Handle SW verify failures and try to redownload the update
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1371
diff
changeset
|
1809 qDebug() << "Shutting down after " << mFailedConnections << |
00fcb9c4d16b
(issue179) Handle SW verify failures and try to redownload the update
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1371
diff
changeset
|
1810 " tries to get an update connection."; |
00fcb9c4d16b
(issue179) Handle SW verify failures and try to redownload the update
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1371
diff
changeset
|
1811 closeApp(); |
00fcb9c4d16b
(issue179) Handle SW verify failures and try to redownload the update
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1371
diff
changeset
|
1812 } else if (waitInterval > 0) { |
00fcb9c4d16b
(issue179) Handle SW verify failures and try to redownload the update
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1371
diff
changeset
|
1813 qDebug() << "Waiting for " << waitInterval / 1000 << " seconds until the next try."; |
00fcb9c4d16b
(issue179) Handle SW verify failures and try to redownload the update
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1371
diff
changeset
|
1814 QTimer::singleShot(waitInterval, this, SLOT(checkUpdates())); |
00fcb9c4d16b
(issue179) Handle SW verify failures and try to redownload the update
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1371
diff
changeset
|
1815 } |
00fcb9c4d16b
(issue179) Handle SW verify failures and try to redownload the update
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1371
diff
changeset
|
1816 } |
00fcb9c4d16b
(issue179) Handle SW verify failures and try to redownload the update
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1371
diff
changeset
|
1817 |
708
bd48fae793b6
(Issue25) Log update check success, change header labels.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
703
diff
changeset
|
1818 void MainWindow::updateCheckSuccess() |
bd48fae793b6
(Issue25) Log update check success, change header labels.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
703
diff
changeset
|
1819 { |
bd48fae793b6
(Issue25) Log update check success, change header labels.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
703
diff
changeset
|
1820 if (getState() != TransferError) { |
bd48fae793b6
(Issue25) Log update check success, change header labels.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
703
diff
changeset
|
1821 const QDateTime now = QDateTime::currentDateTime(); |
bd48fae793b6
(Issue25) Log update check success, change header labels.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
703
diff
changeset
|
1822 mSettings.setValue("lastUpdateCheck", now); |
754
27043d74dc90
(Issue25) Align header contents in their own column.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
748
diff
changeset
|
1823 mLastUpdateCheckContents->setText(QLocale::system().toString(now, DATETIME_FORMAT)); |
27043d74dc90
(Issue25) Align header contents in their own column.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
748
diff
changeset
|
1824 mLastUpdateCheckContents->show(); |
708
bd48fae793b6
(Issue25) Log update check success, change header labels.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
703
diff
changeset
|
1825 mLastUpdateCheck->show(); |
bd48fae793b6
(Issue25) Log update check success, change header labels.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
703
diff
changeset
|
1826 syslog_info_printf(tr("Sucessfully checked for updates.").toUtf8().constData()); |
1227
a1e990947172
(issue38) Add long time error handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1215
diff
changeset
|
1827 handleLTE(lteNoConnection, true); /* Reset error state */ |
a1e990947172
(issue38) Add long time error handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1215
diff
changeset
|
1828 handleLTE(lteInvalidCertificate, true); |
1339
64f812a63de6
(issue170) Keep checking for updates in intervals
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1334
diff
changeset
|
1829 mFailedConnections = 0; |
1373
00fcb9c4d16b
(issue179) Handle SW verify failures and try to redownload the update
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1371
diff
changeset
|
1830 } else { |
00fcb9c4d16b
(issue179) Handle SW verify failures and try to redownload the update
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1371
diff
changeset
|
1831 scheduleFailureRetryOrClose(!isVisible()); |
708
bd48fae793b6
(Issue25) Log update check success, change header labels.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
703
diff
changeset
|
1832 } |
1042
74951e389cb1
(issue103) Only shut down if the mainwidow is not visible
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1034
diff
changeset
|
1833 if ((getState() != NewSoftwareAvailable && getState() != NewListAvailable && mTrayMode) |
74951e389cb1
(issue103) Only shut down if the mainwidow is not visible
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1034
diff
changeset
|
1834 && !isVisible()) { |
962
0a4f7235e759
Close the application if nothing new is available and in tray mode.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
961
diff
changeset
|
1835 qDebug() << "Shutting down as no list or Software is available."; |
0a4f7235e759
Close the application if nothing new is available and in tray mode.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
961
diff
changeset
|
1836 closeApp(); |
0a4f7235e759
Close the application if nothing new is available and in tray mode.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
961
diff
changeset
|
1837 } else { |
0a4f7235e759
Close the application if nothing new is available and in tray mode.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
961
diff
changeset
|
1838 mTrayIcon->show(); |
0a4f7235e759
Close the application if nothing new is available and in tray mode.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
961
diff
changeset
|
1839 } |
708
bd48fae793b6
(Issue25) Log update check success, change header labels.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
703
diff
changeset
|
1840 } |
716
929c3db85eb7
Add central place to obtain current change count.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
714
diff
changeset
|
1841 |
929c3db85eb7
Add central place to obtain current change count.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
714
diff
changeset
|
1842 int MainWindow::changeCount() |
929c3db85eb7
Add central place to obtain current change count.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
714
diff
changeset
|
1843 { |
929c3db85eb7
Add central place to obtain current change count.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
714
diff
changeset
|
1844 return mChangeCount; |
929c3db85eb7
Add central place to obtain current change count.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
714
diff
changeset
|
1845 } |
722
b0929968562a
(Issue31) Add textoverlaybutton to show a text in the button.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
719
diff
changeset
|
1846 |
b0929968562a
(Issue31) Add textoverlaybutton to show a text in the button.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
719
diff
changeset
|
1847 void MainWindow::setChangeCount(int cnt) |
b0929968562a
(Issue31) Add textoverlaybutton to show a text in the button.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
719
diff
changeset
|
1848 { |
b0929968562a
(Issue31) Add textoverlaybutton to show a text in the button.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
719
diff
changeset
|
1849 if (mChangeCount != cnt) { |
b0929968562a
(Issue31) Add textoverlaybutton to show a text in the button.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
719
diff
changeset
|
1850 mChangeCount = cnt; |
b0929968562a
(Issue31) Add textoverlaybutton to show a text in the button.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
719
diff
changeset
|
1851 emit changesChanged(QString("%1").arg(cnt)); |
b0929968562a
(Issue31) Add textoverlaybutton to show a text in the button.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
719
diff
changeset
|
1852 } |
b0929968562a
(Issue31) Add textoverlaybutton to show a text in the button.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
719
diff
changeset
|
1853 } |
940
7c89c5dc2200
(issue89) Add ui to open help in browser
Andre Heinecke <andre.heinecke@intevation.de>
parents:
932
diff
changeset
|
1854 |
956
879a634d0a40
(issue41) Add proxy support
Andre Heinecke <andre.heinecke@intevation.de>
parents:
940
diff
changeset
|
1855 void MainWindow::showProxySettings() |
879a634d0a40
(issue41) Add proxy support
Andre Heinecke <andre.heinecke@intevation.de>
parents:
940
diff
changeset
|
1856 { |
879a634d0a40
(issue41) Add proxy support
Andre Heinecke <andre.heinecke@intevation.de>
parents:
940
diff
changeset
|
1857 ProxySettingsDlg *dlg = new ProxySettingsDlg(this); |
879a634d0a40
(issue41) Add proxy support
Andre Heinecke <andre.heinecke@intevation.de>
parents:
940
diff
changeset
|
1858 dlg->exec(); |
879a634d0a40
(issue41) Add proxy support
Andre Heinecke <andre.heinecke@intevation.de>
parents:
940
diff
changeset
|
1859 } |
879a634d0a40
(issue41) Add proxy support
Andre Heinecke <andre.heinecke@intevation.de>
parents:
940
diff
changeset
|
1860 |
940
7c89c5dc2200
(issue89) Add ui to open help in browser
Andre Heinecke <andre.heinecke@intevation.de>
parents:
932
diff
changeset
|
1861 void MainWindow::showHelp() |
7c89c5dc2200
(issue89) Add ui to open help in browser
Andre Heinecke <andre.heinecke@intevation.de>
parents:
932
diff
changeset
|
1862 { |
7c89c5dc2200
(issue89) Add ui to open help in browser
Andre Heinecke <andre.heinecke@intevation.de>
parents:
932
diff
changeset
|
1863 char *inst_dir = get_install_dir(); |
7c89c5dc2200
(issue89) Add ui to open help in browser
Andre Heinecke <andre.heinecke@intevation.de>
parents:
932
diff
changeset
|
1864 if (!inst_dir) { |
7c89c5dc2200
(issue89) Add ui to open help in browser
Andre Heinecke <andre.heinecke@intevation.de>
parents:
932
diff
changeset
|
1865 qDebug() << "Failed to find install dir"; |
7c89c5dc2200
(issue89) Add ui to open help in browser
Andre Heinecke <andre.heinecke@intevation.de>
parents:
932
diff
changeset
|
1866 return; |
7c89c5dc2200
(issue89) Add ui to open help in browser
Andre Heinecke <andre.heinecke@intevation.de>
parents:
932
diff
changeset
|
1867 } |
7c89c5dc2200
(issue89) Add ui to open help in browser
Andre Heinecke <andre.heinecke@intevation.de>
parents:
932
diff
changeset
|
1868 QString helpPath = QString::fromUtf8(inst_dir); |
7c89c5dc2200
(issue89) Add ui to open help in browser
Andre Heinecke <andre.heinecke@intevation.de>
parents:
932
diff
changeset
|
1869 helpPath += HELP_PATH; |
7c89c5dc2200
(issue89) Add ui to open help in browser
Andre Heinecke <andre.heinecke@intevation.de>
parents:
932
diff
changeset
|
1870 QFileInfo fiHelp(helpPath); |
7c89c5dc2200
(issue89) Add ui to open help in browser
Andre Heinecke <andre.heinecke@intevation.de>
parents:
932
diff
changeset
|
1871 qDebug() << "Opening help: " << fiHelp.absoluteFilePath(); |
7c89c5dc2200
(issue89) Add ui to open help in browser
Andre Heinecke <andre.heinecke@intevation.de>
parents:
932
diff
changeset
|
1872 if (!fiHelp.exists()) { |
7c89c5dc2200
(issue89) Add ui to open help in browser
Andre Heinecke <andre.heinecke@intevation.de>
parents:
932
diff
changeset
|
1873 QMessageBox::warning(this, tr("Error!"), tr ("Failed to find the manual")); |
7c89c5dc2200
(issue89) Add ui to open help in browser
Andre Heinecke <andre.heinecke@intevation.de>
parents:
932
diff
changeset
|
1874 return; |
7c89c5dc2200
(issue89) Add ui to open help in browser
Andre Heinecke <andre.heinecke@intevation.de>
parents:
932
diff
changeset
|
1875 } |
966
9783e32e215f
(issue89) Use platform specific help url.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
965
diff
changeset
|
1876 #ifdef Q_OS_WIN |
9783e32e215f
(issue89) Use platform specific help url.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
965
diff
changeset
|
1877 QDesktopServices::openUrl(QUrl("file:///" + fiHelp.absoluteFilePath())); |
9783e32e215f
(issue89) Use platform specific help url.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
965
diff
changeset
|
1878 #else |
940
7c89c5dc2200
(issue89) Add ui to open help in browser
Andre Heinecke <andre.heinecke@intevation.de>
parents:
932
diff
changeset
|
1879 QDesktopServices::openUrl(QUrl(fiHelp.absoluteFilePath())); |
966
9783e32e215f
(issue89) Use platform specific help url.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
965
diff
changeset
|
1880 #endif |
940
7c89c5dc2200
(issue89) Add ui to open help in browser
Andre Heinecke <andre.heinecke@intevation.de>
parents:
932
diff
changeset
|
1881 free (inst_dir); |
7c89c5dc2200
(issue89) Add ui to open help in browser
Andre Heinecke <andre.heinecke@intevation.de>
parents:
932
diff
changeset
|
1882 return; |
7c89c5dc2200
(issue89) Add ui to open help in browser
Andre Heinecke <andre.heinecke@intevation.de>
parents:
932
diff
changeset
|
1883 } |
1061
db831a204a6b
(issue38) Show error message as messagebox if the window is visible
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1056
diff
changeset
|
1884 |
db831a204a6b
(issue38) Show error message as messagebox if the window is visible
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1056
diff
changeset
|
1885 void MainWindow::showErrorMessage(const QString &msg) |
db831a204a6b
(issue38) Show error message as messagebox if the window is visible
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1056
diff
changeset
|
1886 { |
db831a204a6b
(issue38) Show error message as messagebox if the window is visible
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1056
diff
changeset
|
1887 QMessageBox::warning(this, tr("TrustBridge error"), msg); |
db831a204a6b
(issue38) Show error message as messagebox if the window is visible
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1056
diff
changeset
|
1888 } |
1227
a1e990947172
(issue38) Add long time error handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1215
diff
changeset
|
1889 |
a1e990947172
(issue38) Add long time error handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1215
diff
changeset
|
1890 void MainWindow::handleLTE(LongTimeErrors lte, bool reset) |
a1e990947172
(issue38) Add long time error handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1215
diff
changeset
|
1891 { |
a1e990947172
(issue38) Add long time error handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1215
diff
changeset
|
1892 QString settingPrefix; |
1230
05b938021a24
(issue38) A bit debug output for LTE handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1227
diff
changeset
|
1893 // qDebug() << "Handle LTE for " << lte << " Reset? : " << reset; |
1227
a1e990947172
(issue38) Add long time error handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1215
diff
changeset
|
1894 switch (lte) { |
a1e990947172
(issue38) Add long time error handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1215
diff
changeset
|
1895 case lteInvalidSoftware: |
a1e990947172
(issue38) Add long time error handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1215
diff
changeset
|
1896 settingPrefix = "LTE/invalidSW"; |
a1e990947172
(issue38) Add long time error handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1215
diff
changeset
|
1897 break; |
a1e990947172
(issue38) Add long time error handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1215
diff
changeset
|
1898 case lteInvalidList: |
a1e990947172
(issue38) Add long time error handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1215
diff
changeset
|
1899 settingPrefix = "LTE/invalidList"; |
a1e990947172
(issue38) Add long time error handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1215
diff
changeset
|
1900 break; |
a1e990947172
(issue38) Add long time error handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1215
diff
changeset
|
1901 case lteInvalidCertificate: |
a1e990947172
(issue38) Add long time error handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1215
diff
changeset
|
1902 settingPrefix = "LTE/invalidCertificate"; |
a1e990947172
(issue38) Add long time error handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1215
diff
changeset
|
1903 break; |
a1e990947172
(issue38) Add long time error handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1215
diff
changeset
|
1904 case lteNoConnection: |
a1e990947172
(issue38) Add long time error handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1215
diff
changeset
|
1905 settingPrefix = "LTE/noConnection"; |
a1e990947172
(issue38) Add long time error handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1215
diff
changeset
|
1906 break; |
a1e990947172
(issue38) Add long time error handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1215
diff
changeset
|
1907 default: |
a1e990947172
(issue38) Add long time error handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1215
diff
changeset
|
1908 qDebug() << "Unhandled error. " << lte; |
a1e990947172
(issue38) Add long time error handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1215
diff
changeset
|
1909 } |
a1e990947172
(issue38) Add long time error handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1215
diff
changeset
|
1910 |
a1e990947172
(issue38) Add long time error handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1215
diff
changeset
|
1911 if (reset) { |
a1e990947172
(issue38) Add long time error handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1215
diff
changeset
|
1912 /* delete all values and be done */ |
a1e990947172
(issue38) Add long time error handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1215
diff
changeset
|
1913 mSettings.remove(settingPrefix + "_lastSaved"); |
a1e990947172
(issue38) Add long time error handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1215
diff
changeset
|
1914 mSettings.remove(settingPrefix + "_count"); |
1230
05b938021a24
(issue38) A bit debug output for LTE handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1227
diff
changeset
|
1915 mSettings.remove(settingPrefix + "_lastShown"); |
1227
a1e990947172
(issue38) Add long time error handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1215
diff
changeset
|
1916 return; |
a1e990947172
(issue38) Add long time error handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1215
diff
changeset
|
1917 } |
a1e990947172
(issue38) Add long time error handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1215
diff
changeset
|
1918 |
a1e990947172
(issue38) Add long time error handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1215
diff
changeset
|
1919 QDateTime lastSaved = mSettings.value(settingPrefix + "_lastSaved").toDateTime(); |
a1e990947172
(issue38) Add long time error handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1215
diff
changeset
|
1920 bool cnt_valid; |
a1e990947172
(issue38) Add long time error handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1215
diff
changeset
|
1921 int cnt = mSettings.value(settingPrefix + "_count").toInt(&cnt_valid); |
a1e990947172
(issue38) Add long time error handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1215
diff
changeset
|
1922 if (!cnt_valid) { |
a1e990947172
(issue38) Add long time error handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1215
diff
changeset
|
1923 cnt = 0; |
a1e990947172
(issue38) Add long time error handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1215
diff
changeset
|
1924 } |
a1e990947172
(issue38) Add long time error handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1215
diff
changeset
|
1925 |
a1e990947172
(issue38) Add long time error handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1215
diff
changeset
|
1926 if (!lastSaved.isValid() || lastSaved.daysTo(QDateTime::currentDateTime()) >= 1) { |
a1e990947172
(issue38) Add long time error handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1215
diff
changeset
|
1927 /* The error count is increased at most once a day */ |
a1e990947172
(issue38) Add long time error handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1215
diff
changeset
|
1928 mSettings.setValue(settingPrefix + "_lastSaved", QDateTime::currentDateTime()); |
a1e990947172
(issue38) Add long time error handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1215
diff
changeset
|
1929 mSettings.setValue(settingPrefix + "_count", ++cnt); |
a1e990947172
(issue38) Add long time error handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1215
diff
changeset
|
1930 } |
a1e990947172
(issue38) Add long time error handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1215
diff
changeset
|
1931 |
a1e990947172
(issue38) Add long time error handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1215
diff
changeset
|
1932 |
a1e990947172
(issue38) Add long time error handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1215
diff
changeset
|
1933 if (cnt < 7) { |
a1e990947172
(issue38) Add long time error handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1215
diff
changeset
|
1934 /* We are done */ |
a1e990947172
(issue38) Add long time error handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1215
diff
changeset
|
1935 return; |
a1e990947172
(issue38) Add long time error handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1215
diff
changeset
|
1936 } |
a1e990947172
(issue38) Add long time error handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1215
diff
changeset
|
1937 /* A week has passed. Start showing the error. */ |
a1e990947172
(issue38) Add long time error handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1215
diff
changeset
|
1938 QDateTime lastShown = mSettings.value(settingPrefix + "_lastShown").toDateTime(); |
a1e990947172
(issue38) Add long time error handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1215
diff
changeset
|
1939 if (lastShown.isValid() && lastShown.daysTo(QDateTime::currentDateTime()) < 1) { |
a1e990947172
(issue38) Add long time error handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1215
diff
changeset
|
1940 /* Only show the error message once a day */ |
a1e990947172
(issue38) Add long time error handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1215
diff
changeset
|
1941 return; |
a1e990947172
(issue38) Add long time error handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1215
diff
changeset
|
1942 } |
a1e990947172
(issue38) Add long time error handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1215
diff
changeset
|
1943 |
a1e990947172
(issue38) Add long time error handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1215
diff
changeset
|
1944 mSettings.setValue(settingPrefix + "_lastShown", QDateTime::currentDateTime()); |
a1e990947172
(issue38) Add long time error handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1215
diff
changeset
|
1945 |
a1e990947172
(issue38) Add long time error handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1215
diff
changeset
|
1946 switch (lte) { |
a1e990947172
(issue38) Add long time error handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1215
diff
changeset
|
1947 case lteInvalidSoftware: |
a1e990947172
(issue38) Add long time error handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1215
diff
changeset
|
1948 showErrorMessage(tr("The integrity check for the available software update has " |
a1e990947172
(issue38) Add long time error handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1215
diff
changeset
|
1949 "failed repeatedly.") + "\n" + |
a1e990947172
(issue38) Add long time error handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1215
diff
changeset
|
1950 tr("Please contact your Support or the publisher of the Software.")); |
a1e990947172
(issue38) Add long time error handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1215
diff
changeset
|
1951 break; |
a1e990947172
(issue38) Add long time error handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1215
diff
changeset
|
1952 case lteInvalidList: |
a1e990947172
(issue38) Add long time error handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1215
diff
changeset
|
1953 showErrorMessage(tr("The integrity check of the available certificates has " |
a1e990947172
(issue38) Add long time error handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1215
diff
changeset
|
1954 "failed repeatedly.") + "\n" + |
a1e990947172
(issue38) Add long time error handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1215
diff
changeset
|
1955 tr("Please contact your Support or the publisher of the Software.")); |
a1e990947172
(issue38) Add long time error handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1215
diff
changeset
|
1956 break; |
a1e990947172
(issue38) Add long time error handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1215
diff
changeset
|
1957 case lteInvalidCertificate: |
1275
be989e9d49a4
Translations updated.
Emanuel Schuetze <emanuel@intevation.de>
parents:
1261
diff
changeset
|
1958 showErrorMessage(tr("The authentication of the update server has " |
1227
a1e990947172
(issue38) Add long time error handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1215
diff
changeset
|
1959 "failed repeatedly.") + "\n" + |
a1e990947172
(issue38) Add long time error handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1215
diff
changeset
|
1960 tr("Please contact your Support or the publisher of the Software.")); |
a1e990947172
(issue38) Add long time error handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1215
diff
changeset
|
1961 break; |
a1e990947172
(issue38) Add long time error handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1215
diff
changeset
|
1962 case lteNoConnection: |
a1e990947172
(issue38) Add long time error handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1215
diff
changeset
|
1963 bool useProxy = mSettings.value("UseProxy", false).toBool(); |
a1e990947172
(issue38) Add long time error handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1215
diff
changeset
|
1964 if (useProxy) { |
1275
be989e9d49a4
Translations updated.
Emanuel Schuetze <emanuel@intevation.de>
parents:
1261
diff
changeset
|
1965 showErrorMessage(tr("The connection to the update server has " |
1227
a1e990947172
(issue38) Add long time error handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1215
diff
changeset
|
1966 "failed repeatedly.") + "\n" + |
a1e990947172
(issue38) Add long time error handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1215
diff
changeset
|
1967 tr("Please check that the Proxy Server \"%1\" is available.").arg( |
a1e990947172
(issue38) Add long time error handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1215
diff
changeset
|
1968 mSettings.value("ProxyURL").toString())); |
a1e990947172
(issue38) Add long time error handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1215
diff
changeset
|
1969 } else { |
1275
be989e9d49a4
Translations updated.
Emanuel Schuetze <emanuel@intevation.de>
parents:
1261
diff
changeset
|
1970 showErrorMessage(tr("The connection to the update server has " |
1227
a1e990947172
(issue38) Add long time error handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1215
diff
changeset
|
1971 "failed repeatedly.") + "\n" + |
a1e990947172
(issue38) Add long time error handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1215
diff
changeset
|
1972 tr("Please check your internet connection.")); |
a1e990947172
(issue38) Add long time error handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1215
diff
changeset
|
1973 } |
a1e990947172
(issue38) Add long time error handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1215
diff
changeset
|
1974 break; |
a1e990947172
(issue38) Add long time error handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1215
diff
changeset
|
1975 } |
a1e990947172
(issue38) Add long time error handling.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
1215
diff
changeset
|
1976 } |