author | William Roberts <williamr@symbian.org> |
Wed, 31 Mar 2010 12:33:34 +0100 | |
branch | Symbian3 |
changeset 4 | 837f303aceeb |
permissions | -rw-r--r-- |
williamr@4 | 1 |
/* |
williamr@4 | 2 |
* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). |
williamr@4 | 3 |
* All rights reserved. |
williamr@4 | 4 |
* This component and the accompanying materials are made available |
williamr@4 | 5 |
* under the terms of "Eclipse Public License v1.0" |
williamr@4 | 6 |
* which accompanies this distribution, and is available |
williamr@4 | 7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
williamr@4 | 8 |
* |
williamr@4 | 9 |
* Initial Contributors: |
williamr@4 | 10 |
* Nokia Corporation - initial contribution. |
williamr@4 | 11 |
* |
williamr@4 | 12 |
* Contributors: |
williamr@4 | 13 |
* |
williamr@4 | 14 |
* Description: |
williamr@4 | 15 |
* Phonebook field types collection class |
williamr@4 | 16 |
* |
williamr@4 | 17 |
*/ |
williamr@4 | 18 |
|
williamr@4 | 19 |
|
williamr@4 | 20 |
|
williamr@4 | 21 |
#ifndef __CPbkFieldsInfo_H__ |
williamr@4 | 22 |
#define __CPbkFieldsInfo_H__ |
williamr@4 | 23 |
|
williamr@4 | 24 |
// INCLUDES |
williamr@4 | 25 |
#include <e32base.h> |
williamr@4 | 26 |
// This include is not absolutely needed, but this class is very rarely used |
williamr@4 | 27 |
// without class CPbkFieldInfo. |
williamr@4 | 28 |
#include "CPbkFieldInfo.h" |
williamr@4 | 29 |
|
williamr@4 | 30 |
// FORWARD DECLARATIONS |
williamr@4 | 31 |
class CContactItem; |
williamr@4 | 32 |
class CContactItemField; |
williamr@4 | 33 |
class CContactItemViewDef; |
williamr@4 | 34 |
class RResourceFile; |
williamr@4 | 35 |
class CPbkUidMap; |
williamr@4 | 36 |
class CPbkFieldInfo; |
williamr@4 | 37 |
class CPbkFieldInfoGroup; |
williamr@4 | 38 |
class MPbkVcardProperty; |
williamr@4 | 39 |
class TPbkMatchPriorityLevel; |
williamr@4 | 40 |
|
williamr@4 | 41 |
|
williamr@4 | 42 |
// CLASS DECLARATION |
williamr@4 | 43 |
|
williamr@4 | 44 |
/** |
williamr@4 | 45 |
* Phonebook field types collection class. The collection contains |
williamr@4 | 46 |
* CPbkFieldInfo objects that contain Phonebook specific field type |
williamr@4 | 47 |
* information. Each field Phonebook recognizes is associated with |
williamr@4 | 48 |
* field info object. The field info objects are references to elements |
williamr@4 | 49 |
* in this array. |
williamr@4 | 50 |
*/ |
williamr@4 | 51 |
class CPbkFieldsInfo : |
williamr@4 | 52 |
public CBase |
williamr@4 | 53 |
{ |
williamr@4 | 54 |
public: // interface |
williamr@4 | 55 |
/** |
williamr@4 | 56 |
* Creates and returns an instance of this class intialised from |
williamr@4 | 57 |
* resources. |
williamr@4 | 58 |
* |
williamr@4 | 59 |
* @param aPbkResFile Phonebook's resource file. |
williamr@4 | 60 |
* @param aCntModelResFile Contact Model's resource file. |
williamr@4 | 61 |
*/ |
williamr@4 | 62 |
static CPbkFieldsInfo* NewL |
williamr@4 | 63 |
(RResourceFile& aPbkResFile, RResourceFile& aCntModelResFile); |
williamr@4 | 64 |
|
williamr@4 | 65 |
/** |
williamr@4 | 66 |
* Destructor. |
williamr@4 | 67 |
*/ |
williamr@4 | 68 |
~CPbkFieldsInfo(); |
williamr@4 | 69 |
|
williamr@4 | 70 |
/** |
williamr@4 | 71 |
* Search field info by Phonebook field id. |
williamr@4 | 72 |
* |
williamr@4 | 73 |
* @param aFieldId Phonebook field id to search from the array |
williamr@4 | 74 |
* @return The <it>first</it> (there may be several that match) field |
williamr@4 | 75 |
* info object in the field UI presentation order matching |
williamr@4 | 76 |
* aFieldId. Returns NULL if no match is found. |
williamr@4 | 77 |
*/ |
williamr@4 | 78 |
IMPORT_C CPbkFieldInfo* Find(TPbkFieldId aFieldId) const; |
williamr@4 | 79 |
|
williamr@4 | 80 |
/** |
williamr@4 | 81 |
* Search field info by Phonebook field id and location |
williamr@4 | 82 |
* |
williamr@4 | 83 |
* @param aFieldId Phonebook field id to search from the array |
williamr@4 | 84 |
* @param aLocation Field location (home/work/none) to search from the array |
williamr@4 | 85 |
* @return The field info object (there should be only one) matching |
williamr@4 | 86 |
* aFieldId and aLocation. NULL if no match found. |
williamr@4 | 87 |
*/ |
williamr@4 | 88 |
IMPORT_C CPbkFieldInfo* Find |
williamr@4 | 89 |
(TPbkFieldId aFieldId, TPbkFieldLocation aLocation) const; |
williamr@4 | 90 |
|
williamr@4 | 91 |
/** |
williamr@4 | 92 |
* Search a field info matching contact model field. |
williamr@4 | 93 |
* |
williamr@4 | 94 |
* @param aContactItemField Contact item field whose match is searched |
williamr@4 | 95 |
* from all field info objects. |
williamr@4 | 96 |
* @return The field info object matching aContactItemField. NULL if |
williamr@4 | 97 |
* no match is found. |
williamr@4 | 98 |
*/ |
williamr@4 | 99 |
IMPORT_C CPbkFieldInfo* Find |
williamr@4 | 100 |
(const CContactItemField& aContactItemField) const; |
williamr@4 | 101 |
|
williamr@4 | 102 |
/** |
williamr@4 | 103 |
* @internal Only Phonebook internal use is supported! |
williamr@4 | 104 |
* Creates and returns an initialized matching priority level object. |
williamr@4 | 105 |
* @deprecated |
williamr@4 | 106 |
*/ |
williamr@4 | 107 |
IMPORT_C TPbkMatchPriorityLevel CreateMatchPriority() const; |
williamr@4 | 108 |
|
williamr@4 | 109 |
/** |
williamr@4 | 110 |
* @internal Only Phonebook internal use is supported! |
williamr@4 | 111 |
* Searches a match for a contact model field. |
williamr@4 | 112 |
* |
williamr@4 | 113 |
* @param aContactItemField Contact item field whose match is searched |
williamr@4 | 114 |
* from all field info objects. |
williamr@4 | 115 |
* @param aMatchPriority Priority to match against. Only import |
williamr@4 | 116 |
* types of this priority are checked. |
williamr@4 | 117 |
* @return A match information object. |
williamr@4 | 118 |
* @deprecated |
williamr@4 | 119 |
*/ |
williamr@4 | 120 |
CPbkFieldInfo* Match |
williamr@4 | 121 |
(const CContactItemField& aContactItemField, |
williamr@4 | 122 |
const TPbkMatchPriorityLevel& aMatchPriority) const; |
williamr@4 | 123 |
|
williamr@4 | 124 |
/** |
williamr@4 | 125 |
* @internal Only Phonebook internal use is supported! |
williamr@4 | 126 |
* Searches a match for a vCard property. |
williamr@4 | 127 |
* |
williamr@4 | 128 |
* @param aVcardProperty vCard property to search for a match from |
williamr@4 | 129 |
* all field info objects. |
williamr@4 | 130 |
* @param aMatchPriority Priority to match against. Only import |
williamr@4 | 131 |
* types of this priority are checked. |
williamr@4 | 132 |
* @return A match information object. |
williamr@4 | 133 |
* @deprecated |
williamr@4 | 134 |
*/ |
williamr@4 | 135 |
IMPORT_C CPbkFieldInfo* Match |
williamr@4 | 136 |
(const MPbkVcardProperty& aVcardProperty, |
williamr@4 | 137 |
const TPbkMatchPriorityLevel& aMatchPriority) const; |
williamr@4 | 138 |
|
williamr@4 | 139 |
/** |
williamr@4 | 140 |
* Returns the count of field infos. |
williamr@4 | 141 |
* @return The count of field information elements in this container. |
williamr@4 | 142 |
*/ |
williamr@4 | 143 |
IMPORT_C TInt Count() const; |
williamr@4 | 144 |
|
williamr@4 | 145 |
/** |
williamr@4 | 146 |
* Returns the aIndex:th field info. Field info objects are sorted by |
williamr@4 | 147 |
* the field presentation ordering. |
williamr@4 | 148 |
* @param aIndex The indexed element in this array. |
williamr@4 | 149 |
* @return The element in the indexed position in the array. |
williamr@4 | 150 |
*/ |
williamr@4 | 151 |
IMPORT_C CPbkFieldInfo* operator[](TInt aIndex) const; |
williamr@4 | 152 |
|
williamr@4 | 153 |
/** |
williamr@4 | 154 |
* Returns the count of field info groups. |
williamr@4 | 155 |
* @return The count of field info groups. |
williamr@4 | 156 |
*/ |
williamr@4 | 157 |
IMPORT_C TInt GroupCount() const; |
williamr@4 | 158 |
|
williamr@4 | 159 |
/** |
williamr@4 | 160 |
* Returns the field info group at aIndex. |
williamr@4 | 161 |
* @return The field info group at aIndex. |
williamr@4 | 162 |
*/ |
williamr@4 | 163 |
IMPORT_C const CPbkFieldInfoGroup& GroupAt(TInt aIndex) const; |
williamr@4 | 164 |
|
williamr@4 | 165 |
/** |
williamr@4 | 166 |
* Creates a contact item view definition from an array of Phonebook |
williamr@4 | 167 |
* field ids. |
williamr@4 | 168 |
* |
williamr@4 | 169 |
* @param aFieldTypes Array of Phonebook field types. |
williamr@4 | 170 |
* @return A new contact item view definition. |
williamr@4 | 171 |
*/ |
williamr@4 | 172 |
IMPORT_C CContactItemViewDef* CreateContactItemViewDefLC |
williamr@4 | 173 |
(const CPbkFieldIdArray& aFieldTypes) const; |
williamr@4 | 174 |
|
williamr@4 | 175 |
/** |
williamr@4 | 176 |
* Creates contact item field definition from an array of Phonebook |
williamr@4 | 177 |
* field ids. |
williamr@4 | 178 |
* |
williamr@4 | 179 |
* @param aFieldTypes Phonebook field types to add into the returned |
williamr@4 | 180 |
* array. If NULL an array matching all fields is |
williamr@4 | 181 |
* returned. |
williamr@4 | 182 |
* @return A field def array matching <it>at least fields</it> in |
williamr@4 | 183 |
* aFieldTypes. Please note that the returned field definition |
williamr@4 | 184 |
* may also match other fields than those specified. |
williamr@4 | 185 |
*/ |
williamr@4 | 186 |
IMPORT_C CContactItemFieldDef* CreateContactItemFieldDefLC |
williamr@4 | 187 |
(const CPbkFieldIdArray* aFieldTypes) const; |
williamr@4 | 188 |
|
williamr@4 | 189 |
/** |
williamr@4 | 190 |
* Adds fields from resource readers. Doesn't read or link group |
williamr@4 | 191 |
* information. |
williamr@4 | 192 |
* @param aPbkResReader Initialized resource buffer |
williamr@4 | 193 |
* to PHONEBOOK_FIELD_ARRAY |
williamr@4 | 194 |
* @param aCntModelResReader Initialized resource buffer to |
williamr@4 | 195 |
* ARRAY or FIELDs |
williamr@4 | 196 |
* @param aAddedFieldTypes If not null the field types that were |
williamr@4 | 197 |
* added are appended to this array. The field |
williamr@4 | 198 |
* types are in the order they were defined in |
williamr@4 | 199 |
* resources. |
williamr@4 | 200 |
*/ |
williamr@4 | 201 |
void AddFieldTypesFromResourceL |
williamr@4 | 202 |
(TResourceReader& aPbkResReader, |
williamr@4 | 203 |
TResourceReader& aCntModelResReader, |
williamr@4 | 204 |
RArray<const CPbkFieldInfo*>* aAddedFieldTypes); |
williamr@4 | 205 |
|
williamr@4 | 206 |
private: // Implementation |
williamr@4 | 207 |
CPbkFieldsInfo(); |
williamr@4 | 208 |
CPbkFieldInfoGroup* FindGroup(TPbkFieldGroupId aGroupId); |
williamr@4 | 209 |
void LinkGroupsL(); |
williamr@4 | 210 |
void ReadGroupsInfoL(RResourceFile& aResFile); |
williamr@4 | 211 |
void ConstructFromResourceL |
williamr@4 | 212 |
(RResourceFile& aPbkResFile, RResourceFile& aCntModelResFile); |
williamr@4 | 213 |
void ReadFieldInfoParamsL(); |
williamr@4 | 214 |
|
williamr@4 | 215 |
private: // data |
williamr@4 | 216 |
/// Own: array of field infos |
williamr@4 | 217 |
RPointerArray<CPbkFieldInfo> iEntries; |
williamr@4 | 218 |
/// Own: field info groups |
williamr@4 | 219 |
RPointerArray<CPbkFieldInfoGroup> iGroups; |
williamr@4 | 220 |
/// Own: UID map for field content type matching |
williamr@4 | 221 |
CPbkUidMap* iTypeUidMap; |
williamr@4 | 222 |
/// Own: highest field matching priority level |
williamr@4 | 223 |
TInt iHighestMatchPriorityLevel; |
williamr@4 | 224 |
/// Own: configuration data for field infos |
williamr@4 | 225 |
CPbkFieldInfo::TPbkFieldInfoParams* iPbkFieldInfoParams; |
williamr@4 | 226 |
}; |
williamr@4 | 227 |
|
williamr@4 | 228 |
#endif // __CPbkFieldsInfo_H__ |
williamr@4 | 229 |
|
williamr@4 | 230 |
// End of File |