diff options
Diffstat (limited to 'src/ui/dialog/key_generate/KeygenDialog.h')
-rw-r--r-- | src/ui/dialog/key_generate/KeygenDialog.h | 106 |
1 files changed, 36 insertions, 70 deletions
diff --git a/src/ui/dialog/key_generate/KeygenDialog.h b/src/ui/dialog/key_generate/KeygenDialog.h index dbb5048e..fd827ecd 100644 --- a/src/ui/dialog/key_generate/KeygenDialog.h +++ b/src/ui/dialog/key_generate/KeygenDialog.h @@ -35,6 +35,8 @@ #include "ui/GpgFrontendUI.h" #include "ui/dialog/GeneralDialog.h" +class Ui_KeyGenDialog; + namespace GpgFrontend::UI { /** @@ -61,131 +63,95 @@ class KeyGenDialog : public GeneralDialog { */ void SignalKeyGenerated(); - private: - /** - * @brief Create a key usage group box object - * - * @return QGroupBox* - */ - QGroupBox* create_key_usage_group_box(); + private slots: /** - * @brief Create a basic info group box object - * - * @return QGroupBox* + * @details check all lineedits for false entries. Show error, when there + * is one, otherwise generate the key */ - QGroupBox* create_basic_info_group_box(); + void slot_key_gen_accept(); /** * @brief * + * @param mode */ - QRegularExpression re_email_{ - 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])+)\]))"}; + void slot_easy_mode_changed(const QString& mode); /** * @brief * + * @param mode */ - QStringList error_messages_; ///< List of errors occurring when checking - ///< entries of line edits - - std::shared_ptr<GenKeyInfo> gen_key_info_ = - SecureCreateSharedObject<GenKeyInfo>(); ///< - std::shared_ptr<GenKeyInfo> gen_subkey_info_ = nullptr; ///< - - QDialogButtonBox* button_box_; ///< Box for standard buttons - QLabel* error_label_{}; ///< Label containing error message - QLineEdit* name_edit_{}; ///< Line edit for the keys name - QLineEdit* email_edit_{}; ///< Line edit for the keys email - QLineEdit* comment_edit_{}; ///< Line edit for the keys comment - QSpinBox* key_size_spin_box_{}; ///< Spinbox for the keys size (in bit) - QComboBox* key_type_combo_box_{}; ///< Combobox for Key type - QDateTimeEdit* date_edit_{}; ///< Date edit for expiration date - QCheckBox* expire_check_box_{}; ///< Checkbox, if key should expire - QCheckBox* no_pass_phrase_check_box_{}; - QGroupBox* key_usage_group_box_{}; ///< Group of Widgets detecting the usage - ///< of the Key - QDateTime max_date_time_; ///< - QContainer<QCheckBox*> key_usage_check_boxes_; ///< ENCR, SIGN, CERT, AUTH - QComboBox* gpg_contexts_combo_box_{}; - - int default_gpg_context_channel_; + void slot_easy_valid_date_changed(const QString& mode); /** * @brief * */ - void generate_key_dialog(); + void slot_set_easy_valid_date_2_custom(); /** - * @details Refresh widgets state by GenKeyInfo + * @brief + * */ - void refresh_widgets_state(); + void slot_set_easy_key_algo_2_custom(); + private: /** - * @brief Set the signal slot object + * @brief * */ - void set_signal_slot(); + QRegularExpression re_email_{ + 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])+)\]))"}; /** * @brief * - * @param str - * @return true - * @return false */ - bool check_email_address(const QString& str); + QStringList error_messages_; ///< List of errors occurring when checking + ///< entries of line edits - private slots: + QSharedPointer<Ui_KeyGenDialog> ui_; + QSharedPointer<GenKeyInfo> gen_key_info_; ///< + QSharedPointer<GenKeyInfo> gen_subkey_info_; ///< - /** - * @details when expirebox was checked/unchecked, enable/disable the - * expiration date box - */ - void slot_expire_box_changed(); + QContainer<KeyAlgo> supported_primary_key_algos_; + QContainer<KeyAlgo> supported_subkey_algos_; - /** - * @details check all lineedits for false entries. Show error, when there is - * one, otherwise generate the key - */ - void slot_key_gen_accept(); + int channel_; /** - * @brief - * - * @param state + * @details Refresh widgets state by GenKeyInfo */ - void slot_encryption_box_changed(int state); + void refresh_widgets_state(); /** - * @brief + * @brief Set the signal slot object * - * @param state */ - void slot_signing_box_changed(int state); + void set_signal_slot_config(); /** * @brief * - * @param state + * @param str + * @return true + * @return false */ - void slot_certification_box_changed(int state); + auto check_email_address(const QString& str) -> bool; /** * @brief * - * @param state */ - void slot_authentication_box_changed(int state); + void sync_gen_key_info(); /** * @brief * - * @param index */ - void slot_activated_key_type(int index); + void sync_gen_subkey_info(); }; } // namespace GpgFrontend::UI |