aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/GpgCoreInit.cpp2
-rw-r--r--src/core/function/basic/GpgFunctionObject.h6
-rw-r--r--src/core/function/basic/SingletonStorage.cpp9
-rw-r--r--src/core/function/basic/SingletonStorage.h7
-rw-r--r--src/core/function/gpg/GpgBasicOperator.cpp14
-rw-r--r--src/core/function/gpg/GpgBasicOperator.h2
-rw-r--r--src/core/function/gpg/GpgCommandExecutor.cpp4
-rw-r--r--src/core/function/gpg/GpgFileOpera.cpp12
-rw-r--r--src/core/function/gpg/GpgKeyGetter.cpp36
-rw-r--r--src/core/function/gpg/GpgKeyGetter.h14
-rw-r--r--src/core/function/gpg/GpgKeyImportExporter.cpp6
-rw-r--r--src/core/function/gpg/GpgKeyManager.cpp4
-rw-r--r--src/core/function/gpg/GpgKeyManager.h2
-rw-r--r--src/core/function/gpg/GpgKeyOpera.cpp10
-rw-r--r--src/core/function/gpg/GpgKeyOpera.h2
-rw-r--r--src/core/model/DataObject.cpp4
-rw-r--r--src/core/model/DataObject.h6
-rw-r--r--src/core/model/GpgDecryptResult.cpp4
-rw-r--r--src/core/model/GpgDecryptResult.h2
-rw-r--r--src/core/model/GpgEncryptResult.cpp4
-rw-r--r--src/core/model/GpgEncryptResult.h2
-rw-r--r--src/core/model/GpgGenKeyInfo.cpp8
-rw-r--r--src/core/model/GpgGenKeyInfo.h9
-rw-r--r--src/core/model/GpgKey.cpp8
-rw-r--r--src/core/model/GpgKey.h8
-rw-r--r--src/core/model/GpgKeySignature.cpp51
-rw-r--r--src/core/model/GpgKeySignature.h23
-rw-r--r--src/core/model/GpgKeyTableModel.cpp4
-rw-r--r--src/core/model/GpgKeyTableModel.h2
-rw-r--r--src/core/model/GpgSignResult.cpp4
-rw-r--r--src/core/model/GpgSignResult.h2
-rw-r--r--src/core/model/GpgSignature.cpp38
-rw-r--r--src/core/model/GpgSignature.h23
-rw-r--r--src/core/model/GpgSubKey.cpp14
-rw-r--r--src/core/model/GpgSubKey.h25
-rw-r--r--src/core/model/GpgTOFUInfo.cpp26
-rw-r--r--src/core/model/GpgTOFUInfo.h25
-rw-r--r--src/core/model/GpgUID.cpp15
-rw-r--r--src/core/model/GpgUID.h33
-rw-r--r--src/core/model/GpgVerifyResult.cpp4
-rw-r--r--src/core/model/GpgVerifyResult.h2
-rw-r--r--src/core/module/Event.h2
-rw-r--r--src/core/module/GlobalRegisterTable.cpp7
-rw-r--r--src/core/module/GlobalRegisterTable.h3
-rw-r--r--src/core/module/ModuleManager.cpp6
-rw-r--r--src/core/module/ModuleManager.h6
-rw-r--r--src/core/typedef/CoreTypedef.h27
-rw-r--r--src/core/typedef/GpgTypedef.h28
-rw-r--r--src/core/utils/CommonUtils.cpp2
-rw-r--r--src/core/utils/GpgUtils.cpp2
-rw-r--r--src/test/core/GpgCoreTestKeyModel.cpp4
-rw-r--r--src/ui/UserInterfaceUtils.cpp4
-rw-r--r--src/ui/dialog/SignersPicker.cpp6
-rw-r--r--src/ui/dialog/SignersPicker.h4
-rw-r--r--src/ui/dialog/import_export/ExportKeyPackageDialog.cpp12
-rw-r--r--src/ui/dialog/import_export/ExportKeyPackageDialog.h6
-rw-r--r--src/ui/dialog/import_export/KeyServerImportDialog.cpp15
-rw-r--r--src/ui/dialog/import_export/KeyServerImportDialog.h6
-rw-r--r--src/ui/dialog/import_export/KeyUploadDialog.cpp6
-rw-r--r--src/ui/dialog/import_export/KeyUploadDialog.h4
-rw-r--r--src/ui/dialog/key_generate/KeygenDialog.h2
-rw-r--r--src/ui/dialog/key_generate/SubkeyGenerateDialog.h4
-rw-r--r--src/ui/dialog/keypair_details/KeyPairOperaTab.cpp3
-rw-r--r--src/ui/dialog/keypair_details/KeyPairSubkeyTab.h6
-rw-r--r--src/ui/dialog/keypair_details/KeyPairUIDTab.cpp13
-rw-r--r--src/ui/dialog/keypair_details/KeyPairUIDTab.h16
-rw-r--r--src/ui/dialog/keypair_details/KeyUIDSignDialog.cpp4
-rw-r--r--src/ui/dialog/settings/SettingsGeneral.h3
-rw-r--r--src/ui/dialog/settings/SettingsKeyServer.cpp3
-rw-r--r--src/ui/main_window/KeyMgmt.cpp40
-rw-r--r--src/ui/main_window/KeyMgmt.h2
-rw-r--r--src/ui/main_window/MainWindowFileSlotFunction.cpp48
-rw-r--r--src/ui/main_window/MainWindowGpgOperaFunction.cpp30
-rw-r--r--src/ui/main_window/MainWindowSlotFunction.cpp52
-rw-r--r--src/ui/thread/KeyServerImportTask.cpp9
-rw-r--r--src/ui/thread/KeyServerImportTask.h6
-rw-r--r--src/ui/thread/ListedKeyServerTestTask.cpp4
-rw-r--r--src/ui/thread/ListedKeyServerTestTask.h12
-rw-r--r--src/ui/widgets/KeyList.cpp50
-rw-r--r--src/ui/widgets/KeyList.h14
-rw-r--r--src/ui/widgets/KeyTable.cpp6
-rw-r--r--src/ui/widgets/KeyTable.h2
-rw-r--r--src/ui/widgets/TextEditTabWidget.cpp2
83 files changed, 405 insertions, 552 deletions
diff --git a/src/core/GpgCoreInit.cpp b/src/core/GpgCoreInit.cpp
index 0659377a..7199bd2d 100644
--- a/src/core/GpgCoreInit.cpp
+++ b/src/core/GpgCoreInit.cpp
@@ -616,7 +616,7 @@ auto InitGpgFrontendCore(CoreInitArgs args) -> int {
continue;
}
- if (!GpgKeyGetter::GetInstance(ctx.GetChannel()).FetchKey()) {
+ if (!GpgKeyGetter::GetInstance(ctx.GetChannel()).FlushKeyCache()) {
FLOG_E() << "gpgme context init key cache failed, index:"
<< channel_index;
continue;
diff --git a/src/core/function/basic/GpgFunctionObject.h b/src/core/function/basic/GpgFunctionObject.h
index 06ad6bfd..41a597e5 100644
--- a/src/core/function/basic/GpgFunctionObject.h
+++ b/src/core/function/basic/GpgFunctionObject.h
@@ -141,11 +141,11 @@ class SingletonFunctionObject : public ChannelObject {
}
/**
- * @brief Get all the channel ids
+ * @brief Get the All Channel Id object
*
- * @return std::vector<int>
+ * @return QContainer<int>
*/
- static auto GetAllChannelId() -> std::vector<int> {
+ static auto GetAllChannelId() -> QContainer<int> {
return SingletonStorageCollection::GetInstance(false)
->GetSingletonStorage(typeid(T))
->GetAllChannelId();
diff --git a/src/core/function/basic/SingletonStorage.cpp b/src/core/function/basic/SingletonStorage.cpp
index e51acd77..be26d0f5 100644
--- a/src/core/function/basic/SingletonStorage.cpp
+++ b/src/core/function/basic/SingletonStorage.cpp
@@ -31,7 +31,8 @@
#include <shared_mutex>
#include "core/function/basic/ChannelObject.h"
-#include "utils/MemoryUtils.h"
+#include "core/typedef/CoreTypedef.h"
+#include "core/utils/MemoryUtils.h"
namespace GpgFrontend {
@@ -60,8 +61,8 @@ class SingletonStorage::Impl {
}
}
- auto GetAllChannelId() -> std::vector<int> {
- std::vector<int> channels;
+ auto GetAllChannelId() -> QContainer<int> {
+ QContainer<int> channels;
channels.reserve(instances_map_.size());
for (const auto& [key, value] : instances_map_) {
channels.push_back(key);
@@ -119,7 +120,7 @@ auto SingletonStorage::FindObjectInChannel(int channel)
return p_->FindObjectInChannel(channel);
}
-auto SingletonStorage::GetAllChannelId() -> std::vector<int> {
+auto SingletonStorage::GetAllChannelId() -> QContainer<int> {
return p_->GetAllChannelId();
}
diff --git a/src/core/function/basic/SingletonStorage.h b/src/core/function/basic/SingletonStorage.h
index 81ae570f..574a16ec 100644
--- a/src/core/function/basic/SingletonStorage.h
+++ b/src/core/function/basic/SingletonStorage.h
@@ -29,6 +29,7 @@
#pragma once
#include "core/function/SecureMemoryAllocator.h"
+#include "core/typedef/GpgTypedef.h"
namespace GpgFrontend {
@@ -66,11 +67,11 @@ class GPGFRONTEND_CORE_EXPORT SingletonStorage {
auto FindObjectInChannel(int channel) -> ChannelObject*;
/**
- * @brief Get all the channel ids
+ * @brief Get the All Channel Id object
*
- * @return std::vector<int>
+ * @return QContainer<int>
*/
- auto GetAllChannelId() -> std::vector<int>;
+ auto GetAllChannelId() -> QContainer<int>;
/**
* @brief Set a new object in channel object
diff --git a/src/core/function/gpg/GpgBasicOperator.cpp b/src/core/function/gpg/GpgBasicOperator.cpp
index 6443f242..661c1283 100644
--- a/src/core/function/gpg/GpgBasicOperator.cpp
+++ b/src/core/function/gpg/GpgBasicOperator.cpp
@@ -50,7 +50,7 @@ void GpgBasicOperator::Encrypt(const KeyArgsList& keys,
[=](const DataObjectPtr& data_object) -> GpgError {
if (keys.empty()) return GPG_ERR_CANCELED;
- std::vector<gpgme_key_t> recipients(keys.begin(), keys.end());
+ QContainer<gpgme_key_t> recipients(keys.begin(), keys.end());
// Last entry data_in array has to be nullptr
recipients.emplace_back(nullptr);
@@ -77,7 +77,7 @@ auto GpgBasicOperator::EncryptSync(const KeyArgsList& keys,
[=](const DataObjectPtr& data_object) -> GpgError {
if (keys.empty()) return GPG_ERR_CANCELED;
- std::vector<gpgme_key_t> recipients(keys.begin(), keys.end());
+ QContainer<gpgme_key_t> recipients(keys.begin(), keys.end());
// Last entry data_in array has to be nullptr
recipients.emplace_back(nullptr);
@@ -329,7 +329,7 @@ void GpgBasicOperator::EncryptSign(const KeyArgsList& keys,
if (keys.empty() || signers.empty()) return GPG_ERR_CANCELED;
GpgError err;
- std::vector<gpgme_key_t> recipients(keys.begin(), keys.end());
+ QContainer<gpgme_key_t> recipients(keys.begin(), keys.end());
// Last entry data_in array has to be nullptr
recipients.emplace_back(nullptr);
@@ -361,7 +361,7 @@ auto GpgBasicOperator::EncryptSignSync(const KeyArgsList& keys,
if (keys.empty() || signers.empty()) return GPG_ERR_CANCELED;
GpgError err;
- std::vector<gpgme_key_t> recipients(keys.begin(), keys.end());
+ QContainer<gpgme_key_t> recipients(keys.begin(), keys.end());
// Last entry data_in array has to be nullptr
recipients.emplace_back(nullptr);
@@ -401,14 +401,14 @@ void GpgBasicOperator::SetSigners(const KeyArgsList& signers, bool ascii) {
}
}
-auto GpgBasicOperator::GetSigners(bool ascii) -> std::unique_ptr<KeyArgsList> {
+auto GpgBasicOperator::GetSigners(bool ascii) -> KeyArgsList {
auto* ctx = ascii ? ctx_.DefaultContext() : ctx_.BinaryContext();
auto count = gpgme_signers_count(ctx);
- auto signers = std::make_unique<std::vector<GpgKey>>();
+ auto signers = KeyArgsList{};
for (auto i = 0U; i < count; i++) {
auto key = GpgKey(gpgme_signers_enum(ctx, i));
- signers->push_back(GpgKey(std::move(key)));
+ signers.push_back(GpgKey(std::move(key)));
}
return signers;
}
diff --git a/src/core/function/gpg/GpgBasicOperator.h b/src/core/function/gpg/GpgBasicOperator.h
index 431ccf1c..990d7af5 100644
--- a/src/core/function/gpg/GpgBasicOperator.h
+++ b/src/core/function/gpg/GpgBasicOperator.h
@@ -226,7 +226,7 @@ class GPGFRONTEND_CORE_EXPORT GpgBasicOperator
*
* @return Intelligent pointer pointing to the private key list
*/
- auto GetSigners(bool ascii) -> std::unique_ptr<KeyArgsList>;
+ auto GetSigners(bool ascii) -> KeyArgsList;
private:
GpgContext& ctx_ = GpgContext::GetInstance(
diff --git a/src/core/function/gpg/GpgCommandExecutor.cpp b/src/core/function/gpg/GpgCommandExecutor.cpp
index 3e218b92..5256de60 100644
--- a/src/core/function/gpg/GpgCommandExecutor.cpp
+++ b/src/core/function/gpg/GpgCommandExecutor.cpp
@@ -45,8 +45,8 @@ auto BuildTaskFromExecCtx(const GpgCommandExecutor::ExecuteContext &context)
Thread::Task::TaskCallback result_callback =
[cmd](int /*rtn*/, const DataObjectPtr &data_object) {
- FLOG_D("data object args count of cmd executor result callback: %ld",
- data_object->GetObjectSize());
+ LOG_D() << "data object args count of cmd executor result callback:"
+ << data_object->GetObjectSize();
if (!data_object->Check<int, QString, GpgCommandExecutorCallback>()) {
FLOG_W("data object checking failed");
diff --git a/src/core/function/gpg/GpgFileOpera.cpp b/src/core/function/gpg/GpgFileOpera.cpp
index 5d29364b..9dea413d 100644
--- a/src/core/function/gpg/GpgFileOpera.cpp
+++ b/src/core/function/gpg/GpgFileOpera.cpp
@@ -50,7 +50,7 @@ void GpgFileOpera::EncryptFile(const KeyArgsList& keys, const QString& in_path,
const GpgOperationCallback& cb) {
RunGpgOperaAsync(
[=](const DataObjectPtr& data_object) -> GpgError {
- std::vector<gpgme_key_t> recipients(keys.begin(), keys.end());
+ QContainer<gpgme_key_t> recipients(keys.begin(), keys.end());
// Last entry data_in array has to be nullptr
recipients.emplace_back(nullptr);
@@ -74,7 +74,7 @@ auto GpgFileOpera::EncryptFileSync(
const QString& out_path) -> std::tuple<GpgError, DataObjectPtr> {
return RunGpgOperaSync(
[=](const DataObjectPtr& data_object) -> GpgError {
- std::vector<gpgme_key_t> recipients(keys.begin(), keys.end());
+ QContainer<gpgme_key_t> recipients(keys.begin(), keys.end());
// Last entry data_in array has to be nullptr
recipients.emplace_back(nullptr);
@@ -102,7 +102,7 @@ void GpgFileOpera::EncryptDirectory(const KeyArgsList& keys,
RunGpgOperaAsync(
[=](const DataObjectPtr& data_object) -> GpgError {
- std::vector<gpgme_key_t> recipients(keys.begin(), keys.end());
+ QContainer<gpgme_key_t> recipients(keys.begin(), keys.end());
// Last entry data_in array has to be nullptr
recipients.emplace_back(nullptr);
@@ -304,7 +304,7 @@ void GpgFileOpera::EncryptSignFile(const KeyArgsList& keys,
RunGpgOperaAsync(
[=](const DataObjectPtr& data_object) -> GpgError {
GpgError err;
- std::vector<gpgme_key_t> recipients(keys.begin(), keys.end());
+ QContainer<gpgme_key_t> recipients(keys.begin(), keys.end());
// Last entry data_in array has to be nullptr
recipients.emplace_back(nullptr);
@@ -336,7 +336,7 @@ auto GpgFileOpera::EncryptSignFileSync(
return RunGpgOperaSync(
[=](const DataObjectPtr& data_object) -> GpgError {
GpgError err;
- std::vector<gpgme_key_t> recipients(keys.begin(), keys.end());
+ QContainer<gpgme_key_t> recipients(keys.begin(), keys.end());
// Last entry data_in array has to be nullptr
recipients.emplace_back(nullptr);
@@ -372,7 +372,7 @@ void GpgFileOpera::EncryptSignDirectory(const KeyArgsList& keys,
RunGpgOperaAsync(
[=](const DataObjectPtr& data_object) -> GpgError {
GpgError err;
- std::vector<gpgme_key_t> recipients(keys.begin(), keys.end());
+ QContainer<gpgme_key_t> recipients(keys.begin(), keys.end());
// Last entry data_in array has to be nullptr
recipients.emplace_back(nullptr);
diff --git a/src/core/function/gpg/GpgKeyGetter.cpp b/src/core/function/gpg/GpgKeyGetter.cpp
index c4526e49..e5b234f8 100644
--- a/src/core/function/gpg/GpgKeyGetter.cpp
+++ b/src/core/function/gpg/GpgKeyGetter.cpp
@@ -73,17 +73,17 @@ class GpgKeyGetter::Impl : public SingletonFunctionObject<GpgKeyGetter::Impl> {
return GpgKey(std::move(p_key));
}
- auto FetchKey() -> KeyLinkListPtr {
+ auto FetchKey() -> GpgKeyList {
if (keys_search_cache_.empty()) {
FlushKeyCache();
}
- auto keys_list = std::make_unique<GpgKeyLinkList>();
+ auto keys_list = GpgKeyList{};
{
// get the lock
std::lock_guard<std::mutex> lock(keys_cache_mutex_);
for (const auto& key : keys_cache_) {
- keys_list->push_back(key);
+ keys_list.push_back(key);
}
}
return keys_list;
@@ -149,25 +149,17 @@ class GpgKeyGetter::Impl : public SingletonFunctionObject<GpgKeyGetter::Impl> {
return true;
}
- auto GetKeys(const KeyIdArgsListPtr& ids) -> KeyListPtr {
- auto keys = std::make_unique<KeyArgsList>();
- for (const auto& key_id : *ids) keys->emplace_back(GetKey(key_id, true));
+ auto GetKeys(const KeyIdArgsList& ids) -> GpgKeyList {
+ auto keys = GpgKeyList{};
+ for (const auto& key_id : ids) keys.emplace_back(GetKey(key_id, true));
return keys;
}
- auto GetKeysCopy(const KeyLinkListPtr& keys) -> KeyLinkListPtr {
- // get the lock
- std::lock_guard<std::mutex> lock(ctx_mutex_);
- auto keys_copy = std::make_unique<GpgKeyLinkList>();
- for (const auto& key : *keys) keys_copy->emplace_back(key);
- return keys_copy;
- }
-
- auto GetKeysCopy(const KeyListPtr& keys) -> KeyListPtr {
+ auto GetKeysCopy(const GpgKeyList& keys) -> GpgKeyList {
// get the lock
std::lock_guard<std::mutex> lock(ctx_mutex_);
- auto keys_copy = std::make_unique<KeyArgsList>();
- for (const auto& key : *keys) keys_copy->emplace_back(key);
+ auto keys_copy = GpgKeyList{};
+ for (const auto& key : keys) keys_copy.emplace_back(key);
return keys_copy;
}
@@ -243,19 +235,15 @@ auto GpgKeyGetter::GetPubkey(const QString& key_id, bool use_cache) -> GpgKey {
auto GpgKeyGetter::FlushKeyCache() -> bool { return p_->FlushKeyCache(); }
-auto GpgKeyGetter::GetKeys(const KeyIdArgsListPtr& ids) -> KeyListPtr {
+auto GpgKeyGetter::GetKeys(const KeyIdArgsList& ids) -> GpgKeyList {
return p_->GetKeys(ids);
}
-auto GpgKeyGetter::GetKeysCopy(const KeyLinkListPtr& keys) -> KeyLinkListPtr {
- return p_->GetKeysCopy(keys);
-}
-
-auto GpgKeyGetter::GetKeysCopy(const KeyListPtr& keys) -> KeyListPtr {
+auto GpgKeyGetter::GetKeysCopy(const GpgKeyList& keys) -> GpgKeyList {
return p_->GetKeysCopy(keys);
}
-auto GpgKeyGetter::FetchKey() -> KeyLinkListPtr { return p_->FetchKey(); }
+auto GpgKeyGetter::FetchKey() -> GpgKeyList { return p_->FetchKey(); }
auto GpgKeyGetter::GetGpgKeyTableModel() -> QSharedPointer<GpgKeyTableModel> {
return p_->GetGpgKeyTableModel();
diff --git a/src/core/function/gpg/GpgKeyGetter.h b/src/core/function/gpg/GpgKeyGetter.h
index f354ff49..2ed34531 100644
--- a/src/core/function/gpg/GpgKeyGetter.h
+++ b/src/core/function/gpg/GpgKeyGetter.h
@@ -68,7 +68,7 @@ class GPGFRONTEND_CORE_EXPORT GpgKeyGetter
* @param ids
* @return KeyListPtr
*/
- auto GetKeys(const KeyIdArgsListPtr& key_ids) -> KeyListPtr;
+ auto GetKeys(const KeyIdArgsList& key_ids) -> GpgKeyList;
/**
* @brief Get the Pubkey object
@@ -83,7 +83,7 @@ class GPGFRONTEND_CORE_EXPORT GpgKeyGetter
*
* @return KeyLinkListPtr
*/
- auto FetchKey() -> KeyLinkListPtr;
+ auto FetchKey() -> GpgKeyList;
/**
* @brief flush the keys in the cache
@@ -97,15 +97,7 @@ class GPGFRONTEND_CORE_EXPORT GpgKeyGetter
* @param keys
* @return KeyListPtr
*/
- auto GetKeysCopy(const KeyListPtr& keys) -> KeyListPtr;
-
- /**
- * @brief Get the Keys Copy object
- *
- * @param keys
- * @return KeyLinkListPtr
- */
- auto GetKeysCopy(const KeyLinkListPtr& keys) -> KeyLinkListPtr;
+ auto GetKeysCopy(const GpgKeyList& keys) -> GpgKeyList;
/**
* @brief
diff --git a/src/core/function/gpg/GpgKeyImportExporter.cpp b/src/core/function/gpg/GpgKeyImportExporter.cpp
index fa1f908f..6c78f760 100644
--- a/src/core/function/gpg/GpgKeyImportExporter.cpp
+++ b/src/core/function/gpg/GpgKeyImportExporter.cpp
@@ -82,7 +82,7 @@ auto GpgKeyImportExporter::ExportKey(const GpgKey& key, bool secret, bool ascii,
if (shortest) mode |= GPGME_EXPORT_MODE_MINIMAL;
if (ssh_mode) mode |= GPGME_EXPORT_MODE_SSH;
- std::vector<gpgme_key_t> keys_array;
+ QContainer<gpgme_key_t> keys_array;
// Last entry data_in array has to be nullptr
keys_array.emplace_back(key);
@@ -114,7 +114,7 @@ void GpgKeyImportExporter::ExportKeys(const KeyArgsList& keys, bool secret,
if (shortest) mode |= GPGME_EXPORT_MODE_MINIMAL;
if (ssh_mode) mode |= GPGME_EXPORT_MODE_SSH;
- std::vector<gpgme_key_t> keys_array(keys.begin(), keys.end());
+ QContainer<gpgme_key_t> keys_array(keys.begin(), keys.end());
// Last entry data_in array has to be nullptr
keys_array.emplace_back(nullptr);
@@ -144,7 +144,7 @@ void GpgKeyImportExporter::ExportAllKeys(const KeyArgsList& keys, bool secret,
if (keys.empty()) return GPG_ERR_CANCELED;
int mode = 0;
- std::vector<gpgme_key_t> keys_array(keys.begin(), keys.end());
+ QContainer<gpgme_key_t> keys_array(keys.begin(), keys.end());
// Last entry data_in array has to be nullptr
keys_array.emplace_back(nullptr);
diff --git a/src/core/function/gpg/GpgKeyManager.cpp b/src/core/function/gpg/GpgKeyManager.cpp
index d0576e59..674a3884 100644
--- a/src/core/function/gpg/GpgKeyManager.cpp
+++ b/src/core/function/gpg/GpgKeyManager.cpp
@@ -61,10 +61,10 @@ auto GpgKeyManager::SignKey(const GpgKey& target, KeyArgsList& keys,
}
auto GpgKeyManager::RevSign(const GpgKey& key,
- const SignIdArgsListPtr& signature_id) -> bool {
+ const SignIdArgsList& signature_id) -> bool {
auto& key_getter = GpgKeyGetter::GetInstance(GetChannel());
- for (const auto& sign_id : *signature_id) {
+ for (const auto& sign_id : signature_id) {
auto signing_key = key_getter.GetKey(sign_id.first);
assert(signing_key.IsGood());
diff --git a/src/core/function/gpg/GpgKeyManager.h b/src/core/function/gpg/GpgKeyManager.h
index 7bd45a1c..817179e1 100644
--- a/src/core/function/gpg/GpgKeyManager.h
+++ b/src/core/function/gpg/GpgKeyManager.h
@@ -68,7 +68,7 @@ class GPGFRONTEND_CORE_EXPORT GpgKeyManager
* @return false
*/
auto RevSign(const GpgFrontend::GpgKey& key,
- const GpgFrontend::SignIdArgsListPtr& signature_id) -> bool;
+ const GpgFrontend::SignIdArgsList& signature_id) -> bool;
/**
* @brief Set the Expire object
diff --git a/src/core/function/gpg/GpgKeyOpera.cpp b/src/core/function/gpg/GpgKeyOpera.cpp
index a5346655..92a969ae 100644
--- a/src/core/function/gpg/GpgKeyOpera.cpp
+++ b/src/core/function/gpg/GpgKeyOpera.cpp
@@ -51,9 +51,9 @@ GpgKeyOpera::GpgKeyOpera(int channel)
* Delete keys
* @param uidList key ids
*/
-void GpgKeyOpera::DeleteKeys(KeyIdArgsListPtr key_ids) {
+void GpgKeyOpera::DeleteKeys(KeyIdArgsList key_ids) {
GpgError err;
- for (const auto& tmp : *key_ids) {
+ for (const auto& tmp : key_ids) {
auto key = GpgKeyGetter::GetInstance(GetChannel()).GetKey(tmp);
if (key.IsGood()) {
err = CheckGpgError(gpgme_op_delete_ext(
@@ -532,8 +532,8 @@ auto GpgKeyOpera::ModifyTOFUPolicy(
}
void GpgKeyOpera::DeleteKey(const KeyId& key_id) {
- auto keys = std::make_unique<KeyIdArgsList>();
- keys->push_back(key_id);
- DeleteKeys(std::move(keys));
+ auto keys = KeyIdArgsList{};
+ keys.push_back(key_id);
+ DeleteKeys(keys);
}
} // namespace GpgFrontend
diff --git a/src/core/function/gpg/GpgKeyOpera.h b/src/core/function/gpg/GpgKeyOpera.h
index 7b8a01a1..0084d473 100644
--- a/src/core/function/gpg/GpgKeyOpera.h
+++ b/src/core/function/gpg/GpgKeyOpera.h
@@ -60,7 +60,7 @@ class GPGFRONTEND_CORE_EXPORT GpgKeyOpera
*
* @param key_ids
*/
- void DeleteKeys(KeyIdArgsListPtr key_ids);
+ void DeleteKeys(KeyIdArgsList key_ids);
/**
* @brief
diff --git a/src/core/model/DataObject.cpp b/src/core/model/DataObject.cpp
index 2819065d..13838941 100644
--- a/src/core/model/DataObject.cpp
+++ b/src/core/model/DataObject.cpp
@@ -28,7 +28,7 @@
#include "DataObject.h"
-#include <stack>
+#include "core/typedef/CoreTypedef.h"
namespace GpgFrontend {
@@ -50,7 +50,7 @@ class DataObject::Impl {
auto GetObjectSize() -> size_t { return params_.size(); }
private:
- std::vector<std::any> params_;
+ QContainer<std::any> params_;
};
DataObject::DataObject() : p_(SecureCreateUniqueObject<Impl>()) {}
diff --git a/src/core/model/DataObject.h b/src/core/model/DataObject.h
index f67cff99..1713e8dd 100644
--- a/src/core/model/DataObject.h
+++ b/src/core/model/DataObject.h
@@ -33,13 +33,11 @@
#include <typeinfo>
#include "core/GpgFrontendCoreExport.h"
+#include "core/typedef/CoreTypedef.h"
#include "core/utils/MemoryUtils.h"
namespace GpgFrontend {
-class DataObject;
-using DataObjectPtr = std::shared_ptr<DataObject>; ///<
-
class GPGFRONTEND_CORE_EXPORT DataObject {
public:
DataObject();
@@ -66,7 +64,7 @@ class GPGFRONTEND_CORE_EXPORT DataObject {
auto Check() -> bool {
if (sizeof...(Args) != GetObjectSize()) return false;
- std::vector<std::type_info const*> type_list = {&typeid(Args)...};
+ QContainer<std::type_info const*> type_list = {&typeid(Args)...};
for (size_t i = 0; i < type_list.size(); ++i) {
if (std::type_index(*type_list[i]) !=
std::type_index((*this)[i].type())) {
diff --git a/src/core/model/GpgDecryptResult.cpp b/src/core/model/GpgDecryptResult.cpp
index 3b6ebd67..82398d96 100644
--- a/src/core/model/GpgDecryptResult.cpp
+++ b/src/core/model/GpgDecryptResult.cpp
@@ -48,8 +48,8 @@ auto GpgDecryptResult::GetRaw() -> gpgme_decrypt_result_t {
return result_ref_.get();
}
-auto GpgDecryptResult::Recipients() -> std::vector<GpgRecipient> {
- std::vector<GpgRecipient> result;
+auto GpgDecryptResult::Recipients() -> QContainer<GpgRecipient> {
+ QContainer<GpgRecipient> result;
for (auto* reci = result_ref_->recipients; reci != nullptr;
reci = reci->next) {
try {
diff --git a/src/core/model/GpgDecryptResult.h b/src/core/model/GpgDecryptResult.h
index 8528adc8..1b755868 100644
--- a/src/core/model/GpgDecryptResult.h
+++ b/src/core/model/GpgDecryptResult.h
@@ -39,7 +39,7 @@ class GPGFRONTEND_CORE_EXPORT GpgDecryptResult {
auto GetRaw() -> gpgme_decrypt_result_t;
- auto Recipients() -> std::vector<GpgRecipient>;
+ auto Recipients() -> QContainer<GpgRecipient>;
explicit GpgDecryptResult(gpgme_decrypt_result_t);
diff --git a/src/core/model/GpgEncryptResult.cpp b/src/core/model/GpgEncryptResult.cpp
index b452b6f3..b5af09b1 100644
--- a/src/core/model/GpgEncryptResult.cpp
+++ b/src/core/model/GpgEncryptResult.cpp
@@ -48,8 +48,8 @@ auto GpgEncryptResult::GetRaw() -> gpgme_encrypt_result_t {
}
auto GpgEncryptResult::InvalidRecipients()
- -> std::vector<std::tuple<QString, GpgError>> {
- std::vector<std::tuple<QString, GpgError>> result;
+ -> QContainer<std::tuple<QString, GpgError>> {
+ QContainer<std::tuple<QString, GpgError>> result;
for (auto* invalid_key = result_ref_->invalid_recipients;
invalid_key != nullptr; invalid_key = invalid_key->next) {
try {
diff --git a/src/core/model/GpgEncryptResult.h b/src/core/model/GpgEncryptResult.h
index a534d156..97a52a03 100644
--- a/src/core/model/GpgEncryptResult.h
+++ b/src/core/model/GpgEncryptResult.h
@@ -38,7 +38,7 @@ class GPGFRONTEND_CORE_EXPORT GpgEncryptResult {
auto GetRaw() -> gpgme_encrypt_result_t;
- auto InvalidRecipients() -> std::vector<std::tuple<QString, GpgError>>;
+ auto InvalidRecipients() -> QContainer<std::tuple<QString, GpgError>>;
explicit GpgEncryptResult(gpgme_encrypt_result_t);
diff --git a/src/core/model/GpgGenKeyInfo.cpp b/src/core/model/GpgGenKeyInfo.cpp
index 1aaa4cea..180a7fab 100644
--- a/src/core/model/GpgGenKeyInfo.cpp
+++ b/src/core/model/GpgGenKeyInfo.cpp
@@ -216,8 +216,8 @@ GenKeyInfo::GenKeyInfo(bool m_is_sub_key) : subkey_(m_is_sub_key) {
}
auto GenKeyInfo::GetSupportedKeyAlgo()
- -> const std::vector<GenKeyInfo::KeyGenAlgo> & {
- static std::vector<GenKeyInfo::KeyGenAlgo> k_support_key_algo = {
+ -> const QContainer<GenKeyInfo::KeyGenAlgo> & {
+ static QContainer<GenKeyInfo::KeyGenAlgo> k_support_key_algo = {
{"RSA", "RSA", ""},
{"DSA", "DSA", ""},
};
@@ -260,8 +260,8 @@ auto GenKeyInfo::GetSupportedKeyAlgo()
}
auto GenKeyInfo::GetSupportedSubkeyAlgo()
- -> const std::vector<GenKeyInfo::KeyGenAlgo> & {
- static std::vector<GenKeyInfo::KeyGenAlgo> k_support_subkey_algo = {
+ -> const QContainer<GenKeyInfo::KeyGenAlgo> & {
+ static QContainer<GenKeyInfo::KeyGenAlgo> k_support_subkey_algo = {
{"RSA", "", "RSA"},
{"DSA", "", "DSA"},
{"ELG-E", "", "ELG"},
diff --git a/src/core/model/GpgGenKeyInfo.h b/src/core/model/GpgGenKeyInfo.h
index 5f6c39a6..4092c8e9 100644
--- a/src/core/model/GpgGenKeyInfo.h
+++ b/src/core/model/GpgGenKeyInfo.h
@@ -29,6 +29,7 @@
#pragma once
#include "core/GpgFrontendCoreExport.h"
+#include "core/typedef/CoreTypedef.h"
namespace GpgFrontend {
@@ -47,16 +48,16 @@ class GPGFRONTEND_CORE_EXPORT GenKeyInfo {
/**
* @brief Get the Supported Key Algo object
*
- * @return const std::vector<QString>&
+ * @return const QContainer<QString>&
*/
- static auto GetSupportedKeyAlgo() -> const std::vector<KeyGenAlgo> &;
+ static auto GetSupportedKeyAlgo() -> const QContainer<KeyGenAlgo> &;
/**
* @brief Get the Supported Subkey Algo object
*
- * @return const std::vector<QString>&
+ * @return const QContainer<QString>&
*/
- static auto GetSupportedSubkeyAlgo() -> const std::vector<KeyGenAlgo> &;
+ static auto GetSupportedSubkeyAlgo() -> const QContainer<KeyGenAlgo> &;
/**
* @brief
diff --git a/src/core/model/GpgKey.cpp b/src/core/model/GpgKey.cpp
index e820d6b9..9b0ce1a5 100644
--- a/src/core/model/GpgKey.cpp
+++ b/src/core/model/GpgKey.cpp
@@ -184,8 +184,8 @@ auto GpgKey::IsHasMasterKey() const -> bool {
return key_ref_->subkeys->secret;
}
-auto GpgKey::GetSubKeys() const -> std::unique_ptr<std::vector<GpgSubKey>> {
- auto p_keys = std::make_unique<std::vector<GpgSubKey>>();
+auto GpgKey::GetSubKeys() const -> std::unique_ptr<QContainer<GpgSubKey>> {
+ auto p_keys = std::make_unique<QContainer<GpgSubKey>>();
auto *next = key_ref_->subkeys;
while (next != nullptr) {
p_keys->push_back(GpgSubKey(next));
@@ -194,8 +194,8 @@ auto GpgKey::GetSubKeys() const -> std::unique_ptr<std::vector<GpgSubKey>> {
return p_keys;
}
-auto GpgKey::GetUIDs() const -> std::unique_ptr<std::vector<GpgUID>> {
- auto p_uids = std::make_unique<std::vector<GpgUID>>();
+auto GpgKey::GetUIDs() const -> std::unique_ptr<QContainer<GpgUID>> {
+ auto p_uids = std::make_unique<QContainer<GpgUID>>();
auto *uid_next = key_ref_->uids;
while (uid_next != nullptr) {
p_uids->push_back(GpgUID(uid_next));
diff --git a/src/core/model/GpgKey.h b/src/core/model/GpgKey.h
index 8afa3c7f..adc2ffa9 100644
--- a/src/core/model/GpgKey.h
+++ b/src/core/model/GpgKey.h
@@ -262,17 +262,17 @@ class GPGFRONTEND_CORE_EXPORT GpgKey {
/**
* @brief
*
- * @return std::unique_ptr<std::vector<GpgSubKey>>
+ * @return std::unique_ptr<QContainer<GpgSubKey>>
*/
[[nodiscard]] auto GetSubKeys() const
- -> std::unique_ptr<std::vector<GpgSubKey>>;
+ -> std::unique_ptr<QContainer<GpgSubKey>>;
/**
* @brief
*
- * @return std::unique_ptr<std::vector<GpgUID>>
+ * @return std::unique_ptr<QContainer<GpgUID>>
*/
- [[nodiscard]] auto GetUIDs() const -> std::unique_ptr<std::vector<GpgUID>>;
+ [[nodiscard]] auto GetUIDs() const -> std::unique_ptr<QContainer<GpgUID>>;
/**
* @brief Construct a new Gpg Key object
diff --git a/src/core/model/GpgKeySignature.cpp b/src/core/model/GpgKeySignature.cpp
index 836e7c7c..b3d9712e 100644
--- a/src/core/model/GpgKeySignature.cpp
+++ b/src/core/model/GpgKeySignature.cpp
@@ -34,47 +34,60 @@ GpgKeySignature::GpgKeySignature() = default;
GpgKeySignature::~GpgKeySignature() = default;
-GpgKeySignature::GpgKeySignature(gpgme_key_sig_t sig)
- : signature_ref_(sig, [&](gpgme_key_sig_t signature) {}) {}
+GpgKeySignature::GpgKeySignature(gpgme_key_sig_t sig) : signature_ref_(sig) {}
-GpgKeySignature::GpgKeySignature(GpgKeySignature &&) noexcept = default;
+GpgKeySignature::GpgKeySignature(const GpgKeySignature &) = default;
+auto GpgKeySignature::operator=(const GpgKeySignature &) -> GpgKeySignature & =
+ default;
-GpgKeySignature &GpgKeySignature::operator=(GpgKeySignature &&) noexcept =
- default;
-
-bool GpgKeySignature::IsRevoked() const { return signature_ref_->revoked; }
+auto GpgKeySignature::IsRevoked() const -> bool {
+ return signature_ref_->revoked;
+}
-bool GpgKeySignature::IsExpired() const { return signature_ref_->expired; }
+auto GpgKeySignature::IsExpired() const -> bool {
+ return signature_ref_->expired;
+}
-bool GpgKeySignature::IsInvalid() const { return signature_ref_->invalid; }
+auto GpgKeySignature::IsInvalid() const -> bool {
+ return signature_ref_->invalid;
+}
-bool GpgKeySignature::IsExportable() const {
+auto GpgKeySignature::IsExportable() const -> bool {
return signature_ref_->exportable;
}
-gpgme_error_t GpgKeySignature::GetStatus() const {
+auto GpgKeySignature::GetStatus() const -> gpgme_error_t {
return signature_ref_->status;
}
-QString GpgKeySignature::GetKeyID() const { return signature_ref_->keyid; }
+auto GpgKeySignature::GetKeyID() const -> QString {
+ return signature_ref_->keyid;
+}
-QString GpgKeySignature::GetPubkeyAlgo() const {
+auto GpgKeySignature::GetPubkeyAlgo() const -> QString {
return gpgme_pubkey_algo_name(signature_ref_->pubkey_algo);
}
-QDateTime GpgKeySignature::GetCreateTime() const {
+auto GpgKeySignature::GetCreateTime() const -> QDateTime {
return QDateTime::fromSecsSinceEpoch(signature_ref_->timestamp);
}
-QDateTime GpgKeySignature::GetExpireTime() const {
+auto GpgKeySignature::GetExpireTime() const -> QDateTime {
return QDateTime::fromSecsSinceEpoch(signature_ref_->expires);
}
-QString GpgKeySignature::GetUID() const { return signature_ref_->uid; }
+auto GpgKeySignature::GetUID() const -> QString { return signature_ref_->uid; }
-QString GpgKeySignature::GetName() const { return signature_ref_->name; }
+auto GpgKeySignature::GetName() const -> QString {
+ return signature_ref_->name;
+}
+
+auto GpgKeySignature::GetEmail() const -> QString {
+ return signature_ref_->email;
+}
-QString GpgKeySignature::GetEmail() const { return signature_ref_->email; }
+auto GpgKeySignature::GetComment() const -> QString {
+ return signature_ref_->comment;
+}
-QString GpgKeySignature::GetComment() const { return signature_ref_->comment; }
} // namespace GpgFrontend \ No newline at end of file
diff --git a/src/core/model/GpgKeySignature.h b/src/core/model/GpgKeySignature.h
index ccff0c9c..5f190fa2 100644
--- a/src/core/model/GpgKeySignature.h
+++ b/src/core/model/GpgKeySignature.h
@@ -160,34 +160,17 @@ class GPGFRONTEND_CORE_EXPORT GpgKeySignature {
* @brief Construct a new Gpg Key Signature object
*
*/
- GpgKeySignature(GpgKeySignature &&) noexcept;
-
- /**
- * @brief Construct a new Gpg Key Signature object
- *
- */
- GpgKeySignature(const GpgKeySignature &) = delete;
-
- /**
- * @brief
- *
- * @return GpgKeySignature&
- */
- auto operator=(GpgKeySignature &&) noexcept -> GpgKeySignature &;
+ GpgKeySignature(const GpgKeySignature &);
/**
* @brief
*
* @return GpgKeySignature&
*/
- auto operator=(const GpgKeySignature &) -> GpgKeySignature & = delete;
+ auto operator=(const GpgKeySignature &) -> GpgKeySignature &;
private:
- using KeySignatrueRefHandler =
- std::unique_ptr<struct _gpgme_key_sig,
- std::function<void(gpgme_key_sig_t)>>; ///<
-
- KeySignatrueRefHandler signature_ref_ = nullptr; ///<
+ gpgme_key_sig_t signature_ref_ = nullptr; ///<
};
} // namespace GpgFrontend
diff --git a/src/core/model/GpgKeyTableModel.cpp b/src/core/model/GpgKeyTableModel.cpp
index 8de07b23..efd7e69d 100644
--- a/src/core/model/GpgKeyTableModel.cpp
+++ b/src/core/model/GpgKeyTableModel.cpp
@@ -157,8 +157,8 @@ auto GpgKeyTableModel::setData(const QModelIndex &index, const QVariant &value,
return false;
}
-auto GpgKeyTableModel::GetAllKeyIds() -> GpgKeyIDList {
- GpgKeyIDList keys;
+auto GpgKeyTableModel::GetAllKeyIds() -> KeyIdArgsList {
+ KeyIdArgsList keys;
for (auto &key : buffered_keys_) {
keys.push_back(key.GetId());
}
diff --git a/src/core/model/GpgKeyTableModel.h b/src/core/model/GpgKeyTableModel.h
index a2c64fd0..cc5704e5 100644
--- a/src/core/model/GpgKeyTableModel.h
+++ b/src/core/model/GpgKeyTableModel.h
@@ -186,7 +186,7 @@ class GPGFRONTEND_CORE_EXPORT GpgKeyTableModel : public QAbstractTableModel {
*
* @return auto
*/
- auto GetAllKeyIds() -> GpgKeyIDList;
+ auto GetAllKeyIds() -> KeyIdArgsList;
/**
* @brief Get the Key ID By Row object
diff --git a/src/core/model/GpgSignResult.cpp b/src/core/model/GpgSignResult.cpp
index 59c402dd..4eb28523 100644
--- a/src/core/model/GpgSignResult.cpp
+++ b/src/core/model/GpgSignResult.cpp
@@ -47,8 +47,8 @@ auto GpgSignResult::GetRaw() -> gpgme_sign_result_t {
}
auto GpgSignResult::InvalidSigners()
- -> std::vector<std::tuple<QString, GpgError>> {
- std::vector<std::tuple<QString, GpgError>> result;
+ -> QContainer<std::tuple<QString, GpgError>> {
+ QContainer<std::tuple<QString, GpgError>> result;
for (auto* invalid_key = result_ref_->invalid_signers; invalid_key != nullptr;
invalid_key = invalid_key->next) {
try {
diff --git a/src/core/model/GpgSignResult.h b/src/core/model/GpgSignResult.h
index 3881c86f..75f106f6 100644
--- a/src/core/model/GpgSignResult.h
+++ b/src/core/model/GpgSignResult.h
@@ -41,7 +41,7 @@ class GPGFRONTEND_CORE_EXPORT GpgSignResult {
auto HashAlgo() -> QString;
- auto InvalidSigners() -> std::vector<std::tuple<QString, GpgError>>;
+ auto InvalidSigners() -> QContainer<std::tuple<QString, GpgError>>;
explicit GpgSignResult(gpgme_sign_result_t);
diff --git a/src/core/model/GpgSignature.cpp b/src/core/model/GpgSignature.cpp
index 139e367c..a4314cdb 100644
--- a/src/core/model/GpgSignature.cpp
+++ b/src/core/model/GpgSignature.cpp
@@ -30,27 +30,15 @@
namespace GpgFrontend {
-/**
- * @brief Construct a new Gpg Signature object
- *
- */
-GpgSignature::GpgSignature(GpgSignature &&) noexcept = default;
+GpgSignature::GpgSignature() = default;
-/**
- * @brief
- *
- * @return GpgSignature&
- */
-auto GpgSignature::operator=(GpgSignature &&) noexcept -> GpgSignature & =
- default;
+GpgSignature::GpgSignature(gpgme_signature_t sig) : signature_ref_(sig) {}
-/**
- * @brief Construct a new Gpg Signature:: Gpg Signature object
- *
- * @param sig
- */
-GpgSignature::GpgSignature(gpgme_signature_t sig)
- : signature_ref_(sig, [&](gpgme_signature_t signature) {}) {}
+GpgSignature::~GpgSignature() = default;
+
+GpgSignature::GpgSignature(const GpgSignature &) = default;
+
+auto GpgSignature::operator=(const GpgSignature &) -> GpgSignature & = default;
/**
* @brief
@@ -124,16 +112,4 @@ auto GpgSignature::GetFingerprint() const -> QString {
return signature_ref_->fpr != nullptr ? signature_ref_->fpr : "";
}
-/**
- * @brief Construct a new Gpg Signature object
- *
- */
-GpgSignature::GpgSignature() = default;
-
-/**
- * @brief Destroy the Gpg Signature object
- *
- */
-GpgSignature::~GpgSignature() = default;
-
} // namespace GpgFrontend
diff --git a/src/core/model/GpgSignature.h b/src/core/model/GpgSignature.h
index ddcc943f..aa977d55 100644
--- a/src/core/model/GpgSignature.h
+++ b/src/core/model/GpgSignature.h
@@ -117,33 +117,16 @@ class GPGFRONTEND_CORE_EXPORT GpgSignature {
* @brief Construct a new Gpg Signature object
*
*/
- GpgSignature(GpgSignature &&) noexcept;
-
- /**
- * @brief Construct a new Gpg Signature object
- *
- */
- GpgSignature(const GpgSignature &) = delete;
-
- /**
- * @brief
- *
- * @return GpgSignature&
- */
- auto operator=(GpgSignature &&) noexcept -> GpgSignature &;
+ GpgSignature(const GpgSignature &);
/**
* @brief
*
* @return GpgSignature&
*/
- auto operator=(const GpgSignature &) -> GpgSignature & = delete;
+ auto operator=(const GpgSignature &) -> GpgSignature &;
private:
- using KeySignatrueRefHandler =
- std::unique_ptr<struct _gpgme_signature,
- std::function<void(gpgme_signature_t)>>; ///<
-
- KeySignatrueRefHandler signature_ref_ = nullptr; ///<
+ gpgme_signature_t signature_ref_ = nullptr; ///<
};
} // namespace GpgFrontend
diff --git a/src/core/model/GpgSubKey.cpp b/src/core/model/GpgSubKey.cpp
index ba2f749c..eba4167e 100644
--- a/src/core/model/GpgSubKey.cpp
+++ b/src/core/model/GpgSubKey.cpp
@@ -31,17 +31,11 @@ namespace GpgFrontend {
GpgSubKey::GpgSubKey() = default;
-GpgSubKey::GpgSubKey(gpgme_subkey_t subkey)
- : subkey_ref_(subkey, [&](gpgme_subkey_t subkey) {}) {}
+GpgSubKey::GpgSubKey(gpgme_subkey_t subkey) : subkey_ref_(subkey) {}
-GpgSubKey::GpgSubKey(GpgSubKey&& o) noexcept {
- swap(subkey_ref_, o.subkey_ref_);
-}
+GpgSubKey::GpgSubKey(const GpgSubKey&) = default;
-auto GpgSubKey::operator=(GpgSubKey&& o) noexcept -> GpgSubKey& {
- swap(subkey_ref_, o.subkey_ref_);
- return *this;
-};
+auto GpgSubKey::operator=(const GpgSubKey&) -> GpgSubKey& = default;
auto GpgSubKey::operator==(const GpgSubKey& o) const -> bool {
return GetFingerprint() == o.GetFingerprint();
@@ -56,7 +50,7 @@ auto GpgSubKey::GetPubkeyAlgo() const -> QString {
}
auto GpgSubKey::GetKeyAlgo() const -> QString {
- auto* buffer = gpgme_pubkey_algo_string(subkey_ref_.get());
+ auto* buffer = gpgme_pubkey_algo_string(subkey_ref_);
auto algo = QString(buffer);
gpgme_free(buffer);
return algo.toUpper();
diff --git a/src/core/model/GpgSubKey.h b/src/core/model/GpgSubKey.h
index e9eea6ea..58c6298a 100644
--- a/src/core/model/GpgSubKey.h
+++ b/src/core/model/GpgSubKey.h
@@ -185,30 +185,15 @@ class GPGFRONTEND_CORE_EXPORT GpgSubKey {
/**
* @brief Construct a new Gpg Sub Key object
*
- * @param o
- */
- GpgSubKey(GpgSubKey&& o) noexcept;
-
- /**
- * @brief Construct a new Gpg Sub Key object
- *
- */
- GpgSubKey(const GpgSubKey&) = delete;
-
- /**
- * @brief
- *
- * @param o
- * @return GpgSubKey&
*/
- auto operator=(GpgSubKey&& o) noexcept -> GpgSubKey&;
+ GpgSubKey(const GpgSubKey&);
/**
* @brief
*
* @return GpgSubKey&
*/
- auto operator=(const GpgSubKey&) -> GpgSubKey& = delete;
+ auto operator=(const GpgSubKey&) -> GpgSubKey&;
/**
* @brief
@@ -220,11 +205,7 @@ class GPGFRONTEND_CORE_EXPORT GpgSubKey {
auto operator==(const GpgSubKey& o) const -> bool;
private:
- using SubkeyRefHandler =
- std::unique_ptr<struct _gpgme_subkey,
- std::function<void(gpgme_subkey_t)>>; ///<
-
- SubkeyRefHandler subkey_ref_ = nullptr; ///<
+ gpgme_subkey_t subkey_ref_ = nullptr; ///<
};
} // namespace GpgFrontend
diff --git a/src/core/model/GpgTOFUInfo.cpp b/src/core/model/GpgTOFUInfo.cpp
index be9320d2..3296f05b 100644
--- a/src/core/model/GpgTOFUInfo.cpp
+++ b/src/core/model/GpgTOFUInfo.cpp
@@ -33,16 +33,11 @@ namespace GpgFrontend {
GpgTOFUInfo::GpgTOFUInfo() = default;
GpgTOFUInfo::GpgTOFUInfo(gpgme_tofu_info_t tofu_info)
- : tofu_info_ref_(tofu_info, [&](gpgme_tofu_info_t tofu_info) {}) {}
+ : tofu_info_ref_(tofu_info) {}
-GpgTOFUInfo::GpgTOFUInfo(GpgTOFUInfo&& o) noexcept {
- swap(tofu_info_ref_, o.tofu_info_ref_);
-}
+GpgTOFUInfo::GpgTOFUInfo(const GpgTOFUInfo&) = default;
-auto GpgTOFUInfo::operator=(GpgTOFUInfo&& o) noexcept -> GpgTOFUInfo& {
- swap(tofu_info_ref_, o.tofu_info_ref_);
- return *this;
-};
+auto GpgTOFUInfo::operator=(const GpgTOFUInfo&) -> GpgTOFUInfo& = default;
auto GpgTOFUInfo::GetValidity() const -> unsigned {
return tofu_info_ref_->validity;
@@ -64,29 +59,14 @@ auto GpgTOFUInfo::GetSignFirst() const -> unsigned long {
return tofu_info_ref_->signfirst;
}
-/**
- * @brief
- *
- * @return unsigned long
- */
auto GpgTOFUInfo::GetSignLast() const -> unsigned long {
return tofu_info_ref_->signlast;
}
-/**
- * @brief
- *
- * @return unsigned long
- */
auto GpgTOFUInfo::GetEncrLast() const -> unsigned long {
return tofu_info_ref_->encrlast;
}
-/**
- * @brief
- *
- * @return QString
- */
auto GpgTOFUInfo::GetDescription() const -> QString {
return tofu_info_ref_->description;
}
diff --git a/src/core/model/GpgTOFUInfo.h b/src/core/model/GpgTOFUInfo.h
index efdf62b2..816680ce 100644
--- a/src/core/model/GpgTOFUInfo.h
+++ b/src/core/model/GpgTOFUInfo.h
@@ -110,37 +110,18 @@ class GPGFRONTEND_CORE_EXPORT GpgTOFUInfo {
/**
* @brief Construct a new Gpg T O F U Info object
*
- * @param o
*/
- GpgTOFUInfo(GpgTOFUInfo&& o) noexcept;
-
- /**
- * @brief Construct a new Gpg T O F U Info object
- *
- */
- GpgTOFUInfo(const GpgTOFUInfo&) = delete;
-
- /**
- * @brief
- *
- * @param o
- * @return GpgTOFUInfo&
- */
- auto operator=(GpgTOFUInfo&& o) noexcept -> GpgTOFUInfo&;
+ GpgTOFUInfo(const GpgTOFUInfo&);
/**
* @brief
*
* @return GpgTOFUInfo&
*/
- auto operator=(const GpgTOFUInfo&) -> GpgTOFUInfo& = delete;
+ auto operator=(const GpgTOFUInfo&) -> GpgTOFUInfo&;
private:
- using SubkeyRefHandler =
- std::unique_ptr<struct _gpgme_tofu_info,
- std::function<void(gpgme_tofu_info_t)>>; ///<
-
- SubkeyRefHandler tofu_info_ref_ = nullptr; ///<
+ gpgme_tofu_info_t tofu_info_ref_ = nullptr; ///<
};
} // namespace GpgFrontend
diff --git a/src/core/model/GpgUID.cpp b/src/core/model/GpgUID.cpp
index c84f2a7f..cd4be820 100644
--- a/src/core/model/GpgUID.cpp
+++ b/src/core/model/GpgUID.cpp
@@ -32,10 +32,11 @@ namespace GpgFrontend {
GpgUID::GpgUID() = default;
-GpgUID::GpgUID(gpgme_user_id_t uid)
- : uid_ref_(uid, [&](gpgme_user_id_t uid) {}) {}
+GpgUID::GpgUID(gpgme_user_id_t uid) : uid_ref_(uid) {}
-GpgUID::GpgUID(GpgUID &&o) noexcept { swap(uid_ref_, o.uid_ref_); }
+GpgUID::GpgUID(const GpgUID &) = default;
+
+auto GpgUID::operator=(const GpgUID &) -> GpgUID & = default;
auto GpgUID::GetName() const -> QString { return uid_ref_->name; }
@@ -49,8 +50,8 @@ auto GpgUID::GetRevoked() const -> bool { return uid_ref_->revoked; }
auto GpgUID::GetInvalid() const -> bool { return uid_ref_->invalid; }
-auto GpgUID::GetTofuInfos() const -> std::unique_ptr<std::vector<GpgTOFUInfo>> {
- auto infos = std::make_unique<std::vector<GpgTOFUInfo>>();
+auto GpgUID::GetTofuInfos() const -> std::unique_ptr<QContainer<GpgTOFUInfo>> {
+ auto infos = std::make_unique<QContainer<GpgTOFUInfo>>();
auto *info_next = uid_ref_->tofu;
while (info_next != nullptr) {
infos->push_back(GpgTOFUInfo(info_next));
@@ -60,8 +61,8 @@ auto GpgUID::GetTofuInfos() const -> std::unique_ptr<std::vector<GpgTOFUInfo>> {
}
auto GpgUID::GetSignatures() const
- -> std::unique_ptr<std::vector<GpgKeySignature>> {
- auto sigs = std::make_unique<std::vector<GpgKeySignature>>();
+ -> std::unique_ptr<QContainer<GpgKeySignature>> {
+ auto sigs = std::make_unique<QContainer<GpgKeySignature>>();
auto *sig_next = uid_ref_->signatures;
while (sig_next != nullptr) {
sigs->push_back(GpgKeySignature(sig_next));
diff --git a/src/core/model/GpgUID.h b/src/core/model/GpgUID.h
index 316b5c68..d8ac47f2 100644
--- a/src/core/model/GpgUID.h
+++ b/src/core/model/GpgUID.h
@@ -85,18 +85,18 @@ class GPGFRONTEND_CORE_EXPORT GpgUID {
/**
* @brief
*
- * @return std::unique_ptr<std::vector<GpgTOFUInfo>>
+ * @return std::unique_ptr<QContainer<GpgTOFUInfo>>
*/
[[nodiscard]] auto GetTofuInfos() const
- -> std::unique_ptr<std::vector<GpgTOFUInfo>>;
+ -> std::unique_ptr<QContainer<GpgTOFUInfo>>;
/**
* @brief
*
- * @return std::unique_ptr<std::vector<GpgKeySignature>>
+ * @return std::unique_ptr<QContainer<GpgKeySignature>>
*/
[[nodiscard]] auto GetSignatures() const
- -> std::unique_ptr<std::vector<GpgKeySignature>>;
+ -> std::unique_ptr<QContainer<GpgKeySignature>>;
/**
* @brief Construct a new Gpg U I D object
@@ -112,39 +112,20 @@ class GPGFRONTEND_CORE_EXPORT GpgUID {
explicit GpgUID(gpgme_user_id_t uid);
/**
- * @brief Construct a new Gpg U I D object
- *
- * @param o
- */
- GpgUID(GpgUID &&o) noexcept;
-
- /**
- * @brief Construct a new Gpg U I D object
- *
- */
- GpgUID(const GpgUID &) = delete;
-
- /**
* @brief
*
- * @param o
- * @return GpgUID&
*/
- auto operator=(GpgUID &&o) noexcept -> GpgUID &;
+ GpgUID(const GpgUID &);
/**
* @brief
*
* @return GpgUID&
*/
- auto operator=(const GpgUID &) -> GpgUID & = delete;
+ auto operator=(const GpgUID &) -> GpgUID &;
private:
- using UidRefHandler =
- std::unique_ptr<struct _gpgme_user_id,
- std::function<void(gpgme_user_id_t)>>; ///<
-
- UidRefHandler uid_ref_ = nullptr; ///<
+ gpgme_user_id_t uid_ref_ = nullptr; ///<
};
} // namespace GpgFrontend
diff --git a/src/core/model/GpgVerifyResult.cpp b/src/core/model/GpgVerifyResult.cpp
index f57900fc..cd232c02 100644
--- a/src/core/model/GpgVerifyResult.cpp
+++ b/src/core/model/GpgVerifyResult.cpp
@@ -49,8 +49,8 @@ auto GpgVerifyResult::GetRaw() const -> gpgme_verify_result_t {
return result_ref_.get();
}
-auto GpgVerifyResult::GetSignature() const -> std::vector<GpgSignature> {
- std::vector<GpgSignature> sigatures;
+auto GpgVerifyResult::GetSignature() const -> QContainer<GpgSignature> {
+ QContainer<GpgSignature> sigatures;
auto* signature = result_ref_->signatures;
while (signature != nullptr) {
diff --git a/src/core/model/GpgVerifyResult.h b/src/core/model/GpgVerifyResult.h
index 95ff10cb..c150d633 100644
--- a/src/core/model/GpgVerifyResult.h
+++ b/src/core/model/GpgVerifyResult.h
@@ -39,7 +39,7 @@ class GPGFRONTEND_CORE_EXPORT GpgVerifyResult {
[[nodiscard]] auto GetRaw() const -> gpgme_verify_result_t;
- [[nodiscard]] auto GetSignature() const -> std::vector<GpgSignature>;
+ [[nodiscard]] auto GetSignature() const -> QContainer<GpgSignature>;
explicit GpgVerifyResult(gpgme_verify_result_t);
diff --git a/src/core/module/Event.h b/src/core/module/Event.h
index 6d3c0106..d37992b7 100644
--- a/src/core/module/Event.h
+++ b/src/core/module/Event.h
@@ -43,7 +43,7 @@ class Event;
using EventReference = std::shared_ptr<Event>;
using EventIdentifier = QString;
using EventTriggerIdentifier = QString;
-using Evnets = std::vector<Event>;
+using Evnets = QContainer<Event>;
class GPGFRONTEND_CORE_EXPORT Event {
public:
diff --git a/src/core/module/GlobalRegisterTable.cpp b/src/core/module/GlobalRegisterTable.cpp
index 0f29a58a..ae0d3ee9 100644
--- a/src/core/module/GlobalRegisterTable.cpp
+++ b/src/core/module/GlobalRegisterTable.cpp
@@ -107,10 +107,10 @@ class GlobalRegisterTable::Impl {
return rtn;
}
- auto ListChildKeys(const Namespace& n, const Key& k) -> std::vector<Key> {
+ auto ListChildKeys(const Namespace& n, const Key& k) -> QContainer<Key> {
QStringList const segments = (n + "." + k).split('.');
- std::vector<Key> rtn;
+ QContainer<Key> rtn;
{
std::shared_lock lock(lock_);
@@ -302,8 +302,7 @@ auto GlobalRegisterTable::ListenPublish(QObject* o, Namespace n, Key k,
return p_->ListenPublish(o, n, k, c);
}
-auto GlobalRegisterTable::ListChildKeys(Namespace n,
- Key k) -> std::vector<Key> {
+auto GlobalRegisterTable::ListChildKeys(Namespace n, Key k) -> QContainer<Key> {
return p_->ListChildKeys(n, k);
}
diff --git a/src/core/module/GlobalRegisterTable.h b/src/core/module/GlobalRegisterTable.h
index 15fab0ce..491f0a87 100644
--- a/src/core/module/GlobalRegisterTable.h
+++ b/src/core/module/GlobalRegisterTable.h
@@ -33,6 +33,7 @@
#include <optional>
#include "core/function/SecureMemoryAllocator.h"
+#include "core/typedef/CoreTypedef.h"
namespace GpgFrontend::Module {
@@ -55,7 +56,7 @@ class GlobalRegisterTable : public QObject {
auto ListenPublish(QObject *, Namespace, Key, LPCallback) -> bool;
- auto ListChildKeys(Namespace n, Key k) -> std::vector<Key>;
+ auto ListChildKeys(Namespace n, Key k) -> QContainer<Key>;
signals:
void SignalPublish(Namespace, Key, int, std::any);
diff --git a/src/core/module/ModuleManager.cpp b/src/core/module/ModuleManager.cpp
index 8f97adc3..d340a561 100644
--- a/src/core/module/ModuleManager.cpp
+++ b/src/core/module/ModuleManager.cpp
@@ -220,7 +220,7 @@ class ModuleManager::Impl {
return grt_->ListenPublish(o, n, k, c);
}
- auto ListRTChildKeys(const QString& n, const QString& k) -> std::vector<Key> {
+ auto ListRTChildKeys(const QString& n, const QString& k) -> QContainer<Key> {
return grt_->ListChildKeys(n, k);
}
@@ -271,7 +271,7 @@ auto ListenRTPublishEvent(QObject* o, Namespace n, Key k,
}
auto ListRTChildKeys(const QString& namespace_,
- const QString& key) -> std::vector<Key> {
+ const QString& key) -> QContainer<Key> {
return ModuleManager::GetInstance().ListRTChildKeys(namespace_, key);
}
@@ -341,7 +341,7 @@ auto ModuleManager::ListenRTPublish(QObject* o, Namespace n, Key k,
}
auto ModuleManager::ListRTChildKeys(const QString& n,
- const QString& k) -> std::vector<Key> {
+ const QString& k) -> QContainer<Key> {
return p_->ListRTChildKeys(n, k);
}
diff --git a/src/core/module/ModuleManager.h b/src/core/module/ModuleManager.h
index 5c703bf3..3ac35b98 100644
--- a/src/core/module/ModuleManager.h
+++ b/src/core/module/ModuleManager.h
@@ -101,7 +101,7 @@ class GPGFRONTEND_CORE_EXPORT ModuleManager
auto ListenRTPublish(QObject*, Namespace, Key, LPCallback) -> bool;
- auto ListRTChildKeys(const QString&, const QString&) -> std::vector<Key>;
+ auto ListRTChildKeys(const QString&, const QString&) -> QContainer<Key>;
auto GRT() -> GlobalRegisterTable*;
@@ -175,10 +175,10 @@ auto GPGFRONTEND_CORE_EXPORT ListenRTPublishEvent(QObject*, Namespace, Key,
*
* @param namespace_
* @param key
- * @return std::vector<Key>
+ * @return QContainer<Key>
*/
auto GPGFRONTEND_CORE_EXPORT ListRTChildKeys(
- const QString& namespace_, const QString& key) -> std::vector<Key>;
+ const QString& namespace_, const QString& key) -> QContainer<Key>;
template <typename T>
auto RetrieveRTValueTyped(const QString& namespace_,
diff --git a/src/core/typedef/CoreTypedef.h b/src/core/typedef/CoreTypedef.h
index 7bc0bc25..7d62cf20 100644
--- a/src/core/typedef/CoreTypedef.h
+++ b/src/core/typedef/CoreTypedef.h
@@ -28,22 +28,25 @@
#pragma once
-#include "core/model/DataObject.h"
-
namespace GpgFrontend {
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
+template <typename T>
+using QContainer = QVector<T>;
+#else
+template <typename T>
+using QContainer = QList<T>;
+#endif
+
using GFError = uint32_t;
-using ByteArray = QByteArray; ///<
-using ByteArrayPtr = std::shared_ptr<ByteArray>; ///<
-using StdBypeArrayPtr = std::shared_ptr<ByteArray>; ///<
-using BypeArrayRef = ByteArray&; ///<
-using ConstBypeArrayRef = const ByteArray&; ///<
-using BypeArrayConstRef = const ByteArray&; ///<
-using StringArgsPtr = std::unique_ptr<std::vector<QString>>; ///<
-using StringArgsRef = std::vector<QString>&; ///<
- ///
- ///
+using ByteArray = QByteArray; ///<
+using BypeArrayRef = ByteArray&; ///<
+using BypeArrayConstRef = const ByteArray&; ///<
+using StringArgsPtr = QStringList; ///<
+using StringArgsRef = QStringList&; ///<
+class DataObject;
+using DataObjectPtr = std::shared_ptr<DataObject>; ///<
using OperaRunnable = std::function<GFError(DataObjectPtr)>;
using OperationCallback = std::function<void(GFError, DataObjectPtr)>;
} // namespace GpgFrontend \ No newline at end of file
diff --git a/src/core/typedef/GpgTypedef.h b/src/core/typedef/GpgTypedef.h
index ecd5dc3f..41da6900 100644
--- a/src/core/typedef/GpgTypedef.h
+++ b/src/core/typedef/GpgTypedef.h
@@ -31,6 +31,7 @@
#include <gpgme.h>
#include "core/model/DataObject.h"
+#include "core/typedef/CoreTypedef.h"
namespace GpgFrontend {
@@ -41,25 +42,16 @@ class GpgTOFUInfo;
using GpgError = gpgme_error_t; ///< gpgme error
using GpgErrorCode = gpg_err_code_t;
-using GpgErrorDesc = std::pair<QString, QString>;
+using GpgErrorDesc = QPair<QString, QString>;
-using KeyId = QString; ///<
-using SubkeyId = QString; ///<
-using KeyIdArgsList = std::vector<KeyId>; ///<
-using KeyIdArgsListPtr = std::unique_ptr<KeyIdArgsList>; ///<
-using UIDArgsList = std::vector<QString>; ///<
-using UIDArgsListPtr = std::unique_ptr<UIDArgsList>; ///<
-using SignIdArgsList = std::vector<std::pair<QString, QString>>; ///<
-using SignIdArgsListPtr = std::unique_ptr<SignIdArgsList>; ///<
-using KeyFprArgsListPtr = std::unique_ptr<std::vector<QString>>; ///<
-using KeyArgsList = std::vector<GpgKey>; ///<
-using KeyListPtr = std::shared_ptr<KeyArgsList>; ///<
-using GpgKeyLinkList = std::list<GpgKey>; ///<
-using KeyLinkListPtr = std::unique_ptr<GpgKeyLinkList>; ///<
-using KeyPtr = std::unique_ptr<GpgKey>; ///<
-using KeyPtrArgsList = const std::initializer_list<KeyPtr>; ///<
-using GpgKeyList = QList<GpgKey>; ///<
-using GpgKeyIDList = QList<QString>; ///<
+using KeyId = QString;
+using SubkeyId = QString;
+using KeyIdArgsList = QStringList; ///<
+using UIDArgsList = QContainer<QString>; ///<
+using SignIdArgsList = QContainer<QPair<QString, QString>>; ///<
+using KeyArgsList = QContainer<GpgKey>; ///<
+using GpgKeyLinkList = QContainer<GpgKey>; ///<
+using GpgKeyList = QContainer<GpgKey>; ///<
using GpgSignMode = gpgme_sig_mode_t;
diff --git a/src/core/utils/CommonUtils.cpp b/src/core/utils/CommonUtils.cpp
index 60ce4642..526f5856 100644
--- a/src/core/utils/CommonUtils.cpp
+++ b/src/core/utils/CommonUtils.cpp
@@ -28,6 +28,8 @@
#include "CommonUtils.h"
+#include "core/utils/MemoryUtils.h"
+
namespace GpgFrontend {
auto BeautifyFingerprint(QString fingerprint) -> QString {
diff --git a/src/core/utils/GpgUtils.cpp b/src/core/utils/GpgUtils.cpp
index 29b150bd..dfedd098 100644
--- a/src/core/utils/GpgUtils.cpp
+++ b/src/core/utils/GpgUtils.cpp
@@ -36,7 +36,7 @@ namespace GpgFrontend {
inline auto Trim(QString& s) -> QString { return s.trimmed(); }
auto GetGpgmeErrorString(size_t buffer_size, gpgme_error_t err) -> QString {
- std::vector<char> buffer(buffer_size);
+ QContainer<char> buffer(buffer_size);
gpgme_error_t const ret = gpgme_strerror_r(err, buffer.data(), buffer.size());
if (ret == ERANGE && buffer_size < 1024) {
diff --git a/src/test/core/GpgCoreTestKeyModel.cpp b/src/test/core/GpgCoreTestKeyModel.cpp
index 5d72956f..f5078845 100644
--- a/src/test/core/GpgCoreTestKeyModel.cpp
+++ b/src/test/core/GpgCoreTestKeyModel.cpp
@@ -189,8 +189,8 @@ TEST_F(GpgCoreTest, GpgKeyGetterTest) {
ASSERT_TRUE(key.IsGood());
auto keys = GpgKeyGetter::GetInstance(kGpgFrontendDefaultChannel).FetchKey();
- EXPECT_GT(keys->size(), 0);
- ASSERT_TRUE(find(keys->begin(), keys->end(), key) != keys->end());
+ EXPECT_GT(keys.size(), 0);
+ ASSERT_TRUE(std::find(keys.begin(), keys.end(), key) != keys.end());
}
} // namespace GpgFrontend::Test \ No newline at end of file
diff --git a/src/ui/UserInterfaceUtils.cpp b/src/ui/UserInterfaceUtils.cpp
index d8c0059b..33d72d8d 100644
--- a/src/ui/UserInterfaceUtils.cpp
+++ b/src/ui/UserInterfaceUtils.cpp
@@ -80,10 +80,10 @@ void ImportUnknownKeyFromKeyserver(
QMessageBox::Yes | QMessageBox::No);
if (reply == QMessageBox::Yes) {
auto dialog = KeyServerImportDialog(channel, parent);
- auto key_ids = std::make_unique<KeyIdArgsList>();
+ auto key_ids = KeyIdArgsList{};
auto *signature = verify_result.GetSignatures();
while (signature != nullptr) {
- key_ids->push_back(signature->fpr);
+ key_ids.push_back(signature->fpr);
signature = signature->next;
}
dialog.show();
diff --git a/src/ui/dialog/SignersPicker.cpp b/src/ui/dialog/SignersPicker.cpp
index dcd23a6b..21996f5b 100644
--- a/src/ui/dialog/SignersPicker.cpp
+++ b/src/ui/dialog/SignersPicker.cpp
@@ -78,15 +78,15 @@ SignersPicker::SignersPicker(int channel, QWidget* parent)
this->show();
}
-auto SignersPicker::GetCheckedSigners() -> GpgFrontend::KeyIdArgsListPtr {
+auto SignersPicker::GetCheckedSigners() -> GpgFrontend::KeyIdArgsList {
return key_list_->GetCheckedPrivateKey();
}
-auto SignersPicker::GetCheckedSignerKeyIds() -> QStringList {
+auto SignersPicker::GetCheckedSignerKeyIds() -> GpgFrontend::KeyIdArgsList {
auto priv_keys = key_list_->GetCheckedPrivateKey();
QStringList r;
- for (const auto& priv_key : *priv_keys) {
+ for (const auto& priv_key : priv_keys) {
r.append(priv_key);
}
return r;
diff --git a/src/ui/dialog/SignersPicker.h b/src/ui/dialog/SignersPicker.h
index accf6952..826ccfab 100644
--- a/src/ui/dialog/SignersPicker.h
+++ b/src/ui/dialog/SignersPicker.h
@@ -56,14 +56,14 @@ class SignersPicker : public GeneralDialog {
*
* @return GpgFrontend::KeyIdArgsListPtr
*/
- auto GetCheckedSigners() -> KeyIdArgsListPtr;
+ auto GetCheckedSigners() -> KeyIdArgsList;
/**
* @brief Get the Checked Signer Key Ids object
*
* @return QStringList
*/
- auto GetCheckedSignerKeyIds() -> QStringList;
+ auto GetCheckedSignerKeyIds() -> KeyIdArgsList;
/**
*
* @return
diff --git a/src/ui/dialog/import_export/ExportKeyPackageDialog.cpp b/src/ui/dialog/import_export/ExportKeyPackageDialog.cpp
index 762c79b7..5e6267da 100644
--- a/src/ui/dialog/import_export/ExportKeyPackageDialog.cpp
+++ b/src/ui/dialog/import_export/ExportKeyPackageDialog.cpp
@@ -35,7 +35,7 @@
#include "ui_ExportKeyPackageDialog.h"
GpgFrontend::UI::ExportKeyPackageDialog::ExportKeyPackageDialog(
- int channel, KeyIdArgsListPtr key_ids, QWidget* parent)
+ int channel, KeyIdArgsList key_ids, QWidget* parent)
: GeneralDialog(typeid(ExportKeyPackageDialog).name(), parent),
ui_(GpgFrontend::SecureCreateSharedObject<Ui_exportKeyPackageDialog>()),
current_gpg_context_channel_(channel),
@@ -98,16 +98,16 @@ GpgFrontend::UI::ExportKeyPackageDialog::ExportKeyPackageDialog(
// get suitable key ids
auto keys = GpgKeyGetter::GetInstance(current_gpg_context_channel_)
.GetKeys(key_ids_);
- assert(std::all_of(keys->begin(), keys->end(),
+ assert(std::all_of(keys.begin(), keys.end(),
[](const auto& key) { return key.IsGood(); }));
auto keys_new_end =
- std::remove_if(keys->begin(), keys->end(), [this](const auto& key) {
+ std::remove_if(keys.begin(), keys.end(), [this](const auto& key) {
return ui_->noPublicKeyCheckBox->isChecked() && !key.IsPrivateKey();
});
- keys->erase(keys_new_end, keys->end());
+ keys.erase(keys_new_end, keys.end());
- if (keys->empty()) {
+ if (keys.empty()) {
QMessageBox::critical(this, tr("Error"),
tr("No key is suitable to export."));
return;
@@ -117,7 +117,7 @@ GpgFrontend::UI::ExportKeyPackageDialog::ExportKeyPackageDialog(
this, tr("Generating"), [this, keys](const OperaWaitingHd& op_hd) {
KeyPackageOperator::GenerateKeyPackage(
ui_->outputPathLabel->text(), ui_->nameValueLabel->text(),
- current_gpg_context_channel_, *keys, passphrase_,
+ current_gpg_context_channel_, keys, passphrase_,
ui_->includeSecretKeyCheckBox->isChecked(),
[=](GFError err, const DataObjectPtr&) {
// stop waiting
diff --git a/src/ui/dialog/import_export/ExportKeyPackageDialog.h b/src/ui/dialog/import_export/ExportKeyPackageDialog.h
index bf8e92a6..07722a21 100644
--- a/src/ui/dialog/import_export/ExportKeyPackageDialog.h
+++ b/src/ui/dialog/import_export/ExportKeyPackageDialog.h
@@ -50,13 +50,13 @@ class ExportKeyPackageDialog : public GeneralDialog {
* @param key_ids
* @param parent
*/
- explicit ExportKeyPackageDialog(int channel, KeyIdArgsListPtr key_ids,
+ explicit ExportKeyPackageDialog(int channel, KeyIdArgsList key_ids,
QWidget* parent);
private:
std::shared_ptr<Ui_exportKeyPackageDialog> ui_; ///<
int current_gpg_context_channel_;
- KeyIdArgsListPtr key_ids_; ///<
- QString passphrase_; ///<
+ KeyIdArgsList key_ids_; ///<
+ QString passphrase_; ///<
};
} // namespace GpgFrontend::UI
diff --git a/src/ui/dialog/import_export/KeyServerImportDialog.cpp b/src/ui/dialog/import_export/KeyServerImportDialog.cpp
index e81cc2e8..c15df158 100644
--- a/src/ui/dialog/import_export/KeyServerImportDialog.cpp
+++ b/src/ui/dialog/import_export/KeyServerImportDialog.cpp
@@ -360,7 +360,7 @@ void KeyServerImportDialog::slot_search_finished(
}
void KeyServerImportDialog::slot_import() {
- std::vector<QString> key_ids;
+ KeyIdArgsList key_ids;
const int row_count = keys_table_->rowCount();
for (int i = 0; i < row_count; ++i) {
if (keys_table_->item(i, 2)->isSelected()) {
@@ -377,7 +377,7 @@ void KeyServerImportDialog::slot_import() {
}
}
-void KeyServerImportDialog::SlotImport(const KeyIdArgsListPtr& keys) {
+void KeyServerImportDialog::SlotImport(const KeyIdArgsList& keys) {
// keyserver host url
QString target_keyserver;
@@ -388,18 +388,17 @@ void KeyServerImportDialog::SlotImport(const KeyIdArgsListPtr& keys) {
KeyServerSO key_server(SettingsObject("key_server"));
target_keyserver = key_server.GetTargetServer();
}
- std::vector<QString> key_ids;
- for (const auto& key_id : *keys) {
+ KeyIdArgsList key_ids;
+ for (const auto& key_id : keys) {
key_ids.push_back(key_id);
}
SlotImport(key_ids, target_keyserver);
}
-void KeyServerImportDialog::SlotImport(std::vector<QString> key_ids,
+void KeyServerImportDialog::SlotImport(QStringList key_ids,
QString keyserver_url) {
- auto* task =
- new KeyServerImportTask(std::move(keyserver_url),
- current_gpg_context_channel_, std::move(key_ids));
+ auto* task = new KeyServerImportTask(keyserver_url,
+ current_gpg_context_channel_, key_ids);
connect(task, &KeyServerImportTask::SignalKeyServerImportResult, this,
&KeyServerImportDialog::slot_import_finished);
diff --git a/src/ui/dialog/import_export/KeyServerImportDialog.h b/src/ui/dialog/import_export/KeyServerImportDialog.h
index e4ee2367..25c55c3e 100644
--- a/src/ui/dialog/import_export/KeyServerImportDialog.h
+++ b/src/ui/dialog/import_export/KeyServerImportDialog.h
@@ -59,7 +59,7 @@ class KeyServerImportDialog : public GeneralDialog {
*
* @param keys
*/
- void SlotImport(const KeyIdArgsListPtr& keys);
+ void SlotImport(const KeyIdArgsList& keys);
/**
* @brief
@@ -67,7 +67,7 @@ class KeyServerImportDialog : public GeneralDialog {
* @param keyIds
* @param keyserverUrl
*/
- void SlotImport(std::vector<QString> key_ids_list, QString keyserver_url);
+ void SlotImport(KeyIdArgsList key_ids_list, QString keyserver_url);
signals:
@@ -127,7 +127,7 @@ class KeyServerImportDialog : public GeneralDialog {
*
* @param in_data
*/
- void import_keys(ByteArrayPtr in_data);
+ void import_keys(ByteArray in_data);
/**
* @brief Set the loading object
diff --git a/src/ui/dialog/import_export/KeyUploadDialog.cpp b/src/ui/dialog/import_export/KeyUploadDialog.cpp
index 9a02ea0e..efa72802 100644
--- a/src/ui/dialog/import_export/KeyUploadDialog.cpp
+++ b/src/ui/dialog/import_export/KeyUploadDialog.cpp
@@ -41,13 +41,13 @@
namespace GpgFrontend::UI {
-KeyUploadDialog::KeyUploadDialog(int channel, const KeyIdArgsListPtr& keys_ids,
+KeyUploadDialog::KeyUploadDialog(int channel, const KeyIdArgsList& keys_ids,
QWidget* parent)
: GeneralDialog(typeid(KeyUploadDialog).name(), parent),
current_gpg_context_channel_(channel),
m_keys_(GpgKeyGetter::GetInstance(current_gpg_context_channel_)
.GetKeys(keys_ids)) {
- assert(std::all_of(m_keys_->begin(), m_keys_->end(),
+ assert(std::all_of(m_keys_.begin(), m_keys_.end(),
[](const auto& key) { return key.IsGood(); }));
auto* pb = new QProgressBar();
@@ -70,7 +70,7 @@ KeyUploadDialog::KeyUploadDialog(int channel, const KeyIdArgsListPtr& keys_ids,
void KeyUploadDialog::SlotUpload() {
GpgKeyImportExporter::GetInstance(current_gpg_context_channel_)
- .ExportKeys(*m_keys_, false, true, false, false,
+ .ExportKeys(m_keys_, false, true, false, false,
[=](GpgError err, const DataObjectPtr& data_obj) {
if (CheckGpgError(err) != GPG_ERR_NO_ERROR) {
CommonUtils::RaiseMessageBox(this, err);
diff --git a/src/ui/dialog/import_export/KeyUploadDialog.h b/src/ui/dialog/import_export/KeyUploadDialog.h
index 3085ba0a..36616037 100644
--- a/src/ui/dialog/import_export/KeyUploadDialog.h
+++ b/src/ui/dialog/import_export/KeyUploadDialog.h
@@ -48,7 +48,7 @@ class KeyUploadDialog : public GeneralDialog {
* @param keys_ids
* @param parent
*/
- explicit KeyUploadDialog(int channel, const KeyIdArgsListPtr& keys_ids,
+ explicit KeyUploadDialog(int channel, const KeyIdArgsList& keys_ids,
QWidget* parent);
public slots:
@@ -76,7 +76,7 @@ class KeyUploadDialog : public GeneralDialog {
private:
int current_gpg_context_channel_;
- KeyListPtr m_keys_; ///<
+ GpgKeyList m_keys_; ///<
QByteArray m_key_data_; ///<
};
diff --git a/src/ui/dialog/key_generate/KeygenDialog.h b/src/ui/dialog/key_generate/KeygenDialog.h
index 8b9757d5..dbb5048e 100644
--- a/src/ui/dialog/key_generate/KeygenDialog.h
+++ b/src/ui/dialog/key_generate/KeygenDialog.h
@@ -107,7 +107,7 @@ class KeyGenDialog : public GeneralDialog {
QGroupBox* key_usage_group_box_{}; ///< Group of Widgets detecting the usage
///< of the Key
QDateTime max_date_time_; ///<
- std::vector<QCheckBox*> key_usage_check_boxes_; ///< ENCR, SIGN, CERT, AUTH
+ QContainer<QCheckBox*> key_usage_check_boxes_; ///< ENCR, SIGN, CERT, AUTH
QComboBox* gpg_contexts_combo_box_{};
int default_gpg_context_channel_;
diff --git a/src/ui/dialog/key_generate/SubkeyGenerateDialog.h b/src/ui/dialog/key_generate/SubkeyGenerateDialog.h
index f0a4fed6..fc3c51c9 100644
--- a/src/ui/dialog/key_generate/SubkeyGenerateDialog.h
+++ b/src/ui/dialog/key_generate/SubkeyGenerateDialog.h
@@ -72,8 +72,8 @@ class SubkeyGenerateDialog : public GeneralDialog {
QCheckBox* expire_check_box_{}; ///< Checkbox, if key should expire
QCheckBox* no_pass_phrase_check_box_{}; ///< Checkbox, if key should expire
- std::vector<QCheckBox*> key_usage_check_boxes_; ///< ENCR, SIGN, CERT, AUTH
- QDateTime max_date_time_; ///<
+ QContainer<QCheckBox*> key_usage_check_boxes_; ///< ENCR, SIGN, CERT, AUTH
+ QDateTime max_date_time_; ///<
/**
* @brief Create a key usage group box object
diff --git a/src/ui/dialog/keypair_details/KeyPairOperaTab.cpp b/src/ui/dialog/keypair_details/KeyPairOperaTab.cpp
index 56103d62..35352bbd 100644
--- a/src/ui/dialog/keypair_details/KeyPairOperaTab.cpp
+++ b/src/ui/dialog/keypair_details/KeyPairOperaTab.cpp
@@ -436,8 +436,7 @@ void KeyPairOperaTab::slot_publish_key_to_server() {
return;
}
- auto keys = std::make_unique<KeyIdArgsList>();
- keys->push_back(m_key_.GetId());
+ auto keys = KeyIdArgsList{m_key_.GetId()};
auto* dialog = new KeyUploadDialog(current_gpg_context_channel_, keys, this);
dialog->show();
dialog->SlotUpload();
diff --git a/src/ui/dialog/keypair_details/KeyPairSubkeyTab.h b/src/ui/dialog/keypair_details/KeyPairSubkeyTab.h
index 9c8daeb9..b4aa9a00 100644
--- a/src/ui/dialog/keypair_details/KeyPairSubkeyTab.h
+++ b/src/ui/dialog/keypair_details/KeyPairSubkeyTab.h
@@ -68,9 +68,9 @@ class KeyPairSubkeyTab : public QWidget {
const GpgSubKey& get_selected_subkey();
int current_gpg_context_channel_;
- GpgKey key_; ///<
- QTableWidget* subkey_list_{}; ///<
- std::vector<GpgSubKey> buffered_subkeys_; ///<
+ GpgKey key_; ///<
+ QTableWidget* subkey_list_{}; ///<
+ QContainer<GpgSubKey> buffered_subkeys_; ///<
QGroupBox* list_box_; ///<
QGroupBox* detail_box_; ///<
diff --git a/src/ui/dialog/keypair_details/KeyPairUIDTab.cpp b/src/ui/dialog/keypair_details/KeyPairUIDTab.cpp
index 9fc13690..1d1231c7 100644
--- a/src/ui/dialog/keypair_details/KeyPairUIDTab.cpp
+++ b/src/ui/dialog/keypair_details/KeyPairUIDTab.cpp
@@ -408,12 +408,12 @@ void KeyPairUIDTab::slot_set_primary_uid() {
}
}
-auto KeyPairUIDTab::get_sign_selected() -> SignIdArgsListPtr {
- auto signatures = std::make_unique<SignIdArgsList>();
+auto KeyPairUIDTab::get_sign_selected() -> SignIdArgsList {
+ auto signatures = SignIdArgsList{};
for (int i = 0; i < sig_list_->rowCount(); i++) {
if (sig_list_->item(i, 0)->isSelected()) {
auto& sign = buffered_signatures_[i];
- signatures->push_back({sign.GetKeyID(), sign.GetUID()});
+ signatures.push_back({sign.GetKeyID(), sign.GetUID()});
}
}
return signatures;
@@ -476,7 +476,7 @@ void KeyPairUIDTab::create_sign_popup_menu() {
void KeyPairUIDTab::slot_del_sign() {
auto selected_signs = get_sign_selected();
- if (selected_signs->empty()) {
+ if (selected_signs.empty()) {
QMessageBox::information(
nullptr, tr("Invalid Operation"),
tr("Please select one Key Signature before doing this operation."));
@@ -484,7 +484,7 @@ void KeyPairUIDTab::slot_del_sign() {
}
if (!GpgKeyGetter::GetInstance(current_gpg_context_channel_)
- .GetKey(selected_signs->front().first)
+ .GetKey(selected_signs.front().first)
.IsGood()) {
QMessageBox::critical(
nullptr, tr("Invalid Operation"),
@@ -495,7 +495,7 @@ void KeyPairUIDTab::slot_del_sign() {
QString keynames;
- keynames.append(selected_signs->front().second);
+ keynames.append(selected_signs.front().second);
keynames.append("<br/>");
int ret = QMessageBox::warning(this, tr("Deleting Key Signature"),
@@ -514,6 +514,7 @@ void KeyPairUIDTab::slot_del_sign() {
}
}
}
+
void KeyPairUIDTab::slot_refresh_key() {
// refresh the key
GpgKey refreshed_key = GpgKeyGetter::GetInstance(current_gpg_context_channel_)
diff --git a/src/ui/dialog/keypair_details/KeyPairUIDTab.h b/src/ui/dialog/keypair_details/KeyPairUIDTab.h
index d97ea2d8..3f98e54b 100644
--- a/src/ui/dialog/keypair_details/KeyPairUIDTab.h
+++ b/src/ui/dialog/keypair_details/KeyPairUIDTab.h
@@ -139,13 +139,13 @@ class KeyPairUIDTab : public QWidget {
private:
int current_gpg_context_channel_;
GpgKey m_key_;
- QTableWidget* uid_list_{}; ///<
- QTableWidget* sig_list_{}; ///<
- QTabWidget* tofu_tabs_{}; ///<
- QMenu* uid_popup_menu_{}; ///<
- QMenu* sign_popup_menu_{}; ///<
- std::vector<GpgUID> buffered_uids_; ///<
- std::vector<GpgKeySignature> buffered_signatures_; ///<
+ QTableWidget* uid_list_{}; ///<
+ QTableWidget* sig_list_{}; ///<
+ QTabWidget* tofu_tabs_{}; ///<
+ QMenu* uid_popup_menu_{}; ///<
+ QMenu* sign_popup_menu_{}; ///<
+ QContainer<GpgUID> buffered_uids_; ///<
+ QContainer<GpgKeySignature> buffered_signatures_; ///<
QAction* set_primary_uid_act_;
QAction* sign_uid_act_;
@@ -181,7 +181,7 @@ class KeyPairUIDTab : public QWidget {
*
* @return SignIdArgsListPtr
*/
- auto get_sign_selected() -> SignIdArgsListPtr;
+ auto get_sign_selected() -> SignIdArgsList;
/**
* @brief Get the sign selected object
diff --git a/src/ui/dialog/keypair_details/KeyUIDSignDialog.cpp b/src/ui/dialog/keypair_details/KeyUIDSignDialog.cpp
index e079e683..35f4e57f 100644
--- a/src/ui/dialog/keypair_details/KeyUIDSignDialog.cpp
+++ b/src/ui/dialog/keypair_details/KeyUIDSignDialog.cpp
@@ -108,14 +108,14 @@ void KeyUIDSignDialog::slot_sign_key(bool clicked) {
auto key_ids = m_key_list_->GetChecked();
auto keys =
GpgKeyGetter::GetInstance(current_gpg_context_channel_).GetKeys(key_ids);
- assert(std::all_of(keys->begin(), keys->end(),
+ assert(std::all_of(keys.begin(), keys.end(),
[](const auto& key) { return key.IsGood(); }));
auto expires = std::make_unique<QDateTime>(expires_edit_->dateTime());
// Sign For mKey
if (!GpgKeyManager::GetInstance(current_gpg_context_channel_)
- .SignKey(m_key_, *keys, m_uid_, expires)) {
+ .SignKey(m_key_, keys, m_uid_, expires)) {
QMessageBox::critical(
nullptr, tr("Unsuccessful Operation"),
tr("Signature operation failed for UID %1").arg(m_uid_));
diff --git a/src/ui/dialog/settings/SettingsGeneral.h b/src/ui/dialog/settings/SettingsGeneral.h
index 6dc35d58..0739f466 100644
--- a/src/ui/dialog/settings/SettingsGeneral.h
+++ b/src/ui/dialog/settings/SettingsGeneral.h
@@ -28,6 +28,7 @@
#pragma once
+#include "core/typedef/CoreTypedef.h"
#include "ui/GpgFrontendUI.h"
class Ui_GeneralSettings;
@@ -81,7 +82,7 @@ class GeneralTab : public QWidget {
private:
std::shared_ptr<Ui_GeneralSettings> ui_; ///<
QHash<QString, QString> lang_; ///<
- std::vector<QString> key_ids_list_; ///<
+ QContainer<QString> key_ids_list_; ///<
KeyList* m_key_list_{}; ///<
};
} // namespace GpgFrontend::UI
diff --git a/src/ui/dialog/settings/SettingsKeyServer.cpp b/src/ui/dialog/settings/SettingsKeyServer.cpp
index 38256c8e..e73363d6 100644
--- a/src/ui/dialog/settings/SettingsKeyServer.cpp
+++ b/src/ui/dialog/settings/SettingsKeyServer.cpp
@@ -233,8 +233,7 @@ void KeyserverTab::slot_test_listed_key_server() {
task,
&GpgFrontend::UI::ListedKeyServerTestTask::SignalKeyServerListTestResult,
this,
- [=](std::vector<ListedKeyServerTestTask::KeyServerTestResultType>
- result) {
+ [=](QContainer<ListedKeyServerTestTask::KeyServerTestResultType> result) {
const size_t row_size = ui_->keyServerListTable->rowCount();
if (result.size() != row_size) return;
ui_->keyServerListTable->blockSignals(true);
diff --git a/src/ui/main_window/KeyMgmt.cpp b/src/ui/main_window/KeyMgmt.cpp
index d6530c64..6c0cea0c 100644
--- a/src/ui/main_window/KeyMgmt.cpp
+++ b/src/ui/main_window/KeyMgmt.cpp
@@ -253,11 +253,11 @@ void KeyMgmt::create_actions() {
set_owner_trust_of_key_act_->setData(QVariant("set_owner_trust_level"));
connect(set_owner_trust_of_key_act_, &QAction::triggered, this, [this]() {
auto keys_selected = key_list_->GetSelected();
- if (keys_selected->empty()) return;
+ if (keys_selected.empty()) return;
auto* function = new SetOwnerTrustLevel(this);
function->Exec(key_list_->GetCurrentGpgContextChannel(),
- keys_selected->front());
+ keys_selected.front());
function->deleteLater();
});
}
@@ -324,15 +324,15 @@ void KeyMgmt::SlotDeleteCheckedKeys() {
delete_keys_with_warning(key_list_->GetChecked());
}
-void KeyMgmt::delete_keys_with_warning(KeyIdArgsListPtr uidList) {
+void KeyMgmt::delete_keys_with_warning(KeyIdArgsList uid_list) {
/**
* TODO: Different Messages for private/public key, check if
* more than one selected... compare to seahorse "delete-dialog"
*/
- if (uidList->empty()) return;
+ if (uid_list.empty()) return;
QString keynames;
- for (const auto& key_id : *uidList) {
+ for (const auto& key_id : uid_list) {
auto key =
GpgKeyGetter::GetInstance(key_list_->GetCurrentGpgContextChannel())
.GetKey(key_id);
@@ -352,17 +352,17 @@ void KeyMgmt::delete_keys_with_warning(KeyIdArgsListPtr uidList) {
if (ret == QMessageBox::Yes) {
GpgKeyOpera::GetInstance(key_list_->GetCurrentGpgContextChannel())
- .DeleteKeys(std::move(uidList));
+ .DeleteKeys(std::move(uid_list));
emit SignalKeyStatusUpdated();
}
}
void KeyMgmt::SlotShowKeyDetails() {
auto keys_selected = key_list_->GetSelected();
- if (keys_selected->empty()) return;
+ if (keys_selected.empty()) return;
auto key = GpgKeyGetter::GetInstance(key_list_->GetCurrentGpgContextChannel())
- .GetKey(keys_selected->front());
+ .GetKey(keys_selected.front());
if (!key.IsGood()) {
QMessageBox::critical(this, tr("Error"), tr("Key Not Found."));
@@ -374,7 +374,7 @@ void KeyMgmt::SlotShowKeyDetails() {
void KeyMgmt::SlotExportKeyToKeyPackage() {
auto keys_checked = key_list_->GetChecked();
- if (keys_checked->empty()) {
+ if (keys_checked.empty()) {
QMessageBox::critical(
this, tr("Forbidden"),
tr("Please check some keys before doing this operation."));
@@ -388,17 +388,17 @@ void KeyMgmt::SlotExportKeyToKeyPackage() {
void KeyMgmt::SlotExportKeyToClipboard() {
auto keys_checked = key_list_->GetChecked();
- if (keys_checked->empty()) {
+ if (keys_checked.empty()) {
QMessageBox::critical(
this, tr("Forbidden"),
tr("Please check some keys before doing this operation."));
return;
}
- if (keys_checked->size() == 1) {
+ if (keys_checked.size() == 1) {
auto key =
GpgKeyGetter::GetInstance(key_list_->GetCurrentGpgContextChannel())
- .GetKey(keys_checked->front());
+ .GetKey(keys_checked.front());
assert(key.IsGood());
auto [err, gf_buffer] = GpgKeyImportExporter::GetInstance(
@@ -413,7 +413,7 @@ void KeyMgmt::SlotExportKeyToClipboard() {
auto keys =
GpgKeyGetter::GetInstance(key_list_->GetCurrentGpgContextChannel())
.GetKeys(keys_checked);
- assert(std::all_of(keys->begin(), keys->end(),
+ assert(std::all_of(keys.begin(), keys.end(),
[](const auto& key) { return key.IsGood(); }));
CommonUtils::WaitForOpera(
@@ -421,7 +421,7 @@ void KeyMgmt::SlotExportKeyToClipboard() {
GpgKeyImportExporter::GetInstance(
key_list_->GetCurrentGpgContextChannel())
.ExportKeys(
- *keys, false, true, false, false,
+ keys, false, true, false, false,
[=](GpgError err, const DataObjectPtr& data_obj) {
// stop waiting
op_hd();
@@ -459,7 +459,7 @@ void KeyMgmt::SlotGenerateKeyDialog() {
void KeyMgmt::SlotGenerateSubKey() {
auto keys_selected = key_list_->GetSelected();
- if (keys_selected->empty()) {
+ if (keys_selected.empty()) {
QMessageBox::information(
this, tr("Invalid Operation"),
tr("Please select one KeyPair before doing this operation."));
@@ -467,7 +467,7 @@ void KeyMgmt::SlotGenerateSubKey() {
}
const auto key =
GpgKeyGetter::GetInstance(key_list_->GetCurrentGpgContextChannel())
- .GetKey(keys_selected->front());
+ .GetKey(keys_selected.front());
if (!key.IsGood()) {
QMessageBox::critical(this, tr("Error"), tr("Key Not Found."));
return;
@@ -487,14 +487,14 @@ void KeyMgmt::SlotGenerateSubKey() {
void KeyMgmt::SlotExportAsOpenSSHFormat() {
auto keys_checked = key_list_->GetChecked();
- if (keys_checked->empty()) {
+ if (keys_checked.empty()) {
QMessageBox::critical(
this, tr("Forbidden"),
tr("Please check a key before performing this operation."));
return;
}
- if (keys_checked->size() > 1) {
+ if (keys_checked.size() > 1) {
QMessageBox::critical(this, tr("Forbidden"),
tr("This operation accepts just a single key."));
return;
@@ -503,7 +503,7 @@ void KeyMgmt::SlotExportAsOpenSSHFormat() {
auto keys =
GpgKeyGetter::GetInstance(key_list_->GetCurrentGpgContextChannel())
.GetKeys(keys_checked);
- assert(std::all_of(keys->begin(), keys->end(),
+ assert(std::all_of(keys.begin(), keys.end(),
[](const auto& key) { return key.IsGood(); }));
CommonUtils::WaitForOpera(
@@ -511,7 +511,7 @@ void KeyMgmt::SlotExportAsOpenSSHFormat() {
GpgKeyImportExporter::GetInstance(
key_list_->GetCurrentGpgContextChannel())
.ExportKeys(
- *keys, false, true, false, true,
+ keys, false, true, false, true,
[=](GpgError err, const DataObjectPtr& data_obj) {
// stop waiting
op_hd();
diff --git a/src/ui/main_window/KeyMgmt.h b/src/ui/main_window/KeyMgmt.h
index 4cd87c22..c0c004af 100644
--- a/src/ui/main_window/KeyMgmt.h
+++ b/src/ui/main_window/KeyMgmt.h
@@ -144,7 +144,7 @@ class KeyMgmt : public GeneralMainWindow {
*
* @param uidList
*/
- void delete_keys_with_warning(KeyIdArgsListPtr uidList);
+ void delete_keys_with_warning(KeyIdArgsList uid_list);
KeyList* key_list_; ///<
QMenu* file_menu_{}; ///<
diff --git a/src/ui/main_window/MainWindowFileSlotFunction.cpp b/src/ui/main_window/MainWindowFileSlotFunction.cpp
index 184635a7..e2fe86bd 100644
--- a/src/ui/main_window/MainWindowFileSlotFunction.cpp
+++ b/src/ui/main_window/MainWindowFileSlotFunction.cpp
@@ -79,7 +79,7 @@ void MainWindow::SlotFileEncrypt(const QString& path) {
// check selected keys
auto key_ids = m_key_list_->GetChecked();
- if (key_ids->empty()) {
+ if (key_ids.empty()) {
// Symmetric Encrypt
auto ret = QMessageBox::information(
this, tr("Symmetric Encryption"),
@@ -122,11 +122,11 @@ void MainWindow::SlotFileEncrypt(const QString& path) {
auto p_keys =
GpgKeyGetter::GetInstance(m_key_list_->GetCurrentGpgContextChannel())
.GetKeys(key_ids);
- assert(std::all_of(p_keys->begin(), p_keys->end(),
+ assert(std::all_of(p_keys.begin(), p_keys.end(),
[](const auto& key) { return key.IsGood(); }));
// check key abilities
- for (const auto& key : *p_keys) {
+ for (const auto& key : p_keys) {
bool const key_can_encrypt = key.IsHasActualEncryptionCapability();
if (!key_can_encrypt) {
@@ -143,7 +143,7 @@ void MainWindow::SlotFileEncrypt(const QString& path) {
this, tr("Encrypting"), [=](const OperaWaitingHd& op_hd) {
GpgFileOpera::GetInstance(m_key_list_->GetCurrentGpgContextChannel())
.EncryptFile(
- {p_keys->begin(), p_keys->end()}, path,
+ {p_keys.begin(), p_keys.end()}, path,
!non_ascii_at_file_operation, out_path,
[=](GpgError err, const DataObjectPtr& data_obj) {
// stop waiting
@@ -205,7 +205,7 @@ void MainWindow::SlotDirectoryEncrypt(const QString& path) {
// check selected keys
auto key_ids = m_key_list_->GetChecked();
// symmetric encrypt
- if (key_ids->empty()) {
+ if (key_ids.empty()) {
auto ret = QMessageBox::information(
this, tr("Symmetric Encryption"),
tr("No Key Selected. Do you want to encrypt with a "
@@ -247,11 +247,11 @@ void MainWindow::SlotDirectoryEncrypt(const QString& path) {
auto p_keys =
GpgKeyGetter::GetInstance(m_key_list_->GetCurrentGpgContextChannel())
.GetKeys(key_ids);
- assert(std::all_of(p_keys->begin(), p_keys->end(),
+ assert(std::all_of(p_keys.begin(), p_keys.end(),
[](const auto& key) { return key.IsGood(); }));
// check key abilities
- for (const auto& key : *p_keys) {
+ for (const auto& key : p_keys) {
bool const key_can_encrypt = key.IsHasActualEncryptionCapability();
if (!key_can_encrypt) {
@@ -268,7 +268,7 @@ void MainWindow::SlotDirectoryEncrypt(const QString& path) {
this, tr("Archiving & Encrypting"), [=](const OperaWaitingHd& op_hd) {
GpgFileOpera::GetInstance(m_key_list_->GetCurrentGpgContextChannel())
.EncryptDirectory(
- {p_keys->begin(), p_keys->end()}, path,
+ {p_keys.begin(), p_keys.end()}, path,
!non_ascii_at_file_operation, out_path,
[=](GpgError err, const DataObjectPtr& data_obj) {
// stop waiting
@@ -413,17 +413,17 @@ void MainWindow::SlotFileSign(const QString& path) {
auto keys =
GpgKeyGetter::GetInstance(m_key_list_->GetCurrentGpgContextChannel())
.GetKeys(key_ids);
- assert(std::all_of(keys->begin(), keys->end(),
+ assert(std::all_of(keys.begin(), keys.end(),
[](const auto& key) { return key.IsGood(); }));
- if (keys->empty()) {
+ if (keys.empty()) {
QMessageBox::critical(
this, tr("No Key Checked"),
tr("Please check the key in the key toolbox on the right."));
return;
}
- for (const auto& key : *keys) {
+ for (const auto& key : keys) {
if (!key.IsHasActualSigningCapability()) {
QMessageBox::information(
this, tr("Invalid Operation"),
@@ -456,7 +456,7 @@ void MainWindow::SlotFileSign(const QString& path) {
CommonUtils::WaitForOpera(
this, tr("Signing"), [=](const OperaWaitingHd& op_hd) {
GpgFileOpera::GetInstance(m_key_list_->GetCurrentGpgContextChannel())
- .SignFile({keys->begin(), keys->end()}, path,
+ .SignFile({keys.begin(), keys.end()}, path,
!non_ascii_at_file_operation, sig_file_path,
[=](GpgError err, const DataObjectPtr& data_obj) {
// stop waiting
@@ -575,10 +575,10 @@ void MainWindow::SlotFileEncryptSign(const QString& path) {
auto p_keys =
GpgKeyGetter::GetInstance(m_key_list_->GetCurrentGpgContextChannel())
.GetKeys(key_ids);
- assert(std::all_of(p_keys->begin(), p_keys->end(),
+ assert(std::all_of(p_keys.begin(), p_keys.end(),
[](const auto& key) { return key.IsGood(); }));
- if (p_keys->empty()) {
+ if (p_keys.empty()) {
QMessageBox::critical(
this, tr("No Key Checked"),
tr("Please check the key in the key toolbox on the right."));
@@ -586,7 +586,7 @@ void MainWindow::SlotFileEncryptSign(const QString& path) {
}
// check key abilities
- for (const auto& key : *p_keys) {
+ for (const auto& key : p_keys) {
bool const key_can_encrypt = key.IsHasActualEncryptionCapability();
if (!key_can_encrypt) {
@@ -636,15 +636,15 @@ void MainWindow::SlotFileEncryptSign(const QString& path) {
auto p_signer_keys =
GpgKeyGetter::GetInstance(m_key_list_->GetCurrentGpgContextChannel())
.GetKeys(signer_key_ids);
- assert(std::all_of(p_signer_keys->begin(), p_signer_keys->end(),
+ assert(std::all_of(p_signer_keys.begin(), p_signer_keys.end(),
[](const auto& key) { return key.IsGood(); }));
CommonUtils::WaitForOpera(
this, tr("Encrypting and Signing"), [=](const OperaWaitingHd& op_hd) {
GpgFileOpera::GetInstance(m_key_list_->GetCurrentGpgContextChannel())
.EncryptSignFile(
- {p_keys->begin(), p_keys->end()},
- {p_signer_keys->begin(), p_signer_keys->end()}, path,
+ {p_keys.begin(), p_keys.end()},
+ {p_signer_keys.begin(), p_signer_keys.end()}, path,
!non_ascii_at_file_operation, out_path,
[=](GpgError err, const DataObjectPtr& data_obj) {
// stop waiting
@@ -692,10 +692,10 @@ void MainWindow::SlotDirectoryEncryptSign(const QString& path) {
auto p_keys =
GpgKeyGetter::GetInstance(m_key_list_->GetCurrentGpgContextChannel())
.GetKeys(key_ids);
- assert(std::all_of(p_keys->begin(), p_keys->end(),
+ assert(std::all_of(p_keys.begin(), p_keys.end(),
[](const auto& key) { return key.IsGood(); }));
- if (p_keys->empty()) {
+ if (p_keys.empty()) {
QMessageBox::critical(
this, tr("No Key Checked"),
tr("Please check the key in the key toolbox on the right."));
@@ -703,7 +703,7 @@ void MainWindow::SlotDirectoryEncryptSign(const QString& path) {
}
// check key abilities
- for (const auto& key : *p_keys) {
+ for (const auto& key : p_keys) {
bool const key_can_encrypt = key.IsHasActualEncryptionCapability();
if (!key_can_encrypt) {
@@ -754,7 +754,7 @@ void MainWindow::SlotDirectoryEncryptSign(const QString& path) {
GpgKeyGetter::GetInstance(m_key_list_->GetCurrentGpgContextChannel())
.GetKeys(signer_key_ids);
#ifndef NDEBUG
- for (const auto& key : *p_signer_keys) {
+ for (const auto& key : p_signer_keys) {
assert(key.IsGood());
}
#endif
@@ -764,8 +764,8 @@ void MainWindow::SlotDirectoryEncryptSign(const QString& path) {
[=](const OperaWaitingHd& op_hd) {
GpgFileOpera::GetInstance(m_key_list_->GetCurrentGpgContextChannel())
.EncryptSignDirectory(
- {p_keys->begin(), p_keys->end()},
- {p_signer_keys->begin(), p_signer_keys->end()}, path,
+ {p_keys.begin(), p_keys.end()},
+ {p_signer_keys.begin(), p_signer_keys.end()}, path,
!non_ascii_at_file_operation, out_path,
[=](GpgError err, const DataObjectPtr& data_obj) {
// stop waiting
diff --git a/src/ui/main_window/MainWindowGpgOperaFunction.cpp b/src/ui/main_window/MainWindowGpgOperaFunction.cpp
index a9a65797..4432d4e4 100644
--- a/src/ui/main_window/MainWindowGpgOperaFunction.cpp
+++ b/src/ui/main_window/MainWindowGpgOperaFunction.cpp
@@ -49,7 +49,7 @@ void MainWindow::SlotEncrypt() {
auto key_ids = m_key_list_->GetChecked();
- if (key_ids->empty()) {
+ if (key_ids.empty()) {
// Symmetric Encrypt
auto ret = QMessageBox::information(
this, tr("Symmetric Encryption"),
@@ -102,10 +102,10 @@ void MainWindow::SlotEncrypt() {
auto keys =
GpgKeyGetter::GetInstance(m_key_list_->GetCurrentGpgContextChannel())
.GetKeys(key_ids);
- assert(std::all_of(keys->begin(), keys->end(),
+ assert(std::all_of(keys.begin(), keys.end(),
[](const auto& key) { return key.IsGood(); }));
- for (const auto& key : *keys) {
+ for (const auto& key : keys) {
if (!key.IsHasActualEncryptionCapability()) {
QMessageBox::information(
this, tr("Invalid Operation"),
@@ -124,7 +124,7 @@ void MainWindow::SlotEncrypt() {
GpgFrontend::GpgBasicOperator::GetInstance(
m_key_list_->GetCurrentGpgContextChannel())
.Encrypt(
- {keys->begin(), keys->end()}, buffer, true,
+ {keys.begin(), keys.end()}, buffer, true,
[this, op_hd](GpgError err, const DataObjectPtr& data_obj) {
// stop waiting
op_hd();
@@ -157,7 +157,7 @@ void MainWindow::SlotSign() {
if (edit_->CurPageTextEdit() == nullptr) return;
auto key_ids = m_key_list_->GetCheckedPrivateKey();
- if (key_ids->empty()) {
+ if (key_ids.empty()) {
QMessageBox::critical(
this, tr("No Key Checked"),
tr("Please check the key in the key toolbox on the right."));
@@ -167,10 +167,10 @@ void MainWindow::SlotSign() {
auto keys =
GpgKeyGetter::GetInstance(m_key_list_->GetCurrentGpgContextChannel())
.GetKeys(key_ids);
- assert(std::all_of(keys->begin(), keys->end(),
+ assert(std::all_of(keys.begin(), keys.end(),
[](const auto& key) { return key.IsGood(); }));
- for (const auto& key : *keys) {
+ for (const auto& key : keys) {
if (!key.IsHasActualSigningCapability()) {
QMessageBox::information(
this, tr("Invalid Operation"),
@@ -189,8 +189,8 @@ void MainWindow::SlotSign() {
GpgFrontend::GpgBasicOperator::GetInstance(
m_key_list_->GetCurrentGpgContextChannel())
.Sign(
- {keys->begin(), keys->end()}, buffer, GPGME_SIG_MODE_CLEAR,
- true, [this, hd](GpgError err, const DataObjectPtr& data_obj) {
+ {keys.begin(), keys.end()}, buffer, GPGME_SIG_MODE_CLEAR, true,
+ [this, hd](GpgError err, const DataObjectPtr& data_obj) {
// stop waiting
hd();
@@ -372,7 +372,7 @@ void MainWindow::SlotEncryptSign() {
auto key_ids = m_key_list_->GetChecked();
- if (key_ids->empty()) {
+ if (key_ids.empty()) {
QMessageBox::critical(
this, tr("No Key Checked"),
tr("Please check some key in the key toolbox on the right."));
@@ -382,10 +382,10 @@ void MainWindow::SlotEncryptSign() {
auto keys =
GpgKeyGetter::GetInstance(m_key_list_->GetCurrentGpgContextChannel())
.GetKeys(key_ids);
- assert(std::all_of(keys->begin(), keys->end(),
+ assert(std::all_of(keys.begin(), keys.end(),
[](const auto& key) { return key.IsGood(); }));
- for (const auto& key : *keys) {
+ for (const auto& key : keys) {
bool key_can_encrypt = key.IsHasActualEncryptionCapability();
if (!key_can_encrypt) {
@@ -411,7 +411,7 @@ void MainWindow::SlotEncryptSign() {
auto signer_keys =
GpgKeyGetter::GetInstance(m_key_list_->GetCurrentGpgContextChannel())
.GetKeys(signer_key_ids);
- for (const auto& key : *signer_keys) {
+ for (const auto& key : signer_keys) {
assert(key.IsGood());
}
@@ -424,8 +424,8 @@ void MainWindow::SlotEncryptSign() {
GpgFrontend::GpgBasicOperator::GetInstance(
m_key_list_->GetCurrentGpgContextChannel())
.EncryptSign(
- {keys->begin(), keys->end()},
- {signer_keys->begin(), signer_keys->end()}, buffer, true,
+ {keys.begin(), keys.end()},
+ {signer_keys.begin(), signer_keys.end()}, buffer, true,
[this, hd](GpgError err, const DataObjectPtr& data_obj) {
// stop waiting
hd();
diff --git a/src/ui/main_window/MainWindowSlotFunction.cpp b/src/ui/main_window/MainWindowSlotFunction.cpp
index 19760e0f..03f51298 100644
--- a/src/ui/main_window/MainWindowSlotFunction.cpp
+++ b/src/ui/main_window/MainWindowSlotFunction.cpp
@@ -72,17 +72,17 @@ void MainWindow::slot_find() {
void MainWindow::slot_append_selected_keys() {
auto key_ids = m_key_list_->GetSelected();
- if (key_ids->empty()) {
+ if (key_ids.empty()) {
FLOG_W("no key is selected to export");
return;
}
auto key =
GpgKeyGetter::GetInstance(m_key_list_->GetCurrentGpgContextChannel())
- .GetKey(key_ids->front());
+ .GetKey(key_ids.front());
if (!key.IsGood()) {
LOG_W() << "selected key for exporting is invalid, key id: "
- << key_ids->front();
+ << key_ids.front();
return;
}
@@ -100,14 +100,14 @@ void MainWindow::slot_append_selected_keys() {
void MainWindow::slot_append_keys_create_datetime() {
auto key_ids = m_key_list_->GetSelected();
- if (key_ids->empty()) {
+ if (key_ids.empty()) {
FLOG_W("no key is selected");
return;
}
auto key =
GpgKeyGetter::GetInstance(m_key_list_->GetCurrentGpgContextChannel())
- .GetKey(key_ids->front());
+ .GetKey(key_ids.front());
if (!key.IsGood()) {
QMessageBox::critical(this, tr("Error"), tr("Key Not Found."));
return;
@@ -126,14 +126,14 @@ void MainWindow::slot_append_keys_create_datetime() {
void MainWindow::slot_append_keys_expire_datetime() {
auto key_ids = m_key_list_->GetSelected();
- if (key_ids->empty()) {
+ if (key_ids.empty()) {
FLOG_W("no key is selected");
return;
}
auto key =
GpgKeyGetter::GetInstance(m_key_list_->GetCurrentGpgContextChannel())
- .GetKey(key_ids->front());
+ .GetKey(key_ids.front());
if (!key.IsGood()) {
QMessageBox::critical(this, tr("Error"), tr("Key Not Found."));
return;
@@ -151,11 +151,11 @@ void MainWindow::slot_append_keys_expire_datetime() {
void MainWindow::slot_append_keys_fingerprint() {
auto key_ids = m_key_list_->GetSelected();
- if (key_ids->empty()) return;
+ if (key_ids.empty()) return;
auto key =
GpgKeyGetter::GetInstance(m_key_list_->GetCurrentGpgContextChannel())
- .GetKey(key_ids->front());
+ .GetKey(key_ids.front());
if (!key.IsGood()) {
QMessageBox::critical(this, tr("Error"), tr("Key Not Found."));
return;
@@ -169,11 +169,11 @@ void MainWindow::slot_append_keys_fingerprint() {
void MainWindow::slot_copy_mail_address_to_clipboard() {
auto key_ids = m_key_list_->GetSelected();
- if (key_ids->empty()) return;
+ if (key_ids.empty()) return;
auto key =
GpgKeyGetter::GetInstance(m_key_list_->GetCurrentGpgContextChannel())
- .GetKey(key_ids->front());
+ .GetKey(key_ids.front());
if (!key.IsGood()) {
QMessageBox::critical(this, tr("Error"), tr("Key Not Found."));
return;
@@ -184,11 +184,11 @@ void MainWindow::slot_copy_mail_address_to_clipboard() {
void MainWindow::slot_copy_default_uid_to_clipboard() {
auto key_ids = m_key_list_->GetSelected();
- if (key_ids->empty()) return;
+ if (key_ids.empty()) return;
auto key =
GpgKeyGetter::GetInstance(m_key_list_->GetCurrentGpgContextChannel())
- .GetKey(key_ids->front());
+ .GetKey(key_ids.front());
if (!key.IsGood()) {
QMessageBox::critical(this, tr("Error"), tr("Key Not Found."));
return;
@@ -199,11 +199,11 @@ void MainWindow::slot_copy_default_uid_to_clipboard() {
void MainWindow::slot_copy_key_id_to_clipboard() {
auto key_ids = m_key_list_->GetSelected();
- if (key_ids->empty()) return;
+ if (key_ids.empty()) return;
auto key =
GpgKeyGetter::GetInstance(m_key_list_->GetCurrentGpgContextChannel())
- .GetKey(key_ids->front());
+ .GetKey(key_ids.front());
if (!key.IsGood()) {
QMessageBox::critical(this, tr("Error"), tr("Key Not Found."));
return;
@@ -214,11 +214,11 @@ void MainWindow::slot_copy_key_id_to_clipboard() {
void MainWindow::slot_show_key_details() {
auto key_ids = m_key_list_->GetSelected();
- if (key_ids->empty()) return;
+ if (key_ids.empty()) return;
auto key =
GpgKeyGetter::GetInstance(m_key_list_->GetCurrentGpgContextChannel())
- .GetKey(key_ids->front());
+ .GetKey(key_ids.front());
if (key.IsGood()) {
new KeyDetailsDialog(m_key_list_->GetCurrentGpgContextChannel(), key, this);
} else {
@@ -228,11 +228,11 @@ void MainWindow::slot_show_key_details() {
void MainWindow::slot_add_key_2_favorite() {
auto key_ids = m_key_list_->GetSelected();
- if (key_ids->empty()) return;
+ if (key_ids.empty()) return;
auto key =
GpgKeyGetter::GetInstance(m_key_list_->GetCurrentGpgContextChannel())
- .GetKey(key_ids->front());
+ .GetKey(key_ids.front());
if (!key.IsGood()) return;
auto key_db_name =
@@ -246,11 +246,11 @@ void MainWindow::slot_add_key_2_favorite() {
void MainWindow::slot_remove_key_from_favorite() {
auto key_ids = m_key_list_->GetSelected();
- if (key_ids->empty()) return;
+ if (key_ids.empty()) return;
auto key =
GpgKeyGetter::GetInstance(m_key_list_->GetCurrentGpgContextChannel())
- .GetKey(key_ids->front());
+ .GetKey(key_ids.front());
assert(key.IsGood());
auto key_db_name =
@@ -263,17 +263,17 @@ void MainWindow::slot_remove_key_from_favorite() {
void MainWindow::refresh_keys_from_key_server() {
auto key_ids = m_key_list_->GetSelected();
- if (key_ids->empty()) return;
+ if (key_ids.empty()) return;
CommonUtils::GetInstance()->ImportKeyFromKeyServer(
- m_key_list_->GetCurrentGpgContextChannel(), *key_ids);
+ m_key_list_->GetCurrentGpgContextChannel(), key_ids);
}
void MainWindow::slot_set_owner_trust_level_of_key() {
auto key_ids = m_key_list_->GetSelected();
- if (key_ids->empty()) return;
+ if (key_ids.empty()) return;
auto* function = new SetOwnerTrustLevel(this);
- function->Exec(m_key_list_->GetCurrentGpgContextChannel(), key_ids->front());
+ function->Exec(m_key_list_->GetCurrentGpgContextChannel(), key_ids.front());
function->deleteLater();
}
@@ -692,7 +692,7 @@ void MainWindow::SlotEncryptEML() {
}
}
- LOG_E() << "mime or signature data is missing";
+ return 0;
});
});
}
diff --git a/src/ui/thread/KeyServerImportTask.cpp b/src/ui/thread/KeyServerImportTask.cpp
index 2811919e..a7e0c339 100644
--- a/src/ui/thread/KeyServerImportTask.cpp
+++ b/src/ui/thread/KeyServerImportTask.cpp
@@ -28,17 +28,20 @@
#include "ui/thread/KeyServerImportTask.h"
+#include <utility>
+
#include "core/function/gpg/GpgKeyImportExporter.h"
#include "core/model/SettingsObject.h"
#include "core/utils/BuildInfoUtils.h"
#include "ui/struct/settings_object/KeyServerSO.h"
-GpgFrontend::UI::KeyServerImportTask::KeyServerImportTask(
- QString keyserver_url, int channel, std::vector<QString> keyids)
+GpgFrontend::UI::KeyServerImportTask::KeyServerImportTask(QString keyserver_url,
+ int channel,
+ KeyIdArgsList key_ids)
: Task("key_server_import_task"),
keyserver_url_(std::move(keyserver_url)),
current_gpg_context_channel_(channel),
- keyids_(std::move(keyids)),
+ keyids_(std::move(key_ids)),
manager_(new QNetworkAccessManager(this)) {
HoldOnLifeCycle(true);
diff --git a/src/ui/thread/KeyServerImportTask.h b/src/ui/thread/KeyServerImportTask.h
index f5a3fcdb..4e98a43a 100644
--- a/src/ui/thread/KeyServerImportTask.h
+++ b/src/ui/thread/KeyServerImportTask.h
@@ -32,6 +32,7 @@
#include <qnetworkreply.h>
#include "core/thread/Task.h"
+#include "core/typedef/GpgTypedef.h"
namespace GpgFrontend {
class GpgImportInformation;
@@ -48,8 +49,7 @@ class KeyServerImportTask : public Thread::Task {
* @param keyserver_url
* @param search_string
*/
- KeyServerImportTask(QString keyserver_url, int channel,
- std::vector<QString> keyid);
+ KeyServerImportTask(QString keyserver_url, int channel, KeyIdArgsList keyids);
/**
* @brief
@@ -78,7 +78,7 @@ class KeyServerImportTask : public Thread::Task {
private:
QString keyserver_url_; ///<
int current_gpg_context_channel_; ///<
- std::vector<QString> keyids_; ///<
+ KeyIdArgsList keyids_; ///<
int result_count_ = 0;
QNetworkAccessManager *manager_; ///<
diff --git a/src/ui/thread/ListedKeyServerTestTask.cpp b/src/ui/thread/ListedKeyServerTestTask.cpp
index 77c624dd..624e2b8b 100644
--- a/src/ui/thread/ListedKeyServerTestTask.cpp
+++ b/src/ui/thread/ListedKeyServerTestTask.cpp
@@ -40,8 +40,8 @@ GpgFrontend::UI::ListedKeyServerTestTask::ListedKeyServerTestTask(
network_manager_(new QNetworkAccessManager(this)),
timeout_(timeout) {
HoldOnLifeCycle(true);
- qRegisterMetaType<std::vector<KeyServerTestResultType>>(
- "std::vector<KeyServerTestResultType>");
+ qRegisterMetaType<QContainer<KeyServerTestResultType>>(
+ "QContainer<KeyServerTestResultType>");
}
auto GpgFrontend::UI::ListedKeyServerTestTask::Run() -> int {
diff --git a/src/ui/thread/ListedKeyServerTestTask.h b/src/ui/thread/ListedKeyServerTestTask.h
index 4fff114a..b9a6700d 100644
--- a/src/ui/thread/ListedKeyServerTestTask.h
+++ b/src/ui/thread/ListedKeyServerTestTask.h
@@ -65,14 +65,14 @@ class ListedKeyServerTestTask : public Thread::Task {
* @param result
*/
void SignalKeyServerListTestResult(
- std::vector<KeyServerTestResultType> result);
+ QContainer<KeyServerTestResultType> result);
private:
- QStringList urls_; ///<
- std::vector<KeyServerTestResultType> result_; ///<
- QNetworkAccessManager* network_manager_; ///<
- int timeout_ = 500; ///<
- int result_count_ = 0; ///<
+ QStringList urls_; ///<
+ QContainer<KeyServerTestResultType> result_; ///<
+ QNetworkAccessManager* network_manager_; ///<
+ int timeout_ = 500; ///<
+ int result_count_ = 0; ///<
/**
* @brief
diff --git a/src/ui/widgets/KeyList.cpp b/src/ui/widgets/KeyList.cpp
index 9498480e..d6eeaf55 100644
--- a/src/ui/widgets/KeyList.cpp
+++ b/src/ui/widgets/KeyList.cpp
@@ -307,22 +307,22 @@ void KeyList::SlotRefreshUI() {
ui_->syncButton->setDisabled(false);
}
-auto KeyList::GetChecked(const KeyTable& key_table) -> KeyIdArgsListPtr {
- auto ret = std::make_unique<KeyIdArgsList>();
+auto KeyList::GetChecked(const KeyTable& key_table) -> KeyIdArgsList {
+ auto ret = KeyIdArgsList{};
for (int i = 0; i < key_table.GetRowCount(); i++) {
if (key_table.IsRowChecked(i)) {
- ret->push_back(key_table.GetKeyIdByRow(i));
+ ret.push_back(key_table.GetKeyIdByRow(i));
}
}
return ret;
}
-auto KeyList::GetChecked() -> KeyIdArgsListPtr {
+auto KeyList::GetChecked() -> KeyIdArgsList {
auto* key_table = qobject_cast<KeyTable*>(ui_->keyGroupTab->currentWidget());
- auto ret = std::make_unique<KeyIdArgsList>();
+ auto ret = KeyIdArgsList{};
for (int i = 0; i < key_table->GetRowCount(); i++) {
if (key_table->IsRowChecked(i)) {
- ret->push_back(key_table->GetKeyIdByRow(i));
+ ret.push_back(key_table->GetKeyIdByRow(i));
}
}
return ret;
@@ -339,59 +339,59 @@ auto KeyList::GetCheckedKeys() -> QStringList {
return key_id_list;
}
-auto KeyList::GetAllPrivateKeys() -> KeyIdArgsListPtr {
+auto KeyList::GetAllPrivateKeys() -> KeyIdArgsList {
auto* key_table = qobject_cast<KeyTable*>(ui_->keyGroupTab->currentWidget());
- auto ret = std::make_unique<KeyIdArgsList>();
+ auto ret = KeyIdArgsList{};
for (int i = 0; i < key_table->GetRowCount(); i++) {
if (key_table->IsPrivateKeyByRow(i)) {
- ret->push_back(key_table->GetKeyIdByRow(i));
+ ret.push_back(key_table->GetKeyIdByRow(i));
}
}
return ret;
}
-auto KeyList::GetCheckedPrivateKey() -> KeyIdArgsListPtr {
- auto ret = std::make_unique<KeyIdArgsList>();
+auto KeyList::GetCheckedPrivateKey() -> KeyIdArgsList {
+ auto ret = KeyIdArgsList{};
if (ui_->keyGroupTab->size().isEmpty()) return ret;
auto* key_table = qobject_cast<KeyTable*>(ui_->keyGroupTab->currentWidget());
for (int i = 0; i < key_table->GetRowCount(); i++) {
if (key_table->IsRowChecked(i) && key_table->IsPrivateKeyByRow(i)) {
- ret->push_back(key_table->GetKeyIdByRow(i));
+ ret.push_back(key_table->GetKeyIdByRow(i));
}
}
return ret;
}
-auto KeyList::GetCheckedPublicKey() -> KeyIdArgsListPtr {
- auto ret = std::make_unique<KeyIdArgsList>();
+auto KeyList::GetCheckedPublicKey() -> KeyIdArgsList {
+ auto ret = KeyIdArgsList{};
if (ui_->keyGroupTab->size().isEmpty()) return ret;
auto* key_table = qobject_cast<KeyTable*>(ui_->keyGroupTab->currentWidget());
for (int i = 0; i < key_table->GetRowCount(); i++) {
if (key_table->IsRowChecked(i) && key_table->IsPublicKeyByRow(i)) {
- ret->push_back(key_table->GetKeyIdByRow(i));
+ ret.push_back(key_table->GetKeyIdByRow(i));
}
}
return ret;
}
-void KeyList::SetChecked(const KeyIdArgsListPtr& keyIds,
+void KeyList::SetChecked(const KeyIdArgsList& keyIds,
const KeyTable& key_table) {
- if (!keyIds->empty()) {
+ if (!keyIds.empty()) {
for (int i = 0; i < key_table.GetRowCount(); i++) {
- if (std::find(keyIds->begin(), keyIds->end(),
- key_table.GetKeyIdByRow(i)) != keyIds->end()) {
+ if (std::find(keyIds.begin(), keyIds.end(), key_table.GetKeyIdByRow(i)) !=
+ keyIds.end()) {
key_table.SetRowChecked(i);
}
}
}
}
-auto KeyList::GetSelected() -> KeyIdArgsListPtr {
- auto ret = std::make_unique<KeyIdArgsList>();
+auto KeyList::GetSelected() -> KeyIdArgsList {
+ auto ret = KeyIdArgsList{};
if (ui_->keyGroupTab->size().isEmpty()) return ret;
auto* key_table = qobject_cast<KeyTable*>(ui_->keyGroupTab->currentWidget());
@@ -402,10 +402,10 @@ auto KeyList::GetSelected() -> KeyIdArgsListPtr {
QItemSelectionModel* select = key_table->selectionModel();
for (auto index : select->selectedRows()) {
- ret->push_back(key_table->GetKeyIdByRow(index.row()));
+ ret.push_back(key_table->GetKeyIdByRow(index.row()));
}
- if (ret->empty()) {
+ if (ret.empty()) {
FLOG_W("nothing is selected at key list");
}
return ret;
@@ -573,7 +573,7 @@ void KeyList::slot_sync_with_key_server() {
auto checked_public_keys = GetCheckedPublicKey();
KeyIdArgsList key_ids;
- if (checked_public_keys->empty()) {
+ if (checked_public_keys.empty()) {
QMessageBox::StandardButton const reply = QMessageBox::question(
this, QCoreApplication::tr("Sync All Public Key"),
QCoreApplication::tr("You have not checked any public keys that you "
@@ -589,7 +589,7 @@ void KeyList::slot_sync_with_key_server() {
}
} else {
- key_ids = *checked_public_keys;
+ key_ids = checked_public_keys;
}
if (key_ids.empty()) return;
diff --git a/src/ui/widgets/KeyList.h b/src/ui/widgets/KeyList.h
index 4216eba8..7053b10c 100644
--- a/src/ui/widgets/KeyList.h
+++ b/src/ui/widgets/KeyList.h
@@ -142,7 +142,7 @@ class KeyList : public QWidget {
*
* @return KeyIdArgsListPtr
*/
- auto GetChecked() -> KeyIdArgsListPtr;
+ auto GetChecked() -> KeyIdArgsList;
/**
* @brief Get the Checked Keys object
@@ -157,28 +157,28 @@ class KeyList : public QWidget {
* @param key_table
* @return KeyIdArgsListPtr
*/
- static auto GetChecked(const KeyTable& key_table) -> KeyIdArgsListPtr;
+ static auto GetChecked(const KeyTable& key_table) -> KeyIdArgsList;
/**
* @brief Get the Private Checked object
*
* @return KeyIdArgsListPtr
*/
- auto GetCheckedPrivateKey() -> KeyIdArgsListPtr;
+ auto GetCheckedPrivateKey() -> KeyIdArgsList;
/**
* @brief
*
* @return KeyIdArgsListPtr
*/
- auto GetCheckedPublicKey() -> KeyIdArgsListPtr;
+ auto GetCheckedPublicKey() -> KeyIdArgsList;
/**
* @brief Get the All Private Keys object
*
* @return KeyIdArgsListPtr
*/
- auto GetAllPrivateKeys() -> KeyIdArgsListPtr;
+ auto GetAllPrivateKeys() -> KeyIdArgsList;
/**
* @brief Set the Checked object
@@ -186,7 +186,7 @@ class KeyList : public QWidget {
* @param keyIds
* @param key_table
*/
- static void SetChecked(const KeyIdArgsListPtr& key_ids,
+ static void SetChecked(const KeyIdArgsList& key_ids,
const KeyTable& key_table);
/**
@@ -194,7 +194,7 @@ class KeyList : public QWidget {
*
* @return KeyIdArgsListPtr
*/
- auto GetSelected() -> KeyIdArgsListPtr;
+ auto GetSelected() -> KeyIdArgsList;
/**
* @brief Get the Selected Key object
diff --git a/src/ui/widgets/KeyTable.cpp b/src/ui/widgets/KeyTable.cpp
index bda294a4..9d3511cd 100644
--- a/src/ui/widgets/KeyTable.cpp
+++ b/src/ui/widgets/KeyTable.cpp
@@ -34,10 +34,10 @@
namespace GpgFrontend::UI {
-auto KeyTable::GetChecked() const -> KeyIdArgsListPtr {
- auto ret = std::make_unique<KeyIdArgsList>();
+auto KeyTable::GetChecked() const -> KeyIdArgsList {
+ auto ret = KeyIdArgsList{};
for (decltype(GetRowCount()) i = 0; i < GetRowCount(); i++) {
- if (IsRowChecked(i)) ret->push_back(GetKeyIdByRow(i));
+ if (IsRowChecked(i)) ret.push_back(GetKeyIdByRow(i));
}
return ret;
}
diff --git a/src/ui/widgets/KeyTable.h b/src/ui/widgets/KeyTable.h
index a03a1c83..ae9fcac5 100644
--- a/src/ui/widgets/KeyTable.h
+++ b/src/ui/widgets/KeyTable.h
@@ -70,7 +70,7 @@ struct KeyTable : public QTableView {
*
* @return KeyIdArgsListPtr&
*/
- [[nodiscard]] auto GetChecked() const -> KeyIdArgsListPtr;
+ [[nodiscard]] auto GetChecked() const -> KeyIdArgsList;
/**
* @brief
diff --git a/src/ui/widgets/TextEditTabWidget.cpp b/src/ui/widgets/TextEditTabWidget.cpp
index 4377a424..fbf1a3e7 100644
--- a/src/ui/widgets/TextEditTabWidget.cpp
+++ b/src/ui/widgets/TextEditTabWidget.cpp
@@ -211,7 +211,7 @@ void TextEditTabWidget::slot_save_status_to_cache_for_recovery() {
}
int tab_count = this->count();
- std::vector<std::tuple<int, QString, QString>> unsaved_pages;
+ QContainer<std::tuple<int, QString, QString>> unsaved_pages;
for (int i = 0; i < tab_count; i++) {
auto* target_page = qobject_cast<PlainTextEditorPage*>(this->widget(i));