1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-30 05:02:26 -05:00

Export default value for keys not found in preference storage

This commit is contained in:
cketti 2011-10-26 05:13:22 +02:00
parent afd355f83c
commit ae465789b7

View File

@ -168,8 +168,8 @@ public class SettingsExporter {
Map<String, Object> prefs) throws IOException {
for (String key : GlobalSettings.SETTINGS.keySet()) {
String valueString = prefs.get(key).toString();
String valueString = (String) prefs.get(key);
if (valueString != null) {
try {
SettingsDescription setting = GlobalSettings.SETTINGS.get(key);
Object value = setting.fromString(valueString);
@ -179,6 +179,17 @@ public class SettingsExporter {
Log.w(K9.LOG_TAG, "Global setting \"" + key + "\" has invalid value \"" +
valueString + "\" in preference storage. This shouldn't happen!");
}
} else {
if (K9.DEBUG) {
Log.d(K9.LOG_TAG, "Couldn't find key \"" + key + "\" in preference storage." +
"Using default value.");
}
SettingsDescription setting = GlobalSettings.SETTINGS.get(key);
Object value = setting.getDefaultValue();
String outputValue = setting.toPrettyString(value);
writeKeyValue(serializer, key, outputValue);
}
}
}