utilityapps/creator/engine/inc/creator_phonebookwrapper.h
changeset 55 2d9cac8919d3
parent 51 b048e15729d6
equal deleted inserted replaced
53:819e59dfc032 55:2d9cac8919d3
       
     1 /*
       
     2 * Copyright (c) 2010 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 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef __CREATORPHONEBOOKWRAPPER_H__
       
    21 #define __CREATORPHONEBOOKWRAPPER_H__
       
    22 
       
    23 #include "creator_phonebookbase.h"
       
    24 #include "creator_randomdatafield.h"
       
    25 
       
    26 #include <map>
       
    27 
       
    28 #include "creator_phonebookapi.h"
       
    29 
       
    30 class CCreatorEngine;
       
    31 class CCreatorModuleBaseParameters;
       
    32 
       
    33 class CContactDatabase;	
       
    34 //class CPhonebookWrapperParameters;	
       
    35 class CPhonebookParameters;
       
    36 
       
    37 typedef typename std::map<const TInt, HBufC*> TCreatorContactFields;
       
    38 typedef typename std::pair<const TInt, HBufC*> TCreatorContactField;
       
    39 
       
    40 class CCreatorPhonebookWrapper : public CBase 
       
    41     {
       
    42 public:
       
    43 	enum ContactDetailType{
       
    44 	ELastName,					//0
       
    45 	ELastNameReading,			//1
       
    46 	EFirstName,
       
    47 	EFirstNameReading,
       
    48 	EPrefix,
       
    49 	ESuffix,					//5
       
    50 	ESecondName,
       
    51 	ELandPhoneHome,
       
    52 	EMobilePhoneHome,
       
    53 	EVideoNumberHome,
       
    54 	EFaxNumberHome,				//10
       
    55 	EVoipHome,
       
    56 	EEmailHome,
       
    57 	EUrlHome,
       
    58 	EAddrLabelHome,
       
    59 	EAddrPoHome,				//15
       
    60 	EAddrExtHome,
       
    61 	EAddrStreetHome,
       
    62 	EAddrLocalHome,
       
    63 	EAddrRegionHome,
       
    64 	EAddrPostCodeHome,			//20
       
    65 	EAddrCountryHome,
       
    66 	EJobTitle,
       
    67 	ECompanyName,
       
    68 	ELandPhoneWork,
       
    69 	EMobilePhoneWork,			//25
       
    70 	EVideoNumberWork,
       
    71 	EFaxNumberWork,
       
    72 	EVoipWork,
       
    73 	EEmailWork,
       
    74 	EUrlWork,					//30
       
    75 	EAddrLabelWork,
       
    76 	EAddrPoWork,
       
    77 	EAddrExtWork,
       
    78 	EAddrStreetWork,
       
    79 	EAddrLocalWork,				//35
       
    80 	EAddrRegionWork,
       
    81 	EAddrPostCodeWork,
       
    82 	EAddrCountryWork,
       
    83 	ELandPhoneGen,
       
    84 	EMobilePhoneGen,			//40
       
    85 	EVideoNumberGen,
       
    86 	EFaxNumberGen,
       
    87 	EVoipGen,
       
    88 	EPoc,
       
    89 	ESwis,						//45
       
    90 	ESip,
       
    91 	EEmailGen,
       
    92 	EUrlGen,
       
    93 	EAddrLabelGen,
       
    94 	EAddrPoGen,					//50
       
    95 	EAddrExtGen,
       
    96 	EAddrStreetGen,
       
    97 	EAddrLocalGen,
       
    98 	EAddrRegionGen,
       
    99 	EAddrPostCodeGen,			//55
       
   100 	EAddrCountryGen,
       
   101 	EPagerNumber,
       
   102 	EDtmfString,
       
   103 	EWVAddress,
       
   104 	EDate,						//60
       
   105 	ENote,
       
   106 	EThumbnailPic,
       
   107 	ERingTone,
       
   108 	ECallerObjImg,
       
   109 	ECallerObjText,				//65
       
   110 	EMiddleName,
       
   111 	EDepartment,
       
   112 	EAsstName,
       
   113 	ESpouse,
       
   114 	EChildren,					//70
       
   115 	EAsstPhone,
       
   116 	ECarPhone,
       
   117 	EAnniversary,
       
   118 	ESyncClass,
       
   119 	ELocPrivacy,				//75
       
   120 	EGenLabel,
       
   121 	ETopContact,
       
   122 	EIMPP,
       
   123 	};
       
   124 
       
   125 	
       
   126 public: 
       
   127     static CCreatorPhonebookWrapper* NewL();
       
   128     static CCreatorPhonebookWrapper* NewLC();
       
   129     ~CCreatorPhonebookWrapper();
       
   130 
       
   131 private:
       
   132     CCreatorPhonebookWrapper();
       
   133     void ConstructL();
       
   134 
       
   135 public:  
       
   136     TUint32 CreateContactEntryL(const TCreatorContactFields& Map);    
       
   137     TUint32 CreateGroupEntryL( HBufC* aGroupName );
       
   138     TInt CreateSubscribedContactEntryL(); 
       
   139 
       
   140     /**
       
   141      * NumberOfContacts() will return all contacts from Contact API
       
   142      */
       
   143     TInt NumberOfContacts();
       
   144     
       
   145     TInt AddContactToGroup( TUint32 aGroupId, TUint32 aContact );
       
   146     TInt AddToGroup( TUint32 aGroupId, TInt aAmount );
       
   147     
       
   148     
       
   149     void DeleteAllL();
       
   150     void DeleteAllGroupsL();
       
   151     void DeleteContactsL( RArray<TUint32>& aContactsToDelete, TUid aStoreUid );
       
   152     
       
   153     HBufC* GetPhoneNumberL( TUint32 aContactId );
       
   154     TBool GetContactDetailsL( TUint32 aContactId, TDes& aName, TDes& aPhoneNumber, TDes& aEmail );
       
   155     
       
   156 private:
       
   157     QList<QContactDetail> CreateContactDetailsFromParameters( const TCreatorContactFields& Map );
       
   158     QContactDetail CreateContactDetail( QList<QContactDetail>& aContactDetailList,QString aDetail, QString aFieldContext, QString aFieldString, QString aData );
       
   159     void AddFieldToList( QList<QContactDetail>& aDetailList, QContactDetail aDetail);
       
   160     
       
   161     TBool IsContactGroupL( TUint32& aLink );
       
   162     
       
   163     void DeleteItemsCreatedWithCreatorL( TUid aStoreUid );
       
   164     void DoDeleteItemsCreatedWithCreatorL( TUid aStoreUid, CDictionaryFileStore* aStore );
       
   165     TBool HasOtherThanGroupsL();
       
   166     
       
   167 
       
   168 private:
       
   169 	
       
   170     TInt iOpCounter;
       
   171     
       
   172     static QString iPhoneNumberFields[];
       
   173     static TInt iUrlFields[];
       
   174     static TInt iEmailFields[];
       
   175     
       
   176     RArray<TUint32> iContactLinkArray;
       
   177     RArray<TUint32>  iContactsToDelete;	
       
   178     RArray<TUint32>  iContactGroupsToDelete;	
       
   179     
       
   180     RArray<TUint32> iPreviousDeleteLinks;
       
   181     //RPointerArray<MVPbkContactLinkArray> iPreviousDeleteLinks;  //modify
       
   182     
       
   183 private:
       
   184 	//new variables
       
   185 	/// Ref: the target of the copy
       
   186 	QContact* iStore;       
       
   187     
       
   188     /// Own: Contact database for this store
       
   189     CContactDatabase* iContactDb;    
       
   190     
       
   191     //Contacts found in contacts db.
       
   192     QList<QContactId>* iContactResults;
       
   193     // Contact groups that are found in the store. These are used in filtering
       
   194     // the groups from the find results.
       
   195     QList<QContactId>* iContactGroupsInStore;
       
   196     
       
   197     CCreatorPhonebookAPI* iPhonebookAPI;
       
   198     };
       
   199 
       
   200 #endif // __CREATORPHONEBOOKWRAPPER_H__