creator/engine/inc/creator_phonebook.h
changeset 35 98924d2efce9
parent 23 c9bf25a20c9f
child 48 da3ec8478e66
equal deleted inserted replaced
34:e0ec97ec3cc4 35:98924d2efce9
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 
    18 
    19 
    19 
    20 
       
    21 
       
    22 #ifndef __CREATORPHONEBOOK_H__
    20 #ifndef __CREATORPHONEBOOK_H__
    23 #define __CREATORPHONEBOOK_H__
    21 #define __CREATORPHONEBOOK_H__
    24 
    22 
    25 #include "creator_phonebookbase.h"
    23 #include "creator_phonebookbase.h"
    26 #include "creator_randomdatafield.h"
    24 #include "creator_randomdatafield.h"
       
    25 #include "creator_phonebookwrapper.h"
    27 
    26 
    28 
    27 
    29 //#include <qmobilityglobal.h> //defines Q_SFW_EXPORT
       
    30 //#include <xqservicerequest.h>
       
    31 
       
    32 #include <QString>
       
    33 #include <qglobal.h>
       
    34 #include <QTime>
       
    35 #include <qtcontacts.h>
       
    36 //#include <qcontactmanager.h>
       
    37 //#include <qcontactname.h>
       
    38 //#include <qcontactid.h>
       
    39 //#include <qcontactphonenumber.h>
       
    40 //#include <qcontacturl.h>
       
    41 //#include <qcontactemailaddress.h>
       
    42 //#include <qcontact.h>
       
    43 
       
    44 //#include <e32base.h>
       
    45 //#include <cntdef.h>
       
    46 //#include <cntdb.h>
       
    47 //#include <cntitem.h>
       
    48 //#include <cntfldst.h>
       
    49 //#include <cntview.h>
       
    50 //#include <cvpbkcontactmanager.h>
       
    51 //#include <pbkfields.hrh>
       
    52 //#include <cpbk2imagemanager.h>
       
    53 //#include <mvpbkcontactstorelistobserver.h>
       
    54 //#include <mvpbkbatchoperationobserver.h>
       
    55 //#include <mvpbkcontactfindobserver.h>
       
    56 //#include <mvpbkcontactobserver.h>
       
    57 //#include <mpbk2imageoperationobservers.h>
       
    58 //#include <vpbkeng.rsg>
       
    59 //#include <cvpbkcontactlinkarray.h>
       
    60 //#include <MVPbkContactViewObserver.h>
       
    61 QTM_USE_NAMESPACE
       
    62 
    28 
    63 class CCreatorEngine;
    29 class CCreatorEngine;
    64 class CCreatorModuleBaseParameters;
    30 class CCreatorModuleBaseParameters;
    65 
    31 
    66 //class QContactManager;
       
    67 //class QContact;
       
    68 //class QContactId;
       
    69 //class QContactData;
       
    70 //class QContactName;
       
    71 
       
    72 //class MVPbkStoreContact;  //to change
       
    73 //class MVPbkContactStore;	//to change
       
    74 //class CAsyncWaiter;			//to change - remove
       
    75 class CContactDatabase;	
    32 class CContactDatabase;	
    76 //class MVPbkContactLinkArray;	//to change
       
    77 class CPhonebookParameters;	
    33 class CPhonebookParameters;	
    78 
    34 class CCreatorPhonebookWrapper;
    79 
    35 
    80 class CCreatorPhonebook : public CCreatorPhonebookBase 
    36 class CCreatorPhonebook : public CCreatorPhonebookBase 
    81     {
    37     {
    82 public: 
    38 public: 
    83     static CCreatorPhonebook* NewL(CCreatorEngine* aEngine);
    39     static CCreatorPhonebook* NewL(CCreatorEngine* aEngine);
    97     void DeleteAllL();
    53     void DeleteAllL();
    98     void DeleteAllCreatedByCreatorL();
    54     void DeleteAllCreatedByCreatorL();
    99     void DeleteAllGroupsL();
    55     void DeleteAllGroupsL();
   100     void DeleteAllGroupsCreatedByCreatorL();
    56     void DeleteAllGroupsCreatedByCreatorL();
   101     
    57     
       
    58     void TestPrintOut(CPhonebookParameters* aParam);
       
    59     
   102 private:
    60 private:
   103     
    61     
   104     void InitializeContactParamsL(/*CCreatorModuleBaseParameters* aParameters*/);
    62     void InitializeContactParamsL();
   105     TBool IsContactGroupL( QContactLocalId& aLink );
    63     TBool IsContactGroupL( TUint32& aLink );
   106     void StoreLinksForDeleteL( RArray<TUint32>& aLinks, TUid aStoreUid );														//modify
    64     void StoreLinksForDeleteL( RArray<TUint32>& aLinks, TUid aStoreUid );
   107     void DeleteContactsL( QList<QContactLocalId>& contacts /*MVPbkContactLinkArray* aContacts, TBool aGroup*/ );																//modify
    65     void DeleteContactsL( RArray<TUint32>& aContactsToDelete, TUid aStoreUid );
   108     void DeleteItemsCreatedWithCreatorL( TUid aStoreUid );
    66     void DeleteItemsCreatedWithCreatorL( TUid aStoreUid );
   109     void DoDeleteItemsCreatedWithCreatorL( TUid aStoreUid, CDictionaryFileStore* aStore );
    67     void DoDeleteItemsCreatedWithCreatorL( TUid aStoreUid, CDictionaryFileStore* aStore );
   110     TBool HasOtherThanGroupsL( /*MVPbkContactLinkArray* aContacts */);																			//modify
    68     TBool HasOtherThanGroupsL();
   111     
    69     
   112 
    70 
   113 private:
    71 private:
   114 	
    72 	CCreatorPhonebookWrapper* iPhonebookWrapper;
   115     QContactManager* iContactMngr;//CVPbkContactManager* iContactManager;
       
   116     TInt iOpCounter;
    73     TInt iOpCounter;
   117     
    74     
   118     CPhonebookParameters* iParameters;
    75     CPhonebookParameters* iParameters;
   119     
    76     
   120     static QString iPhoneNumberFields[];
       
   121     static TInt iUrlFields[];
    77     static TInt iUrlFields[];
   122     static TInt iEmailFields[];
    78     static TInt iEmailFields[];
   123     //QList<QContactLocalId> 
    79     
   124     RArray<TUint32> iContactLinkArray;//CVPbkContactLinkArray* iContactLinkArray;	//modify
    80     RArray<TUint32> iContactLinkArray;
   125     RArray<TUint32>  iContactsToDelete;	//CVPbkContactLinkArray* iContactsToDelete;	//modify
    81     RArray<TUint32>  iContactsToDelete;	
   126     RArray<TUint32>  iContactGroupsToDelete;	//CVPbkContactLinkArray* iContactGroupsToDelete;	//modify
    82     RArray<TUint32>  iContactGroupsToDelete;	
   127     
    83     
   128     RArray<TUint32> iPreviousDeleteLinks;
    84     RArray<TUint32> iPreviousDeleteLinks;
   129     //RPointerArray<MVPbkContactLinkArray> iPreviousDeleteLinks;  //modify
       
   130     
    85     
   131 private:
    86 private:
   132 	//new variables
    87 	//new variables
   133 	/// Ref: the target of the copy
    88 	/// Ref: the target of the copy
   134 	QContact* iStore;     //MVPbkContactStore* iStore;  
    89   
   135     
       
   136     //CAsyncWaiter* iWaiter;	//remove
       
   137     
    90     
   138     /// Own: Contact database for this store
    91     /// Own: Contact database for this store
   139     CContactDatabase* iContactDb;    
    92     CContactDatabase* iContactDb;    
   140     
       
   141     //Contacts found in contacts db.
    93     //Contacts found in contacts db.
   142     QList<QContactId>* iContactResults;//MVPbkContactLinkArray* iContactResults;
       
   143     // Contact groups that are found in the store. These are used in filtering
       
   144     // the groups from the find results.
       
   145     QList<QContactId>* iContactGroupsInStore;//MVPbkContactLinkArray* iContactGroupsInStore;
       
   146     
    94     
   147     };
    95     };
   148 
    96 
   149 /**
    97 /**
   150  * phonebook parameters
    98  * phonebook parameters
   157 	void ParseL(CCommandParser* parser, TParseParams /*aCase = 0*/);
   105 	void ParseL(CCommandParser* parser, TParseParams /*aCase = 0*/);
   158 	
   106 	
   159 	TInt CPhonebookParameters::ScriptLinkId() const;
   107 	TInt CPhonebookParameters::ScriptLinkId() const;
   160 	void CPhonebookParameters::SetScriptLinkId(TInt aLinkId);
   108 	void CPhonebookParameters::SetScriptLinkId(TInt aLinkId);
   161 
   109 
   162 	QList<QContactDetail> iContactFields;//	RPointerArray<CCreatorContactField> iContactFields;
   110 	TCreatorContactFields iContactFields;
   163 
   111 
   164     QString iGroupName;//HBufC*  iGroupName;
   112     HBufC*  iGroupName; 	
   165     TInt iContactsInGroup;
   113     TInt iContactsInGroup;
   166     TInt iNumberOfPhoneNumberFields;
   114     TInt iNumberOfPhoneNumberFields;
   167     TInt iNumberOfURLFields;
   115     TInt iNumberOfURLFields;
   168     TInt iNumberOfEmailAddressFields;
   116     TInt iNumberOfEmailAddressFields;
   169     TInt iContactSetPtr;
   117     TInt iContactSetPtr;
   170     RArray<TLinkIdParam> iLinkIds; //QList<QContactId> iLinkIds;// For contactgroup. Stores the linked contact ids.
   118     RArray<TLinkIdParam> iLinkIds; // For contactgroup. Stores the linked contact ids.
       
   119     
   171     
   120     
   172 public:
   121 public:
   173     CPhonebookParameters();
   122     CPhonebookParameters();
   174     ~CPhonebookParameters();
   123     ~CPhonebookParameters();
   175     
   124     
   176 private:
   125 private:
   177     TInt iLinkId; // For contact. Stores the contact id
   126     TInt iLinkId; // For contact. Stores the contact id
   178     };
   127     };
   179 
   128 
   180 
   129 
   181 class CCreatorContactField : public CBase//, public MCreatorRandomDataField
   130 class CCreatorContactField : public CBase				//, public MCreatorRandomDataField
   182     {
   131     {
   183 public:    
   132 public:    
   184     static CCreatorContactField* NewL();
   133     static CCreatorContactField* NewL();
   185     QContactDetail CreateContactDetailL(CCreatorEngine* aEngine,CPhonebookParameters* aParameters,QString aDetail, QString aFieldContext, QString aFieldString, TInt aRand = KErrNotFound );
   134     void AddFieldToParamL( CCreatorEngine* aEngine, CPhonebookParameters* aParam, TInt aType, TInt aRand = KErrNotFound );
   186     QContactDetail CreateContactDetailL(CCreatorEngine* aEngine,CPhonebookParameters* aParameters,QString aDetail, QString aFieldContext, QString aFieldString, TPtrC aData );
   135     void AddFieldToParamL( CPhonebookParameters* aParam, TInt aType, TPtrC aContent );
   187     void AddFieldToParam( CPhonebookParameters* aParam, QContactDetail aDetail);
       
   188     ~CCreatorContactField();
   136     ~CCreatorContactField();
   189 private:
   137 private:
   190     CCreatorContactField();
   138     CCreatorContactField();
   191     void ConstructL();
   139     void ConstructL();
   192     };
   140     };