annotate ui/mainwindow.cpp @ 754:27043d74dc90

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

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