From 6983b5c1dd82d159236ebd06cf17f071cc9c1ee9 Mon Sep 17 00:00:00 2001 From: saturneric Date: Fri, 12 Jan 2024 23:08:38 +0800 Subject: refactor: remove boost and use QString instead of std::filesystem::path --- src/core/function/gpg/GpgKeyManager.cpp | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) (limited to 'src/core/function/gpg/GpgKeyManager.cpp') diff --git a/src/core/function/gpg/GpgKeyManager.cpp b/src/core/function/gpg/GpgKeyManager.cpp index e6ff7214..8d7d9a28 100644 --- a/src/core/function/gpg/GpgKeyManager.cpp +++ b/src/core/function/gpg/GpgKeyManager.cpp @@ -28,9 +28,6 @@ #include "GpgKeyManager.h" -#include -#include - #include "core/GpgModel.h" #include "core/function/gpg/GpgBasicOperator.h" #include "core/function/gpg/GpgKeyGetter.h" @@ -41,8 +38,7 @@ GpgFrontend::GpgKeyManager::GpgKeyManager(int channel) auto GpgFrontend::GpgKeyManager::SignKey( const GpgFrontend::GpgKey& target, GpgFrontend::KeyArgsList& keys, - const QString& uid, - const std::unique_ptr& expires) -> bool { + const QString& uid, const std::unique_ptr& expires) -> bool { GpgBasicOperator::GetInstance().SetSigners(keys, true); unsigned int flags = 0; @@ -51,7 +47,7 @@ auto GpgFrontend::GpgKeyManager::SignKey( if (expires == nullptr) { flags |= GPGME_KEYSIGN_NOEXPIRE; } else { - expires_time_t = to_time_t(*expires); + expires_time_t = expires->toSecsSinceEpoch(); } auto err = CheckGpgError( @@ -77,14 +73,13 @@ auto GpgFrontend::GpgKeyManager::RevSign( return true; } -auto GpgFrontend::GpgKeyManager::SetExpire( - const GpgFrontend::GpgKey& key, std::unique_ptr& subkey, - std::unique_ptr& expires) -> bool { - using namespace boost::posix_time; - +auto GpgFrontend::GpgKeyManager::SetExpire(const GpgFrontend::GpgKey& key, + std::unique_ptr& subkey, + std::unique_ptr& expires) + -> bool { unsigned long expires_time = 0; - if (expires != nullptr) expires_time = to_time_t(ptime(*expires)); + if (expires != nullptr) expires_time = expires->toSecsSinceEpoch(); const char* sub_fprs = nullptr; @@ -191,7 +186,7 @@ auto GpgFrontend::GpgKeyManager::interactor_cb_fnc(void* handle, const char* status, const char* args, int fd) -> gpgme_error_t { - auto handle_struct = static_cast(handle); + auto* handle_struct = static_cast(handle); QString status_s = status; QString args_s = args; GF_CORE_LOG_DEBUG( -- cgit v1.2.3