2 * Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
4 * This component and the accompanying materials are made available
5 * under the terms of "Eclipse Public License v1.0"
6 * which accompanies this distribution, and is available
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
15 * Phonebook constant field type information
20 #ifndef __CPbkFieldInfo_H__
21 #define __CPbkFieldInfo_H__
26 #include "PbkFields.hrh"
27 #include "PbkIconId.hrh"
29 // FORWARD DECLARATIONS
31 class CContactItemField;
32 class CContactItemViewDef;
33 class CContactItemFieldDef;
35 class TResourceReader;
36 class CPbkFieldInfoGroup;
37 class CPbkFieldImportType;
38 class TPbkContactItemFieldType;
39 class TPbkVcardFieldType;
41 class TPbkMatchPriorityLevel;
46 * Phonebook constant field type information. Loaded from resources into
47 * CPbkFieldsInfo array. The corresponding resource structure is PHONEBOOK_FIELD
51 * @see PHONEBOOK_FIELD
59 * Returns the unique Phonebook field id for this field type.
60 * @return The unique Phonebook field id for this field type.
62 IMPORT_C TPbkFieldId FieldId() const;
65 * Returns the storage type of this field type.
66 * @return The storage type of this field type.
68 IMPORT_C TStorageType FieldStorageType() const;
71 * Returns the content type of this field type.
72 * @return The content type of this field type.
75 IMPORT_C const CContentType& ContentType() const;
78 * Returns the category of this field type.
79 * @return The category of this field type
81 IMPORT_C TInt Category() const;
84 * Returns this field type's default label.
85 * @return The field type's default label.
87 IMPORT_C const TDesC& FieldName() const;
90 * Returns Symbian Contacts Model field flags of this field type.
91 * @return Symbian Contacts model field flags for this field type.
93 IMPORT_C TUint Flags() const;
96 * Returns the multiplicity allowed for this field type.
97 * @return The multiplicity allowed for this field type.
99 IMPORT_C TPbkFieldMultiplicity Multiplicity() const;
102 * Returns the maximum data length that Phonebook UI spec specifies
103 * for this field type.
104 * @return The maximum data length that Phonebook UI spec specifies
105 * for this field type.
107 IMPORT_C TInt MaxLength() const;
110 * Returns the default editing mode for this field type.
111 * @return The default editing mode for this field type.
113 IMPORT_C TPbkFieldEditMode EditMode() const;
116 * Returns the default character case for this field type.
117 * @return The default character case for this field type.
119 IMPORT_C TPbkFieldDefaultCase DefaultCase() const;
122 * Returns the icon id for this field type.
123 * @return The icon id for this field type.
125 IMPORT_C TPbkIconId IconId() const;
128 * Returns the UI control type required to edit this field.
129 * @return The UI control type required to edit this field.
131 IMPORT_C TPbkFieldCtrlType CtrlType() const;
134 * Returns additional flags of this field type.
135 * @return The additional flags of this field type.
137 IMPORT_C TUint AddFlags() const;
140 * @deprecated This function is no longer supported.
142 * Returns the UI ordering for adding a field.
143 * @return The UI ordering for adding a field.
145 IMPORT_C TPbkAddItemOrdering AddItemOrdering() const;
148 * Returns ETrue if this field is hidden.
149 * @return ETrue if this field is hidden, EFalse otherwise.
151 IMPORT_C TBool IsHidden() const;
154 * Returns ETrue if this field is read only.
155 * @return ETrue if this field is read only, EFalse otherwise.
157 IMPORT_C TBool IsReadOnly() const;
160 * Returns ETrue if this field is synchronized.
161 * @return ETrue if this field is synchronized, EFalse otherwise.
163 IMPORT_C TBool DoSynchronize() const;
166 * Returns ETrue if this field is disabled.
167 * @return ETrue if this field is disabled, EFalse otherwise.
169 IMPORT_C TBool IsDisabled() const;
172 * Returns ETrue if this is a name field type.
173 * @return ETrue if this is a name field type, EFalse otherwise.
175 IMPORT_C TBool NameField() const;
178 * Returns ETrue if this field type is part of the default template.
179 * @return ETrue if this is part of the default template,
182 IMPORT_C TBool TemplateField() const;
185 * Returns ETrue if this field type can be added by the user.
186 * @return ETrue if this field type can be added by the user,
189 IMPORT_C TBool UserCanAddField() const;
192 * Returns ETrue if the field type can be edited in Phonebook's contact
194 * @return ETrue if this field type can be edited in phonebook's contact
195 * editor, EFalse otherwise.
197 IMPORT_C TBool IsEditable() const;
200 * Returns ETrue if this is a numeric field type.
201 * @return ETrue if this is a numeric field type, EFalse otherwise.
203 IMPORT_C TBool NumericField() const;
206 * Returns ETrue if this is a phone number field type.
207 * @return ETrue if this is a phone number field type, EFalse otherwise.
209 IMPORT_C TBool IsPhoneNumberField() const;
212 * Returns ETrue if this is an EmailOverSms address field type.
213 * @return ETrue if this field type is a EmailOverSms address
214 * field, EFalse otherwise.
216 IMPORT_C TBool IsEmailOverSmsField() const;
219 * Returns ETrue if this is an Email address field type.
220 * @return ETrue if this is a EMail address field type, EFalse otherwise.
222 IMPORT_C TBool IsEmailField() const;
225 * Returns ETrue if this is a MMS address field type.
226 * @return ETrue if this is a MMS address field type, EFalse otherwise.
228 IMPORT_C TBool IsMmsField() const;
231 * Returns ETrue if this is an image field type.
232 * @return ETrue if this is a image field type, EFalse otherwise.
234 IMPORT_C TBool IsImageField() const;
237 * Returns ETrue if this is a POC address field type.
238 * @return ETrue if this is a POC address field type, EFalse otherwise.
240 IMPORT_C TBool IsPocField() const;
243 * Returns ETrue if this is a VOIP address field type.
244 * @return ETrue if this is a VOIP address field type, EFalse otherwise.
246 IMPORT_C TBool IsVoipField() const;
249 * Returns ETrue if aFieldInfo is same as this.
250 * @param aFieldInfo Field info to compare to this field type.
251 * @return ETrue if aField Is same as this field type, EFalse otherwise.
253 IMPORT_C TBool IsSame(const CPbkFieldInfo& aFieldInfo) const;
256 * Returns ETrue if this field info matches aFieldId.
257 * @param aFieldId The field type id to compare to this field type.
258 * @return ETrue if this field info matched aFieldId, EFalse otherwise.
260 IMPORT_C TBool Match(TPbkFieldId aFieldId) const;
263 * Returns ETrue if this field info matches aFieldType at any import
264 * type priority level.
265 * @param aFieldType Field type to match to this field type.
266 * @return ETrue if this field info matches aFieldType at any import
267 * type priority level, EFalse otherwise.
269 TBool Match(const TPbkContactItemFieldType& aFieldType) const;
272 * Returns ETrue if this field info matches aFieldType at import
273 * type priority level defined by aMatchPriority.
274 * @param aFieldType Field type to compare.
275 * @param aMatchPriority Matching priority.
276 * @return ETrue if this field info matches aFieldType at import
277 * type priority level defined by aMatchPriority.
280 (const TPbkContactItemFieldType& aFieldType,
281 const TPbkMatchPriorityLevel& aMatchPriority) const;
284 * Returns ETrue if this field info matches aVcardType at import
285 * type priority level defined by aMatchPriority.
286 * @param aVcardType vCard field type to match to this field type.
287 * @param aMatchPriority Matching priority.
288 * @return ETrue if this field info matches aVcardType at import
289 * type priority level defined by aMatchPriority.
292 (const TPbkVcardFieldType& aVcardType,
293 const TPbkMatchPriorityLevel& aMatchPriority) const;
296 * @deprecated This function is no longer supported. If you want to
297 * find the CPbkFieldInfo instance matching a
298 * CContactItemField use
299 * CPbkFieldsInfo::Match(const CContactItemField&) const.
300 * That function works correctly and uses <it>a lot</it>
301 * faster algorithm than this function.
302 * @param aField Symbian Contacts model contact item to match to this field type.
303 * Returns ETrue if this field info matches aField.
304 * @return ETrue is field matches, EFalse otherwise.
306 IMPORT_C TBool Match(const CContactItemField& aField) const;
309 * Creates a Symbian Contacts model field of this field type. Ownership of the field
310 * is passed to the client.
311 * @return Symbian Contacts model field of this field type.
313 IMPORT_C CContactItemField* CreateFieldL() const;
316 * Returns ETrue if aField's label is equal to this field info objects.
317 * @param aField Symbian Contacts model field to compare to this field types label.
318 * @return ETrue if aField's label is equal to this field info object.
320 TBool IsEqualLabel(const CContactItemField& aField) const;
323 * Returns ETrue if aField's type is equal to this field info object.
324 * @param aField Symbian Contacts model field to compare.
325 * @return ETrue if Symbian Contacts model aField's type is equal
326 * to this field info object.
328 TBool IsEqualType(const CContactItemField& aField) const;
331 * Returns ETrue if aField's type and labels are equal to this field
333 * @param aField Symbian Contacts model field to compare
334 * @return ETrue if aField's type and labels are equal to this field
337 IMPORT_C TBool IsEqualTo(const CContactItemField& aField) const;
340 * Compares the field ordering of this and aOther.
342 * @param aOther The other object this is compared against.
343 * @return 0, if this and aOther are equal in field ordering<br>
344 * negative, if this is less than aOther in field ordering<br>
345 * positive, if this is greater than aOther in field ordering.
347 IMPORT_C TInt CompareOrdering(const CPbkFieldInfo& aOther) const;
350 * Returns the field info group this field info belongs to or NULL.
351 * @return The field info group this field info belongs to or NULL.
353 IMPORT_C const CPbkFieldInfoGroup* Group() const;
356 * Returns the location information of the field.
357 * @return The location information of the field.
359 IMPORT_C TPbkFieldLocation Location() const;
362 * Returns the versit storage type of the field.
363 * @return The versit storage type of the field.
365 IMPORT_C TPbkVersitStorageType VersitStorageType() const;
368 * Add this field's type information to a contact item view definition.
370 * @param aViewDef View definition to add types to.
372 IMPORT_C void AddToViewDefL(CContactItemViewDef& aViewDef) const;
375 * Add this field's type information to a contact item field definition.
377 * @param aFieldDef Field definition to add types to.
379 IMPORT_C void AddToFieldDefL(CContactItemFieldDef& aFieldDef) const;
382 * Returns the Add item label text of the field.
383 * @return The Add item label text of the field.
385 IMPORT_C const TDesC& AddItemText() const;
388 * Returns ETrue if this field is a reading field type (japanese).
389 * @return ETrue if this field is a reading field type (japanese).
391 IMPORT_C TBool IsReadingField() const;
393 private: // Forward declaration of internal class
394 class TPbkFieldInfoParams;
396 private: // Constructors and destructor
399 static CPbkFieldInfo* NewLC(TResourceReader& aReaderStd, TResourceReader& aReaderAdd,
400 TPbkFieldInfoParams& aPbkFieldInfoParams);
403 void ReadCntModelFieldsL(TResourceReader& aReaderStd);
404 void ReadAdditionalFieldsL(TResourceReader& aReaderAdd,
405 TPbkFieldInfoParams& aPbkFieldInfoParams);
406 void ReadImportPropertiesL(TResourceReader& aReaderAdd);
407 void ConstructFromResourceL
408 (TResourceReader& aReaderStd, TResourceReader& aReaderAdd,
409 TPbkFieldInfoParams& aPbkFieldInfoParams);
410 TInt ImportPropertyCount() const;
411 void UpdateTypeUidMapL(CPbkUidMap& aTypeUidMap) const;
412 void CalculateTypeSignatures(const CPbkUidMap& aTypeUidMap);
413 TBool IsEqualFlags(const CContactItemField& aField) const;
415 private: // Structure
417 struct TPbkFieldInfoParams
419 /// Own: Max number length in editor
420 TInt iEditorMaxNumberLength;
425 * Contacts Model attributes
426 * Attribute in resource struct FIELD
428 /// Own: storage type (Text,Date,...)
429 TStorageType iFieldStorageType; // LONG fieldStorageType
430 /// Own: content type
431 CContentType* iContentType; // LONG contactFieldType,
432 // LONG vCardMapping,
433 // STRUCT extraMapping[]
434 /// Own: category (Home/Work)
435 TInt iCategory; // LONG category
436 /// Own: field's default name and label
437 HBufC* iFieldName; // LTEXT fieldName
438 /// Own: special flags
439 TUint iFlags; // LONG flags
442 * Additional attributes
443 * Attributes in resource struct PHONEBOOK_FIELD
445 /// Own: entry Add item labeltext
446 HBufC* iAddItemText; // LTEXT AddItemText
447 /// Own: assorted flags for the field type
448 TUint iAddFlags; // LONG Flags
449 /// Own: maximum length in characters
450 TInt16 iMaxLength; // WORD MaxLength
451 /// Own: index of an icon
452 TInt8 iIconId; // BYTE IconId
453 /// Own: The unique field type id
454 TInt8 iFieldId; // BYTE Id
455 /// Own: allowed multiplicity (one/many).
456 TInt8 iMultiplicity; // BYTE Multiplicity
457 /// Own: default editing mode
458 TInt8 iEditMode; // BYTE EditMode
459 /// Own: default character case
460 TInt8 iDefaultCase; // BYTE DefaultCase
461 /// Own: editor UI control type
462 TInt8 iCtrlType; // BYTE CtrlType
463 /// Own: entry item grouping
464 TInt8 iOrderingGroup; // BYTE OrderingGroup
465 /// Own: entry item group item ordering
466 TInt8 iOrderingItem; // BYTE OrderingItem
467 /// Own: entry Add Item ordering
468 TInt8 iAddItemOrdering; // BYTE AddItemOrdering
469 /// Own: entry item location (none/home/work)
470 TInt8 iLocation; // BYTE Location
471 // Own: data storage type in versit
472 TInt8 iVersitStorageType; // BYTE VersitStorageType
474 /// Own: field import type
475 CPbkFieldImportType* iImportType;
479 /// Own: group id before groups are loaded
480 TPbkFieldGroupId iGroupId;
481 /// Ref: field info group this contact info belongs to
482 const CPbkFieldInfoGroup* iGroup;
485 private: // Friend declarations
486 friend class CPbkFieldsInfo;
487 friend class PbkFieldInfoWrite;
490 #endif // __CPbkFieldInfo_H__