48 _LIT(KCalendarPriorityLow, "Low"); |
48 _LIT(KCalendarPriorityLow, "Low"); |
49 |
49 |
50 class CCalendarPlugin : public CIndexingPlugin, public MDelayedCallbackObserver, public MCalProgressCallBack, public MCalChangeCallBack2 |
50 class CCalendarPlugin : public CIndexingPlugin, public MDelayedCallbackObserver, public MCalProgressCallBack, public MCalChangeCallBack2 |
51 { |
51 { |
52 public: // Constructors and destructor |
52 public: // Constructors and destructor |
53 |
53 |
|
54 enum THarvesterState |
|
55 { |
|
56 EHarvesterIdleState, |
|
57 EHarvesterStartHarvest |
|
58 }; |
|
59 struct TRecord |
|
60 { |
|
61 TCalLocalUid iLocalUid; |
|
62 TCPixActionType iActionType; |
|
63 }; |
|
64 |
54 static CCalendarPlugin* NewL(); |
65 static CCalendarPlugin* NewL(); |
55 static CCalendarPlugin* NewLC(); |
66 static CCalendarPlugin* NewLC(); |
56 virtual ~CCalendarPlugin(); |
67 virtual ~CCalendarPlugin(); |
57 |
68 |
58 public: // From CIndexingPlugin |
69 public: // From CIndexingPlugin |
59 void StartPluginL(); |
70 void StartPluginL(); |
60 void StartHarvestingL(const TDesC& aQualifiedBaseAppClass); |
71 void StartHarvestingL(const TDesC& aQualifiedBaseAppClass); |
|
72 void PausePluginL(); |
|
73 void ResumePluginL(); |
61 |
74 |
62 public: // From MCalProgressCallBack |
75 public: // From MCalProgressCallBack |
63 |
76 |
64 /** Progress callback. |
77 /** Progress callback. |
65 This calls the observing class with the percentage complete of the current operation. |
78 This calls the observing class with the percentage complete of the current operation. |
81 |
94 |
82 public: // From MDelayedCallbackObserver |
95 public: // From MDelayedCallbackObserver |
83 |
96 |
84 void DelayedCallbackL(TInt aCode); |
97 void DelayedCallbackL(TInt aCode); |
85 void DelayedError(TInt aError); |
98 void DelayedError(TInt aError); |
86 #ifdef USE_HIGHLIGHTER |
99 //#ifdef USE_HIGHLIGHTER |
87 public: // AddExcerpt function |
100 public: // AddExcerpt function |
88 |
101 |
89 /* |
102 /* |
90 * Add the value to excerpt field |
103 * Add the value to excerpt field |
91 * @param TDesC& aExcerptValue excerpt value |
104 * @param TDesC& aExcerptValue excerpt value |
110 |
123 |
111 void GetDateTimeDescriptorL(TDateTime& datetime, const TDesC& aFormat, TDes& dateString); |
124 void GetDateTimeDescriptorL(TDateTime& datetime, const TDesC& aFormat, TDes& dateString); |
112 private: // New functions |
125 private: // New functions |
113 |
126 |
114 void HandleChangedEntryL(const TCalChangeEntry& changedEntry); |
127 void HandleChangedEntryL(const TCalChangeEntry& changedEntry); |
115 |
128 /* |
116 void CreateEntryL( const TCalLocalUid& aLocalUid, TCPixActionType aActionType ); |
129 * Indexes a calendar entry |
|
130 */ |
|
131 void CreateEntryL( const TCalLocalUid& aLocalUid, TCPixActionType aActionType ); |
|
132 /* |
|
133 * Adds/updates a calender entry to queue on pause of plugin |
|
134 * @param const TCalLocalUid& aLocalUid: unique UID of a calender entry |
|
135 * @param TCPixActionType aActionType: add/update or delete event |
|
136 */ |
|
137 void OverWriteOrAddToQueueL(const TCalLocalUid& aLocalUid, TCPixActionType aActionType); |
|
138 /* |
|
139 * On resume, removes the entries from the queue and starts indexing |
|
140 */ |
|
141 void IndexQueuedItems(); |
117 |
142 |
118 private: // Constructors |
143 private: // Constructors |
119 |
144 |
120 /** |
145 /** |
121 * Default C++ constructor. |
146 * Default C++ constructor. |
145 CCalEntryView* iEntryView; |
170 CCalEntryView* iEntryView; |
146 |
171 |
147 /** Are we positioned at first entry? */ |
172 /** Are we positioned at first entry? */ |
148 TBool iFirstEntry; |
173 TBool iFirstEntry; |
149 |
174 |
|
175 //State of harvester either to pause/resume |
|
176 TBool iIndexState; |
|
177 // Queue of documents to be indexed |
|
178 RArray<TRecord> iJobQueue; |
|
179 //harvesting state |
|
180 THarvesterState iHarvestState; |
150 // Start harvesting |
181 // Start harvesting |
151 TBool iStartHarvesting; |
182 TBool iStartHarvesting; |
152 #ifdef USE_HIGHLIGHTER |
183 //#ifdef USE_HIGHLIGHTER |
153 // Excerpt field |
184 // Excerpt field |
154 HBufC* iExcerpt; |
185 HBufC* iExcerpt; |
155 #endif |
186 //#endif |
156 //for unit testing. |
187 //for unit testing. |
157 #ifdef HARVESTERPLUGINTESTER_FRIEND |
188 #ifdef HARVESTERPLUGINTESTER_FRIEND |
158 friend class CHarvesterPluginTester; |
189 friend class CHarvesterPluginTester; |
159 #endif |
190 #endif |
160 |
191 |