34 int default_server = 0;
35 QStringList server_list;
40 if (
const auto v = j[
"default_server"]; v.isDouble()) {
41 default_server = v.toInt();
44 if (
const auto v = j[
"server_list"]; v.isArray()) {
45 const QJsonArray j_array = v.toArray();
46 server_list.reserve(j_array.size());
47 for (
const auto& server : j_array) {
48 server_list.append(server.toString());
52 if (server_list.empty()) ResetDefaultServerList();
55 auto ToJson() -> QJsonObject {
57 j[
"default_server"] = default_server;
58 auto j_array = QJsonArray();
60 for (
const auto& s : server_list) {
63 j[
"server_list"] = j_array;
67 auto GetTargetServer() -> QString {
68 if (server_list.empty()) this->ResetDefaultServerList();
69 if (default_server >= server_list.size()) default_server = 0;
70 return server_list[default_server];
73 void ResetDefaultServerList() {
74 server_list <<
"https://keyserver.ubuntu.com"
75 <<
"https://keys.openpgp.org";
Definition: FileReadTask.cpp:31
Definition: KeyServerSO.h:33