Mercurial > trustbridge
comparison ui/createcertlistdialog.cpp @ 367:9491782a8f5a
Added dialog to create a signed certificate list file.
author | Raimund Renkert <rrenkert@intevation.de> |
---|---|
date | Tue, 15 Apr 2014 09:43:53 +0200 |
parents | |
children | 17e1c8f37d72 |
comparison
equal
deleted
inserted
replaced
362:857ae1ffdd6f | 367:9491782a8f5a |
---|---|
1 #include "createcertlistdialog.h" | |
2 #include <QDebug> | |
3 #include <QDir> | |
4 #include <QPushButton> | |
5 #include <QGroupBox> | |
6 #include <QHBoxLayout> | |
7 #include <QVBoxLayout> | |
8 #include <QLabel> | |
9 #include <QFileDialog> | |
10 | |
11 CreateCertListDialog::CreateCertListDialog(QMainWindow *parent) : | |
12 QDialog(parent) | |
13 { | |
14 setWindowTitle(tr("adminstrator - Create signed certificate list")); | |
15 setupGUI(); | |
16 } | |
17 | |
18 void CreateCertListDialog::setupGUI() | |
19 { | |
20 /* Top level layout / widgets */ | |
21 QVBoxLayout *topLayout = new QVBoxLayout; | |
22 QHBoxLayout *headerLayout = new QHBoxLayout; | |
23 QVBoxLayout *centerLayout = new QVBoxLayout; | |
24 QHBoxLayout *bottomLayout = new QHBoxLayout; | |
25 QHBoxLayout *certLayout = new QHBoxLayout; | |
26 QHBoxLayout *saveLayout = new QHBoxLayout; | |
27 | |
28 QString descString = tr("Create a new, signed certificate list.\n"); | |
29 descString.append("Select the certificate and destination directory."); | |
30 QLabel *description = new QLabel(descString); | |
31 headerLayout->addWidget(description); | |
32 | |
33 QLabel *certLabel = new QLabel("Select certificate:"); | |
34 certLabel->setFixedWidth(140); | |
35 mCertFile = new QLineEdit(); | |
36 QPushButton *certSelect = new QPushButton("..."); | |
37 connect(certSelect, SIGNAL(clicked()), this, SLOT(openCertificateSelect())); | |
38 certSelect->setFixedWidth(30); | |
39 certLayout->addWidget(certLabel); | |
40 certLayout->addWidget(mCertFile); | |
41 certLayout->addWidget(certSelect); | |
42 | |
43 QLabel *saveLabel = new QLabel("Select target location:"); | |
44 saveLabel->setFixedWidth(140); | |
45 mSaveFile = new QLineEdit(); | |
46 QPushButton *saveSelect = new QPushButton("..."); | |
47 connect(saveSelect, SIGNAL(clicked()), this, SLOT(openSaveLocation())); | |
48 saveSelect->setFixedWidth(30); | |
49 saveLayout->addWidget(saveLabel); | |
50 saveLayout->addWidget(mSaveFile); | |
51 saveLayout->addWidget(saveSelect); | |
52 | |
53 centerLayout->addLayout(certLayout); | |
54 centerLayout->addLayout(saveLayout); | |
55 | |
56 QPushButton *create = new QPushButton(tr("Create List")); | |
57 connect(create, SIGNAL(clicked()), this, SLOT(createList())); | |
58 bottomLayout->insertStretch(0, 10); | |
59 bottomLayout->addWidget(create); | |
60 | |
61 topLayout->addLayout(headerLayout); | |
62 topLayout->addLayout(centerLayout); | |
63 topLayout->insertStretch(2, 10); | |
64 topLayout->addLayout(bottomLayout); | |
65 | |
66 setLayout(topLayout); | |
67 | |
68 return; | |
69 } | |
70 | |
71 void CreateCertListDialog::openCertificateSelect() | |
72 { | |
73 QString certFile = QFileDialog::getOpenFileName( | |
74 this, tr("Select certificate"), QDir::homePath(), "*.pem *.der *.crt"); | |
75 mCertFile->setText(certFile); | |
76 } | |
77 | |
78 void CreateCertListDialog::openSaveLocation() | |
79 { | |
80 QString saveFile = QFileDialog::getExistingDirectory( | |
81 this, tr("Select target location"), QDir::homePath()); | |
82 mSaveFile->setText(saveFile); | |
83 } | |
84 | |
85 void CreateCertListDialog::createList() | |
86 { | |
87 qDebug() << "and now create the certificate list using:"; | |
88 qDebug() << "certificate: " << mCertFile->text(); | |
89 qDebug() << "target" << mSaveFile->text(); | |
90 // TODO | |
91 } |