Skip to content

Commit

Permalink
Merge pull request #240 from pec1985/timob-12879
Browse files Browse the repository at this point in the history
[TIMOB-12879] Fixed Ti.App.Properties
  • Loading branch information
pec1985 committed May 22, 2014
2 parents 18733ad + c0ea7cc commit 89cec62
Showing 1 changed file with 19 additions and 2 deletions.
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

0 comments on commit 89cec62

Please sign in to comment.