qtcontactsmobility/plugins/contacts/symbian/src/transform/cnttransformringtone.cpp
changeset 31 2a11b5b00470
parent 27 de1630741fbe
equal deleted inserted replaced
27:de1630741fbe 31:2a11b5b00470
    69 
    69 
    70 QContactDetail *CntTransformRingtone::transformItemField(const CContactItemField& field, const QContact &contact)
    70 QContactDetail *CntTransformRingtone::transformItemField(const CContactItemField& field, const QContact &contact)
    71 {
    71 {
    72     QContactRingtone *ringtone = new QContactRingtone(contact.detail<QContactRingtone>());
    72     QContactRingtone *ringtone = new QContactRingtone(contact.detail<QContactRingtone>());
    73 
    73 
    74     // XXX ringtone can have multiple values from different fields glommed together
       
    75 	CContactTextField* storage = field.TextStorage();
    74 	CContactTextField* storage = field.TextStorage();
    76     QString ringtoneString = QString::fromUtf16(storage->Text().Ptr(), storage->Text().Length());
    75     QString ringtoneString = QString::fromUtf16(storage->Text().Ptr(), storage->Text().Length());
    77 
    76 
    78     if (field.ContentType().ContainsFieldType(KUidContactFieldRingTone)) {
    77     if (field.ContentType().ContainsFieldType(KUidContactFieldRingTone)) {
    79         ringtone->setAudioRingtoneUrl(ringtoneString);
    78         ringtone->setAudioRingtoneUrl(ringtoneString);
    80 	}
    79 	}
    81     else if (field.ContentType().ContainsFieldType(KUidContactFieldVideoRingTone)) {
    80     else if (field.ContentType().ContainsFieldType(KUidContactFieldVideoRingTone)) {
    82         ringtone->setVideoRingtoneUrl(ringtoneString);
    81         ringtone->setVideoRingtoneUrl(ringtoneString);
    83     }
    82     }
    84 
       
    85     // XXX need to remove old one somehow
       
    86 
    83 
    87     return ringtone;
    84     return ringtone;
    88 }
    85 }
    89 
    86 
    90 bool CntTransformRingtone::supportsField(TUint32 fieldType) const
    87 bool CntTransformRingtone::supportsField(TUint32 fieldType) const
   119  * \a subType The subtype to be checked
   116  * \a subType The subtype to be checked
   120  * \return True if this subtype is supported
   117  * \return True if this subtype is supported
   121  */
   118  */
   122 bool CntTransformRingtone::supportsSubType(const QString& /*subType*/) const
   119 bool CntTransformRingtone::supportsSubType(const QString& /*subType*/) const
   123 {
   120 {
   124     // XXX todo
       
   125     return false;
   121     return false;
   126 }
   122 }
   127 
   123 
   128 /*!
   124 /*!
   129  * Returns the filed id corresponding to a field
   125  * Returns the filed id corresponding to a field
   130  *
   126  *
   131  * \a fieldName The name of the supported field
   127  * \a fieldName The name of the supported field
   132  * \return fieldId for the fieldName, 0  if not supported
   128  * \return fieldId for the fieldName, 0  if not supported
   133  */
   129  */
   134 quint32 CntTransformRingtone::getIdForField(const QString& /*fieldName*/) const
   130 quint32 CntTransformRingtone::getIdForField(const QString& fieldName) const
   135 {
   131 {
   136     // XXX todo
   132     if (QContactRingtone::FieldAudioRingtoneUrl == fieldName)
   137     return 0;
   133         return 0;
       
   134     else if (QContactRingtone::FieldVideoRingtoneUrl == fieldName)
       
   135         return 0;
       
   136     else
       
   137         return 0;
   138 }
   138 }
   139 
   139 
   140 /*!
   140 /*!
   141  * Modifies the detail definitions. The default detail definitions are
   141  * Modifies the detail definitions. The default detail definitions are
   142  * queried from QContactManagerEngine::schemaDefinitions and then modified
   142  * queried from QContactManagerEngine::schemaDefinitions and then modified