annotate ui/administratorwindow.h @ 1386:90a8eb36e9b0

Add public certificate for updates.trustbridge.de
author Andre Heinecke <andre.heinecke@intevation.de>
date Thu, 15 Jan 2015 16:14:35 +0100
parents d009da9cfa10
children
rev   line source
404
17e1c8f37d72 Add License
Andre Heinecke <aheinecke@intevation.de>
parents: 376
diff changeset
1 /* Copyright (C) 2014 by Bundesamt für Sicherheit in der Informationstechnik
17e1c8f37d72 Add License
Andre Heinecke <aheinecke@intevation.de>
parents: 376
diff changeset
2 * Software engineering by Intevation GmbH
17e1c8f37d72 Add License
Andre Heinecke <aheinecke@intevation.de>
parents: 376
diff changeset
3 *
17e1c8f37d72 Add License
Andre Heinecke <aheinecke@intevation.de>
parents: 376
diff changeset
4 * This file is Free Software under the GNU GPL (v>=2)
17e1c8f37d72 Add License
Andre Heinecke <aheinecke@intevation.de>
parents: 376
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY!
17e1c8f37d72 Add License
Andre Heinecke <aheinecke@intevation.de>
parents: 376
diff changeset
6 * See LICENSE.txt for details.
17e1c8f37d72 Add License
Andre Heinecke <aheinecke@intevation.de>
parents: 376
diff changeset
7 */
333
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
8 #ifndef ADMINSTRATORWINDOW_H
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
9 #define ADMINSTRATORWINDOW_H
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
10
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
11 /**
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
12 * @file administratorwindow.h
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
13 * @brief Administrator UI controller
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
14 */
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
15
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
16 #include <QMainWindow>
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
17 #include <QSettings>
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
18 #include <QMenuBar>
335
811eec4e1b99 Use a table view with the new certificate table model in administrator app.
Raimund Renkert <rrenkert@intevation.de>
parents: 333
diff changeset
19 #include <QTableView>
333
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
20 #include <QPushButton>
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
21
343
e3d6de930c90 Updated the table ui in administrator app.
Raimund Renkert <rrenkert@intevation.de>
parents: 335
diff changeset
22 #include "certificatelist.h"
e3d6de930c90 Updated the table ui in administrator app.
Raimund Renkert <rrenkert@intevation.de>
parents: 335
diff changeset
23 #include "certificatetablemodel.h"
e3d6de930c90 Updated the table ui in administrator app.
Raimund Renkert <rrenkert@intevation.de>
parents: 335
diff changeset
24
333
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
25 class QMenu;
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
26 class QAction;
1316
ff9cd05e861e (issue166) Fix certificiate removal
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1255
diff changeset
27 class QSortFilterProxyModel;
333
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
28
1255
2a1aa9df8f11 (issue133) Improve API documentation
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1053
diff changeset
29 /** @brief Main Window of the Administrator application
2a1aa9df8f11 (issue133) Improve API documentation
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1053
diff changeset
30 *
2a1aa9df8f11 (issue133) Improve API documentation
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1053
diff changeset
31 * The controlling class of the Admin application. Holds
2a1aa9df8f11 (issue133) Improve API documentation
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1053
diff changeset
32 * the certificate data and the settings of the application.
2a1aa9df8f11 (issue133) Improve API documentation
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1053
diff changeset
33 */
333
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
34 class AdministratorWindow : public QMainWindow
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
35 {
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
36 Q_OBJECT
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
37
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
38 public:
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
39 AdministratorWindow();
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
40
463
5200b8e9b2ae Rename tablemodel certificates and add accessors
Andre Heinecke <aheinecke@intevation.de>
parents: 453
diff changeset
41 /** @brief obtain a reference to the certificates currently in the model
5200b8e9b2ae Rename tablemodel certificates and add accessors
Andre Heinecke <aheinecke@intevation.de>
parents: 453
diff changeset
42 * @returns the currently shown certificates
453
6dec8101793c Rename settings and certlist and add accessors
Andre Heinecke <aheinecke@intevation.de>
parents: 427
diff changeset
43 */
463
5200b8e9b2ae Rename tablemodel certificates and add accessors
Andre Heinecke <aheinecke@intevation.de>
parents: 453
diff changeset
44 const QList<Certificate>& certificates() const {
5200b8e9b2ae Rename tablemodel certificates and add accessors
Andre Heinecke <aheinecke@intevation.de>
parents: 453
diff changeset
45 return certificateModel->certificates();
5200b8e9b2ae Rename tablemodel certificates and add accessors
Andre Heinecke <aheinecke@intevation.de>
parents: 453
diff changeset
46 }
453
6dec8101793c Rename settings and certlist and add accessors
Andre Heinecke <aheinecke@intevation.de>
parents: 427
diff changeset
47
6dec8101793c Rename settings and certlist and add accessors
Andre Heinecke <aheinecke@intevation.de>
parents: 427
diff changeset
48 /** @brief get the settings for this application
6dec8101793c Rename settings and certlist and add accessors
Andre Heinecke <aheinecke@intevation.de>
parents: 427
diff changeset
49 * @returns a reference the applications settings object
6dec8101793c Rename settings and certlist and add accessors
Andre Heinecke <aheinecke@intevation.de>
parents: 427
diff changeset
50 */
6dec8101793c Rename settings and certlist and add accessors
Andre Heinecke <aheinecke@intevation.de>
parents: 427
diff changeset
51 QSettings* settings() {return &mSettings;}
6dec8101793c Rename settings and certlist and add accessors
Andre Heinecke <aheinecke@intevation.de>
parents: 427
diff changeset
52
562
ccdc4c6b97ce Log diff between initial certificate list and saved list to a logfile.
Raimund Renkert <rrenkert@intevation.de>
parents: 463
diff changeset
53 /** @brief log the diff between the initial certificate list and the list
ccdc4c6b97ce Log diff between initial certificate list and saved list to a logfile.
Raimund Renkert <rrenkert@intevation.de>
parents: 463
diff changeset
54 * saved as current.
ccdc4c6b97ce Log diff between initial certificate list and saved list to a logfile.
Raimund Renkert <rrenkert@intevation.de>
parents: 463
diff changeset
55 *
ccdc4c6b97ce Log diff between initial certificate list and saved list to a logfile.
Raimund Renkert <rrenkert@intevation.de>
parents: 463
diff changeset
56 * @param currentCerts Path to the current certificate list file.
1053
78798d3af8f0 Fixed doxygen build warnings.
Emanuel Schuetze <emanuel@intevation.de>
parents: 1001
diff changeset
57 * @param keyFingerprint The fingerprint of the signing key used.
562
ccdc4c6b97ce Log diff between initial certificate list and saved list to a logfile.
Raimund Renkert <rrenkert@intevation.de>
parents: 463
diff changeset
58 */
679
75cd2fbf9ac6 (Issue 9) Log key's sha256 fingerprint
Andre Heinecke <andre.heinecke@intevation.de>
parents: 565
diff changeset
59 void logChanges(const QString &currentCerts, const QString &keyFingerprint);
562
ccdc4c6b97ce Log diff between initial certificate list and saved list to a logfile.
Raimund Renkert <rrenkert@intevation.de>
parents: 463
diff changeset
60
565
9db7034b2d6c Added method to get the current certificate list changes.
Raimund Renkert <rrenkert@intevation.de>
parents: 562
diff changeset
61 /** @brief get the currently changed certificates.
9db7034b2d6c Added method to get the current certificate list changes.
Raimund Renkert <rrenkert@intevation.de>
parents: 562
diff changeset
62 * @return a list of certificates.
9db7034b2d6c Added method to get the current certificate list changes.
Raimund Renkert <rrenkert@intevation.de>
parents: 562
diff changeset
63 */
9db7034b2d6c Added method to get the current certificate list changes.
Raimund Renkert <rrenkert@intevation.de>
parents: 562
diff changeset
64 QList<Certificate> currentChanges();
9db7034b2d6c Added method to get the current certificate list changes.
Raimund Renkert <rrenkert@intevation.de>
parents: 562
diff changeset
65
333
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
66 private slots:
1255
2a1aa9df8f11 (issue133) Improve API documentation
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1053
diff changeset
67 /** @brief Create the SW Packages for the target platforms. */
333
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
68 void createInstaller();
1255
2a1aa9df8f11 (issue133) Improve API documentation
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1053
diff changeset
69 /** @brief Shows the About dialog. */
333
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
70 void showAbout();
1255
2a1aa9df8f11 (issue133) Improve API documentation
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1053
diff changeset
71 /** @brief Opens the Help in a browser window. */
1001
0b7bb4f68f5a (issue89) Add Help button
Andre Heinecke <andre.heinecke@intevation.de>
parents: 679
diff changeset
72 void showHelp();
1255
2a1aa9df8f11 (issue133) Improve API documentation
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1053
diff changeset
73 /** @brief Presents a Dialog to load a certificate list and handles the loading. */
344
4454a4dc73a3 Added file dialog to load a certificate list from file.
Raimund Renkert <rrenkert@intevation.de>
parents: 343
diff changeset
74 void loadCertificateFile();
1317
d009da9cfa10 (issue157) Reload list after successful creation
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1316
diff changeset
75 /** @brief Loads the current certificate list. */
d009da9cfa10 (issue157) Reload list after successful creation
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1316
diff changeset
76 void loadCurrentCertificates();
1255
2a1aa9df8f11 (issue133) Improve API documentation
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1053
diff changeset
77 /** @brief Save the current selection of certificates as a certificate list. */
368
f9c98f9e9f76 Show the new dialog on save button click.
Raimund Renkert <rrenkert@intevation.de>
parents: 358
diff changeset
78 void saveCertificateFile();
1255
2a1aa9df8f11 (issue133) Improve API documentation
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1053
diff changeset
79 /** @brief Add certificates to the certificate table. */
358
9ba7b4b4c1de Implemented the load from certificate file and set the edit state of certificates.
Raimund Renkert <rrenkert@intevation.de>
parents: 344
diff changeset
80 void addCertificates();
1255
2a1aa9df8f11 (issue133) Improve API documentation
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1053
diff changeset
81 /** @brief Remove certificates from the current certificate table. */
376
9731d28b95af Implemented 'remove certificate' in administrator app.
Raimund Renkert <rrenkert@intevation.de>
parents: 368
diff changeset
82 void removeCertificates();
1255
2a1aa9df8f11 (issue133) Improve API documentation
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1053
diff changeset
83 /** @brief Changes the state of a certificate when it was clicked. */
376
9731d28b95af Implemented 'remove certificate' in administrator app.
Raimund Renkert <rrenkert@intevation.de>
parents: 368
diff changeset
84 void clickedCertificate(const QModelIndex&);
333
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
85
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
86 private:
1255
2a1aa9df8f11 (issue133) Improve API documentation
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1053
diff changeset
87 /** @brief Setup UI Actions */
333
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
88 void createActions();
1255
2a1aa9df8f11 (issue133) Improve API documentation
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1053
diff changeset
89 /** @brief Setup UI Menu Bar */
333
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
90 void createMenuBar();
1255
2a1aa9df8f11 (issue133) Improve API documentation
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1053
diff changeset
91 /** @brief Create the UI elements of the Window */
333
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
92 void createContent();
1255
2a1aa9df8f11 (issue133) Improve API documentation
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1053
diff changeset
93 /** @brief Load a certificate list into the table view */
344
4454a4dc73a3 Added file dialog to load a certificate list from file.
Raimund Renkert <rrenkert@intevation.de>
parents: 343
diff changeset
94 void loadCertificateTable();
1255
2a1aa9df8f11 (issue133) Improve API documentation
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1053
diff changeset
95 /** @brief Add a list of certificates to the table view
2a1aa9df8f11 (issue133) Improve API documentation
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1053
diff changeset
96 *
2a1aa9df8f11 (issue133) Improve API documentation
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1053
diff changeset
97 * @param[in] certs The certificates to add.
2a1aa9df8f11 (issue133) Improve API documentation
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1053
diff changeset
98 */
358
9ba7b4b4c1de Implemented the load from certificate file and set the edit state of certificates.
Raimund Renkert <rrenkert@intevation.de>
parents: 344
diff changeset
99 void addToCertificateTable(const QList<Certificate> &certs);
1255
2a1aa9df8f11 (issue133) Improve API documentation
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1053
diff changeset
100 /** @brief write a log file for the list creation.
2a1aa9df8f11 (issue133) Improve API documentation
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1053
diff changeset
101 *
2a1aa9df8f11 (issue133) Improve API documentation
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1053
diff changeset
102 * This creates a log entry containing all pertinent information of a
2a1aa9df8f11 (issue133) Improve API documentation
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1053
diff changeset
103 * certificate list creation. It records changes
2a1aa9df8f11 (issue133) Improve API documentation
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1053
diff changeset
104 * made to the certificate list and notes down the current time and
2a1aa9df8f11 (issue133) Improve API documentation
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1053
diff changeset
105 * the key used to sign the certificate list.
2a1aa9df8f11 (issue133) Improve API documentation
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1053
diff changeset
106 *
2a1aa9df8f11 (issue133) Improve API documentation
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1053
diff changeset
107 * @param [in] list the certificate list that is about to be created and should
2a1aa9df8f11 (issue133) Improve API documentation
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1053
diff changeset
108 * be logged.
2a1aa9df8f11 (issue133) Improve API documentation
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1053
diff changeset
109 * @param [in] keyFingerprint the encoded fingerprint of the signing key used.
2a1aa9df8f11 (issue133) Improve API documentation
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1053
diff changeset
110 *
2a1aa9df8f11 (issue133) Improve API documentation
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1053
diff changeset
111 * @returns A byte array containing the log information in latin1 encoding.
2a1aa9df8f11 (issue133) Improve API documentation
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1053
diff changeset
112 */
679
75cd2fbf9ac6 (Issue 9) Log key's sha256 fingerprint
Andre Heinecke <andre.heinecke@intevation.de>
parents: 565
diff changeset
113 QByteArray createLogEntries(const CertificateList &list, const QString &keyFingerprint);
333
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
114
453
6dec8101793c Rename settings and certlist and add accessors
Andre Heinecke <aheinecke@intevation.de>
parents: 427
diff changeset
115 QSettings mSettings;
333
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
116
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
117 QMenuBar *menuBar;
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
118
335
811eec4e1b99 Use a table view with the new certificate table model in administrator app.
Raimund Renkert <rrenkert@intevation.de>
parents: 333
diff changeset
119 QTableView *certificateView;
453
6dec8101793c Rename settings and certlist and add accessors
Andre Heinecke <aheinecke@intevation.de>
parents: 427
diff changeset
120 CertificateList mCertList;
343
e3d6de930c90 Updated the table ui in administrator app.
Raimund Renkert <rrenkert@intevation.de>
parents: 335
diff changeset
121 CertificateTabelModel *certificateModel;
1316
ff9cd05e861e (issue166) Fix certificiate removal
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1255
diff changeset
122 QSortFilterProxyModel *mFilterModel;
333
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
123 QPushButton *saveButton;
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
124 QPushButton *loadButton;
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
125 QPushButton *addButton;
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
126 QPushButton *removeButton;
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
127 };
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
128
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
129 #endif // ADMINSTRATORWINDOW_H

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