diff options
author | saturneric <[email protected]> | 2024-01-22 12:47:00 +0000 |
---|---|---|
committer | saturneric <[email protected]> | 2024-01-22 14:00:29 +0000 |
commit | 4133b5cc1abf297f0e2a85799ed02c8b88c4215a (patch) | |
tree | daafee46e61fbce3357a202ca2256e2397a1ba10 | |
parent | doc: add spdlog as dependencies to README (diff) | |
download | GpgFrontend-4133b5cc1abf297f0e2a85799ed02c8b88c4215a.tar.gz GpgFrontend-4133b5cc1abf297f0e2a85799ed02c8b88c4215a.zip |
fix: QStringList is not equal to QList<QVector>
5 files changed, 23 insertions, 33 deletions
diff --git a/src/core/function/gpg/GpgAdvancedOperator.cpp b/src/core/function/gpg/GpgAdvancedOperator.cpp index 8b60003c..3fc831ed 100644 --- a/src/core/function/gpg/GpgAdvancedOperator.cpp +++ b/src/core/function/gpg/GpgAdvancedOperator.cpp @@ -48,8 +48,7 @@ void GpgFrontend::GpgAdvancedOperator::ClearGpgPasswordCache( } GpgFrontend::GpgCommandExecutor::ExecuteSync( - {gpgconf_path, - {"--reload", "gpg-agent"}, + {gpgconf_path, QStringList{"--reload", "gpg-agent"}, [=](int exit_code, const QString & /*p_out*/, const QString & /*p_err*/) { GF_CORE_LOG_DEBUG("gpgconf reload exit code: {}", exit_code); @@ -70,8 +69,7 @@ void GpgFrontend::GpgAdvancedOperator::ReloadGpgComponents( } GpgFrontend::GpgCommandExecutor::ExecuteSync( - {gpgconf_path, - {"--reload"}, + {gpgconf_path, QStringList{"--reload"}, [=](int exit_code, const QString &, const QString &) { GF_CORE_LOG_DEBUG("gpgconf reload exit code: {}", exit_code); cb(exit_code == 0 ? 0 : -1, TransferParams()); @@ -89,8 +87,7 @@ void GpgFrontend::GpgAdvancedOperator::RestartGpgComponents() { } GpgFrontend::GpgCommandExecutor::ExecuteSync( - {gpgconf_path, - {"--verbose", "--kill", "all"}, + {gpgconf_path, QStringList{"--verbose", "--kill", "all"}, [=](int exit_code, const QString &p_out, const QString &p_err) { GF_CORE_LOG_DEBUG("gpgconf --kill all command got exit code: {}", exit_code); @@ -134,8 +131,7 @@ void GpgFrontend::GpgAdvancedOperator::ResetConfigures(OperationCallback cb) { } GpgFrontend::GpgCommandExecutor::ExecuteSync( - {gpgconf_path, - {"--apply-defaults"}, + {gpgconf_path, QStringList{"--apply-defaults"}, [=](int exit_code, const QString &, const QString &) { GF_CORE_LOG_DEBUG("gpgconf apply-defaults exit code: {}", exit_code); cb(exit_code == 0 ? 0 : -1, TransferParams()); @@ -160,8 +156,7 @@ void GpgFrontend::GpgAdvancedOperator::StartGpgAgent(OperationCallback cb) { } GpgFrontend::GpgCommandExecutor::ExecuteSync( - {gpg_agent_path, - {"--homedir", home_path, "--daemon"}, + {gpg_agent_path, QStringList{"--homedir", home_path, "--daemon"}, [=](int exit_code, const QString &, const QString &) { GF_CORE_LOG_DEBUG("gpgconf daemon exit code: {}", exit_code); cb(exit_code >= 0 ? 0 : -1, TransferParams()); @@ -186,8 +181,7 @@ void GpgFrontend::GpgAdvancedOperator::StartDirmngr(OperationCallback cb) { } GpgFrontend::GpgCommandExecutor::ExecuteSync( - {dirmngr_path, - {"--homedir", home_path, "--daemon"}, + {dirmngr_path, QStringList{"--homedir", home_path, "--daemon"}, [=](int exit_code, const QString &, const QString &) { GF_CORE_LOG_DEBUG("gpgconf daemon exit code: {}", exit_code); cb(exit_code >= 0 ? 0 : -1, TransferParams()); @@ -212,8 +206,7 @@ void GpgFrontend::GpgAdvancedOperator::StartKeyBoxd(OperationCallback cb) { } GpgFrontend::GpgCommandExecutor::ExecuteSync( - {keyboxd_path, - {"--homedir", home_path, "--daemon"}, + {keyboxd_path, QStringList{"--homedir", home_path, "--daemon"}, [=](int exit_code, const QString &, const QString &) { GF_CORE_LOG_DEBUG("gpgconf daemon exit code: {}", exit_code); cb(exit_code >= 0 ? 0 : -1, TransferParams()); diff --git a/src/core/function/gpg/GpgCommandExecutor.cpp b/src/core/function/gpg/GpgCommandExecutor.cpp index 8c994515..6d24f9bd 100644 --- a/src/core/function/gpg/GpgCommandExecutor.cpp +++ b/src/core/function/gpg/GpgCommandExecutor.cpp @@ -156,15 +156,6 @@ auto BuildTaskFromExecCtx(const GpgCommandExecutor::ExecuteContext &context) std::move(result_callback)); } -GpgCommandExecutor::ExecuteContext::ExecuteContext( - QString cmd, QList<QString> arguments, GpgCommandExecutorCallback callback, - Module::TaskRunnerPtr task_runner, GpgCommandExecutorInteractor int_func) - : cmd(std::move(cmd)), - arguments(std::move(arguments)), - cb_func(std::move(callback)), - int_func(std::move(int_func)), - task_runner(std::move(task_runner)) {} - void GpgCommandExecutor::ExecuteSync(ExecuteContext context) { Thread::Task *task = BuildTaskFromExecCtx(context); @@ -247,4 +238,13 @@ void GpgCommandExecutor::ExecuteConcurrentlySync(ExecuteContexts contexts) { looper.exec(); } +GpgCommandExecutor::ExecuteContext::ExecuteContext( + QString cmd, QStringList arguments, GpgCommandExecutorCallback callback, + Module::TaskRunnerPtr task_runner, GpgCommandExecutorInteractor int_func) + : cmd(std::move(cmd)), + arguments(std::move(arguments)), + cb_func(std::move(callback)), + int_func(std::move(int_func)), + task_runner(std::move(task_runner)) {} + } // namespace GpgFrontend
\ No newline at end of file diff --git a/src/core/function/gpg/GpgKeyOpera.cpp b/src/core/function/gpg/GpgKeyOpera.cpp index 5f8daf81..118f4784 100644 --- a/src/core/function/gpg/GpgKeyOpera.cpp +++ b/src/core/function/gpg/GpgKeyOpera.cpp @@ -111,8 +111,8 @@ void GpgKeyOpera::GenerateRevokeCert(const GpgKey& key, // get all components GpgCommandExecutor::ExecuteSync( {app_path, - {"--command-fd", "0", "--status-fd", "1", "--no-tty", "-o", output_path, - "--gen-revoke", key.GetFingerprint()}, + QStringList{"--command-fd", "0", "--status-fd", "1", "--no-tty", "-o", + output_path, "--gen-revoke", key.GetFingerprint()}, [=](int exit_code, const QString& p_out, const QString& p_err) { if (exit_code != 0) { GF_CORE_LOG_ERROR( diff --git a/src/module/integrated/gnupg_info_gathering_module/GnuPGInfoGatheringModule.cpp b/src/module/integrated/gnupg_info_gathering_module/GnuPGInfoGatheringModule.cpp index 91bf93f5..c974ec2a 100644 --- a/src/module/integrated/gnupg_info_gathering_module/GnuPGInfoGatheringModule.cpp +++ b/src/module/integrated/gnupg_info_gathering_module/GnuPGInfoGatheringModule.cpp @@ -100,8 +100,7 @@ auto GnuPGInfoGatheringModule::Exec(EventRefrernce event) -> int { // get all components GpgCommandExecutor::ExecuteSync( - {gpgconf_path, - {"--list-components"}, + {gpgconf_path, QStringList{"--list-components"}, [this, gpgme_version, gpgconf_path](int exit_code, const QString &p_out, const QString &p_err) { MODULE_LOG_DEBUG( @@ -212,8 +211,7 @@ auto GnuPGInfoGatheringModule::Exec(EventRefrernce event) -> int { GpgCommandExecutor::ExecuteContexts exec_contexts; exec_contexts.emplace_back(GpgCommandExecutor::ExecuteContext{ - gpgconf_path, - {"--list-dirs"}, + gpgconf_path, QStringList{"--list-dirs"}, [this](int exit_code, const QString &p_out, const QString &p_err) { MODULE_LOG_DEBUG( "gpgconf configurations exit_code: {} process stdout size: {}", @@ -277,8 +275,7 @@ auto GnuPGInfoGatheringModule::Exec(EventRefrernce event) -> int { } exec_contexts.emplace_back(GpgCommandExecutor::ExecuteContext{ - gpgconf_path, - {"--list-options", component_info.name}, + gpgconf_path, QStringList{"--list-options", component_info.name}, [this, component_info](int exit_code, const QString &p_out, const QString &p_err) { MODULE_LOG_DEBUG( diff --git a/src/ui/function/GenerateRevokeCertification.cpp b/src/ui/function/GenerateRevokeCertification.cpp index b1089d45..b4a6c934 100644 --- a/src/ui/function/GenerateRevokeCertification.cpp +++ b/src/ui/function/GenerateRevokeCertification.cpp @@ -44,8 +44,8 @@ auto GenerateRevokeCertification::Exec(const GpgKey& key, // get all components GpgCommandExecutor::ExecuteSync( {app_path, - {"--command-fd", "0", "--status-fd", "1", "--no-tty", "-o", - std::move(output_path), "--gen-revoke", key.GetFingerprint()}, + QStringList{"--command-fd", "0", "--status-fd", "1", "--no-tty", "-o", + output_path, "--gen-revoke", key.GetFingerprint()}, [=](int exit_code, const QString& p_out, const QString& p_err) { if (exit_code != 0) { GF_UI_LOG_ERROR( |