diff options
author | saturneric <[email protected]> | 2024-11-30 21:15:56 +0000 |
---|---|---|
committer | saturneric <[email protected]> | 2024-11-30 21:15:56 +0000 |
commit | d027dfaefb9497452d6b1d8dc406622afa45a84d (patch) | |
tree | f511423dfe3af5dc51ac61fff843a6a2ea2611ef | |
parent | feat: improve icons and padding (diff) | |
download | GpgFrontend-d027dfaefb9497452d6b1d8dc406622afa45a84d.tar.gz GpgFrontend-d027dfaefb9497452d6b1d8dc406622afa45a84d.zip |
fix: getting gpg-agent to start automatically on macOS
-rw-r--r-- | src/core/function/gpg/GpgAdvancedOperator.cpp | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/src/core/function/gpg/GpgAdvancedOperator.cpp b/src/core/function/gpg/GpgAdvancedOperator.cpp index a742b60a..4a373f0a 100644 --- a/src/core/function/gpg/GpgAdvancedOperator.cpp +++ b/src/core/function/gpg/GpgAdvancedOperator.cpp @@ -120,20 +120,23 @@ void GpgFrontend::GpgAdvancedOperator::RestartGpgComponents() { FLOG_D("gpgconf --kill --all execute result: %d", success); if (!success) { - FLOG_W("restart all component after core initilized failed"); + FLOG_W("restart all component after core initalized failed"); Module::UpsertRTValue( "core", "gpg_advanced_operator.restart_gpg_components", false); return; } - // StartGpgAgent([](int err, DataObjectPtr) { - // if (err >= 0) { - // Module::UpsertRTValue( - // "core", "gpg_advanced_operator.restart_gpg_components", - // true); - // return; - // } - // }); +#if defined(__APPLE__) && defined(__MACH__) + FLOG_I("getting gpg-agent to start automatically on macOS"); +#else + StartGpgAgent([](int err, DataObjectPtr) { + if (err >= 0) { + Module::UpsertRTValue( + "core", "gpg_advanced_operator.restart_gpg_components", true); + return; + } + }); +#endif }}); } @@ -176,7 +179,7 @@ void GpgFrontend::GpgAdvancedOperator::StartGpgAgent(OperationCallback cb) { GpgFrontend::GpgCommandExecutor::ExecuteSync( {gpg_agent_path, QStringList{"--homedir", home_path, "--daemon"}, [=](int exit_code, const QString &, const QString &) { - FLOG_D("gpgconf daemon exit code: %d", exit_code); + FLOG_D("gpg-agent daemon exit code: %d", exit_code); cb(exit_code >= 0 ? 0 : -1, TransferParams()); }}); } |