9#ifndef UI_KEYGENDIALOG_H
10#define UI_KEYGENDIALOG_H
12#include <QtCore/QVariant>
14#include <QtWidgets/QAbstractButton>
15#include <QtWidgets/QApplication>
16#include <QtWidgets/QCheckBox>
17#include <QtWidgets/QDialog>
18#include <QtWidgets/QDialogButtonBox>
19#include <QtWidgets/QFormLayout>
20#include <QtWidgets/QFrame>
21#include <QtWidgets/QLabel>
22#include <QtWidgets/QLineEdit>
23#include <QtWidgets/QPlainTextEdit>
24#include <QtWidgets/QVBoxLayout>
25#include <QtWidgets/QWidget>
32 QVBoxLayout *verticalLayout_2;
35 QVBoxLayout *verticalLayout;
37 QFormLayout *formLayout;
42 QLabel *labelPassphrase;
43 QLineEdit *passphrase1;
44 QLineEdit *passphrase2;
45 QLabel *labelPassphraseInfo;
49 QPlainTextEdit *plainTextEdit;
50 QLabel *labelExpertInfo;
51 QDialogButtonBox *buttonBox;
59 icon.addFile(QString::fromUtf8(
":/artwork/icon.png"), QSize(), QIcon::Mode::Normal, QIcon::State::Off);
62 verticalLayout_2->setObjectName(
"verticalLayout_2");
63 verticalLayout_2->setContentsMargins(6, 6, 6, 6);
65 label->setObjectName(
"label");
66 QSizePolicy sizePolicy(QSizePolicy::Policy::Preferred, QSizePolicy::Policy::Maximum);
67 sizePolicy.setHorizontalStretch(0);
68 sizePolicy.setVerticalStretch(0);
69 sizePolicy.setHeightForWidth(label->sizePolicy().hasHeightForWidth());
70 label->setSizePolicy(sizePolicy);
71 label->setWordWrap(
true);
73 verticalLayout_2->addWidget(label);
76 frame->setObjectName(
"frame");
77 frame->setFrameShape(QFrame::NoFrame);
78 frame->setFrameShadow(QFrame::Plain);
79 verticalLayout =
new QVBoxLayout(frame);
80 verticalLayout->setObjectName(
"verticalLayout");
81 verticalLayout->setContentsMargins(0, 0, 0, 0);
82 widget =
new QWidget(frame);
83 widget->setObjectName(
"widget");
84 QSizePolicy sizePolicy1(QSizePolicy::Policy::Preferred, QSizePolicy::Policy::Preferred);
85 sizePolicy1.setHorizontalStretch(0);
86 sizePolicy1.setVerticalStretch(0);
87 sizePolicy1.setHeightForWidth(widget->sizePolicy().hasHeightForWidth());
88 widget->setSizePolicy(sizePolicy1);
89 formLayout =
new QFormLayout(widget);
90 formLayout->setObjectName(
"formLayout");
91 labelEmail =
new QLabel(widget);
92 labelEmail->setObjectName(
"labelEmail");
93 sizePolicy1.setHeightForWidth(labelEmail->sizePolicy().hasHeightForWidth());
94 labelEmail->setSizePolicy(sizePolicy1);
95 labelEmail->setLayoutDirection(Qt::LeftToRight);
96 labelEmail->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
98 formLayout->setWidget(0, QFormLayout::LabelRole, labelEmail);
100 email =
new QLineEdit(widget);
101 email->setObjectName(
"email");
102 QSizePolicy sizePolicy2(QSizePolicy::Policy::MinimumExpanding, QSizePolicy::Policy::Fixed);
103 sizePolicy2.setHorizontalStretch(0);
104 sizePolicy2.setVerticalStretch(0);
105 sizePolicy2.setHeightForWidth(email->sizePolicy().hasHeightForWidth());
106 email->setSizePolicy(sizePolicy2);
108 formLayout->setWidget(0, QFormLayout::FieldRole, email);
110 labelName =
new QLabel(widget);
111 labelName->setObjectName(
"labelName");
112 sizePolicy1.setHeightForWidth(labelName->sizePolicy().hasHeightForWidth());
113 labelName->setSizePolicy(sizePolicy1);
114 labelName->setLayoutDirection(Qt::LeftToRight);
115 labelName->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
117 formLayout->setWidget(1, QFormLayout::LabelRole, labelName);
119 name =
new QLineEdit(widget);
120 name->setObjectName(
"name");
121 sizePolicy2.setHeightForWidth(name->sizePolicy().hasHeightForWidth());
122 name->setSizePolicy(sizePolicy2);
124 formLayout->setWidget(1, QFormLayout::FieldRole, name);
126 labelPassphrase =
new QLabel(widget);
127 labelPassphrase->setObjectName(
"labelPassphrase");
128 sizePolicy1.setHeightForWidth(labelPassphrase->sizePolicy().hasHeightForWidth());
129 labelPassphrase->setSizePolicy(sizePolicy1);
130 labelPassphrase->setLayoutDirection(Qt::LeftToRight);
131 labelPassphrase->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
133 formLayout->setWidget(2, QFormLayout::LabelRole, labelPassphrase);
135 passphrase1 =
new QLineEdit(widget);
136 passphrase1->setObjectName(
"passphrase1");
137 sizePolicy2.setHeightForWidth(passphrase1->sizePolicy().hasHeightForWidth());
138 passphrase1->setSizePolicy(sizePolicy2);
139 passphrase1->setEchoMode(QLineEdit::Password);
141 formLayout->setWidget(2, QFormLayout::FieldRole, passphrase1);
143 passphrase2 =
new QLineEdit(widget);
144 passphrase2->setObjectName(
"passphrase2");
145 sizePolicy2.setHeightForWidth(passphrase2->sizePolicy().hasHeightForWidth());
146 passphrase2->setSizePolicy(sizePolicy2);
147 passphrase2->setEchoMode(QLineEdit::Password);
149 formLayout->setWidget(3, QFormLayout::FieldRole, passphrase2);
151 labelPassphraseInfo =
new QLabel(widget);
152 labelPassphraseInfo->setObjectName(
"labelPassphraseInfo");
153 QSizePolicy sizePolicy3(QSizePolicy::Policy::Preferred, QSizePolicy::Policy::Minimum);
154 sizePolicy3.setHorizontalStretch(0);
155 sizePolicy3.setVerticalStretch(0);
156 sizePolicy3.setHeightForWidth(labelPassphraseInfo->sizePolicy().hasHeightForWidth());
157 labelPassphraseInfo->setSizePolicy(sizePolicy3);
158 labelPassphraseInfo->setWordWrap(
true);
160 formLayout->setWidget(4, QFormLayout::FieldRole, labelPassphraseInfo);
162 label_2 =
new QLabel(widget);
163 label_2->setObjectName(
"label_2");
165 formLayout->setWidget(3, QFormLayout::LabelRole, label_2);
168 verticalLayout->addWidget(widget);
170 line =
new QFrame(frame);
171 line->setObjectName(
"line");
172 line->setFrameShape(QFrame::Shape::HLine);
173 line->setFrameShadow(QFrame::Shadow::Sunken);
175 verticalLayout->addWidget(line);
177 checkBox =
new QCheckBox(frame);
178 checkBox->setObjectName(
"checkBox");
180 verticalLayout->addWidget(checkBox);
182 plainTextEdit =
new QPlainTextEdit(frame);
183 plainTextEdit->setObjectName(
"plainTextEdit");
184 plainTextEdit->setEnabled(
false);
185 plainTextEdit->setFrameShape(QFrame::StyledPanel);
186 plainTextEdit->setFrameShadow(QFrame::Plain);
187 plainTextEdit->setReadOnly(
true);
188 plainTextEdit->setTextInteractionFlags(Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse);
189 plainTextEdit->setBackgroundVisible(
false);
191 verticalLayout->addWidget(plainTextEdit);
193 labelExpertInfo =
new QLabel(frame);
194 labelExpertInfo->setObjectName(
"labelExpertInfo");
195 labelExpertInfo->setOpenExternalLinks(
true);
196 labelExpertInfo->setTextInteractionFlags(Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse);
198 verticalLayout->addWidget(labelExpertInfo);
200 buttonBox =
new QDialogButtonBox(frame);
201 buttonBox->setObjectName(
"buttonBox");
202 buttonBox->setOrientation(Qt::Horizontal);
203 buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok);
205 verticalLayout->addWidget(buttonBox);
208 verticalLayout_2->addWidget(frame);
210#if QT_CONFIG(shortcut)
211 labelEmail->setBuddy(email);
212 labelName->setBuddy(name);
213 labelPassphrase->setBuddy(passphrase1);
215 QWidget::setTabOrder(email, name);
216 QWidget::setTabOrder(name, passphrase1);
217 QWidget::setTabOrder(passphrase1, passphrase2);
218 QWidget::setTabOrder(passphrase2, checkBox);
219 QWidget::setTabOrder(checkBox, plainTextEdit);
222 QObject::connect(buttonBox, &QDialogButtonBox::accepted,
KeygenDialog, qOverload<>(&QDialog::accept));
223 QObject::connect(buttonBox, &QDialogButtonBox::rejected,
KeygenDialog, qOverload<>(&QDialog::reject));
230 KeygenDialog->setWindowTitle(QCoreApplication::translate(
"KeygenDialog",
"Generate GnuPG keypair",
nullptr));
231 label->setText(QCoreApplication::translate(
"KeygenDialog",
"Generate a new key pair",
nullptr));
232 labelEmail->setText(QCoreApplication::translate(
"KeygenDialog",
"Email",
nullptr));
233 labelName->setText(QCoreApplication::translate(
"KeygenDialog",
"Name",
nullptr));
234 labelPassphrase->setText(QCoreApplication::translate(
"KeygenDialog",
"Passphrase",
nullptr));
235 labelPassphraseInfo->setText(QCoreApplication::translate(
"KeygenDialog",
"<html><head/><body><p>There is no limit on the length of a passphrase, and it should be carefully chosen. From the perspective of security, the passphrase to unlock the private key is one of the weakest points in GnuPG (and other public-key encryption systems as well) since it is the only protection you have if another individual gets your private key. <br/>Ideally, the passphrase should not use words from a dictionary and should mix the case of alphabetic characters as well as use non-alphabetic characters.<br/>A good passphrase is crucial to the secure use of GnuPG.</p></body></html>",
nullptr));
236 label_2->setText(QCoreApplication::translate(
"KeygenDialog",
"Repeat pass",
nullptr));
237 checkBox->setText(QCoreApplication::translate(
"KeygenDialog",
"Expert",
nullptr));
238 plainTextEdit->setPlainText(QCoreApplication::translate(
"KeygenDialog",
"Template contents will be set based on GPG version.",
nullptr));
239 labelExpertInfo->setText(QCoreApplication::translate(
"KeygenDialog",
"For expert options check out the <a href=\"https://www.gnupg.org/documentation/manuals/gnupg/Unattended-GPG-key-generation.html\">GnuPG manual</a>",
nullptr));
Handles GPG keypair generation.