diff -r 48060abbbeaf -r b3cee849fa46 creator/engine/inc/creator_phonebook.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/creator/engine/inc/creator_phonebook.h Tue Aug 31 15:15:20 2010 +0300 @@ -0,0 +1,142 @@ +/* +* 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 __CREATORPHONEBOOK_H__ +#define __CREATORPHONEBOOK_H__ + +#include "creator_phonebookbase.h" +#include "creator_randomdatafield.h" +#include "creator_phonebookwrapper.h" + + + +class CCreatorEngine; +class CCreatorModuleBaseParameters; + +class CContactDatabase; +class CPhonebookParameters; +class CCreatorPhonebookWrapper; + +class CCreatorPhonebook : public CCreatorPhonebookBase + { +public: + static CCreatorPhonebook* NewL(CCreatorEngine* aEngine); + static CCreatorPhonebook* NewLC(CCreatorEngine* aEngine); + ~CCreatorPhonebook(); + +private: + CCreatorPhonebook(); + void ConstructL(CCreatorEngine* aEngine); // from MCreatorModuleBase + +public: + TInt CreateContactEntryL(CCreatorModuleBaseParameters *aParameters); + TInt CreateGroupEntryL(CCreatorModuleBaseParameters *aParameters); + TInt CreateSubscribedContactEntryL(CCreatorModuleBaseParameters *aParameters); + + + void DeleteAllL(); + void DeleteAllCreatedByCreatorL(); + void DeleteAllGroupsL(); + void DeleteAllGroupsCreatedByCreatorL(); + + void TestPrintOut(CPhonebookParameters* aParam); + +private: + + void InitializeContactParamsL(); + TBool IsContactGroupL( TUint32& aLink ); + void StoreLinksForDeleteL( RArray& aLinks, TUid aStoreUid ); + void DeleteContactsL( RArray& aContactsToDelete, TUid aStoreUid ); + void DeleteItemsCreatedWithCreatorL( TUid aStoreUid ); + void DoDeleteItemsCreatedWithCreatorL( TUid aStoreUid, CDictionaryFileStore* aStore ); + TBool HasOtherThanGroupsL(); + + +private: + CCreatorPhonebookWrapper* iPhonebookWrapper; + TInt iOpCounter; + + CPhonebookParameters* iParameters; + + static TInt iUrlFields[]; + static TInt iEmailFields[]; + + RArray iContactLinkArray; + RArray iContactsToDelete; + RArray iContactGroupsToDelete; + + RArray iPreviousDeleteLinks; + +private: + //new variables + /// Ref: the target of the copy + + + /// Own: Contact database for this store + CContactDatabase* iContactDb; + //Contacts found in contacts db. + + }; + +/** + * phonebook parameters + */ + + +class CPhonebookParameters : public CCreatorModuleBaseParameters + { +public: + void ParseL(CCommandParser* parser, TParseParams /*aCase = 0*/); + + TInt CPhonebookParameters::ScriptLinkId() const; + void CPhonebookParameters::SetScriptLinkId(TInt aLinkId); + + TCreatorContactFields iContactFields; + + HBufC* iGroupName; + TInt iContactsInGroup; + TInt iNumberOfPhoneNumberFields; + TInt iNumberOfURLFields; + TInt iNumberOfEmailAddressFields; + TInt iContactSetPtr; + RArray iLinkIds; // For contactgroup. Stores the linked contact ids. + + +public: + CPhonebookParameters(); + ~CPhonebookParameters(); + +private: + TInt iLinkId; // For contact. Stores the contact id + }; + + +class CCreatorContactField : public CBase //, public MCreatorRandomDataField + { +public: + static CCreatorContactField* NewL(); + void AddFieldToParamL( CCreatorEngine* aEngine, CPhonebookParameters* aParam, TInt aType, TInt aRand = KErrNotFound ); + void AddFieldToParamL( CPhonebookParameters* aParam, TInt aType, TPtrC aContent ); + ~CCreatorContactField(); +private: + CCreatorContactField(); + void ConstructL(); + }; + +#endif // __CREATORPHONEBOOK_H__