cpbkcontactitem.h

Go to the documentation of this file.
00001 /*
00002 * ============================================================================
00003 *  Name     : CPbkContactItem from CPbkContactItem.h
00004 *  Part of  : PbkEng.dll 
00005 *
00006 *  Description:
00007 *     Phonebook Contact item class.
00008 *  Version:
00009 *
00010 *  Copyright (C) 2002 Nokia Corporation.
00011 *  This material, including documentation and any related 
00012 *  computer programs, is protected by copyright controlled by 
00013 *  Nokia Corporation. All rights are reserved. Copying, 
00014 *  including reproducing, storing,  adapting or translating, any 
00015 *  or all of this material requires the prior written consent of 
00016 *  Nokia Corporation. This material also contains confidential 
00017 *  information which may not be disclosed to others without the 
00018 *  prior written consent of Nokia Corporation.
00019 * ============================================================================
00020 */
00021 
00022 #ifndef __CPbkContactItem_H__
00023 #define __CPbkContactItem_H__
00024 
00025 //  INCLUDES
00026 #include <e32base.h>        // CBase, CArrayFixFlat
00027 #include "MPbkFieldData.h"  // MPbkFieldDataArray
00028 #include "PbkFields.hrh"    // TPbkFieldId
00029 #include "TPbkContactItemField.h"
00030 
00031 // FORWARD DECLARATIONS
00032 class CPbkFieldsInfo;
00033 class CPbkFieldInfo;
00034 class CContactItemField;
00035 class CContactItem;
00036 class MPbkContactNameFormat;
00037 
00038 
00039 // CLASS DECLARATION
00040 
00044 class CPbkFieldArray : public CArrayFixFlat<TPbkContactItemField>
00045     {
00046     public:
00047         enum
00048             {
00050             KDefaultGranularity = 8
00051             };
00052 
00056         inline CPbkFieldArray() 
00057             : CArrayFixFlat<TPbkContactItemField>(KDefaultGranularity)
00058             {
00059             }
00060 
00065         inline CPbkFieldArray(TInt aGranurality) 
00066             : CArrayFixFlat<TPbkContactItemField>(aGranurality)
00067             {
00068             }
00069     };
00070 
00071 
00078 class CPbkContactItem : 
00079         public CBase, public MPbkFieldDataArray
00080     {
00081     public:  // Constructor and destructor
00092         IMPORT_C static CPbkContactItem* NewL(
00093                 CContactItem* aItem, 
00094                 const CPbkFieldsInfo& aFieldsInfo, 
00095                 MPbkContactNameFormat& aNameFormat);
00096 
00100         ~CPbkContactItem();
00101 
00102     public: // CContactItem functions
00107         IMPORT_C TContactItemId Id() const;
00108         
00115         IMPORT_C TUid Type() const;
00116 
00122         IMPORT_C CContactIdArray* GroupsJoinedLC() const;
00123 
00129         IMPORT_C CContactItem& ContactItem();
00130 
00136         IMPORT_C const CContactItem& ContactItem() const;
00137 
00138     public:  // Field set operations
00143         IMPORT_C CPbkFieldArray& CardFields() const;
00144 
00151         IMPORT_C TPbkContactItemField& AddFieldL(CPbkFieldInfo& aFieldInfo);
00152 
00160         IMPORT_C TBool CanAcceptDataOfType(CPbkFieldInfo& aFieldInfo) const;
00161 
00175         IMPORT_C TPbkContactItemField* AddOrReturnUnusedFieldL
00176             (CPbkFieldInfo& aFieldInfo);
00177 
00182         IMPORT_C void RemoveField(TInt aIndex);
00183 
00192         IMPORT_C void UpdateFieldSetL(const CPbkFieldsInfo& aFieldsInfo);
00193 
00194     public:  // Field searching
00201         IMPORT_C TPbkContactItemField* FindField(TPbkFieldId aFieldId) const;
00202 
00211         IMPORT_C TPbkContactItemField* FindField
00212             (TPbkFieldId aFieldId, TInt& aIndex) const;
00213 
00220         IMPORT_C TPbkContactItemField* FindField(const CPbkFieldInfo& aFieldInfo) const;
00221 
00230         IMPORT_C TPbkContactItemField* FindField
00231             (const CPbkFieldInfo& aFieldInfo, TInt& aIndex) const;
00232 
00242         IMPORT_C TInt FindFieldIndex(const TPbkContactItemField& aField) const;
00243 
00250         IMPORT_C TInt FindContactItemFieldIndex(const CContactItemField& aField) const;
00251 
00265         IMPORT_C TPbkContactItemField* FindNextFieldWithPhoneNumber
00266             (const TDesC& aNumber,
00267             TInt aNumberOfDigits,
00268             TInt &aIndex) const;
00269 
00280         IMPORT_C TPbkContactItemField* FindNextFieldWithText
00281             (const TDesC& aText,
00282             TInt& aIndex) const;
00283 
00291         IMPORT_C TPbkContactItemField* FindSameField
00292             (const TPbkContactItemField& aField) const;
00293 
00294     public: // Contact presentation
00302         IMPORT_C HBufC* GetContactTitleL() const;
00303 
00310         IMPORT_C HBufC* GetContactTitleOrNullL() const;
00311 
00318         IMPORT_C TPbkIconId ContactIconIdL() const;
00319 
00320     public:  // Defaults
00327         IMPORT_C TPbkContactItemField* DefaultPhoneNumberField() const;
00328 
00338         IMPORT_C void SetDefaultPhoneNumberFieldL
00339             (TPbkContactItemField* aField);
00340 
00346         IMPORT_C void RemoveDefaultPhoneNumberField();
00347 
00354         IMPORT_C TPbkContactItemField* DefaultVideoNumberField() const;
00355 
00365         IMPORT_C void SetDefaultVideoNumberFieldL
00366             (TPbkContactItemField* aField);
00367 
00373         IMPORT_C void RemoveDefaultVideoNumberField();
00374 
00381         IMPORT_C TPbkContactItemField* DefaultSmsField() const;
00382 
00392         IMPORT_C void SetDefaultSmsFieldL(TPbkContactItemField* aField);
00393 
00399         IMPORT_C void RemoveDefaultSmsField();
00400 
00407         IMPORT_C TPbkContactItemField* DefaultEmailField() const;
00408 
00418         IMPORT_C void SetDefaultEmailFieldL(TPbkContactItemField* aField);
00419 
00425         IMPORT_C void RemoveDefaultEmailField();
00426 
00433         IMPORT_C TPbkContactItemField* DefaultMmsField() const;
00434 
00444         IMPORT_C void SetDefaultMmsFieldL(TPbkContactItemField* aField);
00445 
00451         IMPORT_C void RemoveDefaultMmsField();
00452 
00459         IMPORT_C TPbkContactItemField* DefaultPocField() const;
00460 
00470         IMPORT_C void SetDefaultPocFieldL(TPbkContactItemField* aField);
00471 
00477         IMPORT_C void RemoveDefaultPocField();
00478         
00485         IMPORT_C TPbkContactItemField* DefaultVoipField() const;
00486 
00496         IMPORT_C void SetDefaultVoipFieldL(TPbkContactItemField* aField);
00497 
00503         IMPORT_C void RemoveDefaultVoipField();
00504         
00511         IMPORT_C TPbkContactItemField* DefaultEmailOverSmsField() const;
00512         
00522         IMPORT_C void SetDefaultEmailOverSmsFieldL(TPbkContactItemField* aField);
00523         
00529         IMPORT_C void RemoveDefaultEmailOverSmsField();
00530 
00531     public:  // Voice tags
00542         IMPORT_C TPbkContactItemField* VoiceTagField() const;
00543 
00555         IMPORT_C void SetVoiceTagFieldL(TPbkContactItemField* aField);
00556 
00563         IMPORT_C void RemoveVoiceTagField();
00564 
00565     public:  // from MPbkFieldDataArray
00566         TInt PbkFieldCount() const;
00567         MPbkFieldData& PbkFieldAt(TInt aIndex);
00568         const MPbkFieldData& PbkFieldAt(TInt aIndex) const;
00569 
00570     public: // Phonebook internal functions, do not call
00577         void PrepareForSaveL();
00578 
00585         void PrepareAfterLoadL();
00586         
00587     private: // Implementation
00588         CPbkContactItem(MPbkContactNameFormat& aNameFormat);
00589         void ConstructL(CContactItem* aItem, const CPbkFieldsInfo& aFieldsInfo);
00590         void CreateFieldArrayL(CContactItem& aContactItem, const CPbkFieldsInfo& aFieldsInfo);
00591         TInt InsertionPos(const TPbkContactItemField& aField) const;
00592         __DECLARE_TEST;
00593         typedef CPbkContactItem SelfType;
00594 
00595     private:    // Data
00597         CContactItem* iItem;
00599         CPbkFieldArray iFields;
00601         MPbkContactNameFormat& iNameFormat;
00602 
00603     private:  // Friend declarations
00604         friend IMPORT_C TBool operator==
00605             (const CPbkContactItem& aLeft, const CPbkContactItem& aRight);
00606     };
00607 
00608 
00609 // FUNCTION DECLARATIONS
00610 
00614 IMPORT_C TBool operator==
00615     (const CPbkContactItem& aLeft, const CPbkContactItem& aRight);
00616 
00620 inline TBool operator!=
00621     (const CPbkContactItem& aLeft, const CPbkContactItem& aRight)
00622     {
00623     return !(aLeft==aRight);
00624     }
00625 
00626 
00627 // __CPbkContactItem_H__
00628 #endif
00629             
00630 // End of File

Copyright © Nokia Corporation 2001-2008
Back to top