aboutsummaryrefslogtreecommitdiffstats
path: root/src/core/struct/cache_object/AllFavoriteKeyPairsCO.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/struct/cache_object/AllFavoriteKeyPairsCO.h')
-rw-r--r--src/core/struct/cache_object/AllFavoriteKeyPairsCO.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/core/struct/cache_object/AllFavoriteKeyPairsCO.h b/src/core/struct/cache_object/AllFavoriteKeyPairsCO.h
index 1086e2e6..61875f1c 100644
--- a/src/core/struct/cache_object/AllFavoriteKeyPairsCO.h
+++ b/src/core/struct/cache_object/AllFavoriteKeyPairsCO.h
@@ -60,6 +60,7 @@ struct AllFavoriteKeyPairsCO {
[[nodiscard]] auto ToJson() const -> QJsonObject {
QJsonObject j;
auto j_key_dbs = QJsonArray();
+#if QT_VERSION >= QT_VERSION_CHECK(6, 4, 0)
for (const auto& k : key_dbs.asKeyValueRange()) {
QJsonObject o;
o["key_db_name"] = k.first;
@@ -69,6 +70,17 @@ struct AllFavoriteKeyPairsCO {
j["key_dbs"] = j_key_dbs;
return j;
}
+#else
+ for (auto it = key_dbs.keyValueBegin(); it != key_dbs.keyValueEnd(); ++it) {
+ QJsonObject o;
+ o["key_db_name"] = it->first;
+ o["key_db"] = it->second.ToJson();
+ j_key_dbs.append(o);
+ }
+ j["key_dbs"] = j_key_dbs;
+ return j;
+ }
+#endif
};
} // namespace GpgFrontend \ No newline at end of file