harvesterplugins/contacts/inc/ccontactsplugin.h
changeset 26 367228f82b66
parent 18 1edf350003c5
child 27 7a8855317cbd
equal deleted inserted replaced
24:1abfa342db42 26:367228f82b66
    73 const TInt KDayLength = 2;
    73 const TInt KDayLength = 2;
    74 const TInt KYearLength = 4;
    74 const TInt KYearLength = 4;
    75 
    75 
    76 class CContactsPlugin : public CIndexingPlugin, public MContactDbObserver, public MDelayedCallbackObserver
    76 class CContactsPlugin : public CIndexingPlugin, public MContactDbObserver, public MDelayedCallbackObserver
    77 {
    77 {
       
    78 private:
       
    79     enum THarvesterState
       
    80         {
       
    81         EHarvesterIdleState,
       
    82         EHarvesterStartHarvest        
       
    83         };
       
    84         
       
    85     struct TRecord 
       
    86         {
       
    87         TInt iContactId;
       
    88         TCPixActionType iActionType;
       
    89         };
    78 public:
    90 public:
    79 	static CContactsPlugin* NewL();
    91 	static CContactsPlugin* NewL();
    80 	static CContactsPlugin* NewLC();
    92 	static CContactsPlugin* NewLC();
    81 	virtual ~CContactsPlugin();
    93 	virtual ~CContactsPlugin();
    82 
    94 
    83 	/**
    95 	/**
    84 	 * From CIndexingPlugin
    96 	 * From CIndexingPlugin
    85 	 */
    97 	 */
    86 	void StartPluginL();
    98 	void StartPluginL();
    87 	void StartHarvestingL(const TDesC& aQualifiedBaseAppClass);
    99 	void StartHarvestingL(const TDesC& aQualifiedBaseAppClass);
    88 
   100 	void PausePluginL();
       
   101 	void ResumePluginL();
    89 	/**
   102 	/**
    90 	 * From MContactDbObserver, HandleDatabaseEventL.
   103 	 * From MContactDbObserver, HandleDatabaseEventL.
    91 	 */
   104 	 */
    92 	void HandleDatabaseEventL(TContactDbObserverEvent aEvent);
   105 	void HandleDatabaseEventL(TContactDbObserverEvent aEvent);
    93 
   106 
   117 
   130 
   118 	/**
   131 	/**
   119 	 *  Helper function: adds information field to the document and to the excerpt field(if available)
   132 	 *  Helper function: adds information field to the document and to the excerpt field(if available)
   120 	 */
   133 	 */
   121 	void AddFieldToDocumentAndExcerptL(CSearchDocument& aDocument, CContactItemFieldSet& aFieldSet, TUid aFieldId, const TDesC& aFieldName, const TInt aConfig = CDocumentField::EStoreYes | CDocumentField::EIndexTokenized );
   134 	void AddFieldToDocumentAndExcerptL(CSearchDocument& aDocument, CContactItemFieldSet& aFieldSet, TUid aFieldId, const TDesC& aFieldName, const TInt aConfig = CDocumentField::EStoreYes | CDocumentField::EIndexTokenized );
   122 #ifdef USE_HIGHLIGHTER
   135 //#ifdef USE_HIGHLIGHTER
   123 	void AddFieldToHLExcerptL( CContactItemFieldSet& aFieldSet, TUid aFieldId);
   136 	void AddFieldToHLExcerptL( CContactItemFieldSet& aFieldSet, TUid aFieldId);
   124 #endif
   137 //#endif
   125 	/**
   138 	/**
   126 	 * Creates the actual contact book index item
   139 	 * Creates the actual contact book index item
   127 	 */
   140 	 */
   128 	void CreateContactIndexItemL(TInt aContentId, TCPixActionType aActionType);
   141 	void CreateContactIndexItemL(TInt aContentId, TCPixActionType aActionType);
       
   142 	
       
   143 	void OverWriteOrAddToQueueL(TRecord& aEntry);
       
   144 	
       
   145 	void IndexQueuedItems();
   129 
   146 
   130 private:
   147 private:
   131 	
   148 	
   132 	/** Contact change notifier */
   149 	/** Contact change notifier */
   133 	CContactChangeNotifier* iChangeNotifier;
   150 	CContactChangeNotifier* iChangeNotifier;
   139 	CDelayedCallback* iAsynchronizer;
   156 	CDelayedCallback* iAsynchronizer;
   140 	/** Current harvested contact index */
   157 	/** Current harvested contact index */
   141 	TInt iCurrentIndex;	
   158 	TInt iCurrentIndex;	
   142 	/** placeholder for Excerpt text dynamic creation */
   159 	/** placeholder for Excerpt text dynamic creation */
   143 	HBufC* iExcerpt;
   160 	HBufC* iExcerpt;
   144 #ifdef USE_HIGHLIGHTER
   161 //#ifdef USE_HIGHLIGHTER
   145 	   HBufC* iHLDisplayExcerpt;
   162 	   HBufC* iHLDisplayExcerpt;
   146 #endif
   163 //#endif
   147 	// CPix database 
   164 	// CPix database 
   148     CCPixIndexer* iIndexer;
   165     CCPixIndexer* iIndexer;
   149 
   166     //State of harvester either to pause/resume
       
   167     TBool iIndexState;    
       
   168     // Queue of documents to be indexed
       
   169     RArray<TRecord> iJobQueue;
       
   170     //harvesting state
       
   171     THarvesterState iHarvestState;
   150 //for helping with testing.
   172 //for helping with testing.
   151 #ifdef HARVESTERPLUGINTESTER_FRIEND
   173 #ifdef HARVESTERPLUGINTESTER_FRIEND
   152     friend class CHarvesterPluginTester;
   174     friend class CHarvesterPluginTester;
   153 #endif
   175 #endif
   154     
   176