aboutsummaryrefslogtreecommitdiffstats
path: root/src/ui/thread/KeyServerImportTask.cpp
diff options
context:
space:
mode:
authorsaturneric <[email protected]>2024-01-15 09:22:32 +0000
committersaturneric <[email protected]>2024-01-15 09:22:32 +0000
commit6c632d70b391f8b317c68f7db8cfd217f9370995 (patch)
tree4136eb7164d9f910527c0392d12bd4854a2fdcff /src/ui/thread/KeyServerImportTask.cpp
parentrefactor: remove boost and use QString instead of std::filesystem::path (diff)
downloadGpgFrontend-6c632d70b391f8b317c68f7db8cfd217f9370995.tar.gz
GpgFrontend-6c632d70b391f8b317c68f7db8cfd217f9370995.zip
feat: use qt json support components in data object and infos gathering module
Diffstat (limited to 'src/ui/thread/KeyServerImportTask.cpp')
-rw-r--r--src/ui/thread/KeyServerImportTask.cpp24
1 files changed, 3 insertions, 21 deletions
diff --git a/src/ui/thread/KeyServerImportTask.cpp b/src/ui/thread/KeyServerImportTask.cpp
index 4e8a41db..cf5c6263 100644
--- a/src/ui/thread/KeyServerImportTask.cpp
+++ b/src/ui/thread/KeyServerImportTask.cpp
@@ -30,6 +30,7 @@
#include "core/function/gpg/GpgKeyImportExporter.h"
#include "ui/struct/SettingsObject.h"
+#include "ui/struct/settings/KeyServerSO.h"
GpgFrontend::UI::KeyServerImportTask::KeyServerImportTask(
QString keyserver_url, std::vector<QString> keyids)
@@ -40,27 +41,8 @@ GpgFrontend::UI::KeyServerImportTask::KeyServerImportTask(
HoldOnLifeCycle(true);
if (keyserver_url_.isEmpty()) {
- try {
- SettingsObject key_server_json("key_server");
- const auto key_server_list =
- key_server_json.Check("server_list", nlohmann::json::array());
-
- size_t const default_key_server_index =
- key_server_json.Check("default_server", 0);
- if (default_key_server_index >= key_server_list.size()) {
- throw std::runtime_error("default_server index out of range");
- }
- auto default_key_server =
- key_server_list[default_key_server_index].get<std::string>();
-
- keyserver_url_ = QString::fromStdString(default_key_server);
- } catch (...) {
- GF_UI_LOG_ERROR("setting operation error", "server_list",
- "default_server");
- keyserver_url_ = "https://keys.openpgp.org";
- return;
- }
-
+ KeyServerSO key_server(SettingsObject("general_settings_state"));
+ keyserver_url_ = key_server.GetTargetServer();
GF_UI_LOG_DEBUG("key server import task sets key server url: {}",
keyserver_url_);
}