18 |
18 |
19 #ifndef CESMRCALDBMGR_H |
19 #ifndef CESMRCALDBMGR_H |
20 #define CESMRCALDBMGR_H |
20 #define CESMRCALDBMGR_H |
21 |
21 |
22 #include <e32base.h> |
22 #include <e32base.h> |
|
23 #include <gdi.h> |
23 //<cmail> |
24 //<cmail> |
24 #include "mesmrutilstombsext.h" |
25 #include "mesmrutilstombsext.h" |
25 //</cmail> |
26 //</cmail> |
26 #include <calprogresscallback.h> |
27 #include <calprogresscallback.h> |
27 #include "cesmrcaldbbase.h" |
28 #include "cesmrcaldbbase.h" |
28 |
29 |
|
30 |
29 class MMRUtilsObserver; |
31 class MMRUtilsObserver; |
30 class CCalSession; |
32 class CCalSession; |
31 class CCalEntry; |
33 class CCalEntry; |
32 class CESMREntryCmdIteratorAO; |
34 class CESMREntryCmdIteratorAO; |
33 class CESMRGraveyardCleaner; |
35 class CESMRGraveyardCleaner; |
|
36 class MESMRCalEntry; |
|
37 class CCalEntryView; |
|
38 class CCalInstanceView; |
|
39 class CCalCalendarInfo; |
|
40 |
34 |
41 |
35 /** |
42 /** |
36 * MESMRServicesCalDbMgr defines interface for calendar DB |
43 * MESMRServicesCalDbMgr defines interface for calendar DB |
37 * operations. |
44 * operations. |
38 * |
45 * |
60 * Returns a valid pointer if status is EAvailable or |
67 * Returns a valid pointer if status is EAvailable or |
61 * EAvailableWithoutTombs, otherwise NULL. |
68 * EAvailableWithoutTombs, otherwise NULL. |
62 * @return instance view pointer, ownership not transferred |
69 * @return instance view pointer, ownership not transferred |
63 */ |
70 */ |
64 virtual CCalInstanceView* NormalDbInstanceView() = 0; |
71 virtual CCalInstanceView* NormalDbInstanceView() = 0; |
|
72 |
|
73 /** |
|
74 * Accessor for Agenda Model CCalInstanceView owned by this utility. |
|
75 * Returns a valid array of pointer if status is EAvailable or |
|
76 * EAvailableWithoutTombs, otherwise NULL. |
|
77 * @return instance view pointer, ownership not transferred |
|
78 */ |
|
79 virtual RPointerArray<CCalInstanceView> NormalDbAllCalenInstanceView() = 0; |
65 |
80 |
66 /** |
81 /** |
67 * Fetches entries from the Agenda Model based on time range. |
82 * Fetches entries from the Agenda Model based on time range. |
68 * In case of repeating entries the entire sequence must |
83 * In case of repeating entries the entire sequence must |
69 * be within range (but modifying entries are considered separately). |
84 * be within range (but modifying entries are considered separately). |
114 * Deletes the given entry from the Agenda Model. |
129 * Deletes the given entry from the Agenda Model. |
115 * @param aUid Entry uid to be deleted |
130 * @param aUid Entry uid to be deleted |
116 * @return KErrNone or a system wide error code |
131 * @return KErrNone or a system wide error code |
117 */ |
132 */ |
118 virtual TInt DeleteEntryL( |
133 virtual TInt DeleteEntryL( |
119 const TDesC8& aUid ) = 0; |
134 const TDesC8& aUid, TInt aCalenIndex ) = 0; |
120 |
135 |
121 /** |
136 /** |
122 * Deletes the given entry from the Agenda Model. |
137 * Deletes the given entry from the Agenda Model. |
123 * @param aLocalUid Entry uid to be deleted |
138 * @param aLocalUid Entry uid to be deleted |
124 * @return KErrNone or a system wide error code |
139 * @return KErrNone or a system wide error code |
125 */ |
140 */ |
126 virtual TInt DeleteEntryL( |
141 virtual TInt DeleteEntryL( |
127 const TCalLocalUid& aLocalUid ) = 0; |
142 const TCalLocalUid& aLocalUid, TInt aCalenIndex ) = 0; |
128 |
143 |
129 /** |
144 /** |
130 * Check entry: GUID, sequence number, existence in Agenda Model and |
145 * Check entry: GUID, sequence number, existence in Agenda Model and |
131 * tombstone database. Same as CMRUtilsTombsExt::StoreL() but doesn't |
146 * tombstone database. Same as CMRUtilsTombsExt::StoreL() but doesn't |
132 * actually store. |
147 * actually store. |
180 * Fetches the calendar session associated with this |
195 * Fetches the calendar session associated with this |
181 * cal db manager. |
196 * cal db manager. |
182 * @return Reference to calendar server session. |
197 * @return Reference to calendar server session. |
183 */ |
198 */ |
184 virtual CCalSession& CalSession() = 0; |
199 virtual CCalSession& CalSession() = 0; |
|
200 |
|
201 /** |
|
202 * Finds matching calendar instance from calendar db. Ownership is |
|
203 * transferred to caller. |
|
204 * If instance cannot be found, NULL is returned. |
|
205 * |
|
206 * @param aCalDb Reference to cal db manager. |
|
207 * @param aEntry Reference to calendar entry |
|
208 * @return Pointer to calendar entry instance. |
|
209 */ |
|
210 virtual CCalInstance* FindInstanceL( |
|
211 const CCalEntry& aEntry ) = 0; |
|
212 |
|
213 /** |
|
214 * Get calendar's color by entry |
|
215 * @param aEntry Reference to calendar entry |
|
216 * @return calendar's color rgb value |
|
217 */ |
|
218 virtual TRgb GetCalendarColorByEntryL( MESMRCalEntry& aEntry ) = 0; |
|
219 |
|
220 /** |
|
221 * Get multi-calendar name list |
|
222 * @param aCalendarNameList Reference to name string array |
|
223 */ |
|
224 virtual void GetMultiCalendarNameListL( RArray<TPtrC>& aCalendarNameList ) = 0; |
|
225 |
|
226 /** |
|
227 * Get calendar's name by entry |
|
228 * @param aEntry Reference to calendar entry |
|
229 * @return calendar's name |
|
230 */ |
|
231 virtual TPtrC GetCalendarNameByEntryL( MESMRCalEntry& aEntry ) = 0; |
|
232 |
|
233 /** |
|
234 * Get calendar's color by calendar name |
|
235 * @param aCalendarName Reference to calendar name |
|
236 * @return calendar's color rgb value |
|
237 */ |
|
238 virtual TRgb GetCalendarColorByNameL( TDesC& aCalendarName ) = 0; |
|
239 |
|
240 /* |
|
241 * Set current calendar by pass calendar index to it |
|
242 * @param aIndex current calendar index |
|
243 */ |
|
244 virtual void SetCurCalendarByIndex( TInt aIndex ) = 0; |
|
245 |
|
246 /* |
|
247 * Set current calendar by pass calendar name to it |
|
248 * @param aCalendarName current calendar name |
|
249 */ |
|
250 virtual void SetCurCalendarByNameL( TDesC& aCalendarName ) = 0; |
|
251 |
|
252 /* |
|
253 * Set current calendar by pass entry |
|
254 * @param aColId current calendar collectionID |
|
255 */ |
|
256 virtual void SetCurCalendarByColIdL( TInt aColId ) = 0; |
|
257 |
|
258 /* |
|
259 * Set current calendar by pass entry |
|
260 * @param aEntry entry which belongs current calendar |
|
261 */ |
|
262 virtual void SetCurCalendarByEntryL( MESMRCalEntry& aEntry ) = 0; |
|
263 |
|
264 /* |
|
265 * Get color of current calendar |
|
266 * @return current calendar's color(rgb value) |
|
267 */ |
|
268 virtual TRgb GetCurCalendarColor() = 0; |
|
269 |
|
270 /* |
|
271 * Get colId of current calendar |
|
272 * @return current calendar's colId |
|
273 */ |
|
274 virtual TInt GetCurCalendarColIdL() = 0; |
|
275 |
|
276 /* |
|
277 * Get index of current calendar |
|
278 * @return current calendar's index |
|
279 */ |
|
280 virtual TInt GetCurCalendarIndex() = 0; |
|
281 |
|
282 /* |
|
283 * Get entryview by CCalEntry |
|
284 * @param aCalEntry use to get calendar which aCalEntry belongs |
|
285 * @return CCalEntryView aCalEntry belongs |
|
286 */ |
|
287 virtual CCalEntryView* EntryViewL(const CCalEntry& aCalEntry ) = 0; |
|
288 |
|
289 /* |
|
290 * Get instanceview by CCalEntry |
|
291 * @param aCalEntry use to get calendar which aCalEntry belongs |
|
292 * @return a CCalInstanceView that aCalEntry belongs |
|
293 */ |
|
294 virtual CCalInstanceView* InstanceViewL(const CCalEntry& aCalEntry ) = 0; |
|
295 |
|
296 /* |
|
297 * Get current entryview |
|
298 * @return current entryView |
|
299 */ |
|
300 virtual CCalEntryView* EntryView() = 0; |
185 }; |
301 }; |
186 |
302 |
187 /** |
303 /** |
188 * Manages two databases: normal Agenda db and tombstone db, and |
304 * Manages two databases: normal Agenda db and tombstone db, and |
189 * handles command logic related to these databases. This class is |
305 * handles command logic related to these databases. This class is |
228 |
344 |
229 protected: // From MESMRUtilsCalDbMgr |
345 protected: // From MESMRUtilsCalDbMgr |
230 |
346 |
231 CCalEntryView* NormalDbEntryView(); |
347 CCalEntryView* NormalDbEntryView(); |
232 CCalInstanceView* NormalDbInstanceView(); |
348 CCalInstanceView* NormalDbInstanceView(); |
|
349 RPointerArray<CCalInstanceView> NormalDbAllCalenInstanceView(); |
233 void FetchEntriesL( |
350 void FetchEntriesL( |
234 RPointerArray<CCalEntry>& aCalEntryArray, |
351 RPointerArray<CCalEntry>& aCalEntryArray, |
235 const CalCommon::TCalTimeRange& aTimeRange ); |
352 const CalCommon::TCalTimeRange& aTimeRange ); |
236 CCalEntry* FetchEntryL( |
353 CCalEntry* FetchEntryL( |
237 const TDesC8& aUid, |
354 const TDesC8& aUid, |
240 CCalEntry& aCalEntry, |
357 CCalEntry& aCalEntry, |
241 TBool aToNormalDb = ETrue ); |
358 TBool aToNormalDb = ETrue ); |
242 TInt UpdateEntryL( |
359 TInt UpdateEntryL( |
243 const CCalEntry& aCalEntry ); |
360 const CCalEntry& aCalEntry ); |
244 TInt DeleteEntryL( |
361 TInt DeleteEntryL( |
245 const TDesC8& aUid ); |
362 const TDesC8& aUid, TInt aCalenIndex ); |
246 TInt DeleteEntryL( |
363 TInt DeleteEntryL( |
247 const TCalLocalUid& aLocalUid ); |
364 const TCalLocalUid& aLocalUid, TInt aCalenIndex ); |
248 MESMRUtilsTombsExt::TESMRUtilsDbResult StoreEntryCondL( |
365 MESMRUtilsTombsExt::TESMRUtilsDbResult StoreEntryCondL( |
249 CCalEntry& aCalEntry, |
366 CCalEntry& aCalEntry, |
250 TBool aResurrect, |
367 TBool aResurrect, |
251 TBool aCheckOnly = EFalse ); |
368 TBool aCheckOnly = EFalse ); |
252 MESMRUtilsTombsExt::TESMRUtilsDbResult CheckEntryCondL( |
369 MESMRUtilsTombsExt::TESMRUtilsDbResult CheckEntryCondL( |
258 void DeleteEntryCondL( |
375 void DeleteEntryCondL( |
259 const CCalEntry& aCalEntry ); |
376 const CCalEntry& aCalEntry ); |
260 void DeleteEntryCondL( |
377 void DeleteEntryCondL( |
261 const CalCommon::TCalTimeRange& aCalTimeRange ); |
378 const CalCommon::TCalTimeRange& aCalTimeRange ); |
262 CCalSession& CalSession(); |
379 CCalSession& CalSession(); |
|
380 CCalInstance* FindInstanceL( |
|
381 const CCalEntry& aEntry ); |
|
382 |
|
383 TRgb GetCalendarColorByEntryL( |
|
384 MESMRCalEntry& aEntry); |
|
385 void GetMultiCalendarNameListL( |
|
386 RArray<TPtrC>& aCalendarNameList); |
|
387 TPtrC GetCalendarNameByEntryL( |
|
388 MESMRCalEntry& aEntry); |
|
389 TRgb GetCalendarColorByNameL( |
|
390 TDesC& aCalendarName); |
|
391 void SetCurCalendarByNameL( |
|
392 TDesC& aCalendarName ); |
|
393 void SetCurCalendarByIndex( |
|
394 TInt aIndex ); |
|
395 void SetCurCalendarByColIdL( |
|
396 TInt aColId ); |
|
397 void SetCurCalendarByEntryL( |
|
398 MESMRCalEntry& aEntry ); |
|
399 TRgb GetCurCalendarColor(); |
|
400 TInt GetCurCalendarColIdL(); |
|
401 TInt GetCurCalendarIndex(); |
|
402 CCalEntryView* EntryViewL(const CCalEntry& aCalEntry ); |
|
403 CCalInstanceView* InstanceViewL(const CCalEntry& aCalEntry ); |
|
404 CCalEntryView* EntryView(); |
263 |
405 |
264 protected: // New functions |
406 protected: // New functions |
265 /** |
407 /** |
266 * Tests whether entry with same GUID and RECURRENCE-ID exists |
408 * Tests whether entry with same GUID and RECURRENCE-ID exists |
267 * in aDb. If yes, then aIndex will tell it's position in aCalEntryArray |
409 * in aDb. If yes, then aIndex will tell it's position in aCalEntryArray |
367 * Not own. |
516 * Not own. |
368 */ |
517 */ |
369 CCalSession& iCalSession; |
518 CCalSession& iCalSession; |
370 |
519 |
371 /** |
520 /** |
|
521 * Calendar session array, support multi calendar |
|
522 * Own. |
|
523 */ |
|
524 RPointerArray<CCalSession> iCalSessionArray; |
|
525 |
|
526 /** |
|
527 * CCalEntryView array, support multi calendar |
|
528 * Own. |
|
529 */ |
|
530 RPointerArray<CCalEntryView> iCalEntryViewArray; |
|
531 |
|
532 /** |
|
533 * CCalInstanceView array, support multi calendar |
|
534 * Own. |
|
535 */ |
|
536 RPointerArray<CCalInstanceView> iCalInstanceViewArray; |
|
537 |
|
538 /** |
|
539 * CCalCalendarInfo array, support multi calendar |
|
540 * Own. |
|
541 */ |
|
542 RPointerArray<CCalCalendarInfo> iCalendarInfoArray; |
|
543 |
|
544 /** |
372 * Reference to cal db observer |
545 * Reference to cal db observer |
373 * |
546 * |
374 */ |
547 */ |
375 MMRUtilsObserver& iObserver; |
548 MMRUtilsObserver& iObserver; |
|
549 |
376 /** |
550 /** |
377 * Normal agenda database |
551 * Normal agenda database |
378 * Own. |
552 * Own. |
379 */ |
553 */ |
380 CESMRCalDbBase* iNormalDb; |
554 CESMRCalDbBase* iNormalDb; |