diff options
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/function/gpg/GpgAutomatonHandler.cpp | 2 | ||||
-rw-r--r-- | src/core/function/gpg/GpgBasicOperator.cpp | 2 | ||||
-rw-r--r-- | src/core/function/gpg/GpgKeyGetter.cpp | 6 | ||||
-rw-r--r-- | src/core/function/gpg/GpgKeyManager.cpp | 10 | ||||
-rw-r--r-- | src/core/function/gpg/GpgKeyOpera.cpp | 11 | ||||
-rw-r--r-- | src/core/function/gpg/GpgUIDOperator.cpp | 8 | ||||
-rw-r--r-- | src/core/function/result_analyse/GpgDecryptResultAnalyse.cpp | 6 | ||||
-rw-r--r-- | src/core/function/result_analyse/GpgSignResultAnalyse.cpp | 22 | ||||
-rw-r--r-- | src/core/function/result_analyse/GpgVerifyResultAnalyse.cpp | 20 | ||||
-rw-r--r-- | src/core/model/GpgAbstractKey.h | 10 | ||||
-rw-r--r-- | src/core/model/GpgKey.cpp | 132 | ||||
-rw-r--r-- | src/core/model/GpgKey.h | 127 | ||||
-rw-r--r-- | src/core/model/GpgKeyTableModel.cpp | 20 | ||||
-rw-r--r-- | src/core/model/GpgKeyTreeModel.cpp | 33 | ||||
-rw-r--r-- | src/core/model/GpgKeyTreeModel.h | 76 | ||||
-rw-r--r-- | src/core/model/GpgSubKey.cpp | 27 | ||||
-rw-r--r-- | src/core/model/GpgSubKey.h | 55 |
17 files changed, 212 insertions, 355 deletions
diff --git a/src/core/function/gpg/GpgAutomatonHandler.cpp b/src/core/function/gpg/GpgAutomatonHandler.cpp index 352400a4..802279ed 100644 --- a/src/core/function/gpg/GpgAutomatonHandler.cpp +++ b/src/core/function/gpg/GpgAutomatonHandler.cpp @@ -97,7 +97,7 @@ auto GpgAutomatonHandler::interator_cb_func(void* handle, const char* status, auto GpgAutomatonHandler::DoInteract( const GpgKey& key, AutomatonNextStateHandler next_state_handler, AutomatonActionHandler action_handler) -> bool { - auto key_fpr = key.GetFingerprint(); + auto key_fpr = key.Fingerprint(); AutomatonHandelStruct handel_struct(key_fpr); handel_struct.SetHandler(std::move(next_state_handler), std::move(action_handler)); diff --git a/src/core/function/gpg/GpgBasicOperator.cpp b/src/core/function/gpg/GpgBasicOperator.cpp index 30fd8912..2548409e 100644 --- a/src/core/function/gpg/GpgBasicOperator.cpp +++ b/src/core/function/gpg/GpgBasicOperator.cpp @@ -49,7 +49,7 @@ void SetSignersImpl(GpgContext& ctx_, const KeyArgsList& signers, bool ascii) { gpgme_signers_clear(ctx); for (const GpgKey& key : signers) { - LOG_D() << "signer's key fpr: " << key.GetFingerprint(); + LOG_D() << "signer's key fpr: " << key.Fingerprint(); if (key.IsHasActualSignCap()) { auto error = gpgme_signers_add(ctx, gpgme_key_t(key)); CheckGpgError(error); diff --git a/src/core/function/gpg/GpgKeyGetter.cpp b/src/core/function/gpg/GpgKeyGetter.cpp index a4ca6021..14145f7f 100644 --- a/src/core/function/gpg/GpgKeyGetter.cpp +++ b/src/core/function/gpg/GpgKeyGetter.cpp @@ -131,12 +131,12 @@ class GpgKeyGetter::Impl : public SingletonFunctionObject<GpgKeyGetter::Impl> { // if so, try to get full information using gpgme_get_key() // this maybe a bug in gpgme if (gpg_key.IsHasCardKey()) { - gpg_key = GetKey(gpg_key.GetId(), false); + gpg_key = GetKey(gpg_key.ID(), false); } keys_cache_.push_back(gpg_key); - keys_search_cache_.insert(gpg_key.GetId(), gpg_key); - keys_search_cache_.insert(gpg_key.GetFingerprint(), gpg_key); + keys_search_cache_.insert(gpg_key.ID(), gpg_key); + keys_search_cache_.insert(gpg_key.Fingerprint(), gpg_key); } } diff --git a/src/core/function/gpg/GpgKeyManager.cpp b/src/core/function/gpg/GpgKeyManager.cpp index 36f68bdc..bd514cf3 100644 --- a/src/core/function/gpg/GpgKeyManager.cpp +++ b/src/core/function/gpg/GpgKeyManager.cpp @@ -85,7 +85,7 @@ auto GpgKeyManager::SetExpire(const GpgKey& key, const char* sub_fprs = nullptr; - if (subkey != nullptr) sub_fprs = subkey->GetFingerprint().toUtf8(); + if (subkey != nullptr) sub_fprs = subkey->Fingerprint().toUtf8(); auto err = CheckGpgError(gpgme_op_setexpire(ctx_.DefaultContext(), static_cast<gpgme_key_t>(key), @@ -174,7 +174,7 @@ auto GpgKeyManager::SetOwnerTrustLevel(const GpgKey& key, auto GpgKeyManager::DeleteSubkey(const GpgKey& key, int subkey_index) -> bool { if (subkey_index < 0 || - subkey_index >= static_cast<int>(key.GetSubKeys()->size())) { + subkey_index >= static_cast<int>(key.SubKeys().size())) { LOG_W() << "illegal subkey index: " << subkey_index; return false; } @@ -246,7 +246,7 @@ auto GpgKeyManager::DeleteSubkey(const GpgKey& key, int subkey_index) -> bool { return QString(""); }; - auto key_fpr = key.GetFingerprint(); + auto key_fpr = key.Fingerprint(); AutomatonHandelStruct handel_struct(key_fpr); handel_struct.SetHandler(next_state_handler, action_handler); @@ -260,7 +260,7 @@ auto GpgKeyManager::RevokeSubkey(const GpgKey& key, int subkey_index, int reason_code, const QString& reason_text) -> bool { if (subkey_index < 0 || - subkey_index >= static_cast<int>(key.GetSubKeys()->size())) { + subkey_index >= static_cast<int>(key.SubKeys().size())) { LOG_W() << "illegal subkey index: " << subkey_index; return false; } @@ -369,7 +369,7 @@ auto GpgKeyManager::RevokeSubkey(const GpgKey& key, int subkey_index, return QString(""); }; - auto key_fpr = key.GetFingerprint(); + auto key_fpr = key.Fingerprint(); AutomatonHandelStruct handel_struct(key_fpr); handel_struct.SetHandler(next_state_handler, action_handler); diff --git a/src/core/function/gpg/GpgKeyOpera.cpp b/src/core/function/gpg/GpgKeyOpera.cpp index 2378b518..3d9b8eda 100644 --- a/src/core/function/gpg/GpgKeyOpera.cpp +++ b/src/core/function/gpg/GpgKeyOpera.cpp @@ -81,7 +81,7 @@ auto GpgKeyOpera::SetExpire(const GpgKey& key, const SubkeyId& subkey_fpr, } GpgError err; - if (key.GetFingerprint() == subkey_fpr || subkey_fpr.isEmpty()) { + if (key.Fingerprint() == subkey_fpr || subkey_fpr.isEmpty()) { err = gpgme_op_setexpire(ctx_.DefaultContext(), static_cast<gpgme_key_t>(key), expires_time, nullptr, 0); @@ -119,7 +119,7 @@ void GpgKeyOpera::GenerateRevokeCert(const GpgKey& key, GpgCommandExecutor::ExecuteSync( {app_path, QStringList{"--command-fd", "0", "--status-fd", "1", "--no-tty", "-o", - output_path, "--gen-revoke", key.GetFingerprint()}, + output_path, "--gen-revoke", key.Fingerprint()}, [=](int exit_code, const QString& p_out, const QString& p_err) { if (exit_code != 0) { LOG_W() << "gnupg gen revoke execute error, process stderr: " @@ -246,8 +246,7 @@ auto GenerateSubKeyImpl(GpgContext& ctx, const GpgKey& key, if (params->IsNonExpired()) flags |= GPGME_CREATE_NOEXPIRE; if (params->IsNoPassPhrase()) flags |= GPGME_CREATE_NOPASSWD; - LOG_D() << "subkey generation args: " << key.GetId() << algo << expires - << flags; + LOG_D() << "subkey generation args: " << key.ID() << algo << expires << flags; auto err = gpgme_op_createsubkey(ctx.DefaultContext(), static_cast<gpgme_key_t>(key), @@ -367,10 +366,10 @@ void GpgKeyOpera::DeleteKey(const KeyId& key_id) { auto AddADSKImpl(GpgContext& ctx, const GpgKey& key, const GpgSubKey& adsk, const DataObjectPtr& data_object) -> GpgError { - auto algo = adsk.GetFingerprint(); + auto algo = adsk.Fingerprint(); unsigned int flags = GPGME_CREATE_ADSK; - LOG_D() << "add adsk args: " << key.GetId() << algo; + LOG_D() << "add adsk args: " << key.ID() << algo; auto err = gpgme_op_createsubkey(ctx.DefaultContext(), static_cast<gpgme_key_t>(key), diff --git a/src/core/function/gpg/GpgUIDOperator.cpp b/src/core/function/gpg/GpgUIDOperator.cpp index b9312745..f3e4fcc2 100644 --- a/src/core/function/gpg/GpgUIDOperator.cpp +++ b/src/core/function/gpg/GpgUIDOperator.cpp @@ -59,7 +59,7 @@ auto GpgUIDOperator::AddUID(const GpgKey& key, const QString& name, } auto GpgUIDOperator::DeleteUID(const GpgKey& key, int uid_index) -> bool { - if (uid_index < 2 || uid_index > static_cast<int>(key.GetUIDs()->size())) { + if (uid_index < 2 || uid_index > static_cast<int>(key.UIDs().size())) { LOG_W() << "illegal uid_index index: " << uid_index; return false; } @@ -131,7 +131,7 @@ auto GpgUIDOperator::DeleteUID(const GpgKey& key, int uid_index) -> bool { return QString(""); }; - auto key_fpr = key.GetFingerprint(); + auto key_fpr = key.Fingerprint(); AutomatonHandelStruct handel_struct(key_fpr); handel_struct.SetHandler(next_state_handler, action_handler); @@ -144,7 +144,7 @@ auto GpgUIDOperator::DeleteUID(const GpgKey& key, int uid_index) -> bool { auto GpgUIDOperator::RevokeUID(const GpgKey& key, int uid_index, int reason_code, const QString& reason_text) -> bool { - if (uid_index < 2 || uid_index > static_cast<int>(key.GetUIDs()->size())) { + if (uid_index < 2 || uid_index > static_cast<int>(key.UIDs().size())) { LOG_W() << "illegal uid index: " << uid_index; return false; } @@ -253,7 +253,7 @@ auto GpgUIDOperator::RevokeUID(const GpgKey& key, int uid_index, return QString(""); }; - auto key_fpr = key.GetFingerprint(); + auto key_fpr = key.Fingerprint(); AutomatonHandelStruct handel_struct(key_fpr); handel_struct.SetHandler(next_state_handler, action_handler); diff --git a/src/core/function/result_analyse/GpgDecryptResultAnalyse.cpp b/src/core/function/result_analyse/GpgDecryptResultAnalyse.cpp index 6e948705..f84e9b85 100644 --- a/src/core/function/result_analyse/GpgDecryptResultAnalyse.cpp +++ b/src/core/function/result_analyse/GpgDecryptResultAnalyse.cpp @@ -110,9 +110,9 @@ void GpgFrontend::GpgDecryptResultAnalyse::print_recipient( auto key = GpgFrontend::GpgKeyGetter::GetInstance(GetChannel()) .GetKey(recipient->keyid); if (key.IsGood()) { - stream << key.GetName(); - if (!key.GetComment().isEmpty()) stream << "(" << key.GetComment() << ")"; - if (!key.GetEmail().isEmpty()) stream << "<" << key.GetEmail() << ">"; + stream << key.Name(); + if (!key.Comment().isEmpty()) stream << "(" << key.Comment() << ")"; + if (!key.Email().isEmpty()) stream << "<" << key.Email() << ">"; } else { stream << "<" << tr("unknown") << ">"; setStatus(0); diff --git a/src/core/function/result_analyse/GpgSignResultAnalyse.cpp b/src/core/function/result_analyse/GpgSignResultAnalyse.cpp index 2530b823..262d0692 100644 --- a/src/core/function/result_analyse/GpgSignResultAnalyse.cpp +++ b/src/core/function/result_analyse/GpgSignResultAnalyse.cpp @@ -76,24 +76,24 @@ void GpgSignResultAnalyse::doAnalyse() { auto singer_key = GpgKeyGetter::GetInstance(GetChannel()).GetKey(fpr); if (singer_key.IsGood()) { stream_ << "- " << tr("Signed By") << ": " - << singer_key.GetUIDs()->front().GetUID() << Qt::endl; + << singer_key.UIDs().front().GetUID() << Qt::endl; - auto subkeys = singer_key.GetSubKeys(); + auto s_keys = singer_key.SubKeys(); auto it = std::find_if( - subkeys->begin(), subkeys->end(), - [fpr](const GpgSubKey &k) { return k.GetFingerprint() == fpr; }); + s_keys.begin(), s_keys.end(), + [fpr](const GpgSubKey &k) { return k.Fingerprint() == fpr; }); - if (it != subkeys->end()) { + if (it != s_keys.end()) { auto &subkey = *it; - if (subkey.GetFingerprint() != singer_key.GetFingerprint()) { - stream_ << "- " << tr("Key ID") << ": " << singer_key.GetId() - << " (" << tr("Subkey") << ")" << Qt::endl; + if (subkey.Fingerprint() != singer_key.Fingerprint()) { + stream_ << "- " << tr("Key ID") << ": " << singer_key.ID() << " (" + << tr("Subkey") << ")" << Qt::endl; } else { - stream_ << "- " << tr("Key ID") << ": " << singer_key.GetId() - << " (" << tr("Primary Key") << ")" << Qt::endl; + stream_ << "- " << tr("Key ID") << ": " << singer_key.ID() << " (" + << tr("Primary Key") << ")" << Qt::endl; } stream_ << "- " << tr("Key Create Date") << ": " - << QLocale().toString(subkey.GetCreateTime()) << Qt::endl; + << QLocale().toString(subkey.CreationTime()) << Qt::endl; } } else { stream_ << "- " << tr("Signed By") << "(" << tr("Fingerprint") << ")" diff --git a/src/core/function/result_analyse/GpgVerifyResultAnalyse.cpp b/src/core/function/result_analyse/GpgVerifyResultAnalyse.cpp index e2fc21f0..09b7da7e 100644 --- a/src/core/function/result_analyse/GpgVerifyResultAnalyse.cpp +++ b/src/core/function/result_analyse/GpgVerifyResultAnalyse.cpp @@ -202,26 +202,26 @@ auto GpgFrontend::GpgVerifyResultAnalyse::print_signer( auto key = GpgFrontend::GpgKeyGetter::GetInstance(GetChannel()).GetKey(fingerprint); if (key.IsGood()) { - stream << "- " << tr("Signed By") << ": " << key.GetUIDs()->front().GetUID() + stream << "- " << tr("Signed By") << ": " << key.UIDs().front().GetUID() << Qt::endl; - auto subkeys = key.GetSubKeys(); - auto it = std::find_if(subkeys->begin(), subkeys->end(), + auto s_keys = key.SubKeys(); + auto it = std::find_if(s_keys.begin(), s_keys.end(), [fingerprint](const GpgSubKey &k) { - return k.GetFingerprint() == fingerprint; + return k.Fingerprint() == fingerprint; }); - if (it != subkeys->end()) { - auto &subkey = *it; - if (subkey.GetFingerprint() != key.GetFingerprint()) { - stream << "- " << tr("Key ID") << ": " << key.GetId() << " (" + if (it != s_keys.end()) { + auto &s_key = *it; + if (s_key.Fingerprint() != key.Fingerprint()) { + stream << "- " << tr("Key ID") << ": " << key.ID() << " (" << tr("Subkey") << ")" << Qt::endl; } else { - stream << "- " << tr("Key ID") << ": " << key.GetId() << " (" + stream << "- " << tr("Key ID") << ": " << key.ID() << " (" << tr("Primary Key") << ")" << Qt::endl; } stream << "- " << tr("Key Create Date") << ": " - << QLocale().toString(subkey.GetCreateTime()) << Qt::endl; + << QLocale().toString(s_key.CreationTime()) << Qt::endl; } } else { diff --git a/src/core/model/GpgAbstractKey.h b/src/core/model/GpgAbstractKey.h index b34643cd..97171daa 100644 --- a/src/core/model/GpgAbstractKey.h +++ b/src/core/model/GpgAbstractKey.h @@ -35,11 +35,19 @@ class GpgAbstractKey { [[nodiscard]] virtual auto ID() const -> QString = 0; [[nodiscard]] virtual auto Fingerprint() const -> QString = 0; [[nodiscard]] virtual auto IsSubKey() const -> bool = 0; - [[nodiscard]] virtual auto CreationTime() const -> QDateTime = 0; + [[nodiscard]] virtual auto IsHasEncrCap() const -> bool = 0; [[nodiscard]] virtual auto IsHasSignCap() const -> bool = 0; [[nodiscard]] virtual auto IsHasCertCap() const -> bool = 0; [[nodiscard]] virtual auto IsHasAuthCap() const -> bool = 0; + [[nodiscard]] virtual auto IsRevoked() const -> bool = 0; + [[nodiscard]] virtual auto IsDisabled() const -> bool = 0; + [[nodiscard]] virtual auto IsExpired() const -> bool = 0; + [[nodiscard]] virtual auto IsGood() const -> bool = 0; + [[nodiscard]] virtual auto PublicKeyAlgo() const -> QString = 0; + [[nodiscard]] virtual auto Algo() const -> QString = 0; + [[nodiscard]] virtual auto CreationTime() const -> QDateTime = 0; + [[nodiscard]] virtual auto ExpirationTime() const -> QDateTime = 0; // diff --git a/src/core/model/GpgKey.cpp b/src/core/model/GpgKey.cpp index ce6f1c10..0c644217 100644 --- a/src/core/model/GpgKey.cpp +++ b/src/core/model/GpgKey.cpp @@ -30,60 +30,38 @@ namespace GpgFrontend { -GpgKey::GpgKey(gpgme_key_t &&key) : key_ref_(key) {} +GpgKey::GpgKey() = default; -GpgKey::GpgKey(GpgKey &&k) noexcept { swap(key_ref_, k.key_ref_); } +GpgKey::GpgKey(gpgme_key_t key) + : key_ref_(key, [](struct _gpgme_key *ptr) { + if (ptr != nullptr) gpgme_key_unref(ptr); + }) {} -auto GpgKey::operator=(GpgKey &&k) noexcept -> GpgKey & { - swap(key_ref_, k.key_ref_); - return *this; -} - -GpgKey::GpgKey(const GpgKey &key) { - auto *key_ref = key.key_ref_.get(); - gpgme_key_ref(key_ref); - this->key_ref_ = KeyRefHandler(key_ref); -} - -auto GpgKey::operator=(const GpgKey &key) -> GpgKey & { - if (this == &key) { - return *this; - } +GpgKey::operator gpgme_key_t() const { return key_ref_.get(); } - auto *key_ref = key.key_ref_.get(); - gpgme_key_ref(key_ref); +GpgKey::GpgKey(const GpgKey &) = default; - this->key_ref_ = KeyRefHandler(key_ref); - return *this; -} +GpgKey::~GpgKey() = default; -auto GpgKey::operator==(const GpgKey &o) const -> bool { - return o.GetId() == this->GetId(); -} - -auto GpgKey::operator<=(const GpgKey &o) const -> bool { - return this->GetId() < o.GetId(); -} - -GpgKey::operator gpgme_key_t() const { return key_ref_.get(); } +auto GpgKey::operator=(const GpgKey &) -> GpgKey & = default; auto GpgKey::IsGood() const -> bool { return key_ref_ != nullptr; } -auto GpgKey::GetId() const -> QString { return key_ref_->subkeys->keyid; } +auto GpgKey::ID() const -> QString { return key_ref_->subkeys->keyid; } -auto GpgKey::GetName() const -> QString { return key_ref_->uids->name; }; +auto GpgKey::Name() const -> QString { return key_ref_->uids->name; }; -auto GpgKey::GetEmail() const -> QString { return key_ref_->uids->email; } +auto GpgKey::Email() const -> QString { return key_ref_->uids->email; } -auto GpgKey::GetComment() const -> QString { return key_ref_->uids->comment; } +auto GpgKey::Comment() const -> QString { return key_ref_->uids->comment; } -auto GpgKey::GetFingerprint() const -> QString { return key_ref_->fpr; } +auto GpgKey::Fingerprint() const -> QString { return key_ref_->fpr; } -auto GpgKey::GetProtocol() const -> QString { +auto GpgKey::Protocol() const -> QString { return gpgme_get_protocol_name(key_ref_->protocol); } -auto GpgKey::GetOwnerTrust() const -> QString { +auto GpgKey::OwnerTrust() const -> QString { switch (key_ref_->owner_trust) { case GPGME_VALIDITY_UNKNOWN: return tr("Unknown"); @@ -101,7 +79,7 @@ auto GpgKey::GetOwnerTrust() const -> QString { return "Invalid"; } -auto GpgKey::GetOwnerTrustLevel() const -> int { +auto GpgKey::OwnerTrustLevel() const -> int { switch (key_ref_->owner_trust) { case GPGME_VALIDITY_UNKNOWN: return 0; @@ -119,31 +97,31 @@ auto GpgKey::GetOwnerTrustLevel() const -> int { return 0; } -auto GpgKey::GetPublicKeyAlgo() const -> QString { +auto GpgKey::PublicKeyAlgo() const -> QString { return gpgme_pubkey_algo_name(key_ref_->subkeys->pubkey_algo); } -auto GpgKey::GetKeyAlgo() const -> QString { +auto GpgKey::Algo() const -> QString { auto *buffer = gpgme_pubkey_algo_string(key_ref_->subkeys); auto algo = QString(buffer); gpgme_free(buffer); return algo.toUpper(); } -auto GpgKey::GetLastUpdateTime() const -> QDateTime { +auto GpgKey::LastUpdateTime() const -> QDateTime { return QDateTime::fromSecsSinceEpoch( static_cast<time_t>(key_ref_->last_update)); } -auto GpgKey::GetExpireTime() const -> QDateTime { +auto GpgKey::ExpirationTime() const -> QDateTime { return QDateTime::fromSecsSinceEpoch(key_ref_->subkeys->expires); }; -auto GpgKey::GetCreateTime() const -> QDateTime { +auto GpgKey::CreationTime() const -> QDateTime { return QDateTime::fromSecsSinceEpoch(key_ref_->subkeys->timestamp); }; -auto GpgKey::GetPrimaryKeyLength() const -> unsigned int { +auto GpgKey::PrimaryKeyLength() const -> unsigned int { return key_ref_->subkeys->length; } @@ -156,9 +134,9 @@ auto GpgKey::IsHasCertCap() const -> bool { return key_ref_->can_certify; } auto GpgKey::IsHasAuthCap() const -> bool { return key_ref_->can_authenticate; } auto GpgKey::IsHasCardKey() const -> bool { - auto subkeys = GetSubKeys(); + auto sub_keys = SubKeys(); return std::any_of( - subkeys->begin(), subkeys->end(), + sub_keys.begin(), sub_keys.end(), [](const GpgSubKey &subkey) -> bool { return subkey.IsCardKey(); }); } @@ -174,44 +152,42 @@ auto GpgKey::IsHasMasterKey() const -> bool { return key_ref_->subkeys->secret; } -auto GpgKey::GetSubKeys() const -> std::unique_ptr<QContainer<GpgSubKey>> { - auto p_keys = std::make_unique<QContainer<GpgSubKey>>(); +auto GpgKey::SubKeys() const -> QContainer<GpgSubKey> { + QContainer<GpgSubKey> ret; auto *next = key_ref_->subkeys; while (next != nullptr) { - p_keys->push_back(GpgSubKey(next)); + ret.push_back(GpgSubKey(next)); next = next->next; } - return p_keys; + return ret; } -auto GpgKey::GetUIDs() const -> std::unique_ptr<QContainer<GpgUID>> { - auto p_uids = std::make_unique<QContainer<GpgUID>>(); +auto GpgKey::UIDs() const -> QContainer<GpgUID> { + QContainer<GpgUID> uids; auto *uid_next = key_ref_->uids; while (uid_next != nullptr) { - p_uids->push_back(GpgUID(uid_next)); + uids.push_back(GpgUID(uid_next)); uid_next = uid_next->next; } - return p_uids; + return uids; } auto GpgKey::IsHasActualSignCap() const -> bool { - auto subkeys = GetSubKeys(); - return std::any_of(subkeys->begin(), subkeys->end(), - [](const GpgSubKey &subkey) -> bool { - return subkey.IsSecretKey() && subkey.IsHasSignCap() && - !subkey.IsDisabled() && !subkey.IsRevoked() && - !subkey.IsExpired(); - }); + auto s_keys = SubKeys(); + return std::any_of( + s_keys.begin(), s_keys.end(), [](const GpgSubKey &s_key) -> bool { + return s_key.IsSecretKey() && s_key.IsHasSignCap() && + !s_key.IsDisabled() && !s_key.IsRevoked() && !s_key.IsExpired(); + }); } auto GpgKey::IsHasActualAuthCap() const -> bool { - auto subkeys = GetSubKeys(); - return std::any_of(subkeys->begin(), subkeys->end(), - [](const GpgSubKey &subkey) -> bool { - return subkey.IsSecretKey() && subkey.IsHasAuthCap() && - !subkey.IsDisabled() && !subkey.IsRevoked() && - !subkey.IsExpired(); - }); + auto s_keys = SubKeys(); + return std::any_of( + s_keys.begin(), s_keys.end(), [](const GpgSubKey &s_key) -> bool { + return s_key.IsSecretKey() && s_key.IsHasAuthCap() && + !s_key.IsDisabled() && !s_key.IsRevoked() && !s_key.IsExpired(); + }); } /** @@ -229,19 +205,17 @@ auto GpgKey::IsHasActualCertCap() const -> bool { * @return if key encrypt */ auto GpgKey::IsHasActualEncrCap() const -> bool { - auto subkeys = GetSubKeys(); - return std::any_of(subkeys->begin(), subkeys->end(), - [](const GpgSubKey &subkey) -> bool { - return subkey.IsHasEncrCap() && !subkey.IsDisabled() && - !subkey.IsRevoked() && !subkey.IsExpired(); + auto s_keys = SubKeys(); + return std::any_of(s_keys.begin(), s_keys.end(), + [](const GpgSubKey &s_key) -> bool { + return s_key.IsHasEncrCap() && !s_key.IsDisabled() && + !s_key.IsRevoked() && !s_key.IsExpired(); }); } -void GpgKey::KeyRefDeleter::operator()(gpgme_key_t _key) { - if (_key != nullptr) gpgme_key_unref(_key); -} - -auto GpgKey::GetPrimaryKey() const -> GpgSubKey { +auto GpgKey::PrimaryKey() const -> GpgSubKey { return GpgSubKey(key_ref_->subkeys); } + +auto GpgKey::IsSubKey() const -> bool { return false; } } // namespace GpgFrontend
\ No newline at end of file diff --git a/src/core/model/GpgKey.h b/src/core/model/GpgKey.h index e2743670..2102cdc4 100644 --- a/src/core/model/GpgKey.h +++ b/src/core/model/GpgKey.h @@ -28,6 +28,7 @@ #pragma once +#include "core/model/GpgAbstractKey.h" #include "core/model/GpgSubKey.h" #include "core/model/GpgUID.h" @@ -37,56 +38,34 @@ namespace GpgFrontend { * @brief * */ -class GPGFRONTEND_CORE_EXPORT GpgKey { +class GPGFRONTEND_CORE_EXPORT GpgKey : public GpgAbstractKey { Q_DECLARE_TR_FUNCTIONS(GpgKey) public: /** * @brief Construct a new Gpg Key object * */ - GpgKey() = default; + GpgKey(); /** * @brief Construct a new Gpg Key object * * @param key */ - explicit GpgKey(gpgme_key_t&& key); - - /** - * @brief Destroy the Gpg Key objects - * - */ - ~GpgKey() = default; - - /** - * @brief Construct a new Gpg Key object - * - * @param key - */ - GpgKey(const gpgme_key_t& key) = delete; + explicit GpgKey(gpgme_key_t key); /** * @brief Construct a new Gpg Key object * * @param k */ - GpgKey(GpgKey&&) noexcept; - - /** - * @brief - * - * @param k - * @return GpgKey& - */ - auto operator=(GpgKey&&) noexcept -> GpgKey&; + GpgKey(const GpgKey&); /** - * @brief Construct a new Gpg Key object + * @brief Destroy the Gpg Key objects * - * @param k */ - GpgKey(const GpgKey&); + virtual ~GpgKey() override; /** * @brief @@ -99,36 +78,18 @@ class GPGFRONTEND_CORE_EXPORT GpgKey { /** * @brief * - * @param key - * @return GpgKey& - */ - auto operator=(const gpgme_key_t&) -> GpgKey& = delete; - - /** - * @brief - * - * @param o - * @return true - * @return false + * @return gpgme_key_t */ - auto operator==(const GpgKey&) const -> bool; + // NOLINTNEXTLINE(google-explicit-constructor) + operator gpgme_key_t() const; /** * @brief * - * @param o * @return true * @return false */ - auto operator<=(const GpgKey&) const -> bool; - - /** - * @brief - * - * @return gpgme_key_t - */ - // NOLINTNEXTLINE(google-explicit-constructor) - operator gpgme_key_t() const; + [[nodiscard]] auto IsSubKey() const -> bool override; /** * @brief @@ -136,105 +97,105 @@ class GPGFRONTEND_CORE_EXPORT GpgKey { * @return true * @return false */ - [[nodiscard]] auto IsGood() const -> bool; + [[nodiscard]] auto IsGood() const -> bool override; /** * @brief * * @return QString */ - [[nodiscard]] auto GetId() const -> QString; + [[nodiscard]] auto ID() const -> QString override; /** * @brief * * @return QString */ - [[nodiscard]] auto GetName() const -> QString; + [[nodiscard]] auto Name() const -> QString; /** * @brief * * @return QString */ - [[nodiscard]] auto GetEmail() const -> QString; + [[nodiscard]] auto Email() const -> QString; /** * @brief * * @return QString */ - [[nodiscard]] auto GetComment() const -> QString; + [[nodiscard]] auto Comment() const -> QString; /** * @brief * * @return QString */ - [[nodiscard]] auto GetFingerprint() const -> QString; + [[nodiscard]] auto Fingerprint() const -> QString override; /** * @brief * * @return QString */ - [[nodiscard]] auto GetProtocol() const -> QString; + [[nodiscard]] auto Protocol() const -> QString; /** * @brief * * @return QString */ - [[nodiscard]] auto GetOwnerTrust() const -> QString; + [[nodiscard]] auto OwnerTrust() const -> QString; /** * @brief * * @return int */ - [[nodiscard]] auto GetOwnerTrustLevel() const -> int; + [[nodiscard]] auto OwnerTrustLevel() const -> int; /** * @brief * * @return QString */ - [[nodiscard]] auto GetPublicKeyAlgo() const -> QString; + [[nodiscard]] auto PublicKeyAlgo() const -> QString override; /** * @brief * * @return QString */ - [[nodiscard]] auto GetKeyAlgo() const -> QString; + [[nodiscard]] auto Algo() const -> QString override; /** * @brief * * @return QDateTime */ - [[nodiscard]] auto GetLastUpdateTime() const -> QDateTime; + [[nodiscard]] auto LastUpdateTime() const -> QDateTime; /** * @brief * * @return QDateTime */ - [[nodiscard]] auto GetExpireTime() const -> QDateTime; + [[nodiscard]] auto ExpirationTime() const -> QDateTime override; /** * @brief Create a time object * * @return QDateTime */ - [[nodiscard]] auto GetCreateTime() const -> QDateTime; + [[nodiscard]] auto CreationTime() const -> QDateTime override; /** * @brief s * * @return unsigned int */ - [[nodiscard]] auto GetPrimaryKeyLength() const -> unsigned int; + [[nodiscard]] auto PrimaryKeyLength() const -> unsigned int; /** * @brief @@ -242,7 +203,7 @@ class GPGFRONTEND_CORE_EXPORT GpgKey { * @return true * @return false */ - [[nodiscard]] auto IsHasEncrCap() const -> bool; + [[nodiscard]] auto IsHasEncrCap() const -> bool override; /** * @brief @@ -259,7 +220,7 @@ class GPGFRONTEND_CORE_EXPORT GpgKey { * @return true * @return false */ - [[nodiscard]] auto IsHasSignCap() const -> bool; + [[nodiscard]] auto IsHasSignCap() const -> bool override; /** * @brief @@ -275,7 +236,7 @@ class GPGFRONTEND_CORE_EXPORT GpgKey { * @return true * @return false */ - [[nodiscard]] auto IsHasCertCap() const -> bool; + [[nodiscard]] auto IsHasCertCap() const -> bool override; /** * @brief @@ -291,7 +252,7 @@ class GPGFRONTEND_CORE_EXPORT GpgKey { * @return true * @return false */ - [[nodiscard]] auto IsHasAuthCap() const -> bool; + [[nodiscard]] auto IsHasAuthCap() const -> bool override; /** * @brief @@ -323,7 +284,7 @@ class GPGFRONTEND_CORE_EXPORT GpgKey { * @return true * @return false */ - [[nodiscard]] auto IsExpired() const -> bool; + [[nodiscard]] auto IsExpired() const -> bool override; /** * @brief @@ -331,7 +292,7 @@ class GPGFRONTEND_CORE_EXPORT GpgKey { * @return true * @return false */ - [[nodiscard]] auto IsRevoked() const -> bool; + [[nodiscard]] auto IsRevoked() const -> bool override; /** * @brief @@ -339,7 +300,7 @@ class GPGFRONTEND_CORE_EXPORT GpgKey { * @return true * @return false */ - [[nodiscard]] auto IsDisabled() const -> bool; + [[nodiscard]] auto IsDisabled() const -> bool override; /** * @brief @@ -354,35 +315,25 @@ class GPGFRONTEND_CORE_EXPORT GpgKey { * * @return std::unique_ptr<QContainer<GpgSubKey>> */ - [[nodiscard]] auto GetSubKeys() const - -> std::unique_ptr<QContainer<GpgSubKey>>; + [[nodiscard]] auto SubKeys() const -> QContainer<GpgSubKey>; /** * @brief * * @return std::unique_ptr<QContainer<GpgUID>> */ - [[nodiscard]] auto GetUIDs() const -> std::unique_ptr<QContainer<GpgUID>>; + [[nodiscard]] auto UIDs() const -> QContainer<GpgUID>; /** - * @brief Get the Primary Key object + * @brief the Primary Key object * * @return GpgSubKey */ - [[nodiscard]] auto GetPrimaryKey() const -> GpgSubKey; + [[nodiscard]] auto PrimaryKey() const -> GpgSubKey; private: - /** - * @brief - * - */ - struct GPGFRONTEND_CORE_EXPORT KeyRefDeleter { - void operator()(gpgme_key_t _key); - }; - - using KeyRefHandler = std::unique_ptr<struct _gpgme_key, KeyRefDeleter>; ///< - - KeyRefHandler key_ref_ = nullptr; ///< + using KeyRefHandler = QSharedPointer<struct _gpgme_key>; ///< + KeyRefHandler key_ref_ = nullptr; ///< }; } // namespace GpgFrontend diff --git a/src/core/model/GpgKeyTableModel.cpp b/src/core/model/GpgKeyTableModel.cpp index 53f5d1b1..1e38cb47 100644 --- a/src/core/model/GpgKeyTableModel.cpp +++ b/src/core/model/GpgKeyTableModel.cpp @@ -82,31 +82,31 @@ auto GpgKeyTableModel::data(const QModelIndex &index, return type_sym; } case 2: { - return key.GetName(); + return key.Name(); } case 3: { - return key.GetEmail(); + return key.Email(); } case 4: { return GetUsagesByKey(key); } case 5: { - return key.GetOwnerTrust(); + return key.OwnerTrust(); } case 6: { - return key.GetId(); + return key.ID(); } case 7: { - return QLocale().toString(key.GetCreateTime(), "yyyy-MM-dd"); + return QLocale().toString(key.CreationTime(), "yyyy-MM-dd"); } case 8: { - return key.GetKeyAlgo(); + return key.Algo(); } case 9: { - return static_cast<int>(key.GetSubKeys()->size()); + return static_cast<int>(key.SubKeys().size()); } case 10: { - return key.GetComment(); + return key.Comment(); } default: return {}; @@ -167,7 +167,7 @@ auto GpgKeyTableModel::setData(const QModelIndex &index, const QVariant &value, auto GpgKeyTableModel::GetAllKeyIds() -> KeyIdArgsList { KeyIdArgsList keys; for (auto &key : buffered_keys_) { - keys.push_back(key.GetId()); + keys.push_back(key.ID()); } return keys; } @@ -175,7 +175,7 @@ auto GpgKeyTableModel::GetAllKeyIds() -> KeyIdArgsList { auto GpgKeyTableModel::GetKeyIDByRow(int row) const -> QString { if (buffered_keys_.size() <= row) return {}; - return buffered_keys_[row].GetId(); + return buffered_keys_[row].ID(); } auto GpgKeyTableModel::IsPrivateKeyByRow(int row) const -> bool { diff --git a/src/core/model/GpgKeyTreeModel.cpp b/src/core/model/GpgKeyTreeModel.cpp index ce43d2d1..3925444c 100644 --- a/src/core/model/GpgKeyTreeModel.cpp +++ b/src/core/model/GpgKeyTreeModel.cpp @@ -203,34 +203,33 @@ auto GpgKeyTreeModel::create_gpg_key_tree_items(const GpgKey &key) -> QSharedPointer<GpgKeyTreeItem> { QVariantList columns; columns << "/"; - columns << key.GetUIDs()->front().GetUID(); - columns << key.GetId(); + columns << key.UIDs().front().GetUID(); + columns << key.ID(); columns << "C"; columns << GetUsagesByKey(key); - columns << key.GetPublicKeyAlgo(); - columns << key.GetKeyAlgo(); - columns << QLocale().toString(key.GetCreateTime(), "yyyy-MM-dd"); + columns << key.PublicKeyAlgo(); + columns << key.Algo(); + columns << QLocale().toString(key.CreationTime(), "yyyy-MM-dd"); auto i_key = QSharedPointer<GpgKeyTreeItem>::create( - QSharedPointer<GpgKeyAdapter>::create(key), columns); + QSharedPointer<GpgKey>::create(key), columns); i_key->SetEnable(enable_detector_(i_key->Key())); i_key->SetCheckable(checkable_detector_(i_key->Key())); cached_items_.push_back(i_key); - auto s_keys = key.GetSubKeys(); - for (const auto &s_key : *s_keys) { + for (const auto &s_key : key.SubKeys()) { QVariantList columns; columns << "/"; - columns << key.GetUIDs()->front().GetUID(); - columns << s_key.GetID(); + columns << key.UIDs().front().GetUID(); + columns << s_key.ID(); columns << (s_key.IsHasCertCap() ? "P" : "S"); columns << GetUsagesBySubkey(s_key); - columns << s_key.GetPubkeyAlgo(); - columns << s_key.GetKeyAlgo(); - columns << QLocale().toString(s_key.GetCreateTime(), "yyyy-MM-dd"); + columns << s_key.PublicKeyAlgo(); + columns << s_key.Algo(); + columns << QLocale().toString(s_key.CreationTime(), "yyyy-MM-dd"); auto i_s_key = QSharedPointer<GpgKeyTreeItem>::create( - QSharedPointer<GpgSubKeyAdapter>::create(s_key), columns); + QSharedPointer<GpgSubKey>::create(s_key), columns); i_s_key->SetEnable(enable_detector_(i_s_key->Key())); i_s_key->SetCheckable(checkable_detector_(i_s_key->Key())); i_key->AppendChild(i_s_key); @@ -245,10 +244,10 @@ auto GpgKeyTreeModel::GetAllCheckedSubKey() -> QContainer<GpgSubKey> { for (const auto &i : cached_items_) { if (!i->Key()->IsSubKey() || !i->Checkable() || !i->Checked()) continue; - auto *adaptor = dynamic_cast<GpgSubKeyAdapter *>(i->Key()); - if (adaptor == nullptr) continue; + auto *s_key = dynamic_cast<GpgSubKey *>(i->Key()); + if (s_key == nullptr) continue; - ret.push_back(adaptor->GetRawKey()); + ret.push_back(*s_key); } return ret; } diff --git a/src/core/model/GpgKeyTreeModel.h b/src/core/model/GpgKeyTreeModel.h index 96b78400..42b29055 100644 --- a/src/core/model/GpgKeyTreeModel.h +++ b/src/core/model/GpgKeyTreeModel.h @@ -82,82 +82,6 @@ inline auto operator~(GpgKeyTreeColumn hs) -> GpgKeyTreeColumn { return static_cast<GpgKeyTreeColumn>(~static_cast<T>(hs)); } -class GPGFRONTEND_CORE_EXPORT GpgKeyAdapter : public GpgAbstractKey { - public: - [[nodiscard]] auto ID() const -> QString override { return key_.GetId(); } - - [[nodiscard]] auto Fingerprint() const -> QString override { - return key_.GetFingerprint(); - } - - [[nodiscard]] auto IsSubKey() const -> bool override { return false; } - - [[nodiscard]] auto CreationTime() const -> QDateTime override { - return key_.GetCreateTime(); - } - - [[nodiscard]] auto IsHasEncrCap() const -> bool override { - return key_.IsHasActualEncrCap(); - } - - [[nodiscard]] auto IsHasSignCap() const -> bool override { - return key_.IsHasActualSignCap(); - } - - [[nodiscard]] auto IsHasCertCap() const -> bool override { - return key_.IsHasActualCertCap(); - } - - [[nodiscard]] auto IsHasAuthCap() const -> bool override { - return key_.IsHasActualAuthCap(); - } - - [[nodiscard]] auto GetRawKey() const -> const GpgKey & { return key_; } - - explicit GpgKeyAdapter(GpgKey key) : key_(std::move(key)) {} - - private: - GpgKey key_; -}; - -class GPGFRONTEND_CORE_EXPORT GpgSubKeyAdapter : public GpgAbstractKey { - public: - [[nodiscard]] auto ID() const -> QString override { return key_.GetID(); } - - [[nodiscard]] auto Fingerprint() const -> QString override { - return key_.GetFingerprint(); - } - - [[nodiscard]] auto IsSubKey() const -> bool override { return true; } - - [[nodiscard]] auto CreationTime() const -> QDateTime override { - return key_.GetCreateTime(); - } - - [[nodiscard]] auto IsHasEncrCap() const -> bool override { - return key_.IsHasEncrCap(); - } - - [[nodiscard]] auto IsHasSignCap() const -> bool override { - return key_.IsHasSignCap(); - } - - [[nodiscard]] auto IsHasCertCap() const -> bool override { - return key_.IsHasCertCap(); - } - - [[nodiscard]] auto IsHasAuthCap() const -> bool override { - return key_.IsHasAuthCap(); - } - - [[nodiscard]] auto GetRawKey() const -> const GpgSubKey & { return key_; } - - explicit GpgSubKeyAdapter(const GpgSubKey &key) : key_(key) {} - - private: - GpgSubKey key_; -}; - class GPGFRONTEND_CORE_EXPORT GpgKeyTreeItem { public: GpgKeyTreeItem() = default; diff --git a/src/core/model/GpgSubKey.cpp b/src/core/model/GpgSubKey.cpp index dbabf085..62f0981a 100644 --- a/src/core/model/GpgSubKey.cpp +++ b/src/core/model/GpgSubKey.cpp @@ -35,32 +35,26 @@ GpgSubKey::GpgSubKey(gpgme_subkey_t subkey) : subkey_ref_(subkey) {} GpgSubKey::GpgSubKey(const GpgSubKey&) = default; -auto GpgSubKey::operator=(const GpgSubKey&) -> GpgSubKey& = default; - -auto GpgSubKey::operator==(const GpgSubKey& o) const -> bool { - return GetFingerprint() == o.GetFingerprint(); -} +GpgSubKey::~GpgSubKey() = default; -auto GpgSubKey::operator<(const GpgSubKey& o) const -> bool { - return GetID() < o.GetID(); -} +auto GpgSubKey::operator=(const GpgSubKey&) -> GpgSubKey& = default; -auto GpgSubKey::GetID() const -> QString { return subkey_ref_->keyid; } +auto GpgSubKey::ID() const -> QString { return subkey_ref_->keyid; } -auto GpgSubKey::GetFingerprint() const -> QString { return subkey_ref_->fpr; } +auto GpgSubKey::Fingerprint() const -> QString { return subkey_ref_->fpr; } -auto GpgSubKey::GetPubkeyAlgo() const -> QString { +auto GpgSubKey::PublicKeyAlgo() const -> QString { return gpgme_pubkey_algo_name(subkey_ref_->pubkey_algo); } -auto GpgSubKey::GetKeyAlgo() const -> QString { +auto GpgSubKey::Algo() const -> QString { auto* buffer = gpgme_pubkey_algo_string(subkey_ref_); auto algo = QString(buffer); gpgme_free(buffer); return algo.toUpper(); } -auto GpgSubKey::GetKeyLength() const -> unsigned int { +auto GpgSubKey::KeyLength() const -> unsigned int { return subkey_ref_->length; } @@ -90,11 +84,11 @@ auto GpgSubKey::IsSecretKey() const -> bool { return subkey_ref_->secret; } auto GpgSubKey::IsCardKey() const -> bool { return subkey_ref_->is_cardkey; } -auto GpgSubKey::GetCreateTime() const -> QDateTime { +auto GpgSubKey::CreationTime() const -> QDateTime { return QDateTime::fromSecsSinceEpoch(subkey_ref_->timestamp); } -auto GpgSubKey::GetExpireTime() const -> QDateTime { +auto GpgSubKey::ExpirationTime() const -> QDateTime { return QDateTime::fromSecsSinceEpoch(subkey_ref_->expires); } @@ -104,4 +98,7 @@ auto GpgSubKey::SmartCardSerialNumber() -> QString { return subkey_ref_->card_number; } +auto GpgSubKey::IsSubKey() const -> bool { return true; } + +auto GpgSubKey::IsGood() const -> bool { return subkey_ref_ != nullptr; } } // namespace GpgFrontend diff --git a/src/core/model/GpgSubKey.h b/src/core/model/GpgSubKey.h index 6577ff5a..255d209f 100644 --- a/src/core/model/GpgSubKey.h +++ b/src/core/model/GpgSubKey.h @@ -31,6 +31,7 @@ #include <gpgme.h> #include "core/GpgFrontendCoreExport.h" +#include "core/model/GpgAbstractKey.h" namespace GpgFrontend { @@ -38,7 +39,7 @@ namespace GpgFrontend { * @brief * */ -class GPGFRONTEND_CORE_EXPORT GpgSubKey { +class GPGFRONTEND_CORE_EXPORT GpgSubKey : public GpgAbstractKey { public: /** * @brief Construct a new Gpg Sub Key object @@ -60,6 +61,12 @@ class GPGFRONTEND_CORE_EXPORT GpgSubKey { GpgSubKey(const GpgSubKey&); /** + * @brief Destroy the Gpg Sub Key object + * + */ + virtual ~GpgSubKey() override; + + /** * @brief * * @return GpgSubKey& @@ -69,55 +76,53 @@ class GPGFRONTEND_CORE_EXPORT GpgSubKey { /** * @brief * - * @param o - * @return true - * @return false + * @return QString */ - auto operator==(const GpgSubKey& o) const -> bool; + [[nodiscard]] auto ID() const -> QString override; /** * @brief * - * @param o - * @return true - * @return false + * @return QString */ - auto operator<(const GpgSubKey& o) const -> bool; + [[nodiscard]] auto Fingerprint() const -> QString override; /** * @brief * - * @return QString + * @return true + * @return false */ - [[nodiscard]] auto GetID() const -> QString; + [[nodiscard]] auto IsSubKey() const -> bool override; /** * @brief * - * @return QString + * @return true + * @return false */ - [[nodiscard]] auto GetFingerprint() const -> QString; + [[nodiscard]] auto IsGood() const -> bool override; /** * @brief * * @return QString */ - [[nodiscard]] auto GetPubkeyAlgo() const -> QString; + [[nodiscard]] auto PublicKeyAlgo() const -> QString override; /** * @brief * * @return QString */ - [[nodiscard]] auto GetKeyAlgo() const -> QString; + [[nodiscard]] auto Algo() const -> QString override; /** * @brief * * @return unsigned int */ - [[nodiscard]] auto GetKeyLength() const -> unsigned int; + [[nodiscard]] auto KeyLength() const -> unsigned int; /** * @brief @@ -125,7 +130,7 @@ class GPGFRONTEND_CORE_EXPORT GpgSubKey { * @return true * @return false */ - [[nodiscard]] auto IsHasEncrCap() const -> bool; + [[nodiscard]] auto IsHasEncrCap() const -> bool override; /** * @brief @@ -133,7 +138,7 @@ class GPGFRONTEND_CORE_EXPORT GpgSubKey { * @return true * @return false */ - [[nodiscard]] auto IsHasSignCap() const -> bool; + [[nodiscard]] auto IsHasSignCap() const -> bool override; /** * @brief @@ -141,7 +146,7 @@ class GPGFRONTEND_CORE_EXPORT GpgSubKey { * @return true * @return false */ - [[nodiscard]] auto IsHasCertCap() const -> bool; + [[nodiscard]] auto IsHasCertCap() const -> bool override; /** * @brief @@ -149,7 +154,7 @@ class GPGFRONTEND_CORE_EXPORT GpgSubKey { * @return true * @return false */ - [[nodiscard]] auto IsHasAuthCap() const -> bool; + [[nodiscard]] auto IsHasAuthCap() const -> bool override; /** * @brief @@ -165,7 +170,7 @@ class GPGFRONTEND_CORE_EXPORT GpgSubKey { * @return true * @return false */ - [[nodiscard]] auto IsExpired() const -> bool; + [[nodiscard]] auto IsExpired() const -> bool override; /** * @brief @@ -173,7 +178,7 @@ class GPGFRONTEND_CORE_EXPORT GpgSubKey { * @return true * @return false */ - [[nodiscard]] auto IsRevoked() const -> bool; + [[nodiscard]] auto IsRevoked() const -> bool override; /** * @brief @@ -181,7 +186,7 @@ class GPGFRONTEND_CORE_EXPORT GpgSubKey { * @return true * @return false */ - [[nodiscard]] auto IsDisabled() const -> bool; + [[nodiscard]] auto IsDisabled() const -> bool override; /** * @brief @@ -204,14 +209,14 @@ class GPGFRONTEND_CORE_EXPORT GpgSubKey { * * @return QDateTime */ - [[nodiscard]] auto GetCreateTime() const -> QDateTime; + [[nodiscard]] auto CreationTime() const -> QDateTime override; /** * @brief * * @return QDateTime */ - [[nodiscard]] auto GetExpireTime() const -> QDateTime; + [[nodiscard]] auto ExpirationTime() const -> QDateTime override; /** * @brief |