From 74d17a094f0a190c3aa080143e02c4f5ad6b0434 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Wed, 23 Jul 2014 11:47:56 -0700 Subject: [PATCH] tweaks to string default handling in DomainServerSettingsManager --- .../src/DomainServerSettingsManager.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/domain-server/src/DomainServerSettingsManager.cpp b/domain-server/src/DomainServerSettingsManager.cpp index f9996aa0e7..0520426ea8 100644 --- a/domain-server/src/DomainServerSettingsManager.cpp +++ b/domain-server/src/DomainServerSettingsManager.cpp @@ -145,7 +145,12 @@ void DomainServerSettingsManager::recurseJSONObjectAndOverwriteSettings(const QJ // we don't continue if this key is not present in our descriptionObject if (descriptionObject.contains(key)) { if (rootValue.isString()) { - settingsVariant[key] = rootValue.toString(); + if (rootValue.toString().isEmpty()) { + // this is an empty value, clear it in settings variant so the default is sent + settingsVariant.remove(key); + } else { + settingsVariant[key] = rootValue.toString(); + } } else if (rootValue.isBool()) { settingsVariant[key] = rootValue.toBool(); } else if (rootValue.isObject()) { @@ -158,9 +163,16 @@ void DomainServerSettingsManager::recurseJSONObjectAndOverwriteSettings(const QJ settingsVariant[key] = QVariantMap(); } + QVariantMap& thisMap = *reinterpret_cast(settingsVariant[key].data()); + recurseJSONObjectAndOverwriteSettings(rootValue.toObject(), - *reinterpret_cast(settingsVariant[key].data()), + thisMap, nextDescriptionObject[DESCRIPTION_SETTINGS_KEY].toObject()); + + if (thisMap.isEmpty()) { + // we've cleared all of the settings below this value, so remove this one too + settingsVariant.remove(key); + } } } }