/*! * Modifies the detail definitions. The default detail definitions are * queried from QContactManagerEngine::schemaDefinitions and then modified * with this function in the transform leaf classes. * * \a definitions The detail definitions to modify. * \a contactType The contact type the definitions apply for. */ void CntTransformAnniversarySimple::detailDefinitions(QMap<QString, QContactDetailDefinition> &definitions, const QString& contactType) const { Q_UNUSED(contactType); if(definitions.contains(QContactAnniversary::DefinitionName)) { QContactDetailDefinition d = definitions.value(QContactAnniversary::DefinitionName); QMap<QString, QContactDetailFieldDefinition> fields = d.fields(); // Following fields not supported in symbian (pre-10.1) back-end, remove fields.remove(QContactAnniversary::FieldCalendarId); fields.remove(QContactAnniversary::FieldEvent); // Sub-types not supported in symbian back-end, remove fields.remove(QContactAnniversary::FieldSubType); // Context not supported in symbian back-end, remove fields.remove(QContactAnniversary::FieldContext); d.setFields(fields); d.setUnique(true); // Replace original definitions definitions.insert(d.name(), d); } }
/*! * Modifies the detail definitions. The default detail definitions are * queried from QContactManagerEngine::schemaDefinitions and then modified * with this function in the transform leaf classes. * * \a definitions The detail definitions to modify. * \a contactType The contact type the definitions apply for. */ void CntTransformName::detailDefinitions(QMap<QString, QContactDetailDefinition> &definitions, const QString& contactType) const { if(definitions.contains(QContactName::DefinitionName)) { QContactDetailDefinition d = definitions.value(QContactName::DefinitionName); QMap<QString, QContactDetailFieldDefinition> fields = d.fields(); // groups support only custom label if(contactType == QContactType::TypeGroup) { fields.remove(QContactName::FieldPrefix); fields.remove(QContactName::FieldFirstName); fields.remove(QContactName::FieldMiddleName); fields.remove(QContactName::FieldLastName); fields.remove(QContactName::FieldSuffix); } else { // Note: Custom labels cannot be enabled for a contact in pre-10.1 // platforms because setting custom label for a contact causes // issues for S60 Phonebook editor. If custom label support is // needed in 10.1 or later, it needs to be variated away from // pre-10.1 platforms. #ifndef SYMBIAN_BACKEND_USE_CNTMODEL_V2 fields.remove(QContactName::FieldCustomLabel); #endif } // Context not supported in symbian back-end, remove fields.remove(QContactName::FieldContext); d.setFields(fields); d.setUnique(true); // Replace original definitions definitions.insert(d.name(), d); } }
/*! * Modifies the detail definitions. The default detail definitions are * queried from QContactManagerEngine::schemaDefinitions and then modified * with this function in the transform leaf classes. * * \a definitions The detail definitions to modify. * \a contactType The contact type the definitions apply for. */ void CntTransformGender::detailDefinitions(QMap<QString, QContactDetailDefinition> &definitions, const QString& contactType) const { Q_UNUSED(contactType); if(definitions.contains(QContactGender::DefinitionName)) { QContactDetailDefinition d = definitions.value(QContactGender::DefinitionName); QMap<QString, QContactDetailFieldDefinition> fields = d.fields(); // Context not supported in symbian back-end, remove fields.remove(QContactGender::FieldContext); d.setFields(fields); d.setUnique(true); // Replace original definitions definitions.insert(d.name(), d); } }
/*! * Modifies the detail definitions. The default detail definitions are * queried from QContactManagerEngine::schemaDefinitions and then modified * with this function in the transform leaf classes. * * \a definitions The detail definitions to modify. * \a contactType The contact type the definitions apply for. */ void CntTransformFamily::detailDefinitions(QMap<QString, QContactDetailDefinition> &definitions, const QString& contactType) const { Q_UNUSED(contactType); // Note: Family is not defined in the default schema QMap<QString, QContactDetailFieldDefinition> fields; QContactDetailFieldDefinition f; QContactDetailDefinition d; d.setName(QContactFamily::DefinitionName); f.setDataType(QVariant::String); f.setAllowableValues(QVariantList()); fields.insert(QContactFamily::FieldSpouse, f); f.setDataType(QVariant::StringList); fields.insert(QContactFamily::FieldChildren, f); d.setFields(fields); d.setUnique(true); definitions.insert(d.name(), d); }
/*! * Returns a map of identifier to detail definition which are valid for contacts whose type is the given \a contactType * which are valid for the contacts in this store */ QMap<QString, QContactDetailDefinition> CntSymbianSimEngine::detailDefinitions(const QString& contactType, QContactManager::Error* error) const { if (!supportedContactTypes().contains(contactType)) { // Should never happen *error = QContactManager::NotSupportedError; return QMap<QString, QContactDetailDefinition>(); } // Get store information SimStoreInfo storeInfo = d->m_simStore->storeInfo(); // the map we will eventually return QMap<QString, QContactDetailDefinition> retn; // local variables for reuse QMap<QString, QContactDetailFieldDefinition> fields; QContactDetailFieldDefinition f; QContactDetailDefinition def; QVariantList subTypes; // sync target def.setName(QContactSyncTarget::DefinitionName); fields.clear(); f.setDataType(QVariant::String); subTypes.clear(); subTypes << QString(QLatin1String(KSimSyncTarget)); f.setAllowableValues(subTypes); fields.insert(QContactSyncTarget::FieldSyncTarget, f); def.setFields(fields); def.setUnique(true); retn.insert(def.name(), def); // type def.setName(QContactType::DefinitionName); fields.clear(); f.setDataType(QVariant::String); subTypes.clear(); // groups are not supported subTypes << QString(QLatin1String(QContactType::TypeContact)); f.setAllowableValues(subTypes); fields.insert(QContactType::FieldType, f); // note: NO CONTEXT!! def.setFields(fields); def.setUnique(true); retn.insert(def.name(), def); /* TODO // guid def.setName(QContactGuid::DefinitionName); fields.clear(); f.setDataType(QVariant::String); f.setAllowableValues(QVariantList()); fields.insert(QContactGuid::FieldGuid, f); f.setDataType(QVariant::StringList); f.setAllowableValues(contexts); fields.insert(QContactDetail::FieldContext, f); def.setFields(fields); def.setUnique(false); def.setAccessConstraint(QContactDetailDefinition::CreateOnly); retn.insert(def.name(), def); */ // display label def.setName(QContactDisplayLabel::DefinitionName); fields.clear(); f.setDataType(QVariant::String); f.setAllowableValues(QVariantList()); fields.insert(QContactDisplayLabel::FieldLabel, f); def.setFields(fields); def.setUnique(true); retn.insert(def.name(), def); // email support needs to be checked run-time, because it is SIM specific if (storeInfo.m_emailSupported) { def.setName(QContactEmailAddress::DefinitionName); fields.clear(); f.setDataType(QVariant::String); f.setAllowableValues(QVariantList()); fields.insert(QContactEmailAddress::FieldEmailAddress, f); def.setFields(fields); def.setUnique(true); retn.insert(def.name(), def); } // phone number def.setName(QContactPhoneNumber::DefinitionName); fields.clear(); f.setDataType(QVariant::String); f.setAllowableValues(QVariantList()); fields.insert(QContactPhoneNumber::FieldNumber, f); // TODO: subtypes supported in case a sim contact can have multiple phone numbers? def.setFields(fields); if (storeInfo.m_additionalNumberSupported) { // multiple numbers supported def.setUnique(false); } else { // only one phone number allowed def.setUnique(true); } retn.insert(def.name(), def); // nickname support needs to be checked run-time, because it is SIM specific if (storeInfo.m_secondNameSupported) { def.setName(QContactNickname::DefinitionName); fields.clear(); f.setDataType(QVariant::String); f.setAllowableValues(QVariantList()); fields.insert(QContactNickname::FieldNickname, f); def.setFields(fields); def.setUnique(true); retn.insert(def.name(), def); } // name def.setName(QContactName::DefinitionName); fields.clear(); f.setDataType(QVariant::String); f.setAllowableValues(QVariantList()); fields.insert(QContactName::FieldCustomLabel, f); def.setFields(fields); def.setUnique(true); retn.insert(def.name(), def); return retn; }