annotate ui/createcertlistdialog.cpp @ 427:d08e39b913ee

Added about dialog content and open the dialog via administration app.
author Raimund Renkert <rrenkert@intevation.de>
date Thu, 17 Apr 2014 12:56:23 +0200
parents d7cda835abd6
children d1819cd56dee
rev   line source
404
17e1c8f37d72 Add License
Andre Heinecke <aheinecke@intevation.de>
parents: 367
diff changeset
1 /* Copyright (C) 2014 by Bundesamt für Sicherheit in der Informationstechnik
17e1c8f37d72 Add License
Andre Heinecke <aheinecke@intevation.de>
parents: 367
diff changeset
2 * Software engineering by Intevation GmbH
17e1c8f37d72 Add License
Andre Heinecke <aheinecke@intevation.de>
parents: 367
diff changeset
3 *
17e1c8f37d72 Add License
Andre Heinecke <aheinecke@intevation.de>
parents: 367
diff changeset
4 * This file is Free Software under the GNU GPL (v>=2)
17e1c8f37d72 Add License
Andre Heinecke <aheinecke@intevation.de>
parents: 367
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY!
17e1c8f37d72 Add License
Andre Heinecke <aheinecke@intevation.de>
parents: 367
diff changeset
6 * See LICENSE.txt for details.
17e1c8f37d72 Add License
Andre Heinecke <aheinecke@intevation.de>
parents: 367
diff changeset
7 */
367
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
8 #include "createcertlistdialog.h"
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
9 #include <QDebug>
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
10 #include <QDir>
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
11 #include <QPushButton>
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
12 #include <QGroupBox>
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
13 #include <QHBoxLayout>
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
14 #include <QVBoxLayout>
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
15 #include <QLabel>
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
16 #include <QFileDialog>
413
860affe19416 Wording und Layout in TrustBridge create certificate file dialog.
Raimund Renkert <rrenkert@intevation.de>
parents: 404
diff changeset
17 #include <QStandardPaths>
367
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
18
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
19 CreateCertListDialog::CreateCertListDialog(QMainWindow *parent) :
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
20 QDialog(parent)
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
21 {
413
860affe19416 Wording und Layout in TrustBridge create certificate file dialog.
Raimund Renkert <rrenkert@intevation.de>
parents: 404
diff changeset
22 setWindowTitle(tr("Save certificate list"));
367
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
23 setupGUI();
413
860affe19416 Wording und Layout in TrustBridge create certificate file dialog.
Raimund Renkert <rrenkert@intevation.de>
parents: 404
diff changeset
24 resize(500, 200);
367
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
25 }
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
26
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
27 void CreateCertListDialog::setupGUI()
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
28 {
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
29 /* Top level layout / widgets */
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
30 QVBoxLayout *topLayout = new QVBoxLayout;
413
860affe19416 Wording und Layout in TrustBridge create certificate file dialog.
Raimund Renkert <rrenkert@intevation.de>
parents: 404
diff changeset
31 QVBoxLayout *headerLayout = new QVBoxLayout;
860affe19416 Wording und Layout in TrustBridge create certificate file dialog.
Raimund Renkert <rrenkert@intevation.de>
parents: 404
diff changeset
32 QHBoxLayout *headerSubLayout = new QHBoxLayout;
367
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
33 QVBoxLayout *centerLayout = new QVBoxLayout;
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
34 QHBoxLayout *bottomLayout = new QHBoxLayout;
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
35 QHBoxLayout *certLayout = new QHBoxLayout;
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
36 QHBoxLayout *saveLayout = new QHBoxLayout;
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
37
413
860affe19416 Wording und Layout in TrustBridge create certificate file dialog.
Raimund Renkert <rrenkert@intevation.de>
parents: 404
diff changeset
38 QLabel *header = new QLabel("<h3>" + tr("Save certificate list") + "</h3>");
860affe19416 Wording und Layout in TrustBridge create certificate file dialog.
Raimund Renkert <rrenkert@intevation.de>
parents: 404
diff changeset
39 QLabel *description = new QLabel(
426
d7cda835abd6 Some wording and Layout in TrustBridge Administration.
Raimund Renkert <rrenkert@intevation.de>
parents: 417
diff changeset
40 tr("Save all managed root certificates in a new, signed certificate list."));
413
860affe19416 Wording und Layout in TrustBridge create certificate file dialog.
Raimund Renkert <rrenkert@intevation.de>
parents: 404
diff changeset
41 headerSubLayout->insertSpacing(0, 40);
860affe19416 Wording und Layout in TrustBridge create certificate file dialog.
Raimund Renkert <rrenkert@intevation.de>
parents: 404
diff changeset
42 headerSubLayout->addWidget(description);
860affe19416 Wording und Layout in TrustBridge create certificate file dialog.
Raimund Renkert <rrenkert@intevation.de>
parents: 404
diff changeset
43 QFrame *headerSeparator = new QFrame();
860affe19416 Wording und Layout in TrustBridge create certificate file dialog.
Raimund Renkert <rrenkert@intevation.de>
parents: 404
diff changeset
44 headerSeparator->setFrameShape(QFrame::HLine);
860affe19416 Wording und Layout in TrustBridge create certificate file dialog.
Raimund Renkert <rrenkert@intevation.de>
parents: 404
diff changeset
45 headerSeparator->setFrameShadow(QFrame::Sunken);
860affe19416 Wording und Layout in TrustBridge create certificate file dialog.
Raimund Renkert <rrenkert@intevation.de>
parents: 404
diff changeset
46 headerLayout->addWidget(header);
860affe19416 Wording und Layout in TrustBridge create certificate file dialog.
Raimund Renkert <rrenkert@intevation.de>
parents: 404
diff changeset
47 headerLayout->addLayout(headerSubLayout);
860affe19416 Wording und Layout in TrustBridge create certificate file dialog.
Raimund Renkert <rrenkert@intevation.de>
parents: 404
diff changeset
48 headerLayout->addWidget(headerSeparator);
367
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
49
413
860affe19416 Wording und Layout in TrustBridge create certificate file dialog.
Raimund Renkert <rrenkert@intevation.de>
parents: 404
diff changeset
50 QLabel *certLabel = new QLabel("Select signature certificate (secret key):");
417
03c562b1a3ea Fixed layout in TrustBridge Adminstration dialogs.
Raimund Renkert <rrenkert@intevation.de>
parents: 413
diff changeset
51 certLabel->setFixedWidth(205);
367
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
52 mCertFile = new QLineEdit();
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
53 QPushButton *certSelect = new QPushButton("...");
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
54 connect(certSelect, SIGNAL(clicked()), this, SLOT(openCertificateSelect()));
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
55 certSelect->setFixedWidth(30);
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
56 certLayout->addWidget(certLabel);
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
57 certLayout->addWidget(mCertFile);
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
58 certLayout->addWidget(certSelect);
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
59
413
860affe19416 Wording und Layout in TrustBridge create certificate file dialog.
Raimund Renkert <rrenkert@intevation.de>
parents: 404
diff changeset
60 QLabel *saveLabel = new QLabel("Select output folder:");
417
03c562b1a3ea Fixed layout in TrustBridge Adminstration dialogs.
Raimund Renkert <rrenkert@intevation.de>
parents: 413
diff changeset
61 saveLabel->setFixedWidth(205);
367
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
62 mSaveFile = new QLineEdit();
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
63 QPushButton *saveSelect = new QPushButton("...");
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
64 connect(saveSelect, SIGNAL(clicked()), this, SLOT(openSaveLocation()));
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
65 saveSelect->setFixedWidth(30);
413
860affe19416 Wording und Layout in TrustBridge create certificate file dialog.
Raimund Renkert <rrenkert@intevation.de>
parents: 404
diff changeset
66
426
d7cda835abd6 Some wording and Layout in TrustBridge Administration.
Raimund Renkert <rrenkert@intevation.de>
parents: 417
diff changeset
67 QString footerText = tr("In addition, each certificate list will be saved "
413
860affe19416 Wording und Layout in TrustBridge create certificate file dialog.
Raimund Renkert <rrenkert@intevation.de>
parents: 404
diff changeset
68 "automatically in the archive directory:\n");
860affe19416 Wording und Layout in TrustBridge create certificate file dialog.
Raimund Renkert <rrenkert@intevation.de>
parents: 404
diff changeset
69 // TODO print out the path, not the displayName.
426
d7cda835abd6 Some wording and Layout in TrustBridge Administration.
Raimund Renkert <rrenkert@intevation.de>
parents: 417
diff changeset
70 footerText.append(QStandardPaths::writableLocation(
d7cda835abd6 Some wording and Layout in TrustBridge Administration.
Raimund Renkert <rrenkert@intevation.de>
parents: 417
diff changeset
71 QStandardPaths::DataLocation));
d7cda835abd6 Some wording and Layout in TrustBridge Administration.
Raimund Renkert <rrenkert@intevation.de>
parents: 417
diff changeset
72 //footerText.append(QStandardPaths::displayName(QStandardPaths::DataLocation));
413
860affe19416 Wording und Layout in TrustBridge create certificate file dialog.
Raimund Renkert <rrenkert@intevation.de>
parents: 404
diff changeset
73 QLabel *footer = new QLabel(footerText);
367
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
74 saveLayout->addWidget(saveLabel);
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
75 saveLayout->addWidget(mSaveFile);
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
76 saveLayout->addWidget(saveSelect);
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
77
413
860affe19416 Wording und Layout in TrustBridge create certificate file dialog.
Raimund Renkert <rrenkert@intevation.de>
parents: 404
diff changeset
78 centerLayout->insertSpacing(0, 10);
367
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
79 centerLayout->addLayout(certLayout);
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
80 centerLayout->addLayout(saveLayout);
413
860affe19416 Wording und Layout in TrustBridge create certificate file dialog.
Raimund Renkert <rrenkert@intevation.de>
parents: 404
diff changeset
81 centerLayout->insertSpacing(3, 10);
367
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
82
417
03c562b1a3ea Fixed layout in TrustBridge Adminstration dialogs.
Raimund Renkert <rrenkert@intevation.de>
parents: 413
diff changeset
83 QPushButton *create = new QPushButton(tr("Sign list"));
367
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
84 connect(create, SIGNAL(clicked()), this, SLOT(createList()));
413
860affe19416 Wording und Layout in TrustBridge create certificate file dialog.
Raimund Renkert <rrenkert@intevation.de>
parents: 404
diff changeset
85 QPushButton *cancel = new QPushButton(tr("Cancel"));
860affe19416 Wording und Layout in TrustBridge create certificate file dialog.
Raimund Renkert <rrenkert@intevation.de>
parents: 404
diff changeset
86 connect(cancel, SIGNAL(clicked()), this, SLOT(close()));
367
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
87 bottomLayout->insertStretch(0, 10);
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
88 bottomLayout->addWidget(create);
413
860affe19416 Wording und Layout in TrustBridge create certificate file dialog.
Raimund Renkert <rrenkert@intevation.de>
parents: 404
diff changeset
89 bottomLayout->addWidget(cancel);
860affe19416 Wording und Layout in TrustBridge create certificate file dialog.
Raimund Renkert <rrenkert@intevation.de>
parents: 404
diff changeset
90
860affe19416 Wording und Layout in TrustBridge create certificate file dialog.
Raimund Renkert <rrenkert@intevation.de>
parents: 404
diff changeset
91 QFrame *bottomSeparator = new QFrame();
860affe19416 Wording und Layout in TrustBridge create certificate file dialog.
Raimund Renkert <rrenkert@intevation.de>
parents: 404
diff changeset
92 bottomSeparator->setFrameShape(QFrame::HLine);
860affe19416 Wording und Layout in TrustBridge create certificate file dialog.
Raimund Renkert <rrenkert@intevation.de>
parents: 404
diff changeset
93 bottomSeparator->setFrameShadow(QFrame::Sunken);
367
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
94
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
95 topLayout->addLayout(headerLayout);
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
96 topLayout->addLayout(centerLayout);
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
97 topLayout->insertStretch(2, 10);
413
860affe19416 Wording und Layout in TrustBridge create certificate file dialog.
Raimund Renkert <rrenkert@intevation.de>
parents: 404
diff changeset
98 topLayout->addWidget(footer);
860affe19416 Wording und Layout in TrustBridge create certificate file dialog.
Raimund Renkert <rrenkert@intevation.de>
parents: 404
diff changeset
99 topLayout->addWidget(bottomSeparator);
367
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
100 topLayout->addLayout(bottomLayout);
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
101
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
102 setLayout(topLayout);
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
103
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
104 return;
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
105 }
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
106
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
107 void CreateCertListDialog::openCertificateSelect()
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
108 {
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
109 QString certFile = QFileDialog::getOpenFileName(
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
110 this, tr("Select certificate"), QDir::homePath(), "*.pem *.der *.crt");
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
111 mCertFile->setText(certFile);
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
112 }
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
113
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
114 void CreateCertListDialog::openSaveLocation()
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
115 {
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
116 QString saveFile = QFileDialog::getExistingDirectory(
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
117 this, tr("Select target location"), QDir::homePath());
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
118 mSaveFile->setText(saveFile);
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
119 }
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
120
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
121 void CreateCertListDialog::createList()
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
122 {
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
123 qDebug() << "and now create the certificate list using:";
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
124 qDebug() << "certificate: " << mCertFile->text();
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
125 qDebug() << "target" << mSaveFile->text();
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
126 // TODO
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
127 }

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