aboutsummaryrefslogtreecommitdiffstats
path: root/src/ui/dialog/keypair_details
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui/dialog/keypair_details')
-rw-r--r--src/ui/dialog/keypair_details/KeyNewUIDDialog.cpp9
-rw-r--r--src/ui/dialog/keypair_details/KeyNewUIDDialog.h12
-rw-r--r--src/ui/dialog/keypair_details/KeySetExpireDateDialog.h8
3 files changed, 6 insertions, 23 deletions
diff --git a/src/ui/dialog/keypair_details/KeyNewUIDDialog.cpp b/src/ui/dialog/keypair_details/KeyNewUIDDialog.cpp
index 6a6745da..37688b44 100644
--- a/src/ui/dialog/keypair_details/KeyNewUIDDialog.cpp
+++ b/src/ui/dialog/keypair_details/KeyNewUIDDialog.cpp
@@ -29,6 +29,7 @@
#include "KeyNewUIDDialog.h"
#include "core/function/gpg/GpgUIDOperator.h"
+#include "core/utils/CommonUtils.h"
#include "ui/UISignalStation.h"
namespace GpgFrontend::UI {
@@ -81,14 +82,11 @@ void KeyNewUIDDialog::slot_create_new_uid() {
QString buffer;
QTextStream error_stream(&buffer);
- /**
- * check for errors in keygen dialog input
- */
if ((name_->text()).size() < 5) {
error_stream << " " << tr("Name must contain at least five characters.")
<< Qt::endl;
}
- if (email_->text().isEmpty() || !check_email_address(email_->text())) {
+ if (email_->text().isEmpty() || !IsEmailAddress(email_->text())) {
error_stream << " " << tr("Please give a email address.") << Qt::endl;
}
auto error_string = error_stream.readAll();
@@ -117,7 +115,4 @@ void KeyNewUIDDialog::slot_create_new_uid() {
}
}
-auto KeyNewUIDDialog::check_email_address(const QString& str) -> bool {
- return re_email_.match(str).hasMatch();
-}
} // namespace GpgFrontend::UI
diff --git a/src/ui/dialog/keypair_details/KeyNewUIDDialog.h b/src/ui/dialog/keypair_details/KeyNewUIDDialog.h
index f298a46b..f6ab93e5 100644
--- a/src/ui/dialog/keypair_details/KeyNewUIDDialog.h
+++ b/src/ui/dialog/keypair_details/KeyNewUIDDialog.h
@@ -74,17 +74,5 @@ class KeyNewUIDDialog : public GeneralDialog {
QStringList error_messages_; ///<
QLabel* error_label_{}; ///<
-
- 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
- */
- auto check_email_address(const QString& str) -> bool;
};
} // namespace GpgFrontend::UI
diff --git a/src/ui/dialog/keypair_details/KeySetExpireDateDialog.h b/src/ui/dialog/keypair_details/KeySetExpireDateDialog.h
index b75339a0..55d09b4b 100644
--- a/src/ui/dialog/keypair_details/KeySetExpireDateDialog.h
+++ b/src/ui/dialog/keypair_details/KeySetExpireDateDialog.h
@@ -75,10 +75,10 @@ class KeySetExpireDateDialog : public GeneralDialog {
*/
void init();
- std::shared_ptr<Ui_ModifiedExpirationDateTime> ui_; ///<
- int current_gpg_context_channel_; ///<
- const GpgKeyPtr m_key_; ///<
- const SubkeyId m_subkey_; ///<
+ QSharedPointer<Ui_ModifiedExpirationDateTime> ui_; ///<
+ int current_gpg_context_channel_; ///<
+ const GpgKeyPtr m_key_; ///<
+ const SubkeyId m_subkey_; ///<
private slots:
/**