epoc32/include/app/cpbkfieldinfo.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
parent 2 2fe1408b6811
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
     1 /*
     2 * Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     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".
     8 *
     9 * Initial Contributors:
    10 * Nokia Corporation - initial contribution.
    11 *
    12 * Contributors:
    13 *
    14 * Description: 
    15 *     Phonebook constant field type information
    16 *
    17 */
    18 
    19 
    20 #ifndef __CPbkFieldInfo_H__
    21 #define __CPbkFieldInfo_H__
    22 
    23 //  INCLUDES
    24 #include    <e32std.h>
    25 #include    <cntdef.h>
    26 #include    "PbkFields.hrh"
    27 #include    "PbkIconId.hrh"
    28 
    29 // FORWARD DECLARATIONS
    30 class CContentType;
    31 class CContactItemField;
    32 class CContactItemViewDef;
    33 class CContactItemFieldDef;
    34 class CPbkFieldsInfo;
    35 class TResourceReader;
    36 class CPbkFieldInfoGroup;
    37 class CPbkFieldImportType;
    38 class TPbkContactItemFieldType;
    39 class TPbkVcardFieldType;
    40 class CPbkUidMap;
    41 class TPbkMatchPriorityLevel;
    42 
    43 // CLASS DECLARATION
    44 
    45 /**
    46  * Phonebook constant field type information. Loaded from resources into
    47  * CPbkFieldsInfo array. The corresponding resource structure is PHONEBOOK_FIELD
    48  * in PbkFieldInfo.rh.
    49  *
    50  * @see CPbkFieldsInfo
    51  * @see PHONEBOOK_FIELD
    52  * @see FIELD
    53  */
    54 class CPbkFieldInfo :
    55         public CBase
    56 	{
    57     public: // Interface
    58         /**
    59          * Returns the unique Phonebook field id for this field type.
    60          * @return The unique Phonebook field id for this field type.
    61          */
    62         IMPORT_C TPbkFieldId FieldId() const;
    63 
    64         /**
    65          * Returns the storage type of this field type.
    66          * @return The storage type of this field type.
    67          */
    68         IMPORT_C TStorageType FieldStorageType() const;
    69 
    70         /**
    71          * Returns the content type of this field type.
    72          * @return The content type of this field type.
    73          * @see CContentType
    74          */
    75         IMPORT_C const CContentType& ContentType() const;
    76 
    77         /**
    78          * Returns the category of this field type.
    79          * @return The category of this field type
    80          */
    81         IMPORT_C TInt Category() const;
    82 
    83         /**
    84          * Returns this field type's default label.
    85          * @return The field type's default label.
    86          */
    87         IMPORT_C const TDesC& FieldName() const;
    88 
    89         /**
    90          * Returns Symbian Contacts Model field flags of this field type.
    91          * @return Symbian Contacts model field flags for this field type.
    92          */
    93         IMPORT_C TUint Flags() const;
    94 
    95         /**
    96          * Returns the multiplicity allowed for this field type.
    97          * @return The multiplicity allowed for this field type.
    98          */
    99         IMPORT_C TPbkFieldMultiplicity Multiplicity() const;
   100 
   101         /**
   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.
   106          */
   107         IMPORT_C TInt MaxLength() const;
   108 
   109         /**
   110          * Returns the default editing mode for this field type.
   111          * @return The default editing mode for this field type.
   112          */
   113         IMPORT_C TPbkFieldEditMode EditMode() const;
   114 
   115         /**
   116          * Returns the default character case for this field type.
   117          * @return The default character case for this field type.
   118          */
   119         IMPORT_C TPbkFieldDefaultCase DefaultCase() const;
   120 
   121         /**
   122          * Returns the icon id for this field type.
   123          * @return The icon id for this field type.
   124          */
   125         IMPORT_C TPbkIconId IconId() const;
   126 
   127         /**
   128          * Returns the UI control type required to edit this field.
   129          * @return The UI control type required to edit this field.
   130          */
   131         IMPORT_C TPbkFieldCtrlType CtrlType() const;
   132 
   133         /**
   134          * Returns additional flags of this field type.
   135          * @return The additional flags of this field type.
   136          */
   137         IMPORT_C TUint AddFlags() const;
   138 
   139         /**
   140          * @deprecated  This function is no longer supported.
   141          *
   142          * Returns the UI ordering for adding a field.
   143          * @return The UI ordering for adding a field.
   144          */
   145         IMPORT_C TPbkAddItemOrdering AddItemOrdering() const;
   146 
   147         /**
   148          * Returns ETrue if this field is hidden.
   149          * @return ETrue if this field is hidden, EFalse otherwise.
   150          */
   151         IMPORT_C TBool IsHidden() const;
   152 
   153         /**
   154          * Returns ETrue if this field is read only.
   155          * @return ETrue if this field is read only, EFalse otherwise.
   156          */
   157         IMPORT_C TBool IsReadOnly() const;
   158 
   159         /**
   160          * Returns ETrue if this field is synchronized.
   161          * @return ETrue if this field is synchronized, EFalse otherwise.
   162          */
   163         IMPORT_C TBool DoSynchronize() const;
   164 
   165         /**
   166          * Returns ETrue if this field is disabled.
   167          * @return ETrue if this field is disabled, EFalse otherwise.
   168          */
   169         IMPORT_C TBool IsDisabled() const;
   170 
   171         /**
   172          * Returns ETrue if this is a name field type.
   173          * @return ETrue if this is a name field type, EFalse otherwise.
   174          */
   175         IMPORT_C TBool NameField() const;
   176 
   177         /**
   178          * Returns ETrue if this field type is part of the default template.
   179          * @return ETrue if this is part of the default template, 
   180          *         EFalse otherwise.
   181          */
   182         IMPORT_C TBool TemplateField() const;
   183 
   184         /**
   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, 
   187          *         EFalse otherwise.
   188          */
   189         IMPORT_C TBool UserCanAddField() const;
   190 
   191         /**
   192          * Returns ETrue if the field type can be edited in Phonebook's contact
   193          * editor.
   194          * @return ETrue if this field type can be edited in phonebook's contact 
   195          *         editor, EFalse otherwise.
   196          */
   197         IMPORT_C TBool IsEditable() const;
   198 
   199         /**
   200          * Returns ETrue if this is a numeric field type.
   201          * @return ETrue if this is a numeric field type, EFalse otherwise.
   202          */
   203         IMPORT_C TBool NumericField() const;
   204 
   205         /**
   206          * Returns ETrue if this is a phone number field type.
   207          * @return ETrue if this is a phone number field type, EFalse otherwise.
   208          */
   209         IMPORT_C TBool IsPhoneNumberField() const;
   210 
   211         /**
   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.
   215          */
   216         IMPORT_C TBool IsEmailOverSmsField() const;
   217 
   218         /**
   219          * Returns ETrue if this is an Email address field type.
   220          * @return ETrue if this is a EMail address field type, EFalse otherwise.
   221          */
   222         IMPORT_C TBool IsEmailField() const;
   223 
   224         /**
   225          * Returns ETrue if this is a MMS address field type.
   226          * @return ETrue if this is a MMS address field type, EFalse otherwise.
   227          */
   228         IMPORT_C TBool IsMmsField() const;
   229 
   230         /**
   231          * Returns ETrue if this is an image field type.
   232          * @return ETrue if this is a image field type, EFalse otherwise.
   233          */
   234         IMPORT_C TBool IsImageField() const;
   235 
   236         /**
   237 		 * Returns ETrue if this is a POC address field type.
   238          * @return ETrue if this is a POC address field type, EFalse otherwise.
   239 		 */
   240         IMPORT_C TBool IsPocField() const;
   241         
   242         /**
   243 		 * Returns ETrue if this is a VOIP address field type.
   244          * @return ETrue if this is a VOIP address field type, EFalse otherwise.
   245 		 */
   246         IMPORT_C TBool IsVoipField() const;
   247 
   248         /**
   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.
   252          */
   253         IMPORT_C TBool IsSame(const CPbkFieldInfo& aFieldInfo) const;
   254 
   255         /**
   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.
   259          */
   260         IMPORT_C TBool Match(TPbkFieldId aFieldId) const;
   261 
   262         /**
   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.
   268          */
   269         TBool Match(const TPbkContactItemFieldType& aFieldType) const;
   270 
   271         /**
   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.
   278          */
   279         TBool Match
   280             (const TPbkContactItemFieldType& aFieldType,
   281             const TPbkMatchPriorityLevel& aMatchPriority) const;
   282 
   283         /**
   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.
   290          */
   291         TBool Match
   292             (const TPbkVcardFieldType& aVcardType,
   293             const TPbkMatchPriorityLevel& aMatchPriority) const;
   294 
   295         /**
   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.
   305          */
   306         IMPORT_C TBool Match(const CContactItemField& aField) const;
   307 
   308         /**
   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.
   312          */
   313         IMPORT_C CContactItemField* CreateFieldL() const;
   314 
   315         /**
   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.
   319          */
   320         TBool IsEqualLabel(const CContactItemField& aField) const;
   321 
   322         /**
   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.
   327          */
   328         TBool IsEqualType(const CContactItemField& aField) const;
   329 
   330         /**
   331          * Returns ETrue if aField's type and labels are equal to this field
   332          * info object.
   333          * @param aField    Symbian Contacts model field to compare
   334          * @return ETrue if aField's type and labels are equal to this field
   335          * info object.
   336          */
   337         IMPORT_C TBool IsEqualTo(const CContactItemField& aField) const;
   338 
   339         /**
   340          * Compares the field ordering of this and aOther.
   341          *
   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.
   346          */
   347         IMPORT_C TInt CompareOrdering(const CPbkFieldInfo& aOther) const;
   348 
   349         /**
   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.
   352          */
   353         IMPORT_C const CPbkFieldInfoGroup* Group() const;
   354 
   355         /**
   356          * Returns the location information of the field.
   357          * @return The location information of the field.
   358          */
   359         IMPORT_C TPbkFieldLocation Location() const;
   360 
   361         /**
   362          * Returns the versit storage type of the field.
   363          * @return The versit storage type of the field.
   364          */
   365         IMPORT_C TPbkVersitStorageType VersitStorageType() const;
   366 
   367         /**
   368          * Add this field's type information to a contact item view definition.
   369          *
   370          * @param aViewDef  View definition to add types to.
   371          */
   372         IMPORT_C void AddToViewDefL(CContactItemViewDef& aViewDef) const;
   373 
   374         /**
   375          * Add this field's type information to a contact item field definition.
   376          *
   377          * @param aFieldDef Field definition to add types to.
   378          */
   379         IMPORT_C void AddToFieldDefL(CContactItemFieldDef& aFieldDef) const;
   380 
   381         /**
   382          * Returns the Add item label text of the field.
   383          * @return The Add item label text of the field.
   384          */
   385         IMPORT_C const TDesC& AddItemText() const;
   386 
   387         /**
   388          * Returns ETrue if this field is a reading field type (japanese).
   389          * @return ETrue if this field is a reading field type (japanese).
   390          */
   391         IMPORT_C TBool IsReadingField() const;
   392 
   393     private: // Forward declaration of internal class
   394         class TPbkFieldInfoParams;
   395 
   396     private: // Constructors and destructor
   397         CPbkFieldInfo();
   398 
   399         static CPbkFieldInfo* NewLC(TResourceReader& aReaderStd, TResourceReader& aReaderAdd, 
   400             TPbkFieldInfoParams& aPbkFieldInfoParams);
   401 
   402         ~CPbkFieldInfo();
   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;
   414     
   415     private: // Structure
   416 
   417         struct TPbkFieldInfoParams
   418 	        {
   419 	        /// Own: Max number length in editor
   420 	        TInt iEditorMaxNumberLength;
   421 	        };
   422 	        
   423     private:  // Data
   424         /**
   425 		 * Contacts Model attributes			
   426 		 * Attribute in resource struct FIELD
   427 		 */
   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
   440 
   441 		/**
   442          * Additional attributes
   443 		 * Attributes in resource struct PHONEBOOK_FIELD
   444 		 */
   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
   473 
   474 		/// Own: field import type
   475         CPbkFieldImportType* iImportType;
   476 
   477         union
   478             {
   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;
   483             } iGroupLink;
   484         
   485     private: // Friend declarations
   486         friend class CPbkFieldsInfo;
   487         friend class PbkFieldInfoWrite;
   488 	};
   489 
   490 #endif // __CPbkFieldInfo_H__
   491 
   492 // End of File