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