aboutsummaryrefslogtreecommitdiffstats
path: root/src/core/function
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/function')
-rw-r--r--src/core/function/gpg/GpgAutomatonHandler.cpp2
-rw-r--r--src/core/function/gpg/GpgBasicOperator.cpp2
-rw-r--r--src/core/function/gpg/GpgKeyGetter.cpp6
-rw-r--r--src/core/function/gpg/GpgKeyManager.cpp10
-rw-r--r--src/core/function/gpg/GpgKeyOpera.cpp11
-rw-r--r--src/core/function/gpg/GpgUIDOperator.cpp8
-rw-r--r--src/core/function/result_analyse/GpgDecryptResultAnalyse.cpp6
-rw-r--r--src/core/function/result_analyse/GpgSignResultAnalyse.cpp22
-rw-r--r--src/core/function/result_analyse/GpgVerifyResultAnalyse.cpp20
9 files changed, 43 insertions, 44 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 {