annotate ui/administratorwindow.cpp @ 939:574cd1fae1dc

Only do selftest on Windows
author Andre Heinecke <andre.heinecke@intevation.de>
date Fri, 22 Aug 2014 19:55:08 +0200
parents 75cd2fbf9ac6
children 0b7bb4f68f5a
rev   line source
404
17e1c8f37d72 Add License
Andre Heinecke <aheinecke@intevation.de>
parents: 401
diff changeset
1 /* Copyright (C) 2014 by Bundesamt für Sicherheit in der Informationstechnik
17e1c8f37d72 Add License
Andre Heinecke <aheinecke@intevation.de>
parents: 401
diff changeset
2 * Software engineering by Intevation GmbH
17e1c8f37d72 Add License
Andre Heinecke <aheinecke@intevation.de>
parents: 401
diff changeset
3 *
17e1c8f37d72 Add License
Andre Heinecke <aheinecke@intevation.de>
parents: 401
diff changeset
4 * This file is Free Software under the GNU GPL (v>=2)
17e1c8f37d72 Add License
Andre Heinecke <aheinecke@intevation.de>
parents: 401
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY!
17e1c8f37d72 Add License
Andre Heinecke <aheinecke@intevation.de>
parents: 401
diff changeset
6 * See LICENSE.txt for details.
17e1c8f37d72 Add License
Andre Heinecke <aheinecke@intevation.de>
parents: 401
diff changeset
7 */
333
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
8 #include "administratorwindow.h"
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
9
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
10 #include <QDebug>
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
11 #include <QMessageBox>
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
12 #include <QAction>
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
13 #include <QMenu>
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
14 #include <QApplication>
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
15 #include <QHBoxLayout>
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
16 #include <QVBoxLayout>
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
17 #include <QGroupBox>
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
18 #include <QSplitter>
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
19 #include <QLabel>
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
20 #include <QImage>
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
21 #include <QCheckBox>
335
811eec4e1b99 Use a table view with the new certificate table model in administrator app.
Raimund Renkert <rrenkert@intevation.de>
parents: 333
diff changeset
22 #include <QHeaderView>
344
4454a4dc73a3 Added file dialog to load a certificate list from file.
Raimund Renkert <rrenkert@intevation.de>
parents: 343
diff changeset
23 #include <QFileDialog>
394
7e0a188d6848 Load the last certificate list from data dir on startup.
Raimund Renkert <rrenkert@intevation.de>
parents: 376
diff changeset
24 #include <QStandardPaths>
398
9e6a2c2033ed Enable sorting in certifacte table view.
Raimund Renkert <rrenkert@intevation.de>
parents: 396
diff changeset
25 #include <QSortFilterProxyModel>
333
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
26
348
e6aa82466420 Use the table item delegate for certificates and make the model editable.
Raimund Renkert <rrenkert@intevation.de>
parents: 344
diff changeset
27 #include "certificatetabledelegate.h"
362
857ae1ffdd6f Open the new dialog from the main menu.
Raimund Renkert <rrenkert@intevation.de>
parents: 358
diff changeset
28 #include "createinstallerdialog.h"
368
f9c98f9e9f76 Show the new dialog on save button click.
Raimund Renkert <rrenkert@intevation.de>
parents: 362
diff changeset
29 #include "createcertlistdialog.h"
566
8728ae882b6a Added dialog to show the differences before saving a certificate list.
Raimund Renkert <rrenkert@intevation.de>
parents: 565
diff changeset
30 #include "certificatediffdialog.h"
427
d08e39b913ee Added about dialog content and open the dialog via administration app.
Raimund Renkert <rrenkert@intevation.de>
parents: 426
diff changeset
31 #include "aboutdialog.h"
348
e6aa82466420 Use the table item delegate for certificates and make the model editable.
Raimund Renkert <rrenkert@intevation.de>
parents: 344
diff changeset
32
333
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
33 AdministratorWindow::AdministratorWindow() {
412
340b8759d005 Wording und icons in TrustBridge Administration main window.
Raimund Renkert <rrenkert@intevation.de>
parents: 404
diff changeset
34 setWindowTitle(tr("TrustBridge Administration"));
394
7e0a188d6848 Load the last certificate list from data dir on startup.
Raimund Renkert <rrenkert@intevation.de>
parents: 376
diff changeset
35 QString path = QStandardPaths::locate(
462
091ad56c2715 Change current certificates file name. Some cleanups.
Andre Heinecke <aheinecke@intevation.de>
parents: 453
diff changeset
36 QStandardPaths::DataLocation, QString("current_certificates.txt"));
453
6dec8101793c Rename settings and certlist and add accessors
Andre Heinecke <aheinecke@intevation.de>
parents: 429
diff changeset
37 mCertList.readList(path.toLocal8Bit());
333
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
38 createActions();
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
39 createMenuBar();
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
40 createContent();
394
7e0a188d6848 Load the last certificate list from data dir on startup.
Raimund Renkert <rrenkert@intevation.de>
parents: 376
diff changeset
41 loadCertificateTable();
540
d7ab9e734317 Start smaller
Andre Heinecke <aheinecke@intevation.de>
parents: 529
diff changeset
42 resize(1190, 500);
333
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
43 }
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
44
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
45 void AdministratorWindow::createActions()
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
46 {
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
47 }
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
48
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
49 void AdministratorWindow::createMenuBar()
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
50 {
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
51 menuBar = new QMenuBar(this);
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
52 QMenu *menu = new QMenu(tr("Menu"), menuBar);
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
53 menuBar->addMenu(menu);
415
b19290d6b148 Removed obsolete menu entries.
Raimund Renkert <rrenkert@intevation.de>
parents: 412
diff changeset
54 QAction *createInstaller = menu->addAction(tr("Create installer ..."));
b19290d6b148 Removed obsolete menu entries.
Raimund Renkert <rrenkert@intevation.de>
parents: 412
diff changeset
55 QAction *about = menu->addAction(tr("About TrustBridge"));
333
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
56 menu->addSeparator();
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
57 QAction *quit = menu->addAction(tr("Quit"));
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
58 connect(createInstaller, SIGNAL(triggered()), this, SLOT(createInstaller()));
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
59 connect(about, SIGNAL(triggered()), this, SLOT(showAbout()));
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
60 connect(quit, SIGNAL(triggered()), qApp, SLOT(quit()));
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
61 setMenuBar(menuBar);
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
62 }
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
63
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
64 void AdministratorWindow::createContent()
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
65 {
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
66 // Create a central widget containing the main layout.
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
67 QWidget *base = new QWidget;
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
68
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
69 // Layouts and Container
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
70 QVBoxLayout *mainLayout = new QVBoxLayout;
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
71 QVBoxLayout *certLayout = new QVBoxLayout;
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
72 QHBoxLayout *headerLayout = new QHBoxLayout;
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
73 QVBoxLayout *headerTextLayout = new QVBoxLayout;
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
74 QHBoxLayout *bottomLayout = new QHBoxLayout;
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
75
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
76 // The certificate list
412
340b8759d005 Wording und icons in TrustBridge Administration main window.
Raimund Renkert <rrenkert@intevation.de>
parents: 404
diff changeset
77 QGroupBox *certBox = new QGroupBox(
426
d7cda835abd6 Some wording and Layout in TrustBridge Administration.
Raimund Renkert <rrenkert@intevation.de>
parents: 415
diff changeset
78 tr("All managed root certificates of the certificate list: "));
335
811eec4e1b99 Use a table view with the new certificate table model in administrator app.
Raimund Renkert <rrenkert@intevation.de>
parents: 333
diff changeset
79 certificateView = new QTableView;
343
e3d6de930c90 Updated the table ui in administrator app.
Raimund Renkert <rrenkert@intevation.de>
parents: 335
diff changeset
80 certificateModel = new CertificateTabelModel();
398
9e6a2c2033ed Enable sorting in certifacte table view.
Raimund Renkert <rrenkert@intevation.de>
parents: 396
diff changeset
81 QSortFilterProxyModel *filterModel = new QSortFilterProxyModel(this);
9e6a2c2033ed Enable sorting in certifacte table view.
Raimund Renkert <rrenkert@intevation.de>
parents: 396
diff changeset
82 filterModel->setSourceModel(certificateModel);
348
e6aa82466420 Use the table item delegate for certificates and make the model editable.
Raimund Renkert <rrenkert@intevation.de>
parents: 344
diff changeset
83 CertificateTableDelegate *delegate = new CertificateTableDelegate(certificateView);
398
9e6a2c2033ed Enable sorting in certifacte table view.
Raimund Renkert <rrenkert@intevation.de>
parents: 396
diff changeset
84 certificateView->setModel(filterModel);
348
e6aa82466420 Use the table item delegate for certificates and make the model editable.
Raimund Renkert <rrenkert@intevation.de>
parents: 344
diff changeset
85 certificateView->setItemDelegate(delegate);
426
d7cda835abd6 Some wording and Layout in TrustBridge Administration.
Raimund Renkert <rrenkert@intevation.de>
parents: 415
diff changeset
86 certificateView->horizontalHeader()->setStretchLastSection(true);
395
a63601810211 Resized administrator main window and columns.
Raimund Renkert <rrenkert@intevation.de>
parents: 394
diff changeset
87 certificateView->resizeColumnsToContents();
a63601810211 Resized administrator main window and columns.
Raimund Renkert <rrenkert@intevation.de>
parents: 394
diff changeset
88 certificateView->setColumnWidth(0, 60);
343
e3d6de930c90 Updated the table ui in administrator app.
Raimund Renkert <rrenkert@intevation.de>
parents: 335
diff changeset
89 certificateView->setSelectionBehavior(QAbstractItemView::SelectRows);
376
9731d28b95af Implemented 'remove certificate' in administrator app.
Raimund Renkert <rrenkert@intevation.de>
parents: 368
diff changeset
90 connect(certificateView, SIGNAL(clicked(const QModelIndex&)), this,
9731d28b95af Implemented 'remove certificate' in administrator app.
Raimund Renkert <rrenkert@intevation.de>
parents: 368
diff changeset
91 SLOT(clickedCertificate(const QModelIndex&)));
343
e3d6de930c90 Updated the table ui in administrator app.
Raimund Renkert <rrenkert@intevation.de>
parents: 335
diff changeset
92 certificateView->verticalHeader()->setVisible(false);
398
9e6a2c2033ed Enable sorting in certifacte table view.
Raimund Renkert <rrenkert@intevation.de>
parents: 396
diff changeset
93 certificateView->setSortingEnabled(true);
335
811eec4e1b99 Use a table view with the new certificate table model in administrator app.
Raimund Renkert <rrenkert@intevation.de>
parents: 333
diff changeset
94 certLayout->addWidget(certificateView);
333
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
95 certBox->setLayout(certLayout);
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
96
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
97 // The header (icon, about text)
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
98 QImage *logoImage = new QImage(":/img/logo.png");
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
99 QLabel *logo = new QLabel;
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
100 logo->setBackgroundRole(QPalette::Base);
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
101 logo->setPixmap(QPixmap::fromImage(*logoImage));
427
d08e39b913ee Added about dialog content and open the dialog via administration app.
Raimund Renkert <rrenkert@intevation.de>
parents: 426
diff changeset
102 QLabel *title = new QLabel("<h2>" + tr("TrustBridge Administration") + "</h2>");
412
340b8759d005 Wording und icons in TrustBridge Administration main window.
Raimund Renkert <rrenkert@intevation.de>
parents: 404
diff changeset
103 QLabel *subTitle = new QLabel(
340b8759d005 Wording und icons in TrustBridge Administration main window.
Raimund Renkert <rrenkert@intevation.de>
parents: 404
diff changeset
104 tr("Management application of the BSI certificate installer"));
333
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
105 headerTextLayout->addWidget(title);
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
106 headerTextLayout->addWidget(subTitle);
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
107 headerLayout->addWidget(logo);
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
108 headerLayout->addLayout(headerTextLayout);
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
109 headerLayout->setStretch(0, 0);
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
110 headerLayout->setStretch(1, 10);
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
111
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
112 // The buttons.
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
113 bottomLayout->setAlignment(Qt::AlignBottom);
412
340b8759d005 Wording und icons in TrustBridge Administration main window.
Raimund Renkert <rrenkert@intevation.de>
parents: 404
diff changeset
114 saveButton = new QPushButton(QIcon(":/img/document-save.png"), tr("Save list"));
368
f9c98f9e9f76 Show the new dialog on save button click.
Raimund Renkert <rrenkert@intevation.de>
parents: 362
diff changeset
115 connect(saveButton, SIGNAL(clicked()), this, SLOT(saveCertificateFile()));
412
340b8759d005 Wording und icons in TrustBridge Administration main window.
Raimund Renkert <rrenkert@intevation.de>
parents: 404
diff changeset
116 loadButton = new QPushButton(QIcon(":/img/document-open.png"), tr("Load list"));
344
4454a4dc73a3 Added file dialog to load a certificate list from file.
Raimund Renkert <rrenkert@intevation.de>
parents: 343
diff changeset
117 connect(loadButton, SIGNAL(clicked()), this, SLOT(loadCertificateFile()));
412
340b8759d005 Wording und icons in TrustBridge Administration main window.
Raimund Renkert <rrenkert@intevation.de>
parents: 404
diff changeset
118 addButton = new QPushButton(QIcon(":/img/document-new.png"), tr("Add certificate"));
358
9ba7b4b4c1de Implemented the load from certificate file and set the edit state of certificates.
Raimund Renkert <rrenkert@intevation.de>
parents: 348
diff changeset
119 connect(addButton, SIGNAL(clicked()), this, SLOT(addCertificates()));
412
340b8759d005 Wording und icons in TrustBridge Administration main window.
Raimund Renkert <rrenkert@intevation.de>
parents: 404
diff changeset
120 removeButton = new QPushButton(QIcon(":/img/document-close.png"), tr("Remove certificate"));
376
9731d28b95af Implemented 'remove certificate' in administrator app.
Raimund Renkert <rrenkert@intevation.de>
parents: 368
diff changeset
121 removeButton->setEnabled(false);
9731d28b95af Implemented 'remove certificate' in administrator app.
Raimund Renkert <rrenkert@intevation.de>
parents: 368
diff changeset
122 connect(removeButton, SIGNAL(clicked()), this, SLOT(removeCertificates()));
333
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
123 bottomLayout->addWidget(saveButton);
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
124 bottomLayout->addWidget(loadButton);
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
125 bottomLayout->addWidget(addButton);
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
126 bottomLayout->addWidget(removeButton);
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
127 bottomLayout->insertStretch(4, 10);
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 mainLayout->addLayout(headerLayout);
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
130 mainLayout->addWidget(certBox);
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
131 mainLayout->addLayout(bottomLayout);
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
132
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
133
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
134 // QMainWindow allready has a layout. All child layouts and widgets are
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
135 // managed in the central widget.
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
136 base->setLayout(mainLayout);
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
137 setCentralWidget(base);
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
138 }
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
139
344
4454a4dc73a3 Added file dialog to load a certificate list from file.
Raimund Renkert <rrenkert@intevation.de>
parents: 343
diff changeset
140 void AdministratorWindow::loadCertificateFile()
4454a4dc73a3 Added file dialog to load a certificate list from file.
Raimund Renkert <rrenkert@intevation.de>
parents: 343
diff changeset
141 {
515
9d3880db6ba7 Improve error handlig and persist user decisions
Andre Heinecke <aheinecke@intevation.de>
parents: 462
diff changeset
142 QString lastCertFile = mSettings.value("LastCertList", QDir::homePath()).toString();
344
4454a4dc73a3 Added file dialog to load a certificate list from file.
Raimund Renkert <rrenkert@intevation.de>
parents: 343
diff changeset
143 QString certFile = QFileDialog::getOpenFileName(
515
9d3880db6ba7 Improve error handlig and persist user decisions
Andre Heinecke <aheinecke@intevation.de>
parents: 462
diff changeset
144 this, tr("Select certificate list file"), lastCertFile, "*.txt");
567
75e39c52aa94 Check if cert-list filename is null (user canceled open file dialog).
Raimund Renkert <rrenkert@intevation.de>
parents: 566
diff changeset
145 if (certFile.isNull()) {
75e39c52aa94 Check if cert-list filename is null (user canceled open file dialog).
Raimund Renkert <rrenkert@intevation.de>
parents: 566
diff changeset
146 return;
75e39c52aa94 Check if cert-list filename is null (user canceled open file dialog).
Raimund Renkert <rrenkert@intevation.de>
parents: 566
diff changeset
147 }
453
6dec8101793c Rename settings and certlist and add accessors
Andre Heinecke <aheinecke@intevation.de>
parents: 429
diff changeset
148 mCertList.readList(certFile.toLocal8Bit().constData());
6dec8101793c Rename settings and certlist and add accessors
Andre Heinecke <aheinecke@intevation.de>
parents: 429
diff changeset
149 if (!mCertList.isValid()) {
515
9d3880db6ba7 Improve error handlig and persist user decisions
Andre Heinecke <aheinecke@intevation.de>
parents: 462
diff changeset
150 QMessageBox::warning(this, tr("Error!"), tr("Failed to load the certificate list."));
462
091ad56c2715 Change current certificates file name. Some cleanups.
Andre Heinecke <aheinecke@intevation.de>
parents: 453
diff changeset
151 } else {
396
26651cc0cc47 Remove all certificates if a new list is loaded from file.
Raimund Renkert <rrenkert@intevation.de>
parents: 395
diff changeset
152 certificateModel->removeAll();
344
4454a4dc73a3 Added file dialog to load a certificate list from file.
Raimund Renkert <rrenkert@intevation.de>
parents: 343
diff changeset
153 loadCertificateTable();
515
9d3880db6ba7 Improve error handlig and persist user decisions
Andre Heinecke <aheinecke@intevation.de>
parents: 462
diff changeset
154 mSettings.setValue("LastCertList", certFile);
344
4454a4dc73a3 Added file dialog to load a certificate list from file.
Raimund Renkert <rrenkert@intevation.de>
parents: 343
diff changeset
155 }
4454a4dc73a3 Added file dialog to load a certificate list from file.
Raimund Renkert <rrenkert@intevation.de>
parents: 343
diff changeset
156 }
4454a4dc73a3 Added file dialog to load a certificate list from file.
Raimund Renkert <rrenkert@intevation.de>
parents: 343
diff changeset
157
368
f9c98f9e9f76 Show the new dialog on save button click.
Raimund Renkert <rrenkert@intevation.de>
parents: 362
diff changeset
158 void AdministratorWindow::saveCertificateFile()
f9c98f9e9f76 Show the new dialog on save button click.
Raimund Renkert <rrenkert@intevation.de>
parents: 362
diff changeset
159 {
566
8728ae882b6a Added dialog to show the differences before saving a certificate list.
Raimund Renkert <rrenkert@intevation.de>
parents: 565
diff changeset
160 CertificateDiffDialog *diffDialog = new CertificateDiffDialog(this);
8728ae882b6a Added dialog to show the differences before saving a certificate list.
Raimund Renkert <rrenkert@intevation.de>
parents: 565
diff changeset
161 int ret = diffDialog->exec();
8728ae882b6a Added dialog to show the differences before saving a certificate list.
Raimund Renkert <rrenkert@intevation.de>
parents: 565
diff changeset
162 if (ret == QDialog::Accepted) {
8728ae882b6a Added dialog to show the differences before saving a certificate list.
Raimund Renkert <rrenkert@intevation.de>
parents: 565
diff changeset
163 CreateCertListDialog *dialog = new CreateCertListDialog(this);
8728ae882b6a Added dialog to show the differences before saving a certificate list.
Raimund Renkert <rrenkert@intevation.de>
parents: 565
diff changeset
164 dialog->show();
8728ae882b6a Added dialog to show the differences before saving a certificate list.
Raimund Renkert <rrenkert@intevation.de>
parents: 565
diff changeset
165 }
368
f9c98f9e9f76 Show the new dialog on save button click.
Raimund Renkert <rrenkert@intevation.de>
parents: 362
diff changeset
166 }
f9c98f9e9f76 Show the new dialog on save button click.
Raimund Renkert <rrenkert@intevation.de>
parents: 362
diff changeset
167
358
9ba7b4b4c1de Implemented the load from certificate file and set the edit state of certificates.
Raimund Renkert <rrenkert@intevation.de>
parents: 348
diff changeset
168 void AdministratorWindow::addCertificates()
9ba7b4b4c1de Implemented the load from certificate file and set the edit state of certificates.
Raimund Renkert <rrenkert@intevation.de>
parents: 348
diff changeset
169 {
429
f07bc5de2a87 Adminstration: "Add certificate" can now load multiple certificate files.
Raimund Renkert <rrenkert@intevation.de>
parents: 427
diff changeset
170 QStringList certFiles = QFileDialog::getOpenFileNames(
529
c81123298387 Also allow cer files,..
Andre Heinecke <aheinecke@intevation.de>
parents: 515
diff changeset
171 this, tr("Select certificate"), QDir::homePath(), "*.pem *.der *.crt *.cer");
429
f07bc5de2a87 Adminstration: "Add certificate" can now load multiple certificate files.
Raimund Renkert <rrenkert@intevation.de>
parents: 427
diff changeset
172 for (int i = 0; i < certFiles.size(); i++) {
f07bc5de2a87 Adminstration: "Add certificate" can now load multiple certificate files.
Raimund Renkert <rrenkert@intevation.de>
parents: 427
diff changeset
173 QString certFile = certFiles.at(i);
f07bc5de2a87 Adminstration: "Add certificate" can now load multiple certificate files.
Raimund Renkert <rrenkert@intevation.de>
parents: 427
diff changeset
174 QList<Certificate> certs = Certificate::fromFileName(certFile);
f07bc5de2a87 Adminstration: "Add certificate" can now load multiple certificate files.
Raimund Renkert <rrenkert@intevation.de>
parents: 427
diff changeset
175 addToCertificateTable(certs);
f07bc5de2a87 Adminstration: "Add certificate" can now load multiple certificate files.
Raimund Renkert <rrenkert@intevation.de>
parents: 427
diff changeset
176 }
427
d08e39b913ee Added about dialog content and open the dialog via administration app.
Raimund Renkert <rrenkert@intevation.de>
parents: 426
diff changeset
177 certificateView->resizeColumnsToContents();
d08e39b913ee Added about dialog content and open the dialog via administration app.
Raimund Renkert <rrenkert@intevation.de>
parents: 426
diff changeset
178 certificateView->setColumnWidth(0, 60);
358
9ba7b4b4c1de Implemented the load from certificate file and set the edit state of certificates.
Raimund Renkert <rrenkert@intevation.de>
parents: 348
diff changeset
179 }
9ba7b4b4c1de Implemented the load from certificate file and set the edit state of certificates.
Raimund Renkert <rrenkert@intevation.de>
parents: 348
diff changeset
180
376
9731d28b95af Implemented 'remove certificate' in administrator app.
Raimund Renkert <rrenkert@intevation.de>
parents: 368
diff changeset
181 void AdministratorWindow::removeCertificates()
9731d28b95af Implemented 'remove certificate' in administrator app.
Raimund Renkert <rrenkert@intevation.de>
parents: 368
diff changeset
182 {
9731d28b95af Implemented 'remove certificate' in administrator app.
Raimund Renkert <rrenkert@intevation.de>
parents: 368
diff changeset
183 QModelIndexList list = certificateView->selectionModel()->selectedRows();
9731d28b95af Implemented 'remove certificate' in administrator app.
Raimund Renkert <rrenkert@intevation.de>
parents: 368
diff changeset
184 for (int i = list.size() -1 ; i >= 0; i--) {
9731d28b95af Implemented 'remove certificate' in administrator app.
Raimund Renkert <rrenkert@intevation.de>
parents: 368
diff changeset
185 certificateModel->removeRow(list.at(i).row(), list.at(i));
9731d28b95af Implemented 'remove certificate' in administrator app.
Raimund Renkert <rrenkert@intevation.de>
parents: 368
diff changeset
186 }
9731d28b95af Implemented 'remove certificate' in administrator app.
Raimund Renkert <rrenkert@intevation.de>
parents: 368
diff changeset
187 }
9731d28b95af Implemented 'remove certificate' in administrator app.
Raimund Renkert <rrenkert@intevation.de>
parents: 368
diff changeset
188
344
4454a4dc73a3 Added file dialog to load a certificate list from file.
Raimund Renkert <rrenkert@intevation.de>
parents: 343
diff changeset
189 void AdministratorWindow::loadCertificateTable() {
453
6dec8101793c Rename settings and certlist and add accessors
Andre Heinecke <aheinecke@intevation.de>
parents: 429
diff changeset
190 foreach(const Certificate &cert, mCertList.getCertificates()) {
358
9ba7b4b4c1de Implemented the load from certificate file and set the edit state of certificates.
Raimund Renkert <rrenkert@intevation.de>
parents: 348
diff changeset
191 certificateModel->addCertificate(cert, true);
9ba7b4b4c1de Implemented the load from certificate file and set the edit state of certificates.
Raimund Renkert <rrenkert@intevation.de>
parents: 348
diff changeset
192 }
395
a63601810211 Resized administrator main window and columns.
Raimund Renkert <rrenkert@intevation.de>
parents: 394
diff changeset
193 certificateView->resizeColumnsToContents();
a63601810211 Resized administrator main window and columns.
Raimund Renkert <rrenkert@intevation.de>
parents: 394
diff changeset
194 certificateView->setColumnWidth(0, 60);
358
9ba7b4b4c1de Implemented the load from certificate file and set the edit state of certificates.
Raimund Renkert <rrenkert@intevation.de>
parents: 348
diff changeset
195 }
9ba7b4b4c1de Implemented the load from certificate file and set the edit state of certificates.
Raimund Renkert <rrenkert@intevation.de>
parents: 348
diff changeset
196
9ba7b4b4c1de Implemented the load from certificate file and set the edit state of certificates.
Raimund Renkert <rrenkert@intevation.de>
parents: 348
diff changeset
197 void AdministratorWindow::addToCertificateTable(const QList<Certificate> &certs)
9ba7b4b4c1de Implemented the load from certificate file and set the edit state of certificates.
Raimund Renkert <rrenkert@intevation.de>
parents: 348
diff changeset
198 {
9ba7b4b4c1de Implemented the load from certificate file and set the edit state of certificates.
Raimund Renkert <rrenkert@intevation.de>
parents: 348
diff changeset
199 foreach(const Certificate &cert, certs) {
9ba7b4b4c1de Implemented the load from certificate file and set the edit state of certificates.
Raimund Renkert <rrenkert@intevation.de>
parents: 348
diff changeset
200 certificateModel->addCertificate(cert, false);
344
4454a4dc73a3 Added file dialog to load a certificate list from file.
Raimund Renkert <rrenkert@intevation.de>
parents: 343
diff changeset
201 }
4454a4dc73a3 Added file dialog to load a certificate list from file.
Raimund Renkert <rrenkert@intevation.de>
parents: 343
diff changeset
202 }
4454a4dc73a3 Added file dialog to load a certificate list from file.
Raimund Renkert <rrenkert@intevation.de>
parents: 343
diff changeset
203
333
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
204 void AdministratorWindow::showAbout()
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
205 {
427
d08e39b913ee Added about dialog content and open the dialog via administration app.
Raimund Renkert <rrenkert@intevation.de>
parents: 426
diff changeset
206 AboutDialog *dialog = new AboutDialog(this);
d08e39b913ee Added about dialog content and open the dialog via administration app.
Raimund Renkert <rrenkert@intevation.de>
parents: 426
diff changeset
207 dialog->show();
333
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
208 }
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
209
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
210 void AdministratorWindow::createInstaller()
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
211 {
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
212 qDebug() << "create Installer";
362
857ae1ffdd6f Open the new dialog from the main menu.
Raimund Renkert <rrenkert@intevation.de>
parents: 358
diff changeset
213 CreateInstallerDialog *dialog = new CreateInstallerDialog(this);
857ae1ffdd6f Open the new dialog from the main menu.
Raimund Renkert <rrenkert@intevation.de>
parents: 358
diff changeset
214 dialog->show();
333
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
215 }
de94c4ec22b1 Renamed management to administrator application.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
216
376
9731d28b95af Implemented 'remove certificate' in administrator app.
Raimund Renkert <rrenkert@intevation.de>
parents: 368
diff changeset
217 void AdministratorWindow::clickedCertificate(const QModelIndex &index)
9731d28b95af Implemented 'remove certificate' in administrator app.
Raimund Renkert <rrenkert@intevation.de>
parents: 368
diff changeset
218 {
9731d28b95af Implemented 'remove certificate' in administrator app.
Raimund Renkert <rrenkert@intevation.de>
parents: 368
diff changeset
219 if (index.data(Qt::UserRole).toBool()) {
9731d28b95af Implemented 'remove certificate' in administrator app.
Raimund Renkert <rrenkert@intevation.de>
parents: 368
diff changeset
220 removeButton->setEnabled(false);
9731d28b95af Implemented 'remove certificate' in administrator app.
Raimund Renkert <rrenkert@intevation.de>
parents: 368
diff changeset
221 }
9731d28b95af Implemented 'remove certificate' in administrator app.
Raimund Renkert <rrenkert@intevation.de>
parents: 368
diff changeset
222 else {
9731d28b95af Implemented 'remove certificate' in administrator app.
Raimund Renkert <rrenkert@intevation.de>
parents: 368
diff changeset
223 removeButton->setEnabled(true);
9731d28b95af Implemented 'remove certificate' in administrator app.
Raimund Renkert <rrenkert@intevation.de>
parents: 368
diff changeset
224 }
9731d28b95af Implemented 'remove certificate' in administrator app.
Raimund Renkert <rrenkert@intevation.de>
parents: 368
diff changeset
225 }
562
ccdc4c6b97ce Log diff between initial certificate list and saved list to a logfile.
Raimund Renkert <rrenkert@intevation.de>
parents: 540
diff changeset
226
679
75cd2fbf9ac6 (Issue 9) Log key's sha256 fingerprint
Andre Heinecke <andre.heinecke@intevation.de>
parents: 570
diff changeset
227 void AdministratorWindow::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: 540
diff changeset
228 {
ccdc4c6b97ce Log diff between initial certificate list and saved list to a logfile.
Raimund Renkert <rrenkert@intevation.de>
parents: 540
diff changeset
229 QDir logDir(QStandardPaths::writableLocation(QStandardPaths::DataLocation));
ccdc4c6b97ce Log diff between initial certificate list and saved list to a logfile.
Raimund Renkert <rrenkert@intevation.de>
parents: 540
diff changeset
230 QString logFilePath = logDir.filePath("log.txt");
ccdc4c6b97ce Log diff between initial certificate list and saved list to a logfile.
Raimund Renkert <rrenkert@intevation.de>
parents: 540
diff changeset
231 QFile logFile(logFilePath);
ccdc4c6b97ce Log diff between initial certificate list and saved list to a logfile.
Raimund Renkert <rrenkert@intevation.de>
parents: 540
diff changeset
232
ccdc4c6b97ce Log diff between initial certificate list and saved list to a logfile.
Raimund Renkert <rrenkert@intevation.de>
parents: 540
diff changeset
233 if (!logFile.open(QIODevice::Append)) {
570
c9d296f04995 Inform the user when logging fails.
Andre Heinecke <aheinecke@intevation.de>
parents: 567
diff changeset
234 QMessageBox::warning(this, tr("Error!"), tr("Failed to open log file: ") +
c9d296f04995 Inform the user when logging fails.
Andre Heinecke <aheinecke@intevation.de>
parents: 567
diff changeset
235 logFilePath + tr(" Changes are not logged!"));
562
ccdc4c6b97ce Log diff between initial certificate list and saved list to a logfile.
Raimund Renkert <rrenkert@intevation.de>
parents: 540
diff changeset
236 qDebug() << "Failed to open log file: " << logFilePath;
ccdc4c6b97ce Log diff between initial certificate list and saved list to a logfile.
Raimund Renkert <rrenkert@intevation.de>
parents: 540
diff changeset
237 return;
ccdc4c6b97ce Log diff between initial certificate list and saved list to a logfile.
Raimund Renkert <rrenkert@intevation.de>
parents: 540
diff changeset
238 }
ccdc4c6b97ce Log diff between initial certificate list and saved list to a logfile.
Raimund Renkert <rrenkert@intevation.de>
parents: 540
diff changeset
239
ccdc4c6b97ce Log diff between initial certificate list and saved list to a logfile.
Raimund Renkert <rrenkert@intevation.de>
parents: 540
diff changeset
240 CertificateList newCertList;
ccdc4c6b97ce Log diff between initial certificate list and saved list to a logfile.
Raimund Renkert <rrenkert@intevation.de>
parents: 540
diff changeset
241 newCertList.readList(currentCerts.toLocal8Bit());
679
75cd2fbf9ac6 (Issue 9) Log key's sha256 fingerprint
Andre Heinecke <andre.heinecke@intevation.de>
parents: 570
diff changeset
242 QByteArray entries = createLogEntries(newCertList, keyFingerprint);
562
ccdc4c6b97ce Log diff between initial certificate list and saved list to a logfile.
Raimund Renkert <rrenkert@intevation.de>
parents: 540
diff changeset
243 if(logFile.write(entries) != entries.size()) {
570
c9d296f04995 Inform the user when logging fails.
Andre Heinecke <aheinecke@intevation.de>
parents: 567
diff changeset
244 QMessageBox::warning(this, tr("Error!"), tr("Failed to write log file: ") +
c9d296f04995 Inform the user when logging fails.
Andre Heinecke <aheinecke@intevation.de>
parents: 567
diff changeset
245 logFilePath + tr(" Changes are not logged!"));
562
ccdc4c6b97ce Log diff between initial certificate list and saved list to a logfile.
Raimund Renkert <rrenkert@intevation.de>
parents: 540
diff changeset
246 return;
ccdc4c6b97ce Log diff between initial certificate list and saved list to a logfile.
Raimund Renkert <rrenkert@intevation.de>
parents: 540
diff changeset
247 }
ccdc4c6b97ce Log diff between initial certificate list and saved list to a logfile.
Raimund Renkert <rrenkert@intevation.de>
parents: 540
diff changeset
248 logFile.close();
ccdc4c6b97ce Log diff between initial certificate list and saved list to a logfile.
Raimund Renkert <rrenkert@intevation.de>
parents: 540
diff changeset
249 }
ccdc4c6b97ce Log diff between initial certificate list and saved list to a logfile.
Raimund Renkert <rrenkert@intevation.de>
parents: 540
diff changeset
250
679
75cd2fbf9ac6 (Issue 9) Log key's sha256 fingerprint
Andre Heinecke <andre.heinecke@intevation.de>
parents: 570
diff changeset
251 QByteArray AdministratorWindow::createLogEntries(const CertificateList &list, const QString& keyFingerprint)
562
ccdc4c6b97ce Log diff between initial certificate list and saved list to a logfile.
Raimund Renkert <rrenkert@intevation.de>
parents: 540
diff changeset
252 {
ccdc4c6b97ce Log diff between initial certificate list and saved list to a logfile.
Raimund Renkert <rrenkert@intevation.de>
parents: 540
diff changeset
253 QByteArray entries;
ccdc4c6b97ce Log diff between initial certificate list and saved list to a logfile.
Raimund Renkert <rrenkert@intevation.de>
parents: 540
diff changeset
254 QByteArray removeListEntries;
ccdc4c6b97ce Log diff between initial certificate list and saved list to a logfile.
Raimund Renkert <rrenkert@intevation.de>
parents: 540
diff changeset
255
ccdc4c6b97ce Log diff between initial certificate list and saved list to a logfile.
Raimund Renkert <rrenkert@intevation.de>
parents: 540
diff changeset
256 QDateTime currentDate = QDateTime::currentDateTime();
ccdc4c6b97ce Log diff between initial certificate list and saved list to a logfile.
Raimund Renkert <rrenkert@intevation.de>
parents: 540
diff changeset
257 QDateTime newListDate = list.date();
ccdc4c6b97ce Log diff between initial certificate list and saved list to a logfile.
Raimund Renkert <rrenkert@intevation.de>
parents: 540
diff changeset
258 QDateTime listDate = mCertList.date();
ccdc4c6b97ce Log diff between initial certificate list and saved list to a logfile.
Raimund Renkert <rrenkert@intevation.de>
parents: 540
diff changeset
259
ccdc4c6b97ce Log diff between initial certificate list and saved list to a logfile.
Raimund Renkert <rrenkert@intevation.de>
parents: 540
diff changeset
260 entries.append("##### " +
ccdc4c6b97ce Log diff between initial certificate list and saved list to a logfile.
Raimund Renkert <rrenkert@intevation.de>
parents: 540
diff changeset
261 currentDate.toString("yyyy-MM-dd hh:mm") +
ccdc4c6b97ce Log diff between initial certificate list and saved list to a logfile.
Raimund Renkert <rrenkert@intevation.de>
parents: 540
diff changeset
262 tr(" new certificatelist ") +
ccdc4c6b97ce Log diff between initial certificate list and saved list to a logfile.
Raimund Renkert <rrenkert@intevation.de>
parents: 540
diff changeset
263 newListDate.toString(Qt::ISODate) +
ccdc4c6b97ce Log diff between initial certificate list and saved list to a logfile.
Raimund Renkert <rrenkert@intevation.de>
parents: 540
diff changeset
264 tr(" based on list from ") +
ccdc4c6b97ce Log diff between initial certificate list and saved list to a logfile.
Raimund Renkert <rrenkert@intevation.de>
parents: 540
diff changeset
265 listDate.toString(Qt::ISODate) +
ccdc4c6b97ce Log diff between initial certificate list and saved list to a logfile.
Raimund Renkert <rrenkert@intevation.de>
parents: 540
diff changeset
266 "#####\r\n");
ccdc4c6b97ce Log diff between initial certificate list and saved list to a logfile.
Raimund Renkert <rrenkert@intevation.de>
parents: 540
diff changeset
267 entries.append(tr("signing certificate: \r\n"));
679
75cd2fbf9ac6 (Issue 9) Log key's sha256 fingerprint
Andre Heinecke <andre.heinecke@intevation.de>
parents: 570
diff changeset
268 entries.append(keyFingerprint);
75cd2fbf9ac6 (Issue 9) Log key's sha256 fingerprint
Andre Heinecke <andre.heinecke@intevation.de>
parents: 570
diff changeset
269
75cd2fbf9ac6 (Issue 9) Log key's sha256 fingerprint
Andre Heinecke <andre.heinecke@intevation.de>
parents: 570
diff changeset
270 entries.append(tr("\r\nnew certificates:\r\n"));
562
ccdc4c6b97ce Log diff between initial certificate list and saved list to a logfile.
Raimund Renkert <rrenkert@intevation.de>
parents: 540
diff changeset
271
ccdc4c6b97ce Log diff between initial certificate list and saved list to a logfile.
Raimund Renkert <rrenkert@intevation.de>
parents: 540
diff changeset
272 foreach (const Certificate& cert, list.getCertificates()) {
ccdc4c6b97ce Log diff between initial certificate list and saved list to a logfile.
Raimund Renkert <rrenkert@intevation.de>
parents: 540
diff changeset
273 if (!mCertList.getCertificates().contains(cert)) {
ccdc4c6b97ce Log diff between initial certificate list and saved list to a logfile.
Raimund Renkert <rrenkert@intevation.de>
parents: 540
diff changeset
274 QString certEntry(cert.subjectCN() + ": " + cert.base64Line() + "\r\n");
ccdc4c6b97ce Log diff between initial certificate list and saved list to a logfile.
Raimund Renkert <rrenkert@intevation.de>
parents: 540
diff changeset
275 if (cert.isInstallCert()) {
ccdc4c6b97ce Log diff between initial certificate list and saved list to a logfile.
Raimund Renkert <rrenkert@intevation.de>
parents: 540
diff changeset
276 entries.append(certEntry);
ccdc4c6b97ce Log diff between initial certificate list and saved list to a logfile.
Raimund Renkert <rrenkert@intevation.de>
parents: 540
diff changeset
277 }
ccdc4c6b97ce Log diff between initial certificate list and saved list to a logfile.
Raimund Renkert <rrenkert@intevation.de>
parents: 540
diff changeset
278 else {
ccdc4c6b97ce Log diff between initial certificate list and saved list to a logfile.
Raimund Renkert <rrenkert@intevation.de>
parents: 540
diff changeset
279 removeListEntries.append(certEntry);
ccdc4c6b97ce Log diff between initial certificate list and saved list to a logfile.
Raimund Renkert <rrenkert@intevation.de>
parents: 540
diff changeset
280 }
ccdc4c6b97ce Log diff between initial certificate list and saved list to a logfile.
Raimund Renkert <rrenkert@intevation.de>
parents: 540
diff changeset
281 }
ccdc4c6b97ce Log diff between initial certificate list and saved list to a logfile.
Raimund Renkert <rrenkert@intevation.de>
parents: 540
diff changeset
282 }
ccdc4c6b97ce Log diff between initial certificate list and saved list to a logfile.
Raimund Renkert <rrenkert@intevation.de>
parents: 540
diff changeset
283
ccdc4c6b97ce Log diff between initial certificate list and saved list to a logfile.
Raimund Renkert <rrenkert@intevation.de>
parents: 540
diff changeset
284 entries.append(tr("certificates marked to remove:\r\n"));
ccdc4c6b97ce Log diff between initial certificate list and saved list to a logfile.
Raimund Renkert <rrenkert@intevation.de>
parents: 540
diff changeset
285 entries.append(removeListEntries);
ccdc4c6b97ce Log diff between initial certificate list and saved list to a logfile.
Raimund Renkert <rrenkert@intevation.de>
parents: 540
diff changeset
286 entries.append("\r\n");
ccdc4c6b97ce Log diff between initial certificate list and saved list to a logfile.
Raimund Renkert <rrenkert@intevation.de>
parents: 540
diff changeset
287
ccdc4c6b97ce Log diff between initial certificate list and saved list to a logfile.
Raimund Renkert <rrenkert@intevation.de>
parents: 540
diff changeset
288 return entries;
ccdc4c6b97ce Log diff between initial certificate list and saved list to a logfile.
Raimund Renkert <rrenkert@intevation.de>
parents: 540
diff changeset
289 }
565
9db7034b2d6c Added method to get the current certificate list changes.
Raimund Renkert <rrenkert@intevation.de>
parents: 562
diff changeset
290
9db7034b2d6c Added method to get the current certificate list changes.
Raimund Renkert <rrenkert@intevation.de>
parents: 562
diff changeset
291 QList<Certificate> AdministratorWindow::currentChanges()
9db7034b2d6c Added method to get the current certificate list changes.
Raimund Renkert <rrenkert@intevation.de>
parents: 562
diff changeset
292 {
9db7034b2d6c Added method to get the current certificate list changes.
Raimund Renkert <rrenkert@intevation.de>
parents: 562
diff changeset
293 QList<Certificate> changed;
9db7034b2d6c Added method to get the current certificate list changes.
Raimund Renkert <rrenkert@intevation.de>
parents: 562
diff changeset
294 foreach(const Certificate& cert, certificates()) {
9db7034b2d6c Added method to get the current certificate list changes.
Raimund Renkert <rrenkert@intevation.de>
parents: 562
diff changeset
295 if (!mCertList.getCertificates().contains(cert)) {
9db7034b2d6c Added method to get the current certificate list changes.
Raimund Renkert <rrenkert@intevation.de>
parents: 562
diff changeset
296 changed.append(cert);
9db7034b2d6c Added method to get the current certificate list changes.
Raimund Renkert <rrenkert@intevation.de>
parents: 562
diff changeset
297 }
9db7034b2d6c Added method to get the current certificate list changes.
Raimund Renkert <rrenkert@intevation.de>
parents: 562
diff changeset
298 }
9db7034b2d6c Added method to get the current certificate list changes.
Raimund Renkert <rrenkert@intevation.de>
parents: 562
diff changeset
299 return changed;
9db7034b2d6c Added method to get the current certificate list changes.
Raimund Renkert <rrenkert@intevation.de>
parents: 562
diff changeset
300 }

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