creator/engine/inc/creator_phonebook.h
changeset 55 2d9cac8919d3
parent 53 819e59dfc032
child 56 392f7045e621
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 __CREATORPHONEBOOK_H__
       
    21 #define __CREATORPHONEBOOK_H__
       
    22 
       
    23 #include "creator_phonebookbase.h"
       
    24 #include "creator_randomdatafield.h"
       
    25 #include "creator_phonebookwrapper.h"
       
    26 
       
    27 
       
    28 
       
    29 class CCreatorEngine;
       
    30 class CCreatorModuleBaseParameters;
       
    31 
       
    32 class CContactDatabase;	
       
    33 class CPhonebookParameters;	
       
    34 class CCreatorPhonebookWrapper;
       
    35 
       
    36 class CCreatorPhonebook : public CCreatorPhonebookBase 
       
    37     {
       
    38 public: 
       
    39     static CCreatorPhonebook* NewL(CCreatorEngine* aEngine);
       
    40     static CCreatorPhonebook* NewLC(CCreatorEngine* aEngine);
       
    41     ~CCreatorPhonebook();
       
    42 
       
    43 private:
       
    44     CCreatorPhonebook();
       
    45     void ConstructL(CCreatorEngine* aEngine); // from MCreatorModuleBase
       
    46 
       
    47 public:  
       
    48     TInt CreateContactEntryL(CCreatorModuleBaseParameters *aParameters);    
       
    49     TInt CreateGroupEntryL(CCreatorModuleBaseParameters *aParameters);
       
    50     TInt CreateSubscribedContactEntryL(CCreatorModuleBaseParameters *aParameters); 
       
    51 
       
    52     
       
    53     void DeleteAllL();
       
    54     void DeleteAllCreatedByCreatorL();
       
    55     void DeleteAllGroupsL();
       
    56     void DeleteAllGroupsCreatedByCreatorL();
       
    57     
       
    58     void TestPrintOut(CPhonebookParameters* aParam);
       
    59     inline CCreatorPhonebookWrapper* GetPhonebookWrapper(){ return iPhonebookWrapper; };
       
    60 private:
       
    61     
       
    62     void InitializeContactParamsL();
       
    63     TBool IsContactGroupL( TUint32& aLink );
       
    64     void StoreLinksForDeleteL( RArray<TUint32>& aLinks, TUid aStoreUid );
       
    65     void DeleteContactsL( RArray<TUint32>& aContactsToDelete, TUid aStoreUid );
       
    66     void DeleteItemsCreatedWithCreatorL( TUid aStoreUid );
       
    67     void DoDeleteItemsCreatedWithCreatorL( TUid aStoreUid, CDictionaryFileStore* aStore );
       
    68     TBool HasOtherThanGroupsL();
       
    69     
       
    70 
       
    71 private:
       
    72 	CCreatorPhonebookWrapper* iPhonebookWrapper;
       
    73     TInt iOpCounter;
       
    74     
       
    75     CPhonebookParameters* iParameters;
       
    76     
       
    77     static TInt iUrlFields[];
       
    78     static TInt iEmailFields[];
       
    79     
       
    80     RArray<TUint32> iContactLinkArray;
       
    81     RArray<TUint32>  iContactsToDelete;	
       
    82     RArray<TUint32>  iContactGroupsToDelete;	
       
    83     
       
    84     RArray<TUint32> iPreviousDeleteLinks;
       
    85     
       
    86 private:
       
    87 	//new variables
       
    88 	/// Ref: the target of the copy
       
    89   
       
    90     
       
    91     /// Own: Contact database for this store
       
    92     CContactDatabase* iContactDb;    
       
    93     //Contacts found in contacts db.
       
    94     
       
    95     };
       
    96 
       
    97 /**
       
    98  * phonebook parameters
       
    99  */
       
   100     
       
   101 
       
   102 class CPhonebookParameters : public CCreatorModuleBaseParameters
       
   103     {
       
   104 public:
       
   105 	void ParseL(CCommandParser* parser, TParseParams /*aCase = 0*/);
       
   106 	
       
   107 	TInt CPhonebookParameters::ScriptLinkId() const;
       
   108 	void CPhonebookParameters::SetScriptLinkId(TInt aLinkId);
       
   109 
       
   110 	TCreatorContactFields iContactFields;
       
   111 
       
   112     HBufC*  iGroupName; 	
       
   113     TInt iContactsInGroup;
       
   114     TInt iNumberOfPhoneNumberFields;
       
   115     TInt iNumberOfURLFields;
       
   116     TInt iNumberOfEmailAddressFields;
       
   117     TInt iContactSetPtr;
       
   118     RArray<TLinkIdParam> iLinkIds; // For contactgroup. Stores the linked contact ids.
       
   119     
       
   120     
       
   121 public:
       
   122     CPhonebookParameters();
       
   123     ~CPhonebookParameters();
       
   124     
       
   125 private:
       
   126     TInt iLinkId; // For contact. Stores the contact id
       
   127     };
       
   128 
       
   129 
       
   130 class CCreatorContactField : public CBase				//, public MCreatorRandomDataField
       
   131     {
       
   132 public:    
       
   133     static CCreatorContactField* NewL();
       
   134     void AddFieldToParamL( CCreatorEngine* aEngine, CPhonebookParameters* aParam, TInt aType, TInt aRand = KErrNotFound );
       
   135     void AddFieldToParamL( CPhonebookParameters* aParam, TInt aType, TPtrC aContent );
       
   136     ~CCreatorContactField();
       
   137 private:
       
   138     CCreatorContactField();
       
   139     void ConstructL();
       
   140     };
       
   141 
       
   142 #endif // __CREATORPHONEBOOK_H__