williamr@2: /* williamr@2: * Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). williamr@2: * All rights reserved. williamr@2: * This component and the accompanying materials are made available williamr@4: * under the terms of "Eclipse Public License v1.0" williamr@2: * which accompanies this distribution, and is available williamr@4: * at the URL "http://www.eclipse.org/legal/epl-v10.html". williamr@2: * williamr@2: * Initial Contributors: williamr@2: * Nokia Corporation - initial contribution. williamr@2: * williamr@2: * Contributors: williamr@2: * williamr@2: * Description: williamr@2: * Phonebook constant field type information williamr@2: * williamr@2: */ williamr@2: williamr@2: williamr@2: #ifndef __CPbkFieldInfo_H__ williamr@2: #define __CPbkFieldInfo_H__ williamr@2: williamr@2: // INCLUDES williamr@2: #include williamr@2: #include williamr@2: #include "PbkFields.hrh" williamr@2: #include "PbkIconId.hrh" williamr@2: williamr@2: // FORWARD DECLARATIONS williamr@2: class CContentType; williamr@2: class CContactItemField; williamr@2: class CContactItemViewDef; williamr@2: class CContactItemFieldDef; williamr@2: class CPbkFieldsInfo; williamr@2: class TResourceReader; williamr@2: class CPbkFieldInfoGroup; williamr@2: class CPbkFieldImportType; williamr@2: class TPbkContactItemFieldType; williamr@2: class TPbkVcardFieldType; williamr@2: class CPbkUidMap; williamr@2: class TPbkMatchPriorityLevel; williamr@2: williamr@2: // CLASS DECLARATION williamr@2: williamr@2: /** williamr@2: * Phonebook constant field type information. Loaded from resources into williamr@2: * CPbkFieldsInfo array. The corresponding resource structure is PHONEBOOK_FIELD williamr@2: * in PbkFieldInfo.rh. williamr@2: * williamr@2: * @see CPbkFieldsInfo williamr@2: * @see PHONEBOOK_FIELD williamr@2: * @see FIELD williamr@2: */ williamr@2: class CPbkFieldInfo : williamr@2: public CBase williamr@2: { williamr@2: public: // Interface williamr@2: /** williamr@2: * Returns the unique Phonebook field id for this field type. williamr@2: * @return The unique Phonebook field id for this field type. williamr@2: */ williamr@2: IMPORT_C TPbkFieldId FieldId() const; williamr@2: williamr@2: /** williamr@2: * Returns the storage type of this field type. williamr@2: * @return The storage type of this field type. williamr@2: */ williamr@2: IMPORT_C TStorageType FieldStorageType() const; williamr@2: williamr@2: /** williamr@2: * Returns the content type of this field type. williamr@2: * @return The content type of this field type. williamr@2: * @see CContentType williamr@2: */ williamr@2: IMPORT_C const CContentType& ContentType() const; williamr@2: williamr@2: /** williamr@2: * Returns the category of this field type. williamr@2: * @return The category of this field type williamr@2: */ williamr@2: IMPORT_C TInt Category() const; williamr@2: williamr@2: /** williamr@2: * Returns this field type's default label. williamr@2: * @return The field type's default label. williamr@2: */ williamr@2: IMPORT_C const TDesC& FieldName() const; williamr@2: williamr@2: /** williamr@2: * Returns Symbian Contacts Model field flags of this field type. williamr@2: * @return Symbian Contacts model field flags for this field type. williamr@2: */ williamr@2: IMPORT_C TUint Flags() const; williamr@2: williamr@2: /** williamr@2: * Returns the multiplicity allowed for this field type. williamr@2: * @return The multiplicity allowed for this field type. williamr@2: */ williamr@2: IMPORT_C TPbkFieldMultiplicity Multiplicity() const; williamr@2: williamr@2: /** williamr@2: * Returns the maximum data length that Phonebook UI spec specifies williamr@2: * for this field type. williamr@2: * @return The maximum data length that Phonebook UI spec specifies williamr@2: * for this field type. williamr@2: */ williamr@2: IMPORT_C TInt MaxLength() const; williamr@2: williamr@2: /** williamr@2: * Returns the default editing mode for this field type. williamr@2: * @return The default editing mode for this field type. williamr@2: */ williamr@2: IMPORT_C TPbkFieldEditMode EditMode() const; williamr@2: williamr@2: /** williamr@2: * Returns the default character case for this field type. williamr@2: * @return The default character case for this field type. williamr@2: */ williamr@2: IMPORT_C TPbkFieldDefaultCase DefaultCase() const; williamr@2: williamr@2: /** williamr@2: * Returns the icon id for this field type. williamr@2: * @return The icon id for this field type. williamr@2: */ williamr@2: IMPORT_C TPbkIconId IconId() const; williamr@2: williamr@2: /** williamr@2: * Returns the UI control type required to edit this field. williamr@2: * @return The UI control type required to edit this field. williamr@2: */ williamr@2: IMPORT_C TPbkFieldCtrlType CtrlType() const; williamr@2: williamr@2: /** williamr@2: * Returns additional flags of this field type. williamr@2: * @return The additional flags of this field type. williamr@2: */ williamr@2: IMPORT_C TUint AddFlags() const; williamr@2: williamr@2: /** williamr@2: * @deprecated This function is no longer supported. williamr@2: * williamr@2: * Returns the UI ordering for adding a field. williamr@2: * @return The UI ordering for adding a field. williamr@2: */ williamr@2: IMPORT_C TPbkAddItemOrdering AddItemOrdering() const; williamr@2: williamr@2: /** williamr@2: * Returns ETrue if this field is hidden. williamr@2: * @return ETrue if this field is hidden, EFalse otherwise. williamr@2: */ williamr@2: IMPORT_C TBool IsHidden() const; williamr@2: williamr@2: /** williamr@2: * Returns ETrue if this field is read only. williamr@2: * @return ETrue if this field is read only, EFalse otherwise. williamr@2: */ williamr@2: IMPORT_C TBool IsReadOnly() const; williamr@2: williamr@2: /** williamr@2: * Returns ETrue if this field is synchronized. williamr@2: * @return ETrue if this field is synchronized, EFalse otherwise. williamr@2: */ williamr@2: IMPORT_C TBool DoSynchronize() const; williamr@2: williamr@2: /** williamr@2: * Returns ETrue if this field is disabled. williamr@2: * @return ETrue if this field is disabled, EFalse otherwise. williamr@2: */ williamr@2: IMPORT_C TBool IsDisabled() const; williamr@2: williamr@2: /** williamr@2: * Returns ETrue if this is a name field type. williamr@2: * @return ETrue if this is a name field type, EFalse otherwise. williamr@2: */ williamr@2: IMPORT_C TBool NameField() const; williamr@2: williamr@2: /** williamr@2: * Returns ETrue if this field type is part of the default template. williamr@2: * @return ETrue if this is part of the default template, williamr@2: * EFalse otherwise. williamr@2: */ williamr@2: IMPORT_C TBool TemplateField() const; williamr@2: williamr@2: /** williamr@2: * Returns ETrue if this field type can be added by the user. williamr@2: * @return ETrue if this field type can be added by the user, williamr@2: * EFalse otherwise. williamr@2: */ williamr@2: IMPORT_C TBool UserCanAddField() const; williamr@2: williamr@2: /** williamr@2: * Returns ETrue if the field type can be edited in Phonebook's contact williamr@2: * editor. williamr@2: * @return ETrue if this field type can be edited in phonebook's contact williamr@2: * editor, EFalse otherwise. williamr@2: */ williamr@2: IMPORT_C TBool IsEditable() const; williamr@2: williamr@2: /** williamr@2: * Returns ETrue if this is a numeric field type. williamr@2: * @return ETrue if this is a numeric field type, EFalse otherwise. williamr@2: */ williamr@2: IMPORT_C TBool NumericField() const; williamr@2: williamr@2: /** williamr@2: * Returns ETrue if this is a phone number field type. williamr@2: * @return ETrue if this is a phone number field type, EFalse otherwise. williamr@2: */ williamr@2: IMPORT_C TBool IsPhoneNumberField() const; williamr@2: williamr@2: /** williamr@2: * Returns ETrue if this is an EmailOverSms address field type. williamr@2: * @return ETrue if this field type is a EmailOverSms address williamr@2: * field, EFalse otherwise. williamr@2: */ williamr@2: IMPORT_C TBool IsEmailOverSmsField() const; williamr@2: williamr@2: /** williamr@2: * Returns ETrue if this is an Email address field type. williamr@2: * @return ETrue if this is a EMail address field type, EFalse otherwise. williamr@2: */ williamr@2: IMPORT_C TBool IsEmailField() const; williamr@2: williamr@2: /** williamr@2: * Returns ETrue if this is a MMS address field type. williamr@2: * @return ETrue if this is a MMS address field type, EFalse otherwise. williamr@2: */ williamr@2: IMPORT_C TBool IsMmsField() const; williamr@2: williamr@2: /** williamr@2: * Returns ETrue if this is an image field type. williamr@2: * @return ETrue if this is a image field type, EFalse otherwise. williamr@2: */ williamr@2: IMPORT_C TBool IsImageField() const; williamr@2: williamr@2: /** williamr@2: * Returns ETrue if this is a POC address field type. williamr@2: * @return ETrue if this is a POC address field type, EFalse otherwise. williamr@2: */ williamr@2: IMPORT_C TBool IsPocField() const; williamr@2: williamr@2: /** williamr@2: * Returns ETrue if this is a VOIP address field type. williamr@2: * @return ETrue if this is a VOIP address field type, EFalse otherwise. williamr@2: */ williamr@2: IMPORT_C TBool IsVoipField() const; williamr@2: williamr@2: /** williamr@2: * Returns ETrue if aFieldInfo is same as this. williamr@2: * @param aFieldInfo Field info to compare to this field type. williamr@2: * @return ETrue if aField Is same as this field type, EFalse otherwise. williamr@2: */ williamr@2: IMPORT_C TBool IsSame(const CPbkFieldInfo& aFieldInfo) const; williamr@2: williamr@2: /** williamr@2: * Returns ETrue if this field info matches aFieldId. williamr@2: * @param aFieldId The field type id to compare to this field type. williamr@2: * @return ETrue if this field info matched aFieldId, EFalse otherwise. williamr@2: */ williamr@2: IMPORT_C TBool Match(TPbkFieldId aFieldId) const; williamr@2: williamr@2: /** williamr@2: * Returns ETrue if this field info matches aFieldType at any import williamr@2: * type priority level. williamr@2: * @param aFieldType Field type to match to this field type. williamr@2: * @return ETrue if this field info matches aFieldType at any import williamr@2: * type priority level, EFalse otherwise. williamr@2: */ williamr@2: TBool Match(const TPbkContactItemFieldType& aFieldType) const; williamr@2: williamr@2: /** williamr@2: * Returns ETrue if this field info matches aFieldType at import williamr@2: * type priority level defined by aMatchPriority. williamr@2: * @param aFieldType Field type to compare. williamr@2: * @param aMatchPriority Matching priority. williamr@2: * @return ETrue if this field info matches aFieldType at import williamr@2: * type priority level defined by aMatchPriority. williamr@2: */ williamr@2: TBool Match williamr@2: (const TPbkContactItemFieldType& aFieldType, williamr@2: const TPbkMatchPriorityLevel& aMatchPriority) const; williamr@2: williamr@2: /** williamr@2: * Returns ETrue if this field info matches aVcardType at import williamr@2: * type priority level defined by aMatchPriority. williamr@2: * @param aVcardType vCard field type to match to this field type. williamr@2: * @param aMatchPriority Matching priority. williamr@2: * @return ETrue if this field info matches aVcardType at import williamr@2: * type priority level defined by aMatchPriority. williamr@2: */ williamr@2: TBool Match williamr@2: (const TPbkVcardFieldType& aVcardType, williamr@2: const TPbkMatchPriorityLevel& aMatchPriority) const; williamr@2: williamr@2: /** williamr@2: * @deprecated This function is no longer supported. If you want to williamr@2: * find the CPbkFieldInfo instance matching a williamr@2: * CContactItemField use williamr@2: * CPbkFieldsInfo::Match(const CContactItemField&) const. williamr@2: * That function works correctly and uses a lot williamr@2: * faster algorithm than this function. williamr@2: * @param aField Symbian Contacts model contact item to match to this field type. williamr@2: * Returns ETrue if this field info matches aField. williamr@2: * @return ETrue is field matches, EFalse otherwise. williamr@2: */ williamr@2: IMPORT_C TBool Match(const CContactItemField& aField) const; williamr@2: williamr@2: /** williamr@2: * Creates a Symbian Contacts model field of this field type. Ownership of the field williamr@2: * is passed to the client. williamr@2: * @return Symbian Contacts model field of this field type. williamr@2: */ williamr@2: IMPORT_C CContactItemField* CreateFieldL() const; williamr@2: williamr@2: /** williamr@2: * Returns ETrue if aField's label is equal to this field info objects. williamr@2: * @param aField Symbian Contacts model field to compare to this field types label. williamr@2: * @return ETrue if aField's label is equal to this field info object. williamr@2: */ williamr@2: TBool IsEqualLabel(const CContactItemField& aField) const; williamr@2: williamr@2: /** williamr@2: * Returns ETrue if aField's type is equal to this field info object. williamr@2: * @param aField Symbian Contacts model field to compare. williamr@2: * @return ETrue if Symbian Contacts model aField's type is equal williamr@2: * to this field info object. williamr@2: */ williamr@2: TBool IsEqualType(const CContactItemField& aField) const; williamr@2: williamr@2: /** williamr@2: * Returns ETrue if aField's type and labels are equal to this field williamr@2: * info object. williamr@2: * @param aField Symbian Contacts model field to compare williamr@2: * @return ETrue if aField's type and labels are equal to this field williamr@2: * info object. williamr@2: */ williamr@2: IMPORT_C TBool IsEqualTo(const CContactItemField& aField) const; williamr@2: williamr@2: /** williamr@2: * Compares the field ordering of this and aOther. williamr@2: * williamr@2: * @param aOther The other object this is compared against. williamr@2: * @return 0, if this and aOther are equal in field ordering
williamr@2: * negative, if this is less than aOther in field ordering
williamr@2: * positive, if this is greater than aOther in field ordering. williamr@2: */ williamr@2: IMPORT_C TInt CompareOrdering(const CPbkFieldInfo& aOther) const; williamr@2: williamr@2: /** williamr@2: * Returns the field info group this field info belongs to or NULL. williamr@2: * @return The field info group this field info belongs to or NULL. williamr@2: */ williamr@2: IMPORT_C const CPbkFieldInfoGroup* Group() const; williamr@2: williamr@2: /** williamr@2: * Returns the location information of the field. williamr@2: * @return The location information of the field. williamr@2: */ williamr@2: IMPORT_C TPbkFieldLocation Location() const; williamr@2: williamr@2: /** williamr@2: * Returns the versit storage type of the field. williamr@2: * @return The versit storage type of the field. williamr@2: */ williamr@2: IMPORT_C TPbkVersitStorageType VersitStorageType() const; williamr@2: williamr@2: /** williamr@2: * Add this field's type information to a contact item view definition. williamr@2: * williamr@2: * @param aViewDef View definition to add types to. williamr@2: */ williamr@2: IMPORT_C void AddToViewDefL(CContactItemViewDef& aViewDef) const; williamr@2: williamr@2: /** williamr@2: * Add this field's type information to a contact item field definition. williamr@2: * williamr@2: * @param aFieldDef Field definition to add types to. williamr@2: */ williamr@2: IMPORT_C void AddToFieldDefL(CContactItemFieldDef& aFieldDef) const; williamr@2: williamr@2: /** williamr@2: * Returns the Add item label text of the field. williamr@2: * @return The Add item label text of the field. williamr@2: */ williamr@2: IMPORT_C const TDesC& AddItemText() const; williamr@2: williamr@2: /** williamr@2: * Returns ETrue if this field is a reading field type (japanese). williamr@2: * @return ETrue if this field is a reading field type (japanese). williamr@2: */ williamr@2: IMPORT_C TBool IsReadingField() const; williamr@2: williamr@2: private: // Forward declaration of internal class williamr@2: class TPbkFieldInfoParams; williamr@2: williamr@2: private: // Constructors and destructor williamr@2: CPbkFieldInfo(); williamr@2: williamr@2: static CPbkFieldInfo* NewLC(TResourceReader& aReaderStd, TResourceReader& aReaderAdd, williamr@2: TPbkFieldInfoParams& aPbkFieldInfoParams); williamr@2: williamr@2: ~CPbkFieldInfo(); williamr@2: void ReadCntModelFieldsL(TResourceReader& aReaderStd); williamr@2: void ReadAdditionalFieldsL(TResourceReader& aReaderAdd, williamr@2: TPbkFieldInfoParams& aPbkFieldInfoParams); williamr@2: void ReadImportPropertiesL(TResourceReader& aReaderAdd); williamr@2: void ConstructFromResourceL williamr@2: (TResourceReader& aReaderStd, TResourceReader& aReaderAdd, williamr@2: TPbkFieldInfoParams& aPbkFieldInfoParams); williamr@2: TInt ImportPropertyCount() const; williamr@2: void UpdateTypeUidMapL(CPbkUidMap& aTypeUidMap) const; williamr@2: void CalculateTypeSignatures(const CPbkUidMap& aTypeUidMap); williamr@2: TBool IsEqualFlags(const CContactItemField& aField) const; williamr@2: williamr@2: private: // Structure williamr@2: williamr@2: struct TPbkFieldInfoParams williamr@2: { williamr@2: /// Own: Max number length in editor williamr@2: TInt iEditorMaxNumberLength; williamr@2: }; williamr@2: williamr@2: private: // Data williamr@2: /** williamr@2: * Contacts Model attributes williamr@2: * Attribute in resource struct FIELD williamr@2: */ williamr@2: /// Own: storage type (Text,Date,...) williamr@2: TStorageType iFieldStorageType; // LONG fieldStorageType williamr@2: /// Own: content type williamr@2: CContentType* iContentType; // LONG contactFieldType, williamr@2: // LONG vCardMapping, williamr@2: // STRUCT extraMapping[] williamr@2: /// Own: category (Home/Work) williamr@2: TInt iCategory; // LONG category williamr@2: /// Own: field's default name and label williamr@2: HBufC* iFieldName; // LTEXT fieldName williamr@2: /// Own: special flags williamr@2: TUint iFlags; // LONG flags williamr@2: williamr@2: /** williamr@2: * Additional attributes williamr@2: * Attributes in resource struct PHONEBOOK_FIELD williamr@2: */ williamr@2: /// Own: entry Add item labeltext williamr@2: HBufC* iAddItemText; // LTEXT AddItemText williamr@2: /// Own: assorted flags for the field type williamr@2: TUint iAddFlags; // LONG Flags williamr@2: /// Own: maximum length in characters williamr@2: TInt16 iMaxLength; // WORD MaxLength williamr@2: /// Own: index of an icon williamr@2: TInt8 iIconId; // BYTE IconId williamr@2: /// Own: The unique field type id williamr@2: TInt8 iFieldId; // BYTE Id williamr@2: /// Own: allowed multiplicity (one/many). williamr@2: TInt8 iMultiplicity; // BYTE Multiplicity williamr@2: /// Own: default editing mode williamr@2: TInt8 iEditMode; // BYTE EditMode williamr@2: /// Own: default character case williamr@2: TInt8 iDefaultCase; // BYTE DefaultCase williamr@2: /// Own: editor UI control type williamr@2: TInt8 iCtrlType; // BYTE CtrlType williamr@2: /// Own: entry item grouping williamr@2: TInt8 iOrderingGroup; // BYTE OrderingGroup williamr@2: /// Own: entry item group item ordering williamr@2: TInt8 iOrderingItem; // BYTE OrderingItem williamr@2: /// Own: entry Add Item ordering williamr@2: TInt8 iAddItemOrdering; // BYTE AddItemOrdering williamr@2: /// Own: entry item location (none/home/work) williamr@2: TInt8 iLocation; // BYTE Location williamr@2: // Own: data storage type in versit williamr@2: TInt8 iVersitStorageType; // BYTE VersitStorageType williamr@2: williamr@2: /// Own: field import type williamr@2: CPbkFieldImportType* iImportType; williamr@2: williamr@2: union williamr@2: { williamr@2: /// Own: group id before groups are loaded williamr@2: TPbkFieldGroupId iGroupId; williamr@2: /// Ref: field info group this contact info belongs to williamr@2: const CPbkFieldInfoGroup* iGroup; williamr@2: } iGroupLink; williamr@2: williamr@2: private: // Friend declarations williamr@2: friend class CPbkFieldsInfo; williamr@2: friend class PbkFieldInfoWrite; williamr@2: }; williamr@2: williamr@2: #endif // __CPbkFieldInfo_H__ williamr@2: williamr@2: // End of File