epoc32/include/app/cpbkfieldinfo.h
branchSymbian2
changeset 2 2fe1408b6811
parent 1 666f914201fb
child 4 837f303aceeb
     1.1 --- a/epoc32/include/app/cpbkfieldinfo.h	Tue Nov 24 13:55:44 2009 +0000
     1.2 +++ b/epoc32/include/app/cpbkfieldinfo.h	Tue Mar 16 16:12:26 2010 +0000
     1.3 @@ -1,1 +1,492 @@
     1.4 -cpbkfieldinfo.h
     1.5 +/*
     1.6 +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
     1.7 +* All rights reserved.
     1.8 +* This component and the accompanying materials are made available
     1.9 +* under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
    1.10 +* which accompanies this distribution, and is available
    1.11 +* at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
    1.12 +*
    1.13 +* Initial Contributors:
    1.14 +* Nokia Corporation - initial contribution.
    1.15 +*
    1.16 +* Contributors:
    1.17 +*
    1.18 +* Description: 
    1.19 +*     Phonebook constant field type information
    1.20 +*
    1.21 +*/
    1.22 +
    1.23 +
    1.24 +#ifndef __CPbkFieldInfo_H__
    1.25 +#define __CPbkFieldInfo_H__
    1.26 +
    1.27 +//  INCLUDES
    1.28 +#include    <e32std.h>
    1.29 +#include    <cntdef.h>
    1.30 +#include    "PbkFields.hrh"
    1.31 +#include    "PbkIconId.hrh"
    1.32 +
    1.33 +// FORWARD DECLARATIONS
    1.34 +class CContentType;
    1.35 +class CContactItemField;
    1.36 +class CContactItemViewDef;
    1.37 +class CContactItemFieldDef;
    1.38 +class CPbkFieldsInfo;
    1.39 +class TResourceReader;
    1.40 +class CPbkFieldInfoGroup;
    1.41 +class CPbkFieldImportType;
    1.42 +class TPbkContactItemFieldType;
    1.43 +class TPbkVcardFieldType;
    1.44 +class CPbkUidMap;
    1.45 +class TPbkMatchPriorityLevel;
    1.46 +
    1.47 +// CLASS DECLARATION
    1.48 +
    1.49 +/**
    1.50 + * Phonebook constant field type information. Loaded from resources into
    1.51 + * CPbkFieldsInfo array. The corresponding resource structure is PHONEBOOK_FIELD
    1.52 + * in PbkFieldInfo.rh.
    1.53 + *
    1.54 + * @see CPbkFieldsInfo
    1.55 + * @see PHONEBOOK_FIELD
    1.56 + * @see FIELD
    1.57 + */
    1.58 +class CPbkFieldInfo :
    1.59 +        public CBase
    1.60 +	{
    1.61 +    public: // Interface
    1.62 +        /**
    1.63 +         * Returns the unique Phonebook field id for this field type.
    1.64 +         * @return The unique Phonebook field id for this field type.
    1.65 +         */
    1.66 +        IMPORT_C TPbkFieldId FieldId() const;
    1.67 +
    1.68 +        /**
    1.69 +         * Returns the storage type of this field type.
    1.70 +         * @return The storage type of this field type.
    1.71 +         */
    1.72 +        IMPORT_C TStorageType FieldStorageType() const;
    1.73 +
    1.74 +        /**
    1.75 +         * Returns the content type of this field type.
    1.76 +         * @return The content type of this field type.
    1.77 +         * @see CContentType
    1.78 +         */
    1.79 +        IMPORT_C const CContentType& ContentType() const;
    1.80 +
    1.81 +        /**
    1.82 +         * Returns the category of this field type.
    1.83 +         * @return The category of this field type
    1.84 +         */
    1.85 +        IMPORT_C TInt Category() const;
    1.86 +
    1.87 +        /**
    1.88 +         * Returns this field type's default label.
    1.89 +         * @return The field type's default label.
    1.90 +         */
    1.91 +        IMPORT_C const TDesC& FieldName() const;
    1.92 +
    1.93 +        /**
    1.94 +         * Returns Symbian Contacts Model field flags of this field type.
    1.95 +         * @return Symbian Contacts model field flags for this field type.
    1.96 +         */
    1.97 +        IMPORT_C TUint Flags() const;
    1.98 +
    1.99 +        /**
   1.100 +         * Returns the multiplicity allowed for this field type.
   1.101 +         * @return The multiplicity allowed for this field type.
   1.102 +         */
   1.103 +        IMPORT_C TPbkFieldMultiplicity Multiplicity() const;
   1.104 +
   1.105 +        /**
   1.106 +         * Returns the maximum data length that Phonebook UI spec specifies
   1.107 +         * for this field type.
   1.108 +         * @return The maximum data length that Phonebook UI spec specifies
   1.109 +         *         for this field type.
   1.110 +         */
   1.111 +        IMPORT_C TInt MaxLength() const;
   1.112 +
   1.113 +        /**
   1.114 +         * Returns the default editing mode for this field type.
   1.115 +         * @return The default editing mode for this field type.
   1.116 +         */
   1.117 +        IMPORT_C TPbkFieldEditMode EditMode() const;
   1.118 +
   1.119 +        /**
   1.120 +         * Returns the default character case for this field type.
   1.121 +         * @return The default character case for this field type.
   1.122 +         */
   1.123 +        IMPORT_C TPbkFieldDefaultCase DefaultCase() const;
   1.124 +
   1.125 +        /**
   1.126 +         * Returns the icon id for this field type.
   1.127 +         * @return The icon id for this field type.
   1.128 +         */
   1.129 +        IMPORT_C TPbkIconId IconId() const;
   1.130 +
   1.131 +        /**
   1.132 +         * Returns the UI control type required to edit this field.
   1.133 +         * @return The UI control type required to edit this field.
   1.134 +         */
   1.135 +        IMPORT_C TPbkFieldCtrlType CtrlType() const;
   1.136 +
   1.137 +        /**
   1.138 +         * Returns additional flags of this field type.
   1.139 +         * @return The additional flags of this field type.
   1.140 +         */
   1.141 +        IMPORT_C TUint AddFlags() const;
   1.142 +
   1.143 +        /**
   1.144 +         * @deprecated  This function is no longer supported.
   1.145 +         *
   1.146 +         * Returns the UI ordering for adding a field.
   1.147 +         * @return The UI ordering for adding a field.
   1.148 +         */
   1.149 +        IMPORT_C TPbkAddItemOrdering AddItemOrdering() const;
   1.150 +
   1.151 +        /**
   1.152 +         * Returns ETrue if this field is hidden.
   1.153 +         * @return ETrue if this field is hidden, EFalse otherwise.
   1.154 +         */
   1.155 +        IMPORT_C TBool IsHidden() const;
   1.156 +
   1.157 +        /**
   1.158 +         * Returns ETrue if this field is read only.
   1.159 +         * @return ETrue if this field is read only, EFalse otherwise.
   1.160 +         */
   1.161 +        IMPORT_C TBool IsReadOnly() const;
   1.162 +
   1.163 +        /**
   1.164 +         * Returns ETrue if this field is synchronized.
   1.165 +         * @return ETrue if this field is synchronized, EFalse otherwise.
   1.166 +         */
   1.167 +        IMPORT_C TBool DoSynchronize() const;
   1.168 +
   1.169 +        /**
   1.170 +         * Returns ETrue if this field is disabled.
   1.171 +         * @return ETrue if this field is disabled, EFalse otherwise.
   1.172 +         */
   1.173 +        IMPORT_C TBool IsDisabled() const;
   1.174 +
   1.175 +        /**
   1.176 +         * Returns ETrue if this is a name field type.
   1.177 +         * @return ETrue if this is a name field type, EFalse otherwise.
   1.178 +         */
   1.179 +        IMPORT_C TBool NameField() const;
   1.180 +
   1.181 +        /**
   1.182 +         * Returns ETrue if this field type is part of the default template.
   1.183 +         * @return ETrue if this is part of the default template, 
   1.184 +         *         EFalse otherwise.
   1.185 +         */
   1.186 +        IMPORT_C TBool TemplateField() const;
   1.187 +
   1.188 +        /**
   1.189 +         * Returns ETrue if this field type can be added by the user.
   1.190 +         * @return ETrue if this field type can be added by the user, 
   1.191 +         *         EFalse otherwise.
   1.192 +         */
   1.193 +        IMPORT_C TBool UserCanAddField() const;
   1.194 +
   1.195 +        /**
   1.196 +         * Returns ETrue if the field type can be edited in Phonebook's contact
   1.197 +         * editor.
   1.198 +         * @return ETrue if this field type can be edited in phonebook's contact 
   1.199 +         *         editor, EFalse otherwise.
   1.200 +         */
   1.201 +        IMPORT_C TBool IsEditable() const;
   1.202 +
   1.203 +        /**
   1.204 +         * Returns ETrue if this is a numeric field type.
   1.205 +         * @return ETrue if this is a numeric field type, EFalse otherwise.
   1.206 +         */
   1.207 +        IMPORT_C TBool NumericField() const;
   1.208 +
   1.209 +        /**
   1.210 +         * Returns ETrue if this is a phone number field type.
   1.211 +         * @return ETrue if this is a phone number field type, EFalse otherwise.
   1.212 +         */
   1.213 +        IMPORT_C TBool IsPhoneNumberField() const;
   1.214 +
   1.215 +        /**
   1.216 +         * Returns ETrue if this is an EmailOverSms address field type.
   1.217 +         * @return ETrue if this field type is a EmailOverSms address 
   1.218 +         *         field, EFalse otherwise.
   1.219 +         */
   1.220 +        IMPORT_C TBool IsEmailOverSmsField() const;
   1.221 +
   1.222 +        /**
   1.223 +         * Returns ETrue if this is an Email address field type.
   1.224 +         * @return ETrue if this is a EMail address field type, EFalse otherwise.
   1.225 +         */
   1.226 +        IMPORT_C TBool IsEmailField() const;
   1.227 +
   1.228 +        /**
   1.229 +         * Returns ETrue if this is a MMS address field type.
   1.230 +         * @return ETrue if this is a MMS address field type, EFalse otherwise.
   1.231 +         */
   1.232 +        IMPORT_C TBool IsMmsField() const;
   1.233 +
   1.234 +        /**
   1.235 +         * Returns ETrue if this is an image field type.
   1.236 +         * @return ETrue if this is a image field type, EFalse otherwise.
   1.237 +         */
   1.238 +        IMPORT_C TBool IsImageField() const;
   1.239 +
   1.240 +        /**
   1.241 +		 * Returns ETrue if this is a POC address field type.
   1.242 +         * @return ETrue if this is a POC address field type, EFalse otherwise.
   1.243 +		 */
   1.244 +        IMPORT_C TBool IsPocField() const;
   1.245 +        
   1.246 +        /**
   1.247 +		 * Returns ETrue if this is a VOIP address field type.
   1.248 +         * @return ETrue if this is a VOIP address field type, EFalse otherwise.
   1.249 +		 */
   1.250 +        IMPORT_C TBool IsVoipField() const;
   1.251 +
   1.252 +        /**
   1.253 +         * Returns ETrue if aFieldInfo is same as this.
   1.254 +         * @param aFieldInfo Field info to compare to this field type.
   1.255 +         * @return ETrue if aField Is same as this field type, EFalse otherwise.
   1.256 +         */
   1.257 +        IMPORT_C TBool IsSame(const CPbkFieldInfo& aFieldInfo) const;
   1.258 +
   1.259 +        /**
   1.260 +         * Returns ETrue if this field info matches aFieldId.
   1.261 +         * @param aFieldId  The field type id to compare to this field type.
   1.262 +         * @return ETrue if this field info matched aFieldId, EFalse otherwise.
   1.263 +         */
   1.264 +        IMPORT_C TBool Match(TPbkFieldId aFieldId) const;
   1.265 +
   1.266 +        /**
   1.267 +         * Returns ETrue if this field info matches aFieldType at any import
   1.268 +         * type priority level.
   1.269 +         * @param aFieldType    Field type to match to this field type.
   1.270 +         * @return ETrue if this field info matches aFieldType at any import
   1.271 +         * type priority level, EFalse otherwise.
   1.272 +         */
   1.273 +        TBool Match(const TPbkContactItemFieldType& aFieldType) const;
   1.274 +
   1.275 +        /**
   1.276 +         * Returns ETrue if this field info matches aFieldType at import
   1.277 +         * type priority level defined by aMatchPriority.
   1.278 +         * @param aFieldType    Field type to compare.
   1.279 +         * @param aMatchPriority    Matching priority.
   1.280 +         * @return ETrue if this field info matches aFieldType at import
   1.281 +         *         type priority level defined by aMatchPriority.
   1.282 +         */
   1.283 +        TBool Match
   1.284 +            (const TPbkContactItemFieldType& aFieldType,
   1.285 +            const TPbkMatchPriorityLevel& aMatchPriority) const;
   1.286 +
   1.287 +        /**
   1.288 +         * Returns ETrue if this field info matches aVcardType at import
   1.289 +         * type priority level defined by aMatchPriority.
   1.290 +         * @param aVcardType        vCard field type to match to this field type.
   1.291 +         * @param aMatchPriority    Matching priority.
   1.292 +         * @return ETrue if this field info matches aVcardType at import
   1.293 +         *         type priority level defined by aMatchPriority.
   1.294 +         */
   1.295 +        TBool Match
   1.296 +            (const TPbkVcardFieldType& aVcardType,
   1.297 +            const TPbkMatchPriorityLevel& aMatchPriority) const;
   1.298 +
   1.299 +        /**
   1.300 +         * @deprecated  This function is no longer supported. If you want to
   1.301 +         *              find the CPbkFieldInfo instance matching a
   1.302 +         *              CContactItemField use
   1.303 +         *              CPbkFieldsInfo::Match(const CContactItemField&) const.
   1.304 +         *              That function works correctly and uses <it>a lot</it>
   1.305 +         *              faster algorithm than this function.
   1.306 +         * @param aField    Symbian Contacts model contact item to match to this field type.
   1.307 +         * Returns ETrue if this field info matches aField.
   1.308 +         * @return ETrue is field matches, EFalse otherwise.
   1.309 +         */
   1.310 +        IMPORT_C TBool Match(const CContactItemField& aField) const;
   1.311 +
   1.312 +        /**
   1.313 +         * Creates a Symbian Contacts model field of this field type. Ownership of the field
   1.314 +         * is passed to the client.
   1.315 +         * @return Symbian Contacts model field of this field type.
   1.316 +         */
   1.317 +        IMPORT_C CContactItemField* CreateFieldL() const;
   1.318 +
   1.319 +        /**
   1.320 +         * Returns ETrue if aField's label is equal to this field info objects.
   1.321 +         * @param aField    Symbian Contacts model field to compare to this field types label.
   1.322 +         * @return ETrue if aField's label is equal to this field info object.
   1.323 +         */
   1.324 +        TBool IsEqualLabel(const CContactItemField& aField) const;
   1.325 +
   1.326 +        /**
   1.327 +         * Returns ETrue if aField's type is equal to this field info object.
   1.328 +         * @param aField Symbian Contacts model field to compare.
   1.329 +         * @return ETrue if Symbian Contacts model aField's type is equal 
   1.330 +         *         to this field info object.
   1.331 +         */
   1.332 +        TBool IsEqualType(const CContactItemField& aField) const;
   1.333 +
   1.334 +        /**
   1.335 +         * Returns ETrue if aField's type and labels are equal to this field
   1.336 +         * info object.
   1.337 +         * @param aField    Symbian Contacts model field to compare
   1.338 +         * @return ETrue if aField's type and labels are equal to this field
   1.339 +         * info object.
   1.340 +         */
   1.341 +        IMPORT_C TBool IsEqualTo(const CContactItemField& aField) const;
   1.342 +
   1.343 +        /**
   1.344 +         * Compares the field ordering of this and aOther.
   1.345 +         *
   1.346 +         * @param   aOther  The other object this is compared against.
   1.347 +         * @return  0, if this and aOther are equal in field ordering<br>
   1.348 +         *          negative, if this is less than aOther in field ordering<br>
   1.349 +         *          positive, if this is greater than aOther in field ordering.
   1.350 +         */
   1.351 +        IMPORT_C TInt CompareOrdering(const CPbkFieldInfo& aOther) const;
   1.352 +
   1.353 +        /**
   1.354 +         * Returns the field info group this field info belongs to or NULL.
   1.355 +         * @return The field info group this field info belongs to or NULL.
   1.356 +         */
   1.357 +        IMPORT_C const CPbkFieldInfoGroup* Group() const;
   1.358 +
   1.359 +        /**
   1.360 +         * Returns the location information of the field.
   1.361 +         * @return The location information of the field.
   1.362 +         */
   1.363 +        IMPORT_C TPbkFieldLocation Location() const;
   1.364 +
   1.365 +        /**
   1.366 +         * Returns the versit storage type of the field.
   1.367 +         * @return The versit storage type of the field.
   1.368 +         */
   1.369 +        IMPORT_C TPbkVersitStorageType VersitStorageType() const;
   1.370 +
   1.371 +        /**
   1.372 +         * Add this field's type information to a contact item view definition.
   1.373 +         *
   1.374 +         * @param aViewDef  View definition to add types to.
   1.375 +         */
   1.376 +        IMPORT_C void AddToViewDefL(CContactItemViewDef& aViewDef) const;
   1.377 +
   1.378 +        /**
   1.379 +         * Add this field's type information to a contact item field definition.
   1.380 +         *
   1.381 +         * @param aFieldDef Field definition to add types to.
   1.382 +         */
   1.383 +        IMPORT_C void AddToFieldDefL(CContactItemFieldDef& aFieldDef) const;
   1.384 +
   1.385 +        /**
   1.386 +         * Returns the Add item label text of the field.
   1.387 +         * @return The Add item label text of the field.
   1.388 +         */
   1.389 +        IMPORT_C const TDesC& AddItemText() const;
   1.390 +
   1.391 +        /**
   1.392 +         * Returns ETrue if this field is a reading field type (japanese).
   1.393 +         * @return ETrue if this field is a reading field type (japanese).
   1.394 +         */
   1.395 +        IMPORT_C TBool IsReadingField() const;
   1.396 +
   1.397 +    private: // Forward declaration of internal class
   1.398 +        class TPbkFieldInfoParams;
   1.399 +
   1.400 +    private: // Constructors and destructor
   1.401 +        CPbkFieldInfo();
   1.402 +
   1.403 +        static CPbkFieldInfo* NewLC(TResourceReader& aReaderStd, TResourceReader& aReaderAdd, 
   1.404 +            TPbkFieldInfoParams& aPbkFieldInfoParams);
   1.405 +
   1.406 +        ~CPbkFieldInfo();
   1.407 +        void ReadCntModelFieldsL(TResourceReader& aReaderStd);
   1.408 +        void ReadAdditionalFieldsL(TResourceReader& aReaderAdd, 
   1.409 +            TPbkFieldInfoParams& aPbkFieldInfoParams);
   1.410 +        void ReadImportPropertiesL(TResourceReader& aReaderAdd);
   1.411 +        void ConstructFromResourceL
   1.412 +            (TResourceReader& aReaderStd, TResourceReader& aReaderAdd,
   1.413 +             TPbkFieldInfoParams& aPbkFieldInfoParams);
   1.414 +        TInt ImportPropertyCount() const;
   1.415 +        void UpdateTypeUidMapL(CPbkUidMap& aTypeUidMap) const;
   1.416 +        void CalculateTypeSignatures(const CPbkUidMap& aTypeUidMap);
   1.417 +        TBool IsEqualFlags(const CContactItemField& aField) const;
   1.418 +    
   1.419 +    private: // Structure
   1.420 +
   1.421 +        struct TPbkFieldInfoParams
   1.422 +	        {
   1.423 +	        /// Own: Max number length in editor
   1.424 +	        TInt iEditorMaxNumberLength;
   1.425 +	        };
   1.426 +	        
   1.427 +    private:  // Data
   1.428 +        /**
   1.429 +		 * Contacts Model attributes			
   1.430 +		 * Attribute in resource struct FIELD
   1.431 +		 */
   1.432 +        /// Own: storage type (Text,Date,...)
   1.433 +        TStorageType iFieldStorageType;		// LONG fieldStorageType
   1.434 +		/// Own: content type
   1.435 +        CContentType* iContentType;			// LONG contactFieldType,
   1.436 +											// LONG vCardMapping,
   1.437 +											// STRUCT extraMapping[]
   1.438 +		/// Own: category (Home/Work)
   1.439 +        TInt iCategory;						// LONG category
   1.440 +		/// Own: field's default name and label
   1.441 +        HBufC* iFieldName;					// LTEXT fieldName
   1.442 +		/// Own: special flags
   1.443 +        TUint iFlags;						// LONG flags
   1.444 +
   1.445 +		/**
   1.446 +         * Additional attributes
   1.447 +		 * Attributes in resource struct PHONEBOOK_FIELD
   1.448 +		 */
   1.449 +        /// Own: entry Add item labeltext
   1.450 +        HBufC* iAddItemText;				// LTEXT AddItemText
   1.451 +        /// Own: assorted flags for the field type
   1.452 +        TUint iAddFlags;					// LONG Flags
   1.453 +        /// Own: maximum length in characters
   1.454 +        TInt16 iMaxLength;					// WORD MaxLength
   1.455 +        /// Own: index of an icon
   1.456 +        TInt8 iIconId;					    // BYTE IconId
   1.457 +        /// Own: The unique field type id
   1.458 +        TInt8 iFieldId;                     // BYTE Id
   1.459 +        /// Own: allowed multiplicity (one/many).
   1.460 +        TInt8 iMultiplicity;                // BYTE Multiplicity
   1.461 +        /// Own: default editing mode
   1.462 +        TInt8 iEditMode;		            // BYTE EditMode
   1.463 +        /// Own: default character case
   1.464 +        TInt8 iDefaultCase;                 // BYTE DefaultCase
   1.465 +        /// Own: editor UI control type
   1.466 +        TInt8 iCtrlType;                    // BYTE CtrlType
   1.467 +        /// Own: entry item grouping
   1.468 +        TInt8 iOrderingGroup;	            // BYTE OrderingGroup
   1.469 +        /// Own: entry item group item ordering
   1.470 +        TInt8 iOrderingItem;		        // BYTE OrderingItem
   1.471 +        /// Own: entry Add Item ordering
   1.472 +        TInt8 iAddItemOrdering;             // BYTE AddItemOrdering
   1.473 +        /// Own: entry item location (none/home/work)
   1.474 +        TInt8 iLocation;		            // BYTE Location
   1.475 +        // Own: data storage type in versit
   1.476 +        TInt8 iVersitStorageType;           // BYTE VersitStorageType
   1.477 +
   1.478 +		/// Own: field import type
   1.479 +        CPbkFieldImportType* iImportType;
   1.480 +
   1.481 +        union
   1.482 +            {
   1.483 +            /// Own: group id before groups are loaded
   1.484 +            TPbkFieldGroupId iGroupId;
   1.485 +            /// Ref: field info group this contact info belongs to
   1.486 +            const CPbkFieldInfoGroup* iGroup;
   1.487 +            } iGroupLink;
   1.488 +        
   1.489 +    private: // Friend declarations
   1.490 +        friend class CPbkFieldsInfo;
   1.491 +        friend class PbkFieldInfoWrite;
   1.492 +	};
   1.493 +
   1.494 +#endif // __CPbkFieldInfo_H__
   1.495 +
   1.496 +// End of File