comparison ui/createcertlistdialog.cpp @ 424:81cf25402cb0

Merge
author Andre Heinecke <aheinecke@intevation.de>
date Thu, 17 Apr 2014 08:55:16 +0000
parents 03c562b1a3ea
children d7cda835abd6
comparison
equal deleted inserted replaced
423:3d1e9df24803 424:81cf25402cb0
12 #include <QGroupBox> 12 #include <QGroupBox>
13 #include <QHBoxLayout> 13 #include <QHBoxLayout>
14 #include <QVBoxLayout> 14 #include <QVBoxLayout>
15 #include <QLabel> 15 #include <QLabel>
16 #include <QFileDialog> 16 #include <QFileDialog>
17 #include <QStandardPaths>
17 18
18 CreateCertListDialog::CreateCertListDialog(QMainWindow *parent) : 19 CreateCertListDialog::CreateCertListDialog(QMainWindow *parent) :
19 QDialog(parent) 20 QDialog(parent)
20 { 21 {
21 setWindowTitle(tr("adminstrator - Create signed certificate list")); 22 setWindowTitle(tr("Save certificate list"));
22 setupGUI(); 23 setupGUI();
24 resize(500, 200);
23 } 25 }
24 26
25 void CreateCertListDialog::setupGUI() 27 void CreateCertListDialog::setupGUI()
26 { 28 {
27 /* Top level layout / widgets */ 29 /* Top level layout / widgets */
28 QVBoxLayout *topLayout = new QVBoxLayout; 30 QVBoxLayout *topLayout = new QVBoxLayout;
29 QHBoxLayout *headerLayout = new QHBoxLayout; 31 QVBoxLayout *headerLayout = new QVBoxLayout;
32 QHBoxLayout *headerSubLayout = new QHBoxLayout;
30 QVBoxLayout *centerLayout = new QVBoxLayout; 33 QVBoxLayout *centerLayout = new QVBoxLayout;
31 QHBoxLayout *bottomLayout = new QHBoxLayout; 34 QHBoxLayout *bottomLayout = new QHBoxLayout;
32 QHBoxLayout *certLayout = new QHBoxLayout; 35 QHBoxLayout *certLayout = new QHBoxLayout;
33 QHBoxLayout *saveLayout = new QHBoxLayout; 36 QHBoxLayout *saveLayout = new QHBoxLayout;
34 37
35 QString descString = tr("Create a new, signed certificate list.\n"); 38 QLabel *header = new QLabel("<h3>" + tr("Save certificate list") + "</h3>");
36 descString.append("Select the certificate and destination directory."); 39 QLabel *description = new QLabel(
37 QLabel *description = new QLabel(descString); 40 tr("Save all managed root certificates in a new, signed certificate list"));
38 headerLayout->addWidget(description); 41 headerSubLayout->insertSpacing(0, 40);
42 headerSubLayout->addWidget(description);
43 QFrame *headerSeparator = new QFrame();
44 headerSeparator->setFrameShape(QFrame::HLine);
45 headerSeparator->setFrameShadow(QFrame::Sunken);
46 headerLayout->addWidget(header);
47 headerLayout->addLayout(headerSubLayout);
48 headerLayout->addWidget(headerSeparator);
39 49
40 QLabel *certLabel = new QLabel("Select certificate:"); 50 QLabel *certLabel = new QLabel("Select signature certificate (secret key):");
41 certLabel->setFixedWidth(140); 51 certLabel->setFixedWidth(205);
42 mCertFile = new QLineEdit(); 52 mCertFile = new QLineEdit();
43 QPushButton *certSelect = new QPushButton("..."); 53 QPushButton *certSelect = new QPushButton("...");
44 connect(certSelect, SIGNAL(clicked()), this, SLOT(openCertificateSelect())); 54 connect(certSelect, SIGNAL(clicked()), this, SLOT(openCertificateSelect()));
45 certSelect->setFixedWidth(30); 55 certSelect->setFixedWidth(30);
46 certLayout->addWidget(certLabel); 56 certLayout->addWidget(certLabel);
47 certLayout->addWidget(mCertFile); 57 certLayout->addWidget(mCertFile);
48 certLayout->addWidget(certSelect); 58 certLayout->addWidget(certSelect);
49 59
50 QLabel *saveLabel = new QLabel("Select target location:"); 60 QLabel *saveLabel = new QLabel("Select output folder:");
51 saveLabel->setFixedWidth(140); 61 saveLabel->setFixedWidth(205);
52 mSaveFile = new QLineEdit(); 62 mSaveFile = new QLineEdit();
53 QPushButton *saveSelect = new QPushButton("..."); 63 QPushButton *saveSelect = new QPushButton("...");
54 connect(saveSelect, SIGNAL(clicked()), this, SLOT(openSaveLocation())); 64 connect(saveSelect, SIGNAL(clicked()), this, SLOT(openSaveLocation()));
55 saveSelect->setFixedWidth(30); 65 saveSelect->setFixedWidth(30);
66
67 QString footerText = tr("In addition, each certificate list will be saved"
68 "automatically in the archive directory:\n");
69 // TODO print out the path, not the displayName.
70 footerText.append(QStandardPaths::displayName(QStandardPaths::DataLocation));
71 QLabel *footer = new QLabel(footerText);
56 saveLayout->addWidget(saveLabel); 72 saveLayout->addWidget(saveLabel);
57 saveLayout->addWidget(mSaveFile); 73 saveLayout->addWidget(mSaveFile);
58 saveLayout->addWidget(saveSelect); 74 saveLayout->addWidget(saveSelect);
59 75
76 centerLayout->insertSpacing(0, 10);
60 centerLayout->addLayout(certLayout); 77 centerLayout->addLayout(certLayout);
61 centerLayout->addLayout(saveLayout); 78 centerLayout->addLayout(saveLayout);
79 centerLayout->insertSpacing(3, 10);
62 80
63 QPushButton *create = new QPushButton(tr("Create List")); 81 QPushButton *create = new QPushButton(tr("Sign list"));
64 connect(create, SIGNAL(clicked()), this, SLOT(createList())); 82 connect(create, SIGNAL(clicked()), this, SLOT(createList()));
83 QPushButton *cancel = new QPushButton(tr("Cancel"));
84 connect(cancel, SIGNAL(clicked()), this, SLOT(close()));
65 bottomLayout->insertStretch(0, 10); 85 bottomLayout->insertStretch(0, 10);
66 bottomLayout->addWidget(create); 86 bottomLayout->addWidget(create);
87 bottomLayout->addWidget(cancel);
88
89 QFrame *bottomSeparator = new QFrame();
90 bottomSeparator->setFrameShape(QFrame::HLine);
91 bottomSeparator->setFrameShadow(QFrame::Sunken);
67 92
68 topLayout->addLayout(headerLayout); 93 topLayout->addLayout(headerLayout);
69 topLayout->addLayout(centerLayout); 94 topLayout->addLayout(centerLayout);
70 topLayout->insertStretch(2, 10); 95 topLayout->insertStretch(2, 10);
96 topLayout->addWidget(footer);
97 topLayout->addWidget(bottomSeparator);
71 topLayout->addLayout(bottomLayout); 98 topLayout->addLayout(bottomLayout);
72 99
73 setLayout(topLayout); 100 setLayout(topLayout);
74 101
75 return; 102 return;

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