epoc32/include/app/CPbkContactItem.h
branchSymbian3
changeset 4 837f303aceeb
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/epoc32/include/app/CPbkContactItem.h	Wed Mar 31 12:33:34 2010 +0100
     1.3 @@ -0,0 +1,627 @@
     1.4 +/*
     1.5 +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
     1.6 +* All rights reserved.
     1.7 +* This component and the accompanying materials are made available
     1.8 +* under the terms of "Eclipse Public License v1.0"
     1.9 +* which accompanies this distribution, and is available
    1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.11 +*
    1.12 +* Initial Contributors:
    1.13 +* Nokia Corporation - initial contribution.
    1.14 +*
    1.15 +* Contributors:
    1.16 +*
    1.17 +* Description: 
    1.18 +*     Phonebook Contact item class.
    1.19 +*
    1.20 +*/
    1.21 +
    1.22 +
    1.23 +#ifndef __CPbkContactItem_H__
    1.24 +#define __CPbkContactItem_H__
    1.25 +
    1.26 +//  INCLUDES
    1.27 +#include <e32base.h>        // CBase, CArrayFixFlat
    1.28 +#include "MPbkFieldData.h"  // MPbkFieldDataArray
    1.29 +#include "PbkFields.hrh"    // TPbkFieldId
    1.30 +#include "TPbkContactItemField.h"
    1.31 +
    1.32 +// FORWARD DECLARATIONS
    1.33 +class CPbkFieldsInfo;
    1.34 +class CPbkFieldInfo;
    1.35 +class CContactItemField;
    1.36 +class CContactItem;
    1.37 +class MPbkContactNameFormat;
    1.38 +
    1.39 +
    1.40 +// CLASS DECLARATION
    1.41 +
    1.42 +/**
    1.43 + * Array of TPbkContactItemField instances.
    1.44 + */
    1.45 +class CPbkFieldArray : public CArrayFixFlat<TPbkContactItemField>
    1.46 +    {
    1.47 +    public:
    1.48 +        enum
    1.49 +            {
    1.50 +            /// Default array reallocation granularity
    1.51 +            KDefaultGranularity = 8
    1.52 +            };
    1.53 +
    1.54 +        /** 
    1.55 +         * Constructor.
    1.56 +         */
    1.57 +        inline CPbkFieldArray() 
    1.58 +            : CArrayFixFlat<TPbkContactItemField>(KDefaultGranularity)
    1.59 +            {
    1.60 +            }
    1.61 +
    1.62 +        /**
    1.63 +         * Constructor.
    1.64 +         * @param aGranularity  Reallocation granularity of this array.
    1.65 +         */
    1.66 +        inline CPbkFieldArray(TInt aGranurality) 
    1.67 +            : CArrayFixFlat<TPbkContactItemField>(aGranurality)
    1.68 +            {
    1.69 +            }
    1.70 +    };
    1.71 +
    1.72 +
    1.73 +/**
    1.74 + * Phonebook Contact item class. Contact items can be read from the contact
    1.75 + * database by using the Phonebook engine, @see CPbkContactEngine.
    1.76 + * This class extends Symbian Contacts model class CContactItem capabilities 
    1.77 + * to better suit Phonebook application's needs.
    1.78 + */
    1.79 +class CPbkContactItem : 
    1.80 +        public CBase, public MPbkFieldDataArray
    1.81 +    {
    1.82 +    public:  // Constructor and destructor
    1.83 +        /**
    1.84 +         * Creates an instance of this class.
    1.85 +         *
    1.86 +         * @param aItem         Contact item this object wraps. This object 
    1.87 +         *                      takes ownership of aItem. If this function 
    1.88 +         *                      leaves, ownership is not taken.
    1.89 +         * @param aFieldsInfo   Collection of Phonebook field types.
    1.90 +         * @param aNameFormat   Contact name formatter.
    1.91 +         * @return  A new instance of this class.
    1.92 +         */
    1.93 +        IMPORT_C static CPbkContactItem* NewL(
    1.94 +                CContactItem* aItem, 
    1.95 +                const CPbkFieldsInfo& aFieldsInfo, 
    1.96 +                MPbkContactNameFormat& aNameFormat);
    1.97 +
    1.98 +        /**
    1.99 +         * Destructor.
   1.100 +         */
   1.101 +        ~CPbkContactItem();
   1.102 +
   1.103 +    public: // CContactItem functions
   1.104 +        /**
   1.105 +         * Returns this contact item's id.
   1.106 +         * @see CContactItem::Id()
   1.107 +         */
   1.108 +        IMPORT_C TContactItemId Id() const;
   1.109 +        
   1.110 +        /**
   1.111 +         * Returns type of this contact item. The contact types are documented in
   1.112 +         * the Symbian Contacts model CContactItem::Type().
   1.113 +         * @return Contact type.
   1.114 +         * @see CContactItem::Type()
   1.115 +         */
   1.116 +        IMPORT_C TUid Type() const;
   1.117 +
   1.118 +        /**
   1.119 +         * Gets the groups this contact belongs to.
   1.120 +         * @return Array of group ids. Caller owns the array.
   1.121 +         * @see CContactItem::GroupsJoinedLC()
   1.122 +         */
   1.123 +        IMPORT_C CContactIdArray* GroupsJoinedLC() const;
   1.124 +
   1.125 +        /**
   1.126 +         * Converts this object to a CContactItem. Use only if this class's API
   1.127 +         * is not enough.
   1.128 +         * @return  The underlying Symbian Contacts model contact item object.
   1.129 +         */
   1.130 +        IMPORT_C CContactItem& ContactItem();
   1.131 +
   1.132 +        /**
   1.133 +         * Converts this object to a const CContactItem. Use only if this 
   1.134 +         * class's API is not enough.
   1.135 +         * @return  The underlying Symbian Contacts model contact item object.
   1.136 +         */
   1.137 +        IMPORT_C const CContactItem& ContactItem() const;
   1.138 +
   1.139 +    public:  // Field set operations
   1.140 +        /**
   1.141 +         * Returns the field set of this contact item.
   1.142 +         * @return  Field array of this contact item.
   1.143 +         */
   1.144 +        IMPORT_C CPbkFieldArray& CardFields() const;
   1.145 +
   1.146 +        /**
   1.147 +         * Creates a new field based on aFieldInfo and adds it to this contact.
   1.148 +         *
   1.149 +         * @param aFieldInfo    Type of field to create.
   1.150 +         * @return The created field.
   1.151 +         */
   1.152 +      	IMPORT_C TPbkContactItemField& AddFieldL(CPbkFieldInfo& aFieldInfo);
   1.153 +
   1.154 +        /**
   1.155 +         * Returns ETrue if data of type aFieldInfo can be added to this 
   1.156 +         * contact.
   1.157 +         * @param aFieldInfo    The field type that we are trying to add.
   1.158 +         * @return  ETrue if the contact can accept this type of data, EFalse
   1.159 +         *          otherwise.
   1.160 +         */
   1.161 +        IMPORT_C TBool CanAcceptDataOfType(CPbkFieldInfo& aFieldInfo) const;
   1.162 +
   1.163 +        /**
   1.164 +         * Finds an unused or creates a new field based on aFieldInfo. An 
   1.165 +         * unused field is a field that is in the contact template, but
   1.166 +         * doesnt contain any data, in other words it is empty. So a unused 
   1.167 +         * field is preferred ad the next field to add user data before 
   1.168 +         * adding a new field to the contact.
   1.169 +         *
   1.170 +         * @param aFieldInfo    Type of field to search or create.
   1.171 +         * @return  Pointer to the found or created field. NULL only if<br>
   1.172 +         *          field exists AND <br>
   1.173 +         *          field is nonempty AND <br>
   1.174 +         *          aFieldInfo.Multiplicity()==EPbkFieldMultiplicityOne.
   1.175 +         */
   1.176 +      	IMPORT_C TPbkContactItemField* AddOrReturnUnusedFieldL
   1.177 +            (CPbkFieldInfo& aFieldInfo);
   1.178 +
   1.179 +        /**
   1.180 +         * Deletes field at aIndex.
   1.181 +         * @param aIndex    Field index to delete from the contact item.
   1.182 +         */
   1.183 +        IMPORT_C void RemoveField(TInt aIndex);
   1.184 +
   1.185 +        /**
   1.186 +         * Updates this contacts field set to match the field set of
   1.187 +         * the owned CContactItem. No need to call unless contact item's
   1.188 +         * field set has been manipulated directly. In other words 
   1.189 +         * remaps the field types of this contact item from the underlying
   1.190 +         * Symbian Contacts model contact item.
   1.191 +         * @param aFieldsInfo   The new fields set for this contact.
   1.192 +         */
   1.193 +        IMPORT_C void UpdateFieldSetL(const CPbkFieldsInfo& aFieldsInfo);
   1.194 +
   1.195 +    public:  // Field searching
   1.196 +        /**
   1.197 +         * Returns first field matching aFieldId.
   1.198 +         *
   1.199 +         * @param aFieldId  Field id to search.
   1.200 +         * @return First field matching aFieldId, NULL if none found.
   1.201 +         */
   1.202 +        IMPORT_C TPbkContactItemField* FindField(TPbkFieldId aFieldId) const;
   1.203 +
   1.204 +        /**
   1.205 +         * Returns first field matching aFieldId starting from aIndex.
   1.206 +         *
   1.207 +         * @param aFieldId  Field id to search.
   1.208 +         * @param aIndex    Input: field index where to start the search from,
   1.209 +         *                  output: index of the found field or -1 if not found.
   1.210 +         * @return Field matching aFieldId, NULL if none found.
   1.211 +         */
   1.212 +        IMPORT_C TPbkContactItemField* FindField
   1.213 +            (TPbkFieldId aFieldId, TInt& aIndex) const;
   1.214 +
   1.215 +        /**
   1.216 +         * Returns first field matching aFieldInfo.
   1.217 +         *
   1.218 +         * @param aFieldInfo    Field type to find from the contact.
   1.219 +         * @return First field matching aFieldInfo, NULL if none found.
   1.220 +         */
   1.221 +        IMPORT_C TPbkContactItemField* FindField(const CPbkFieldInfo& aFieldInfo) const;
   1.222 +
   1.223 +        /**
   1.224 +         * Returns first field matching aFieldInfo starting from aIndex.
   1.225 +         *
   1.226 +         * @param aFieldInfo    Field type to find from the contact.
   1.227 +         * @param aIndex    Input: field index where to start the search from,
   1.228 +         *                  output: index of the found field or -1 if not found.
   1.229 +         * @return Field matching aFieldInfo, NULL if none found.
   1.230 +         */
   1.231 +        IMPORT_C TPbkContactItemField* FindField
   1.232 +            (const CPbkFieldInfo& aFieldInfo, TInt& aIndex) const;
   1.233 +
   1.234 +        /**
   1.235 +         * Returns aField's index from this contact item.
   1.236 +         *
   1.237 +         * @param aField    Field to search for. Field is matched with 
   1.238 +         *                  TPbkContactItemField::IsSame -function.
   1.239 +         * @return  Index of aField in this contact item's field set, 
   1.240 +         *          KErrNotFound if not found.
   1.241 +         * @see TPbkContactItemField::IsSame
   1.242 +         */
   1.243 +        IMPORT_C TInt FindFieldIndex(const TPbkContactItemField& aField) const;
   1.244 +
   1.245 +        /**
   1.246 +         * Returns aField's index from ContactItem()'s CardFields() or 
   1.247 +         * KErrNotFound if not found.
   1.248 +         * @param aField    The field which index we are querying.
   1.249 +         * @return The fields index in this contact item, KErrNotFound is not found.
   1.250 +         */
   1.251 +        IMPORT_C TInt FindContactItemFieldIndex(const CContactItemField& aField) const;
   1.252 +
   1.253 +        /**
   1.254 +         * Searches phone number fields of this contact for a match.
   1.255 +         * Uses PbkEngUtils::ContainSameDigits to perform the matching.
   1.256 +         *
   1.257 +         * @param aNumber   Phone number to match to.
   1.258 +         * @param aNumberOfDigits   Number of digits to compare from the end 
   1.259 +         *                          of the phone numbers. Full comparison
   1.260 +         *                          performed if 0.
   1.261 +         * @param aIndex    Input: field index where to start the search from,
   1.262 +         *                  output: index of the found field or KErrNotFound if not found.
   1.263 +         * @return The matching field, NULL if not found.
   1.264 +         * @see PbkEngUtils::ContainSameDigits
   1.265 +         */
   1.266 +        IMPORT_C TPbkContactItemField* FindNextFieldWithPhoneNumber
   1.267 +            (const TDesC& aNumber,
   1.268 +            TInt aNumberOfDigits,
   1.269 +            TInt &aIndex) const;
   1.270 +
   1.271 +        /**
   1.272 +         * Searches for a text in this contact's fields. Uses TDesC::FindF()
   1.273 +         * search the text from the fields.
   1.274 +         *
   1.275 +         * @param aIndex    Input: field index from where to start the search,
   1.276 +         *                  Output: index of the found field or KErrNotFound 
   1.277 +         *                  if not found.
   1.278 +         * @return The matching field, NULL if not found.
   1.279 +         * @see TDesC::FindF
   1.280 +         */
   1.281 +        IMPORT_C TPbkContactItemField* FindNextFieldWithText
   1.282 +            (const TDesC& aText,
   1.283 +            TInt& aIndex) const;
   1.284 +
   1.285 +        /**
   1.286 +         * Returns field matching aField from this contact item's field set, NULL if
   1.287 +         * not found.
   1.288 +         * @param aField    The field that we a mathing.
   1.289 +         * @return  Matching field or NULL if not found.
   1.290 +         * @postcond !FindSameField(field) || FindSameField(field)->IsSame(field)
   1.291 +         */
   1.292 +        IMPORT_C TPbkContactItemField* FindSameField
   1.293 +            (const TPbkContactItemField& aField) const;
   1.294 +
   1.295 +    public: // Contact presentation
   1.296 +        /**
   1.297 +         * Gets a title text for this contact or localized unnamed text.
   1.298 +         *
   1.299 +         * @return  A buffer containing the title or localized unnamed text if no
   1.300 +         *          title can be generated. Caller is responsible for deleting 
   1.301 +         *          the returned buffer.
   1.302 +         */
   1.303 +        IMPORT_C HBufC* GetContactTitleL() const;
   1.304 +
   1.305 +        /**
   1.306 +         * Gets a title text for this contact.
   1.307 +         *
   1.308 +         * @return  A buffer containing the title text, NULL if title is empty.
   1.309 +         *          Caller is responsible for deleting the returned buffer.
   1.310 +         */
   1.311 +        IMPORT_C HBufC* GetContactTitleOrNullL() const;
   1.312 +
   1.313 +        /**
   1.314 +         * Returns an Phonebook icon id for a contact. This icon id is the icon
   1.315 +         * of the field that is set as the default number to call.
   1.316 +         *
   1.317 +         * @return  Icon index for this contact, EPbkNullIconId for no icon.
   1.318 +         */
   1.319 +        IMPORT_C TPbkIconId ContactIconIdL() const;
   1.320 +
   1.321 +    public:  // Defaults
   1.322 +        /**
   1.323 +         * Returns the default phone number field of this contact.
   1.324 +         *
   1.325 +         * @return  Default phone number field of this contact, 
   1.326 +         *          NULL if no default set.
   1.327 +         */
   1.328 +        IMPORT_C TPbkContactItemField* DefaultPhoneNumberField() const;
   1.329 +
   1.330 +        /**
   1.331 +         * Sets this contact's default phone number field to aField.
   1.332 +         *
   1.333 +         * @param aField    Field to set as default, if NULL phone number
   1.334 +         *                  default is removed. Guaranteed not to leave if
   1.335 +         *                  aField is NULL.
   1.336 +         * @exception KErrNotFound  If aField is not this contact's field.
   1.337 +         * @exception KErrNotSupported  If aField is not a phone number field.
   1.338 +         */
   1.339 +        IMPORT_C void SetDefaultPhoneNumberFieldL
   1.340 +            (TPbkContactItemField* aField);
   1.341 +
   1.342 +        /**
   1.343 +         * Removes phone number default from this contact.
   1.344 +         *
   1.345 +         * @postcond DefaultPhoneNumberField()==NULL.
   1.346 +         */
   1.347 +        IMPORT_C void RemoveDefaultPhoneNumberField();
   1.348 +
   1.349 +        /**
   1.350 +         * Returns the default video number field of this contact.
   1.351 +         *
   1.352 +         * @return  Default video number field of this contact, 
   1.353 +         *          NULL if no default set.
   1.354 +         */
   1.355 +        IMPORT_C TPbkContactItemField* DefaultVideoNumberField() const;
   1.356 +
   1.357 +        /**
   1.358 +         * Sets this contact's default video number field to aField.
   1.359 +         *
   1.360 +         * @param aField    Field to set as default, if NULL video number
   1.361 +         *                  default is removed. Guaranteed not to leave if
   1.362 +         *                  aField is NULL.
   1.363 +         * @exception KErrNotFound  if aField is not this contact's field.
   1.364 +         * @exception KErrNotSupported  if aField is not a phone number field.
   1.365 +         */
   1.366 +        IMPORT_C void SetDefaultVideoNumberFieldL
   1.367 +            (TPbkContactItemField* aField);
   1.368 +
   1.369 +        /**
   1.370 +         * Removes video number default from this contact.
   1.371 +         *
   1.372 +         * @postcond DefaultVideoNumberField()==NULL.
   1.373 +         */
   1.374 +        IMPORT_C void RemoveDefaultVideoNumberField();
   1.375 +
   1.376 +        /**
   1.377 +         * Returns the default SMS field of this contact.
   1.378 +         *
   1.379 +         * @return  Default SMS field of this contact, 
   1.380 +         *          NULL if no default set.
   1.381 +         */
   1.382 +        IMPORT_C TPbkContactItemField* DefaultSmsField() const;
   1.383 +
   1.384 +        /**
   1.385 +         * Sets this contact's default SMS field to aField.
   1.386 +         *
   1.387 +         * @param aField    Field to set as default, if NULL SMS
   1.388 +         *                  default is removed. Guaranteed not to leave if
   1.389 +         *                  aField is NULL.
   1.390 +         * @exception KErrNotFound  if aField is not this contact's field.
   1.391 +         * @exception KErrNotSupported  if aField is not a phone number field.
   1.392 +         */
   1.393 +        IMPORT_C void SetDefaultSmsFieldL(TPbkContactItemField* aField);
   1.394 +
   1.395 +        /**
   1.396 +         * Removes SMS field default from this contact.
   1.397 +         *
   1.398 +         * @postcond DefaultSmsField()==NULL.
   1.399 +         */
   1.400 +        IMPORT_C void RemoveDefaultSmsField();
   1.401 +
   1.402 +        /**
   1.403 +         * Returns the default email field of this contact.
   1.404 +         *
   1.405 +         * @return  Default email field of this contact, 
   1.406 +         *          NULL if no default set.
   1.407 +         */
   1.408 +        IMPORT_C TPbkContactItemField* DefaultEmailField() const;
   1.409 +
   1.410 +        /**
   1.411 +         * Sets this contact's default email address field to aField.
   1.412 +         *
   1.413 +         * @param aField    Field to set as default, if NULL email 
   1.414 +         *                  default is removed. Guaranteed not to leave if
   1.415 +         *                  aField is NULL.
   1.416 +         * @exception KErrNotFound  If aField is not this contact's field.
   1.417 +         * @exception KErrNotSupported  If aField is not an email field.
   1.418 +         */
   1.419 +        IMPORT_C void SetDefaultEmailFieldL(TPbkContactItemField* aField);
   1.420 +
   1.421 +        /**
   1.422 +         * Removes email field default from this contact.
   1.423 +         *
   1.424 +         * @postcond DefaultEmailField()==NULL.
   1.425 +         */
   1.426 +        IMPORT_C void RemoveDefaultEmailField();
   1.427 +
   1.428 +        /**
   1.429 +         * Returns the default Mms field of this contact.
   1.430 +         *
   1.431 +         * @return  Default Mms field of this contact, 
   1.432 +         *          NULL if no default set.
   1.433 +         */
   1.434 +        IMPORT_C TPbkContactItemField* DefaultMmsField() const;
   1.435 +
   1.436 +        /**
   1.437 +         * Sets this contact's default MMS address field to aField.
   1.438 +         *
   1.439 +         * @param aField    Field to set as default, if NULL MMS 
   1.440 +         *                  default is removed. Guaranteed not to leave if
   1.441 +         *                  aField is NULL.
   1.442 +         * @exception KErrNotFound  If aField is not this contact's field.
   1.443 +         * @exception KErrNotSupported  If aField is not an email field.
   1.444 +         */
   1.445 +        IMPORT_C void SetDefaultMmsFieldL(TPbkContactItemField* aField);
   1.446 +
   1.447 +        /**
   1.448 +         * Removes MMS field default from this contact.
   1.449 +         *
   1.450 +         * @postcond DefaultMmsField()==NULL.
   1.451 +         */
   1.452 +        IMPORT_C void RemoveDefaultMmsField();
   1.453 +
   1.454 +        /**
   1.455 +         * Returns the default Poc field of this contact.
   1.456 +         *
   1.457 +         * @return  Default Poc field of this contact, 
   1.458 +         *          NULL if no default set.
   1.459 +         */
   1.460 +        IMPORT_C TPbkContactItemField* DefaultPocField() const;
   1.461 +
   1.462 +        /**
   1.463 +         * Sets this contact's default POC address field to aField.
   1.464 +         *
   1.465 +         * @param aField    Field to set as default, if NULL POC 
   1.466 +         *                  default is removed. Guaranteed not to leave if
   1.467 +         *                  aField is NULL.
   1.468 +         * @exception KErrNotFound  If aField is not this contact's field.
   1.469 +         * @exception KErrNotSupported  If aField is not an email field.
   1.470 +         */
   1.471 +        IMPORT_C void SetDefaultPocFieldL(TPbkContactItemField* aField);
   1.472 +
   1.473 +        /**
   1.474 +         * Removes POC field default from this contact.
   1.475 +         *
   1.476 +         * @postcond DefaultPocField()==NULL.
   1.477 +         */
   1.478 +        IMPORT_C void RemoveDefaultPocField();
   1.479 +        
   1.480 +        /**
   1.481 +         * Returns the default VOIP field of this contact.
   1.482 +         *
   1.483 +         * @return  Default VOIP field of this contact, 
   1.484 +         *          NULL if no default set.
   1.485 +         */
   1.486 +        IMPORT_C TPbkContactItemField* DefaultVoipField() const;
   1.487 +
   1.488 +        /**
   1.489 +         * Sets this contact's default VOIP address field to aField.
   1.490 +         *
   1.491 +         * @param aField    Field to set as default, if NULL VOIP 
   1.492 +         *                  default is removed. Guaranteed not to leave if
   1.493 +         *                  aField is NULL.
   1.494 +         * @exception KErrNotFound  If aField is not this contact's field.
   1.495 +         * @exception KErrNotSupported  If aField is not an email field.
   1.496 +         */
   1.497 +        IMPORT_C void SetDefaultVoipFieldL(TPbkContactItemField* aField);
   1.498 +
   1.499 +        /**
   1.500 +         * Removes VOIP field default from this contact.
   1.501 +         *
   1.502 +         * @postcond DefaultVoipField()==NULL.
   1.503 +         */
   1.504 +        IMPORT_C void RemoveDefaultVoipField();
   1.505 +        
   1.506 +        /**
   1.507 +         * Returns the default EmailOverSms field of this contact.
   1.508 +         *
   1.509 +         * @return  Default EmailOverSms field of this contact, 
   1.510 +         *          NULL if no default set.
   1.511 +         */
   1.512 +        IMPORT_C TPbkContactItemField* DefaultEmailOverSmsField() const;
   1.513 +        
   1.514 +        /**
   1.515 +         * Sets this contact's default Sms With Email address field to aField.
   1.516 +         *
   1.517 +         * @param aField    Field to set as default, if NULL Sms With Email 
   1.518 +         *                  default is removed. Guaranteed not to leave if
   1.519 +         *                  aField is NULL.
   1.520 +         * @exception KErrNotFound  If aField is not this contact's field.
   1.521 +         * @exception KErrNotSupported  If aField is not an email field.
   1.522 +         */
   1.523 +        IMPORT_C void SetDefaultEmailOverSmsFieldL(TPbkContactItemField* aField);
   1.524 +        
   1.525 +        /**
   1.526 +         * Removes EmailOverSms field default from this contact.
   1.527 +         *
   1.528 +         * @postcond DefaultEmailOverSmsField()==NULL.
   1.529 +         */
   1.530 +        IMPORT_C void RemoveDefaultEmailOverSmsField();
   1.531 +
   1.532 +    public:  // Voice tags
   1.533 +        /**
   1.534 +         * Returns the voice tag field of this contact.
   1.535 +         * NOTE: If this function is unable to make a connection to 
   1.536 +         * the voice tag handling system for some reason, this function will 
   1.537 +         * return null.
   1.538 +         *
   1.539 +         * @return  Voice tag field of this contact, 
   1.540 +         *          NULL if no voice tag set.
   1.541 +         * @deprecated
   1.542 +         */
   1.543 +        IMPORT_C TPbkContactItemField* VoiceTagField() const;
   1.544 +
   1.545 +        /**
   1.546 +         * Sets this contact's voice tag field to aField.
   1.547 +         *
   1.548 +         * @param aField    Field to set as default, if NULL voice tag mark
   1.549 +         *                  is removed. Guaranteed not to leave if
   1.550 +         *                  aField is NULL.
   1.551 +         * @exception KErrNotFound  If aField is not this contact's field.
   1.552 +         * @exception KErrNotSupported  If aField is not a phone number field.
   1.553 +         * @postcond (aField && VoiceTagField()->IsSame(*aField)) || (!aField && !VoiceTagField())
   1.554 +         * @deprecated
   1.555 +         */
   1.556 +        IMPORT_C void SetVoiceTagFieldL(TPbkContactItemField* aField);
   1.557 +
   1.558 +        /**
   1.559 +         * Removes any voice tag mark from this contact.
   1.560 +         *
   1.561 +         * @postcond VoiceTagField()==NULL.
   1.562 +         * @deprecated
   1.563 +         */
   1.564 +        IMPORT_C void RemoveVoiceTagField();
   1.565 +
   1.566 +    public:  // from MPbkFieldDataArray
   1.567 +        TInt PbkFieldCount() const;
   1.568 +        MPbkFieldData& PbkFieldAt(TInt aIndex);
   1.569 +        const MPbkFieldData& PbkFieldAt(TInt aIndex) const;
   1.570 +
   1.571 +    public: // Phonebook internal functions, do not call
   1.572 +        /**
   1.573 +         * @internal
   1.574 +         * Prepares this contact for saving into the contact database.
   1.575 +         * @see PrepareAfterLoad
   1.576 +         * @deprecated
   1.577 +         */
   1.578 +        void PrepareForSaveL();
   1.579 +
   1.580 +        /**
   1.581 +         * @internal
   1.582 +         * Prepares this contact after loading it from the contact database.
   1.583 +         * @see PrepareForSaveL
   1.584 +         * @deprecated
   1.585 +         */
   1.586 +        void PrepareAfterLoadL();
   1.587 +        
   1.588 +    private: // Implementation
   1.589 +        CPbkContactItem(MPbkContactNameFormat& aNameFormat);
   1.590 +        void ConstructL(CContactItem* aItem, const CPbkFieldsInfo& aFieldsInfo);
   1.591 +        void CreateFieldArrayL(CContactItem& aContactItem, const CPbkFieldsInfo& aFieldsInfo);
   1.592 +        TInt InsertionPos(const TPbkContactItemField& aField) const;
   1.593 +        __DECLARE_TEST;
   1.594 +        typedef CPbkContactItem SelfType;
   1.595 +
   1.596 +    private:    // Data
   1.597 +        /// Own: Embedded contact item.
   1.598 +        CContactItem* iItem;
   1.599 +        /// Own: array of phonebook contact item fields
   1.600 +        CPbkFieldArray iFields;
   1.601 +        /// Ref: Contact name formatting API
   1.602 +        MPbkContactNameFormat& iNameFormat;
   1.603 +
   1.604 +    private:  // Friend declarations
   1.605 +        friend IMPORT_C TBool operator==
   1.606 +            (const CPbkContactItem& aLeft, const CPbkContactItem& aRight);
   1.607 +    };
   1.608 +
   1.609 +
   1.610 +// FUNCTION DECLARATIONS
   1.611 +
   1.612 +/**
   1.613 + * Returns ETrue if aLeft and aRight contents are the same.
   1.614 + */
   1.615 +IMPORT_C TBool operator==
   1.616 +    (const CPbkContactItem& aLeft, const CPbkContactItem& aRight);
   1.617 +
   1.618 +/**
   1.619 + * Returns ETrue if aLeft and aRight contents differ.
   1.620 + */
   1.621 +inline TBool operator!=
   1.622 +    (const CPbkContactItem& aLeft, const CPbkContactItem& aRight)
   1.623 +    {
   1.624 +    return !(aLeft==aRight);
   1.625 +    }
   1.626 +
   1.627 +
   1.628 +#endif // __CPbkContactItem_H__
   1.629 +            
   1.630 +// End of File