Uploaded image for project: 'Qt Mobility'
  1. Qt Mobility
  2. QTMOBILITY-1709

Symbian Settings Layer doesn't support "real" type Central Repository keys

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Invalid
    • Icon: Not Evaluated Not Evaluated
    • None
    • 1.2.x
    • Publish & Subscribe
    • 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));
                  }
      

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            satu.m.makela satu makela
            ahaapane Aapo Haapanen (closed Nokia identity) (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes