annotate ui/createcertlistdialog.cpp @ 417:03c562b1a3ea

Fixed layout in TrustBridge Adminstration dialogs.
author Raimund Renkert <rrenkert@intevation.de>
date Wed, 16 Apr 2014 17:46:40 +0200
parents 860affe19416
children d7cda835abd6
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(
860affe19416 Wording und Layout in TrustBridge create certificate file dialog.
Raimund Renkert <rrenkert@intevation.de>
parents: 404
diff changeset
40 tr("Save all managed root certificates in a new, signed certificate list"));
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
860affe19416 Wording und Layout in TrustBridge create certificate file dialog.
Raimund Renkert <rrenkert@intevation.de>
parents: 404
diff changeset
67 QString footerText = tr("In addition, each certificate list will be saved"
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.
860affe19416 Wording und Layout in TrustBridge create certificate file dialog.
Raimund Renkert <rrenkert@intevation.de>
parents: 404
diff changeset
70 footerText.append(QStandardPaths::displayName(QStandardPaths::DataLocation));
860affe19416 Wording und Layout in TrustBridge create certificate file dialog.
Raimund Renkert <rrenkert@intevation.de>
parents: 404
diff changeset
71 QLabel *footer = new QLabel(footerText);
367
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
72 saveLayout->addWidget(saveLabel);
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
73 saveLayout->addWidget(mSaveFile);
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
74 saveLayout->addWidget(saveSelect);
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
75
413
860affe19416 Wording und Layout in TrustBridge create certificate file dialog.
Raimund Renkert <rrenkert@intevation.de>
parents: 404
diff changeset
76 centerLayout->insertSpacing(0, 10);
367
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
77 centerLayout->addLayout(certLayout);
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
78 centerLayout->addLayout(saveLayout);
413
860affe19416 Wording und Layout in TrustBridge create certificate file dialog.
Raimund Renkert <rrenkert@intevation.de>
parents: 404
diff changeset
79 centerLayout->insertSpacing(3, 10);
367
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
80
417
03c562b1a3ea Fixed layout in TrustBridge Adminstration dialogs.
Raimund Renkert <rrenkert@intevation.de>
parents: 413
diff changeset
81 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
82 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
83 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
84 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
85 bottomLayout->insertStretch(0, 10);
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
86 bottomLayout->addWidget(create);
413
860affe19416 Wording und Layout in TrustBridge create certificate file dialog.
Raimund Renkert <rrenkert@intevation.de>
parents: 404
diff changeset
87 bottomLayout->addWidget(cancel);
860affe19416 Wording und Layout in TrustBridge create certificate file dialog.
Raimund Renkert <rrenkert@intevation.de>
parents: 404
diff changeset
88
860affe19416 Wording und Layout in TrustBridge create certificate file dialog.
Raimund Renkert <rrenkert@intevation.de>
parents: 404
diff changeset
89 QFrame *bottomSeparator = new QFrame();
860affe19416 Wording und Layout in TrustBridge create certificate file dialog.
Raimund Renkert <rrenkert@intevation.de>
parents: 404
diff changeset
90 bottomSeparator->setFrameShape(QFrame::HLine);
860affe19416 Wording und Layout in TrustBridge create certificate file dialog.
Raimund Renkert <rrenkert@intevation.de>
parents: 404
diff changeset
91 bottomSeparator->setFrameShadow(QFrame::Sunken);
367
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
92
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
93 topLayout->addLayout(headerLayout);
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
94 topLayout->addLayout(centerLayout);
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
95 topLayout->insertStretch(2, 10);
413
860affe19416 Wording und Layout in TrustBridge create certificate file dialog.
Raimund Renkert <rrenkert@intevation.de>
parents: 404
diff changeset
96 topLayout->addWidget(footer);
860affe19416 Wording und Layout in TrustBridge create certificate file dialog.
Raimund Renkert <rrenkert@intevation.de>
parents: 404
diff changeset
97 topLayout->addWidget(bottomSeparator);
367
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
98 topLayout->addLayout(bottomLayout);
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
99
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
100 setLayout(topLayout);
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 return;
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
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
105 void CreateCertListDialog::openCertificateSelect()
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 QString certFile = QFileDialog::getOpenFileName(
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
108 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
109 mCertFile->setText(certFile);
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
110 }
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
111
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
112 void CreateCertListDialog::openSaveLocation()
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 QString saveFile = QFileDialog::getExistingDirectory(
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
115 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
116 mSaveFile->setText(saveFile);
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
117 }
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
118
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
119 void CreateCertListDialog::createList()
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 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
122 qDebug() << "certificate: " << mCertFile->text();
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
123 qDebug() << "target" << mSaveFile->text();
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
124 // TODO
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
125 }

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