GpgFrontend Project
A Free, Powerful, Easy-to-Use, Compact, Cross-Platform, and Installation-Free OpenPGP(pgp) Crypto Tool.
KeygenDialog.h
1
27#ifndef __KEYGENDIALOG_H__
28#define __KEYGENDIALOG_H__
29
30#include "core/GpgContext.h"
31#include "core/GpgGenKeyInfo.h"
32#include "ui/GpgFrontendUI.h"
33
34namespace GpgFrontend::UI {
35
40class KeyGenDialog : public QDialog {
41 Q_OBJECT
42
43 public:
51 explicit KeyGenDialog(QWidget* parent = nullptr);
52
53 signals:
58 void SignalKeyGenerated();
59
60 private:
66 QGroupBox* create_key_usage_group_box();
67
73 QGroupBox* create_basic_info_group_box();
74
79 QRegularExpression re_email_{
80 R"((?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9]))\.){3}(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9])|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\]))"};
81
86 QStringList error_messages_;
88 std::unique_ptr<GenKeyInfo> gen_key_info_ =
89 std::make_unique<GenKeyInfo>();
90 QDialogButtonBox* button_box_;
91 QLabel* error_label_{};
92 QLineEdit* name_edit_{};
93 QLineEdit* email_edit_{};
94 QLineEdit* comment_edit_{};
95 QSpinBox* key_size_spin_box_{};
96 QComboBox* key_type_combo_box_{};
97 QDateTimeEdit* date_edit_{};
98 QCheckBox* expire_check_box_{};
99 QCheckBox* no_pass_phrase_check_box_{};
100 QGroupBox* key_usage_group_box_{};
102 QDateTime max_date_time_;
103 std::vector<QCheckBox*> key_usage_check_boxes_;
104
109 void generate_key_dialog();
110
115
120 void set_signal_slot();
121
129 bool check_email_address(const QString& str);
130
131 private slots:
132
138
143 void slot_key_gen_accept();
144
150 void slot_encryption_box_changed(int state);
151
157 void slot_signing_box_changed(int state);
158
164 void slot_certification_box_changed(int state);
165
171 void slot_authentication_box_changed(int state);
172
178 void slot_activated_key_type(int index);
179};
180
181} // namespace GpgFrontend::UI
182
183#endif // __KEYGENDIALOG_H__
Definition: KeygenDialog.h:40
QGroupBox * create_basic_info_group_box()
Create a basic info group box object.
Definition: KeygenDialog.cpp:346
QStringList error_messages_
Definition: KeygenDialog.h:86
void slot_signing_box_changed(int state)
Definition: KeygenDialog.cpp:225
QCheckBox * expire_check_box_
Checkbox, if key should expire.
Definition: KeygenDialog.h:98
QDateTimeEdit * date_edit_
Date edit for expiration date.
Definition: KeygenDialog.h:97
QComboBox * key_type_combo_box_
Combobox for Key type.
Definition: KeygenDialog.h:96
QLineEdit * comment_edit_
Line edit for the keys comment.
Definition: KeygenDialog.h:94
QLineEdit * email_edit_
Line edit for the keys email.
Definition: KeygenDialog.h:93
KeyGenDialog(QWidget *parent=nullptr)
Definition: KeygenDialog.cpp:38
void slot_certification_box_changed(int state)
Definition: KeygenDialog.cpp:233
void refresh_widgets_state()
Definition: KeygenDialog.cpp:257
void slot_expire_box_changed()
Definition: KeygenDialog.cpp:176
QGroupBox * key_usage_group_box_
Definition: KeygenDialog.h:100
QLineEdit * name_edit_
Line edit for the keys name.
Definition: KeygenDialog.h:92
QLabel * error_label_
Label containing error message.
Definition: KeygenDialog.h:91
QGroupBox * create_key_usage_group_box()
Create a key usage group box object.
Definition: KeygenDialog.cpp:184
void slot_authentication_box_changed(int state)
Definition: KeygenDialog.cpp:241
void set_signal_slot()
Set the signal slot object.
Definition: KeygenDialog.cpp:311
QDialogButtonBox * button_box_
Box for standard buttons.
Definition: KeygenDialog.h:90
QSpinBox * key_size_spin_box_
Spinbox for the keys size (in bit)
Definition: KeygenDialog.h:95
std::vector< QCheckBox * > key_usage_check_boxes_
ENCR, SIGN, CERT, AUTH.
Definition: KeygenDialog.h:103
void slot_activated_key_type(int index)
Definition: KeygenDialog.cpp:249
void slot_encryption_box_changed(int state)
Definition: KeygenDialog.cpp:217
bool check_email_address(const QString &str)
Definition: KeygenDialog.cpp:342
void slot_key_gen_accept()
Definition: KeygenDialog.cpp:89
Definition: VerifyDetailsDialog.cpp:33