-
Bug
-
Resolution: Invalid
-
Not Evaluated
-
None
-
1.2.x
-
None
It is not possible to write into "real" type Central Repository keys using QValueSpacePublisher. Trying to write anything to such a key fails. Symbian Settings Layer only supports native integer and bytearray types. All other types are serialized into a bytearray. Trying to write wrong type into a Central Repository key fails in native Symbian CRepository API.
XQSettingsManager does support reals, so adding the support to Symbian Settings Layer would be quite simple. Just by not serializing doubles into bytearray, XQSettingsLayer will try to store the value as native "real" type.
Original code:
bool SymbianSettingsLayer::setValue ... if (data.type() == QVariant::Int || data.type() == QVariant::ByteArray) { //Write integers and bytearrays as such success = m_settingsManager.writeItemValue(settingsKey, data); } else { //Write other data types serialized into a bytearray QByteArray byteArray; QDataStream writeStream(&byteArray, QIODevice::WriteOnly); writeStream << data; success = m_settingsManager.writeItemValue(settingsKey, QVariant(byteArray)); }
Fix suggestion:
bool SymbianSettingsLayer::setValue ... if (data.type() == QVariant::Int || data.type() == QVariant::ByteArray || (target == PathMapper::TargetCRepository && data.type() == QVariant::Double)) { //Write integers and bytearrays as such success = m_settingsManager.writeItemValue(settingsKey, data); } else { //Write other data types serialized into a bytearray QByteArray byteArray; QDataStream writeStream(&byteArray, QIODevice::WriteOnly); writeStream << data; success = m_settingsManager.writeItemValue(settingsKey, QVariant(byteArray)); }