|
1 /* |
|
2 * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the License "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Defination of class CCalendarInterface |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef __CALENDARINTERFACE_H |
|
20 #define __CALENDARINTERFACE_H |
|
21 |
|
22 #include <LiwCommon.h> |
|
23 #include <LiwServiceIfBase.h> |
|
24 #include <LiwBufferExtension.h> |
|
25 |
|
26 #include <calrrule.h> |
|
27 #include <calalarm.h> |
|
28 #include <caluser.h> |
|
29 #include <calentry.h> |
|
30 #include <calchangecallback.h> |
|
31 |
|
32 #include "calendarheader.h" |
|
33 #include "calendarconstants.h" |
|
34 |
|
35 class CCalendarService; |
|
36 class CIterableCalEntryList; |
|
37 class CEntryAttributes; |
|
38 class TUIDSet; |
|
39 |
|
40 /** |
|
41 * This class provides the Calendar SAPI interface to LIW Framework |
|
42 */ |
|
43 class CCalendarInterface : public CBase, public MLiwInterface |
|
44 { |
|
45 |
|
46 public: |
|
47 |
|
48 /** |
|
49 * Two-phased constructor. |
|
50 * @return CCalendarInterface* |
|
51 */ |
|
52 static CCalendarInterface* NewL(); |
|
53 |
|
54 /** |
|
55 * Destructor. |
|
56 */ |
|
57 virtual ~CCalendarInterface(); |
|
58 |
|
59 private: |
|
60 |
|
61 /** |
|
62 * Constructor |
|
63 */ |
|
64 CCalendarInterface(); |
|
65 |
|
66 /** |
|
67 * Symbian Constructor |
|
68 */ |
|
69 void ConstructL(); |
|
70 |
|
71 // MLiwInterface member functions |
|
72 public: |
|
73 |
|
74 /** |
|
75 * Executes the SAPI as per params |
|
76 * @param aCmdName Command name defining which operation is to be performed |
|
77 * @param aInParamList Input param list |
|
78 * @param aOutParamList Output list |
|
79 * @param aCmdOptions Command option |
|
80 * @param aCallback Callback object pointer |
|
81 */ |
|
82 virtual void ExecuteCmdL( const TDesC8& aCmdName, |
|
83 const CLiwGenericParamList& aInParamList, |
|
84 CLiwGenericParamList& aOutParamList, |
|
85 TUint aCmdOptions = 0, |
|
86 MLiwNotifyCallback* aCallback = 0 ); |
|
87 |
|
88 /** |
|
89 * Closes the interface |
|
90 */ |
|
91 virtual void Close(); |
|
92 |
|
93 /** |
|
94 * Static Functions |
|
95 * |
|
96 * Same functionality required outside the CCalendarInterface class in case of async |
|
97 * operation. Those set of functions can be given as static. |
|
98 */ |
|
99 public: |
|
100 |
|
101 /** |
|
102 * Converts symbian errcode to equivalent SAPI error code |
|
103 * @param aErrorCode Symbian error code |
|
104 * |
|
105 * @return mapped SAPI error code |
|
106 */ |
|
107 static TInt32 ErrCodeConversion(TInt aErrorCode); |
|
108 |
|
109 /** |
|
110 * Set Import output to output parameter |
|
111 * @param aOutputUIDSet Import output |
|
112 * @param aOutParamList Output parammeter |
|
113 * |
|
114 * @return void |
|
115 */ |
|
116 static void SetImportOutputL( RPointerArray<TUIDSet>& aOutputUIDSet, |
|
117 CLiwGenericParamList& aOutParamList ); |
|
118 |
|
119 /** |
|
120 * Set Change Notification output to output parameter |
|
121 * @param aOutputChangeSet Notifications list |
|
122 * @param aOutParamList Output parammeter |
|
123 * |
|
124 * @return void |
|
125 */ |
|
126 static void SetNotifyOutputL( RArray<TCalChangeEntry>& aOutputChangeSet, |
|
127 CLiwGenericParamList& aOutParamList ); |
|
128 |
|
129 /** |
|
130 * Set GlobalUid/LocalUid to the LiwVariant |
|
131 * @param aReturnValue Variant to be set |
|
132 * @param aUIDSet GlobalUid/LocalUid |
|
133 * |
|
134 * @return void |
|
135 */ |
|
136 static void GetTLiwVariantForUIDSetL( TLiwVariant& aReturnValue, TUIDSet* aUIDSet ); |
|
137 |
|
138 /** |
|
139 * Set Change type to the LiwVariant |
|
140 * @param aValue Variant to be set |
|
141 * @param aChangeEntry Change Type |
|
142 * |
|
143 * @return void |
|
144 */ |
|
145 static void GetTLiwVariantForCalChangeEntryL( TLiwVariant& aValue, |
|
146 TCalChangeEntry& aChangeEntry ); |
|
147 |
|
148 /** |
|
149 * Cleanup function for an CIterableCalEntryList |
|
150 * @param aIterEntryList CIterableCalEntryList pointer |
|
151 * |
|
152 * @return void |
|
153 */ |
|
154 static void CleanupIterableCalEntry(void* aIterEntryList); |
|
155 |
|
156 /** |
|
157 * Returns Day of Month of repeat rule as LiwVariant Map. Caller takes the ownership of map |
|
158 * @param aDayOfMonth Day of Month |
|
159 * |
|
160 * @return CLiwDefaultMap* LiwMap object |
|
161 */ |
|
162 static CLiwDefaultMap* GetDayOfMonthL( const TCalRRule::TDayOfMonth& aDayOfMonth ); |
|
163 |
|
164 /** |
|
165 * Returns CalUser as LiwVariant Map. Caller takes the ownership of map |
|
166 * @param aCalUser Day of Month |
|
167 * @param aAttendee True if User is an attendee |
|
168 * |
|
169 * @return CLiwDefaultMap* LiwMap object |
|
170 */ |
|
171 static CLiwDefaultMap* GetCalUserL( CCalUser* aCalUser, TBool aAttendee = EFalse ); |
|
172 |
|
173 /** |
|
174 * Returns array of CalTime as LiwVariant List. Caller takes the ownership of list |
|
175 * @param aDates Array of CalTime |
|
176 * |
|
177 * @return CLiwDefaultList* LiwList object |
|
178 */ |
|
179 static CLiwDefaultList* GetDatesListL( RArray<TCalTime>& aDates ) ; |
|
180 |
|
181 /** |
|
182 * Returns RepeatRule as LiwVariant Map. Caller takes the ownership of map |
|
183 * @param aRepeatRule Repeat Rule |
|
184 * |
|
185 * @return CLiwDefaultMap* LiwMap object |
|
186 */ |
|
187 static CLiwDefaultMap* GetRRMapL( const TCalRRule& aRepeatRule ); |
|
188 |
|
189 /** |
|
190 * Returns string literal for the given Entry Type |
|
191 * @param aType Entry Type |
|
192 * |
|
193 * @return TPtrC Entry Type string |
|
194 */ |
|
195 static TPtrC GetEntryTypeL( const CCalEntry::TType aType ); |
|
196 |
|
197 /** |
|
198 * Returns string literal for the given Entry Replication status |
|
199 * @param aReplicationStatus Replication status |
|
200 * |
|
201 * @return TPtrC Replication status string |
|
202 */ |
|
203 static TPtrC GetReplicationL( const CCalEntry::TReplicationStatus aReplicationStatus ); |
|
204 |
|
205 /** |
|
206 * Returns string literal for Change Types |
|
207 * @param aChangeType Change Type |
|
208 * |
|
209 * @return TPtrC Change Type |
|
210 */ |
|
211 static TPtrC GetChangeType( const MCalChangeCallBack2::TChangeType aChangeType ); |
|
212 |
|
213 /** |
|
214 * Returns string literal for Entry Status |
|
215 * @param aStatus Entry Status |
|
216 * |
|
217 * @return TPtrC Entry Status |
|
218 */ |
|
219 static TPtrC GetStatusL( const CCalEntry::TStatus aStatus ); |
|
220 |
|
221 /** |
|
222 * Returns string literal for Attendee Status |
|
223 * @param aStatus Attendee Status |
|
224 * |
|
225 * @return TPtrC Attendee Status |
|
226 */ |
|
227 static TPtrC GetAttendeeStatusL( const CCalAttendee::TCalStatus aStatus ); |
|
228 |
|
229 /** |
|
230 * Get string literal for Attendee Role |
|
231 * @param aRole Attendee Role |
|
232 * |
|
233 * @return TPtrC Attendee Role |
|
234 */ |
|
235 static TPtrC GetAttendeeRoleL( const CCalAttendee::TCalRole aRole ); |
|
236 |
|
237 /** |
|
238 * Return string literal for Entry Method |
|
239 * @param aMethod Entry Method |
|
240 * |
|
241 * @return TPtrC Entry Method |
|
242 */ |
|
243 static TPtrC GetMethodL( const CCalEntry::TMethod aMethod ); |
|
244 |
|
245 /** |
|
246 * Removes the reference of CIterableCalEntryList from the table maintained |
|
247 * by interface |
|
248 * @param aCalEntryList Element that need to be removed from the table |
|
249 * |
|
250 * @return void |
|
251 */ |
|
252 void RemoveCalEntryListFromArray( CIterableCalEntryList* aCalEntryList ); |
|
253 |
|
254 |
|
255 private: |
|
256 |
|
257 /** |
|
258 * Issues Add Calendar request to Calendar Service |
|
259 * @param aInParamList Input param list |
|
260 * @param aOutParamList Output param list |
|
261 * @param aPosBased ETrue for position pased parameters |
|
262 * |
|
263 * @return void |
|
264 */ |
|
265 void AddCalendarL(const CLiwGenericParamList& aInParamList, |
|
266 CLiwGenericParamList& aOutParamList, |
|
267 const TBool aPosBased ); |
|
268 |
|
269 /** |
|
270 * Issues Add Calendar Entry request to Calendar Service |
|
271 * @param aInParamList Input param list |
|
272 * @param aOutParamList Output param list |
|
273 * @param aPosBased ETrue for position pased parameters |
|
274 * |
|
275 * @return void |
|
276 */ |
|
277 void AddCalendarEntryL(const CLiwGenericParamList& aInParamList, |
|
278 CLiwGenericParamList& aOutParamList, |
|
279 const TBool aPosBased ); |
|
280 |
|
281 /** |
|
282 * Issues Delete Calendar request to Calendar Service |
|
283 * @param aInParamList Input param list |
|
284 * @param aOutParamList Output param list |
|
285 * @param aPosBased ETrue for position pased parameters |
|
286 * |
|
287 * @return void |
|
288 */ |
|
289 void DeleteCalendarL( const CLiwGenericParamList& aInParamList, TBool aPosBased); |
|
290 |
|
291 /** |
|
292 * Issues Delete Calendar Entry request to Calendar Service |
|
293 * @param aInParamList Input param list |
|
294 * @param aOutParamList Output param list |
|
295 * @param aCmdOptions Command option |
|
296 * @param aCallback Callback object pointer |
|
297 * @param aPosBased ETrue for position pased parameters |
|
298 * @param aTransactionId Output param for async request to store transaction id |
|
299 * |
|
300 * @return void |
|
301 */ |
|
302 void DeleteCalendarEntryL(const CLiwGenericParamList& aInParamList, |
|
303 CLiwGenericParamList& aOutParamList, |
|
304 TUint aCmdOptions, |
|
305 MLiwNotifyCallback* aCallback , |
|
306 const TBool aPosBased, |
|
307 TInt32& aTransactionId ); |
|
308 |
|
309 /** |
|
310 * Issues GetList Calendar request to Calendar Service |
|
311 * @param aInParamList Input param list |
|
312 * @param aOutParamList Output param list |
|
313 * @param aPosBased ETrue for position pased parameters |
|
314 * |
|
315 * @return void |
|
316 */ |
|
317 void GetListCalendarL(const CLiwGenericParamList& aInParamList, |
|
318 CLiwGenericParamList& aOutParamList, |
|
319 const TBool aPosBased ); |
|
320 |
|
321 /** |
|
322 * Issues GetList Calendar Entry request to Calendar Service |
|
323 * @param aInParamList Input param list |
|
324 * @param aOutParamList Output param list |
|
325 * @param aPosBased ETrue for position pased parameters |
|
326 * |
|
327 * @return void |
|
328 */ |
|
329 void GetListCalendarEntryL(const CLiwGenericParamList& aInParamList, |
|
330 CLiwGenericParamList& aOutParamList, |
|
331 const TBool aPosBased ); |
|
332 |
|
333 /** |
|
334 * Issues Import Calendar Entry request to Calendar Service |
|
335 * @param aInParamList Input param list |
|
336 * @param aOutParamList Output param list |
|
337 * @param aCmdOptions Command option |
|
338 * @param aCallback Callback object pointer |
|
339 * @param aPosBased ETrue for position pased parameters |
|
340 * @param aTransactionId Output param for async request to store transaction id |
|
341 * |
|
342 * @return void |
|
343 */ |
|
344 void ImportCalendarEntryL(const CLiwGenericParamList& aInParamList, |
|
345 CLiwGenericParamList& aOutParamList, |
|
346 TUint aCmdOptions, |
|
347 MLiwNotifyCallback* aCallback , |
|
348 const TBool aPosBased, |
|
349 TInt32& aTransactionId ); |
|
350 |
|
351 /** |
|
352 * Issues Export Calendar Entry request to Calendar Service |
|
353 * @param aInParamList Input param list |
|
354 * @param aOutParamList Output param list |
|
355 * @param aCmdOptions Command option |
|
356 * @param aCallback Callback object pointer |
|
357 * @param aPosBased ETrue for position pased parameters |
|
358 * @param aTransactionId Output param for async request to store transaction id |
|
359 * |
|
360 * @return void |
|
361 */ |
|
362 void ExportCalendarEntryL(const CLiwGenericParamList& aInParamList, |
|
363 CLiwGenericParamList& aOutParamList, |
|
364 TUint aCmdOptions, |
|
365 MLiwNotifyCallback* aCallback , |
|
366 const TBool aPosBased, |
|
367 TInt32& aTransactionId ); |
|
368 |
|
369 /** |
|
370 * Issues Change Notification request to Calendar Service |
|
371 * @param aInParamList Input param list |
|
372 * @param aCallback Callback object pointer |
|
373 * @param aPosBased ETrue for position pased parameters |
|
374 * @param aTransactionId Output param for async request to store transaction id |
|
375 * |
|
376 * @return void |
|
377 */ |
|
378 void RequestNotificationL( const CLiwGenericParamList& aInParamList, |
|
379 MLiwNotifyCallback* aCallback, |
|
380 const TBool aPosBased, |
|
381 TInt32& aTransactionId ); |
|
382 |
|
383 |
|
384 |
|
385 /** |
|
386 * Extracts LocalUid as TCalLocalUid from input Uid String |
|
387 * @param aLocalUid Input string |
|
388 * @param aOutLocalUid output param for LocalUid |
|
389 * |
|
390 * @return void |
|
391 */ |
|
392 void GetLocalUid( const TDesC& aLocalUid, TCalLocalUid& aOutLocalUid ); |
|
393 |
|
394 /** |
|
395 * Extracts GlobalUid as 8-bit string from input Uid String |
|
396 * @param aGlobalUid Input string |
|
397 * @param aOutGlobalUid output param for GlobalUid |
|
398 * |
|
399 * @return void |
|
400 */ |
|
401 void GetGlobalUid( const TDesC& aGlobalUid, TPtr8 aOutGlobalUid ); |
|
402 |
|
403 /** |
|
404 * Extracts ContentType from the input param list |
|
405 * @param aInParamList Input param list |
|
406 * @param aPosBased ETrue for position pased parameters |
|
407 * |
|
408 * @return ContentType string |
|
409 */ |
|
410 TPtrC GetContentType(const CLiwGenericParamList& aInParamList, |
|
411 TBool& aPosBased ); |
|
412 |
|
413 /** |
|
414 * Extracts TransactionId from the input param list |
|
415 * @param aInParamList Input param list |
|
416 * @param aTransactionId output param fromtransactiod id |
|
417 * |
|
418 * @return void |
|
419 */ |
|
420 void GetTransactionIdL( const CLiwGenericParamList& aInParamList, |
|
421 TInt32& aTransactionId ); |
|
422 |
|
423 /** |
|
424 * Extracts CalendarName from the input param list |
|
425 * @param aInParamList Input param list |
|
426 * @param aCmdName Command Name |
|
427 * @param aField ParameterName to read |
|
428 * @param aPosBased ETrue for position pased parameters |
|
429 * @param aCalendarName Output param for Calendar Name |
|
430 * |
|
431 * @return void |
|
432 */ |
|
433 void GetCalendarNameL( const CLiwGenericParamList& aInParamList, |
|
434 const TDesC8& aCmdName, |
|
435 const TDesC8& aField, |
|
436 TBool aPosBased, |
|
437 HBufC*& aCalendarName ); |
|
438 |
|
439 /** |
|
440 * Extracts Descriptor Field from Map in input param list |
|
441 * @param aInParamList Input param list |
|
442 * @param aCmdName Command Name |
|
443 * @param aMapName Map name in input param list |
|
444 * @param aFieldName Filed name to read from map |
|
445 * @param aPosBased ETrue for position pased parameters |
|
446 * @param aOutputField Output param for Field value |
|
447 * |
|
448 * @return void |
|
449 */ |
|
450 void CCalendarInterface::GetDesCFieldFromMapL( const CLiwGenericParamList& aInParamList, |
|
451 const TDesC8& aCmdName, |
|
452 const TDesC8& aMapName, |
|
453 const TDesC8& aFieldName, |
|
454 TBool aPosBased, |
|
455 HBufC*& aOutputField ); |
|
456 |
|
457 /** |
|
458 * Extracts 8-bit Descriptor Field from Map in input param list |
|
459 * @param aInParamList Input param list |
|
460 * @param aCmdName Command Name |
|
461 * @param aMapName Map name in input param list |
|
462 * @param aFieldName Filed name to read from map |
|
463 * @param aPosBased ETrue for position pased parameters |
|
464 * @param aOutputField Output param for Field value |
|
465 * |
|
466 * @return void |
|
467 */ |
|
468 void CCalendarInterface::GetDesC8FieldFromMapL( const CLiwGenericParamList& aInParamList, |
|
469 const TDesC8& aCmdName, |
|
470 const TDesC8& aMapName, |
|
471 const TDesC8& aFieldName, |
|
472 TBool aPosBased, |
|
473 HBufC8*& aOutputField ); |
|
474 |
|
475 /** |
|
476 * Extracts Entry attributes for Add/Update request |
|
477 * @param aInParamList Input param list |
|
478 * @param aCalendarName CalendarName |
|
479 * @param aPosBased ETrue for position pased parameters |
|
480 * |
|
481 * @return CEntryAttributes* EntryAttributes object |
|
482 */ |
|
483 CEntryAttributes* GetAddParametersL( const CLiwGenericParamList& aInParamList, |
|
484 const TDesC& aCalendarName, |
|
485 TBool aPosBased); |
|
486 |
|
487 /** |
|
488 * Extracts Filter for Delete request |
|
489 * @param aInParamList Input param list |
|
490 * @param aFilter Output param for Filter |
|
491 * @param aPosBased ETrue for position pased parameters |
|
492 * |
|
493 * @return void |
|
494 */ |
|
495 void GetDeleteEntryFilterL(const CLiwGenericParamList& aInParamList, |
|
496 CCalendarFilter& aFilter, |
|
497 const TBool aPosBased ); |
|
498 |
|
499 /** |
|
500 * Extracts Inputs for Import request |
|
501 * @param aInParamList Input param list |
|
502 * @param aPosBased ETrue for position pased parameters |
|
503 * @param aInputBuffer Output param for Buffer from which entries to be imported |
|
504 * @param aImportFile Output param for File from which entries to be imported |
|
505 * @param aCalendarFormat Output param for Calendar Format to be used (ICal/VCal) |
|
506 * @param aCalendarName Output param for Calendar Name |
|
507 * |
|
508 * @return void |
|
509 */ |
|
510 void GetImportInputL( const CLiwGenericParamList& aInParamList, |
|
511 TBool aPosBased, |
|
512 HBufC8*& aInputBuffer, |
|
513 TDes& aImportFile, |
|
514 TDes8& aCalendarFormat, |
|
515 TDes& aCalendarName ); |
|
516 |
|
517 /** |
|
518 * Extracts Inputs for Export request |
|
519 * @param aInParamList Input param list |
|
520 * @param aPosBased ETrue for position pased parameters |
|
521 * @param aCalExportParams Output param for Export parameters |
|
522 * |
|
523 * @return void |
|
524 */ |
|
525 void GetExportInputL( const CLiwGenericParamList& aInParamList, |
|
526 TBool aPosBased, |
|
527 CCalendarExportParams& aCalExportParams); |
|
528 |
|
529 /** |
|
530 * Extracts Inputs for Change Notification request |
|
531 * @param aInParamList Input param list |
|
532 * @param aFileter Output param for Change Notification filter |
|
533 * @param aPosBased ETrue for position pased parameters |
|
534 * |
|
535 * @return void |
|
536 */ |
|
537 void GetNotificationFilterL( const CLiwGenericParamList& aInParamList, |
|
538 CCalendarFilter& aFilter, |
|
539 const TBool aPosBased ); |
|
540 |
|
541 /** |
|
542 * Appends error message |
|
543 * @param aCmdName Command Name |
|
544 * @param aParameter Parameter Name |
|
545 * @param aMessage Error message |
|
546 * |
|
547 * @return void |
|
548 */ |
|
549 void AppendErrorMessageL( const TDesC8& aCmdName, |
|
550 const TDesC8& aParameter, |
|
551 const TDesC& aMessage ); |
|
552 |
|
553 /** |
|
554 * Checks for the valid data type of Parameter. |
|
555 * @param aParam Input parameter |
|
556 * @param aExpectedtype Expected type for input parameter |
|
557 * @param aCmdName Command Name |
|
558 * @param aParameter Parameter Name |
|
559 * @param aErrorMessage Error message in case of type mismatch |
|
560 * |
|
561 * @return void |
|
562 */ |
|
563 void ValidateParamTypeL( TLiwVariant& aParam, |
|
564 LIW::TVariantTypeId aExpectedtype, |
|
565 const TDesC8& aCmdName, |
|
566 const TDesC8& aParameter, |
|
567 const TDesC& aMessage ); |
|
568 |
|
569 /** |
|
570 * Returns entry type for given LocalUid. |
|
571 * @param aCalendarName CalendarName |
|
572 * @param aLocalUid LocalUid |
|
573 * |
|
574 * @return Entry type |
|
575 */ |
|
576 TInt GetEntryType( const TDesC& aCalendarName, TCalLocalUid aLocalUid ); |
|
577 |
|
578 /** |
|
579 * Check if given calendar is in use. |
|
580 * @param aCalendarName CalendarName |
|
581 * |
|
582 * @return True if given calendar is in use |
|
583 */ |
|
584 TBool CCalendarInterface::CheckCalendarInUse( const TDesC& aCalendarName ); |
|
585 |
|
586 private: |
|
587 |
|
588 /** |
|
589 * CCalendarService class pointer |
|
590 * @internal |
|
591 */ |
|
592 CCalendarService* iCalService; |
|
593 |
|
594 /** |
|
595 * Error Message object |
|
596 * @internal |
|
597 */ |
|
598 HBufC* iErrorMessage; |
|
599 |
|
600 /** |
|
601 * Array containing the list of CalEntryList. |
|
602 * @internal |
|
603 */ |
|
604 RPointerArray<CIterableCalEntryList> iArrayCalEntryList; |
|
605 |
|
606 }; |
|
607 |
|
608 |
|
609 #endif __CALENDARINTERFACE_H |