From 813c8e3fe0da9ee3b46fff1618d3e4ed05f2c429 Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Thu, 3 Sep 2020 22:32:33 +0200 Subject: SyndData::parseJson: use fromJson() ...instead of a complicated explicit code converting from JSON to varianthash to hash. --- lib/syncdata.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'lib/syncdata.cpp') diff --git a/lib/syncdata.cpp b/lib/syncdata.cpp index a9ec5ee7..e6472e18 100644 --- a/lib/syncdata.cpp +++ b/lib/syncdata.cpp @@ -182,12 +182,8 @@ void SyncData::parseJson(const QJsonObject& json, const QString& baseDir) accountData = load(json, "account_data"_ls); toDeviceEvents = load(json, "to_device"_ls); - auto deviceOneTimeKeysCountVariantHash = - json.value("device_one_time_keys_count"_ls).toObject().toVariantHash(); - for (auto key : deviceOneTimeKeysCountVariantHash.keys()) { - deviceOneTimeKeysCount_.insert( - key, deviceOneTimeKeysCountVariantHash.value(key).toInt()); - } + fromJson(json.value("device_one_time_keys_count"_ls), + deviceOneTimeKeysCount_); auto rooms = json.value("rooms"_ls).toObject(); JoinStates::Int ii = 1; // ii is used to make a JoinState value -- cgit v1.2.3