williamr@4: /* williamr@4: * Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). williamr@4: * All rights reserved. williamr@4: * This component and the accompanying materials are made available williamr@4: * under the terms of "Eclipse Public License v1.0" williamr@4: * which accompanies this distribution, and is available williamr@4: * at the URL "http://www.eclipse.org/legal/epl-v10.html". williamr@4: * williamr@4: * Initial Contributors: williamr@4: * Nokia Corporation - initial contribution. williamr@4: * williamr@4: * Contributors: williamr@4: * williamr@4: * Description: williamr@4: * Phonebook field types collection class williamr@4: * williamr@4: */ williamr@4: williamr@4: williamr@4: williamr@4: #ifndef __CPbkFieldsInfo_H__ williamr@4: #define __CPbkFieldsInfo_H__ williamr@4: williamr@4: // INCLUDES williamr@4: #include williamr@4: // This include is not absolutely needed, but this class is very rarely used williamr@4: // without class CPbkFieldInfo. williamr@4: #include "CPbkFieldInfo.h" williamr@4: williamr@4: // FORWARD DECLARATIONS williamr@4: class CContactItem; williamr@4: class CContactItemField; williamr@4: class CContactItemViewDef; williamr@4: class RResourceFile; williamr@4: class CPbkUidMap; williamr@4: class CPbkFieldInfo; williamr@4: class CPbkFieldInfoGroup; williamr@4: class MPbkVcardProperty; williamr@4: class TPbkMatchPriorityLevel; williamr@4: williamr@4: williamr@4: // CLASS DECLARATION williamr@4: williamr@4: /** williamr@4: * Phonebook field types collection class. The collection contains williamr@4: * CPbkFieldInfo objects that contain Phonebook specific field type williamr@4: * information. Each field Phonebook recognizes is associated with williamr@4: * field info object. The field info objects are references to elements williamr@4: * in this array. williamr@4: */ williamr@4: class CPbkFieldsInfo : williamr@4: public CBase williamr@4: { williamr@4: public: // interface williamr@4: /** williamr@4: * Creates and returns an instance of this class intialised from williamr@4: * resources. williamr@4: * williamr@4: * @param aPbkResFile Phonebook's resource file. williamr@4: * @param aCntModelResFile Contact Model's resource file. williamr@4: */ williamr@4: static CPbkFieldsInfo* NewL williamr@4: (RResourceFile& aPbkResFile, RResourceFile& aCntModelResFile); williamr@4: williamr@4: /** williamr@4: * Destructor. williamr@4: */ williamr@4: ~CPbkFieldsInfo(); williamr@4: williamr@4: /** williamr@4: * Search field info by Phonebook field id. williamr@4: * williamr@4: * @param aFieldId Phonebook field id to search from the array williamr@4: * @return The first (there may be several that match) field williamr@4: * info object in the field UI presentation order matching williamr@4: * aFieldId. Returns NULL if no match is found. williamr@4: */ williamr@4: IMPORT_C CPbkFieldInfo* Find(TPbkFieldId aFieldId) const; williamr@4: williamr@4: /** williamr@4: * Search field info by Phonebook field id and location williamr@4: * williamr@4: * @param aFieldId Phonebook field id to search from the array williamr@4: * @param aLocation Field location (home/work/none) to search from the array williamr@4: * @return The field info object (there should be only one) matching williamr@4: * aFieldId and aLocation. NULL if no match found. williamr@4: */ williamr@4: IMPORT_C CPbkFieldInfo* Find williamr@4: (TPbkFieldId aFieldId, TPbkFieldLocation aLocation) const; williamr@4: williamr@4: /** williamr@4: * Search a field info matching contact model field. williamr@4: * williamr@4: * @param aContactItemField Contact item field whose match is searched williamr@4: * from all field info objects. williamr@4: * @return The field info object matching aContactItemField. NULL if williamr@4: * no match is found. williamr@4: */ williamr@4: IMPORT_C CPbkFieldInfo* Find williamr@4: (const CContactItemField& aContactItemField) const; williamr@4: williamr@4: /** williamr@4: * @internal Only Phonebook internal use is supported! williamr@4: * Creates and returns an initialized matching priority level object. williamr@4: * @deprecated williamr@4: */ williamr@4: IMPORT_C TPbkMatchPriorityLevel CreateMatchPriority() const; williamr@4: williamr@4: /** williamr@4: * @internal Only Phonebook internal use is supported! williamr@4: * Searches a match for a contact model field. williamr@4: * williamr@4: * @param aContactItemField Contact item field whose match is searched williamr@4: * from all field info objects. williamr@4: * @param aMatchPriority Priority to match against. Only import williamr@4: * types of this priority are checked. williamr@4: * @return A match information object. williamr@4: * @deprecated williamr@4: */ williamr@4: CPbkFieldInfo* Match williamr@4: (const CContactItemField& aContactItemField, williamr@4: const TPbkMatchPriorityLevel& aMatchPriority) const; williamr@4: williamr@4: /** williamr@4: * @internal Only Phonebook internal use is supported! williamr@4: * Searches a match for a vCard property. williamr@4: * williamr@4: * @param aVcardProperty vCard property to search for a match from williamr@4: * all field info objects. williamr@4: * @param aMatchPriority Priority to match against. Only import williamr@4: * types of this priority are checked. williamr@4: * @return A match information object. williamr@4: * @deprecated williamr@4: */ williamr@4: IMPORT_C CPbkFieldInfo* Match williamr@4: (const MPbkVcardProperty& aVcardProperty, williamr@4: const TPbkMatchPriorityLevel& aMatchPriority) const; williamr@4: williamr@4: /** williamr@4: * Returns the count of field infos. williamr@4: * @return The count of field information elements in this container. williamr@4: */ williamr@4: IMPORT_C TInt Count() const; williamr@4: williamr@4: /** williamr@4: * Returns the aIndex:th field info. Field info objects are sorted by williamr@4: * the field presentation ordering. williamr@4: * @param aIndex The indexed element in this array. williamr@4: * @return The element in the indexed position in the array. williamr@4: */ williamr@4: IMPORT_C CPbkFieldInfo* operator[](TInt aIndex) const; williamr@4: williamr@4: /** williamr@4: * Returns the count of field info groups. williamr@4: * @return The count of field info groups. williamr@4: */ williamr@4: IMPORT_C TInt GroupCount() const; williamr@4: williamr@4: /** williamr@4: * Returns the field info group at aIndex. williamr@4: * @return The field info group at aIndex. williamr@4: */ williamr@4: IMPORT_C const CPbkFieldInfoGroup& GroupAt(TInt aIndex) const; williamr@4: williamr@4: /** williamr@4: * Creates a contact item view definition from an array of Phonebook williamr@4: * field ids. williamr@4: * williamr@4: * @param aFieldTypes Array of Phonebook field types. williamr@4: * @return A new contact item view definition. williamr@4: */ williamr@4: IMPORT_C CContactItemViewDef* CreateContactItemViewDefLC williamr@4: (const CPbkFieldIdArray& aFieldTypes) const; williamr@4: williamr@4: /** williamr@4: * Creates contact item field definition from an array of Phonebook williamr@4: * field ids. williamr@4: * williamr@4: * @param aFieldTypes Phonebook field types to add into the returned williamr@4: * array. If NULL an array matching all fields is williamr@4: * returned. williamr@4: * @return A field def array matching at least fields in williamr@4: * aFieldTypes. Please note that the returned field definition williamr@4: * may also match other fields than those specified. williamr@4: */ williamr@4: IMPORT_C CContactItemFieldDef* CreateContactItemFieldDefLC williamr@4: (const CPbkFieldIdArray* aFieldTypes) const; williamr@4: williamr@4: /** williamr@4: * Adds fields from resource readers. Doesn't read or link group williamr@4: * information. williamr@4: * @param aPbkResReader Initialized resource buffer williamr@4: * to PHONEBOOK_FIELD_ARRAY williamr@4: * @param aCntModelResReader Initialized resource buffer to williamr@4: * ARRAY or FIELDs williamr@4: * @param aAddedFieldTypes If not null the field types that were williamr@4: * added are appended to this array. The field williamr@4: * types are in the order they were defined in williamr@4: * resources. williamr@4: */ williamr@4: void AddFieldTypesFromResourceL williamr@4: (TResourceReader& aPbkResReader, williamr@4: TResourceReader& aCntModelResReader, williamr@4: RArray* aAddedFieldTypes); williamr@4: williamr@4: private: // Implementation williamr@4: CPbkFieldsInfo(); williamr@4: CPbkFieldInfoGroup* FindGroup(TPbkFieldGroupId aGroupId); williamr@4: void LinkGroupsL(); williamr@4: void ReadGroupsInfoL(RResourceFile& aResFile); williamr@4: void ConstructFromResourceL williamr@4: (RResourceFile& aPbkResFile, RResourceFile& aCntModelResFile); williamr@4: void ReadFieldInfoParamsL(); williamr@4: williamr@4: private: // data williamr@4: /// Own: array of field infos williamr@4: RPointerArray iEntries; williamr@4: /// Own: field info groups williamr@4: RPointerArray iGroups; williamr@4: /// Own: UID map for field content type matching williamr@4: CPbkUidMap* iTypeUidMap; williamr@4: /// Own: highest field matching priority level williamr@4: TInt iHighestMatchPriorityLevel; williamr@4: /// Own: configuration data for field infos williamr@4: CPbkFieldInfo::TPbkFieldInfoParams* iPbkFieldInfoParams; williamr@4: }; williamr@4: williamr@4: #endif // __CPbkFieldsInfo_H__ williamr@4: williamr@4: // End of File