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 #include "ui/dialog/GeneralDialog.h"
34 
35 namespace GpgFrontend::UI {
36 
41 class KeyGenDialog : public GeneralDialog {
42  Q_OBJECT
43 
44  public:
52  explicit KeyGenDialog(QWidget* parent = nullptr);
53 
54  signals:
59  void SignalKeyGenerated();
60 
61  private:
67  QGroupBox* create_key_usage_group_box();
68 
74  QGroupBox* create_basic_info_group_box();
75 
80  QRegularExpression re_email_{
81  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])+)\]))"};
82 
87  QStringList error_messages_;
89  std::unique_ptr<GenKeyInfo> gen_key_info_ =
90  std::make_unique<GenKeyInfo>();
91  QDialogButtonBox* button_box_;
92  QLabel* error_label_{};
93  QLineEdit* name_edit_{};
94  QLineEdit* email_edit_{};
95  QLineEdit* comment_edit_{};
96  QLineEdit* passphrase_edit_{};
97  QSpinBox* key_size_spin_box_{};
98  QComboBox* key_type_combo_box_{};
99  QDateTimeEdit* date_edit_{};
100  QCheckBox* expire_check_box_{};
101  QCheckBox* no_pass_phrase_check_box_{};
102  QGroupBox* key_usage_group_box_{};
104  QDateTime max_date_time_;
105  std::vector<QCheckBox*> key_usage_check_boxes_;
106  bool use_pinentry_ = false;
107 
112  void generate_key_dialog();
113 
117  void refresh_widgets_state();
118 
123  void set_signal_slot();
124 
132  bool check_email_address(const QString& str);
133 
134  private slots:
135 
141 
146  void slot_key_gen_accept();
147 
153  void slot_encryption_box_changed(int state);
154 
160  void slot_signing_box_changed(int state);
161 
167  void slot_certification_box_changed(int state);
168 
174  void slot_authentication_box_changed(int state);
175 
181  void slot_activated_key_type(int index);
182 };
183 
184 } // namespace GpgFrontend::UI
185 
186 #endif // __KEYGENDIALOG_H__
Definition: GeneralDialog.h:35
Definition: KeygenDialog.h:41
QGroupBox * create_basic_info_group_box()
Create a basic info group box object.
Definition: KeygenDialog.cpp:367
QStringList error_messages_
Definition: KeygenDialog.h:87
void slot_signing_box_changed(int state)
Definition: KeygenDialog.cpp:250
QCheckBox * expire_check_box_
Checkbox, if key should expire.
Definition: KeygenDialog.h:100
QDateTimeEdit * date_edit_
Date edit for expiration date.
Definition: KeygenDialog.h:99
QComboBox * key_type_combo_box_
Combobox for Key type.
Definition: KeygenDialog.h:98
QLineEdit * comment_edit_
Line edit for the keys comment.
Definition: KeygenDialog.h:95
QLineEdit * email_edit_
Line edit for the keys email.
Definition: KeygenDialog.h:94
KeyGenDialog(QWidget *parent=nullptr)
Definition: KeygenDialog.cpp:41
void slot_certification_box_changed(int state)
Definition: KeygenDialog.cpp:258
void refresh_widgets_state()
Definition: KeygenDialog.cpp:283
void slot_expire_box_changed()
Definition: KeygenDialog.cpp:201
QGroupBox * key_usage_group_box_
Definition: KeygenDialog.h:102
QLineEdit * name_edit_
Line edit for the keys name.
Definition: KeygenDialog.h:93
QLabel * error_label_
Label containing error message.
Definition: KeygenDialog.h:92
QGroupBox * create_key_usage_group_box()
Create a key usage group box object.
Definition: KeygenDialog.cpp:209
void slot_authentication_box_changed(int state)
Definition: KeygenDialog.cpp:266
void set_signal_slot()
Set the signal slot object.
Definition: KeygenDialog.cpp:335
QDialogButtonBox * button_box_
Box for standard buttons.
Definition: KeygenDialog.h:91
QSpinBox * key_size_spin_box_
Spinbox for the keys size (in bit)
Definition: KeygenDialog.h:97
std::vector< QCheckBox * > key_usage_check_boxes_
ENCR, SIGN, CERT, AUTH.
Definition: KeygenDialog.h:105
void slot_activated_key_type(int index)
Definition: KeygenDialog.cpp:274
void slot_encryption_box_changed(int state)
Definition: KeygenDialog.cpp:242
bool check_email_address(const QString &str)
Definition: KeygenDialog.cpp:363
void slot_key_gen_accept()
Definition: KeygenDialog.cpp:91
Definition: FileReadTask.cpp:29