diff options
author | Saturneric <[email protected]> | 2021-09-05 15:02:19 +0000 |
---|---|---|
committer | Saturneric <[email protected]> | 2021-09-05 15:02:19 +0000 |
commit | 39440522111abf3adeef6b56cb23722119fbf3c2 (patch) | |
tree | 5979b3808d58c8c576e288004877d826556b4cda /src/gpg/function/UidOperator.cpp | |
parent | Modified ResultAnalyse. (diff) | |
download | GpgFrontend-39440522111abf3adeef6b56cb23722119fbf3c2.tar.gz GpgFrontend-39440522111abf3adeef6b56cb23722119fbf3c2.zip |
Rewrite the core.
Adjust the structure.
Diffstat (limited to 'src/gpg/function/UidOperator.cpp')
-rw-r--r-- | src/gpg/function/UidOperator.cpp | 41 |
1 files changed, 27 insertions, 14 deletions
diff --git a/src/gpg/function/UidOperator.cpp b/src/gpg/function/UidOperator.cpp index 91fe70fe..937396d4 100644 --- a/src/gpg/function/UidOperator.cpp +++ b/src/gpg/function/UidOperator.cpp @@ -24,22 +24,35 @@ #include "gpg/function/UidOperator.h" -bool GpgFrontend::UidOperator::addUID(const GpgFrontend::GpgKey &key, const GpgFrontend::GpgUID &uid) { - QString userid = QString("%1 (%3) <%2>").arg(uid.name(), uid.email(), uid.comment()); - auto err = gpgme_op_adduid(ctx, gpgme_key_t(key), userid.toUtf8().constData(), 0); - if (gpgme_err_code(err) == GPG_ERR_NO_ERROR) return true; - else return false; +bool GpgFrontend::UidOperator::addUID(const GpgFrontend::GpgKey &key, + const GpgFrontend::GpgUID &uid) { + QString userid = + QString("%1 (%3) <%2>") + .arg(uid.name().c_str(), uid.email().c_str(), uid.comment().c_str()); + auto err = + gpgme_op_adduid(ctx, gpgme_key_t(key), userid.toUtf8().constData(), 0); + if (gpgme_err_code(err) == GPG_ERR_NO_ERROR) + return true; + else + return false; } -bool GpgFrontend::UidOperator::revUID(const GpgFrontend::GpgKey &key, const GpgFrontend::GpgUID &uid) { - auto err = check_gpg_error(gpgme_op_revuid(ctx, gpgme_key_t(key), uid.uid().toUtf8().constData(), 0)); - if (gpgme_err_code(err) == GPG_ERR_NO_ERROR) return true; - else return false; +bool GpgFrontend::UidOperator::revUID(const GpgFrontend::GpgKey &key, + const GpgFrontend::GpgUID &uid) { + auto err = check_gpg_error( + gpgme_op_revuid(ctx, gpgme_key_t(key), uid.uid().c_str(), 0)); + if (gpgme_err_code(err) == GPG_ERR_NO_ERROR) + return true; + else + return false; } -bool GpgFrontend::UidOperator::setPrimaryUID(const GpgFrontend::GpgKey &key, const GpgFrontend::GpgUID &uid) { - auto err = check_gpg_error(gpgme_op_set_uid_flag(ctx, gpgme_key_t(key), - uid.uid().toUtf8().constData(), "primary", nullptr)); - if (gpgme_err_code(err) == GPG_ERR_NO_ERROR) return true; - else return false; +bool GpgFrontend::UidOperator::setPrimaryUID(const GpgFrontend::GpgKey &key, + const GpgFrontend::GpgUID &uid) { + auto err = check_gpg_error(gpgme_op_set_uid_flag( + ctx, gpgme_key_t(key), uid.uid().c_str(), "primary", nullptr)); + if (gpgme_err_code(err) == GPG_ERR_NO_ERROR) + return true; + else + return false; } |