Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TIMOB-12879] Fixed Ti.App.Properties #240

Merged
merged 1 commit into from
May 22, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
21 changes: 19 additions & 2 deletions src/tibb/src/Modules/App/TiAppPropertiesModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,13 @@ QMap<QString, Ti::TiValue> TiAppPropertiesModule::createMapFromQVariant(QVariant
map.insert(key, newVal);
break;
}
case QVariant::Map:
{
Ti::TiValue newVal;
newVal.setMap(createMapFromQVariant(current.toMap()));
map.insert(key, newVal);
break;
}
default:
{
Ti::TiValue newVal;
Expand Down Expand Up @@ -159,6 +166,13 @@ QList<Ti::TiValue> TiAppPropertiesModule::createListFromQVariant(QVariant val)
list.append(newVal);
break;
}
case QVariant::Map:
{
Ti::TiValue newVal;
newVal.setMap(createMapFromQVariant(current.toMap()));
list.append(newVal);
break;
}
default:
{
Ti::TiValue newVal;
Expand Down Expand Up @@ -267,6 +281,10 @@ void TiAppPropertiesModule::setProp(Ti::TiValue value, PropertyType type)
Ti::TiValue key = values.at(0);
Ti::TiValue prop = values.at(1);

if(prop.isNull() || prop.isUndefined()) {
setProp(key, TiAppPropertiesModule::RemoveProperty);
return;
}
settings.setValue(key.toString(), convertTiValueToQVariant(prop, type));
}

Expand Down Expand Up @@ -297,7 +315,6 @@ Ti::TiValue TiAppPropertiesModule::getProp(Ti::TiValue value, PropertyType type)
{
if(prop.isValid())
{
settings.setValue(key, prop);
return convertQVariantToTiValue(prop, type);
}
QSettings defaultSettings("app/native/_private_assets_/app_properties.ini", QSettings::IniFormat);
Expand All @@ -307,7 +324,7 @@ Ti::TiValue TiAppPropertiesModule::getProp(Ti::TiValue value, PropertyType type)
}
}
Ti::TiValue val;
val.setUndefined();
val.setNull();
return val;
}

Expand Down