diff -r 819e59dfc032 -r 2d9cac8919d3 utilityapps/creator/engine/inc/creator_phonebookwrapper.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/utilityapps/creator/engine/inc/creator_phonebookwrapper.h Mon Oct 18 16:30:05 2010 +0300 @@ -0,0 +1,200 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + + +#ifndef __CREATORPHONEBOOKWRAPPER_H__ +#define __CREATORPHONEBOOKWRAPPER_H__ + +#include "creator_phonebookbase.h" +#include "creator_randomdatafield.h" + +#include + +#include "creator_phonebookapi.h" + +class CCreatorEngine; +class CCreatorModuleBaseParameters; + +class CContactDatabase; +//class CPhonebookWrapperParameters; +class CPhonebookParameters; + +typedef typename std::map TCreatorContactFields; +typedef typename std::pair TCreatorContactField; + +class CCreatorPhonebookWrapper : public CBase + { +public: + enum ContactDetailType{ + ELastName, //0 + ELastNameReading, //1 + EFirstName, + EFirstNameReading, + EPrefix, + ESuffix, //5 + ESecondName, + ELandPhoneHome, + EMobilePhoneHome, + EVideoNumberHome, + EFaxNumberHome, //10 + EVoipHome, + EEmailHome, + EUrlHome, + EAddrLabelHome, + EAddrPoHome, //15 + EAddrExtHome, + EAddrStreetHome, + EAddrLocalHome, + EAddrRegionHome, + EAddrPostCodeHome, //20 + EAddrCountryHome, + EJobTitle, + ECompanyName, + ELandPhoneWork, + EMobilePhoneWork, //25 + EVideoNumberWork, + EFaxNumberWork, + EVoipWork, + EEmailWork, + EUrlWork, //30 + EAddrLabelWork, + EAddrPoWork, + EAddrExtWork, + EAddrStreetWork, + EAddrLocalWork, //35 + EAddrRegionWork, + EAddrPostCodeWork, + EAddrCountryWork, + ELandPhoneGen, + EMobilePhoneGen, //40 + EVideoNumberGen, + EFaxNumberGen, + EVoipGen, + EPoc, + ESwis, //45 + ESip, + EEmailGen, + EUrlGen, + EAddrLabelGen, + EAddrPoGen, //50 + EAddrExtGen, + EAddrStreetGen, + EAddrLocalGen, + EAddrRegionGen, + EAddrPostCodeGen, //55 + EAddrCountryGen, + EPagerNumber, + EDtmfString, + EWVAddress, + EDate, //60 + ENote, + EThumbnailPic, + ERingTone, + ECallerObjImg, + ECallerObjText, //65 + EMiddleName, + EDepartment, + EAsstName, + ESpouse, + EChildren, //70 + EAsstPhone, + ECarPhone, + EAnniversary, + ESyncClass, + ELocPrivacy, //75 + EGenLabel, + ETopContact, + EIMPP, + }; + + +public: + static CCreatorPhonebookWrapper* NewL(); + static CCreatorPhonebookWrapper* NewLC(); + ~CCreatorPhonebookWrapper(); + +private: + CCreatorPhonebookWrapper(); + void ConstructL(); + +public: + TUint32 CreateContactEntryL(const TCreatorContactFields& Map); + TUint32 CreateGroupEntryL( HBufC* aGroupName ); + TInt CreateSubscribedContactEntryL(); + + /** + * NumberOfContacts() will return all contacts from Contact API + */ + TInt NumberOfContacts(); + + TInt AddContactToGroup( TUint32 aGroupId, TUint32 aContact ); + TInt AddToGroup( TUint32 aGroupId, TInt aAmount ); + + + void DeleteAllL(); + void DeleteAllGroupsL(); + void DeleteContactsL( RArray& aContactsToDelete, TUid aStoreUid ); + + HBufC* GetPhoneNumberL( TUint32 aContactId ); + TBool GetContactDetailsL( TUint32 aContactId, TDes& aName, TDes& aPhoneNumber, TDes& aEmail ); + +private: + QList CreateContactDetailsFromParameters( const TCreatorContactFields& Map ); + QContactDetail CreateContactDetail( QList& aContactDetailList,QString aDetail, QString aFieldContext, QString aFieldString, QString aData ); + void AddFieldToList( QList& aDetailList, QContactDetail aDetail); + + TBool IsContactGroupL( TUint32& aLink ); + + void DeleteItemsCreatedWithCreatorL( TUid aStoreUid ); + void DoDeleteItemsCreatedWithCreatorL( TUid aStoreUid, CDictionaryFileStore* aStore ); + TBool HasOtherThanGroupsL(); + + +private: + + TInt iOpCounter; + + static QString iPhoneNumberFields[]; + static TInt iUrlFields[]; + static TInt iEmailFields[]; + + RArray iContactLinkArray; + RArray iContactsToDelete; + RArray iContactGroupsToDelete; + + RArray iPreviousDeleteLinks; + //RPointerArray iPreviousDeleteLinks; //modify + +private: + //new variables + /// Ref: the target of the copy + QContact* iStore; + + /// Own: Contact database for this store + CContactDatabase* iContactDb; + + //Contacts found in contacts db. + QList* iContactResults; + // Contact groups that are found in the store. These are used in filtering + // the groups from the find results. + QList* iContactGroupsInStore; + + CCreatorPhonebookAPI* iPhonebookAPI; + }; + +#endif // __CREATORPHONEBOOKWRAPPER_H__