|
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: Implementation of class CCalendarHeader |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <calsession.h> |
|
20 #include <calcommon.h> |
|
21 #include <calentry.h> |
|
22 #include <calentryview.h> |
|
23 #include <calinstanceview.h> |
|
24 #include <calprogresscallback.h> |
|
25 #include <caleninterimutils2.h> |
|
26 |
|
27 |
|
28 #include "calendarheader.h" |
|
29 #include "calendarconstants.h" |
|
30 |
|
31 /** |
|
32 * MCalProgressCallBack implementation. |
|
33 * Used for the creation of CCalEntryView and CCalInstanceView |
|
34 */ |
|
35 class CCalProgressCallBack : public CBase, public MCalProgressCallBack |
|
36 { |
|
37 /** |
|
38 * Constructor |
|
39 */ |
|
40 CCalProgressCallBack(CActiveSchedulerWait* aWaitSchedular) : iWaitSchedular(aWaitSchedular) |
|
41 { |
|
42 } |
|
43 |
|
44 public: |
|
45 |
|
46 /** |
|
47 * Two Phase Constructor |
|
48 */ |
|
49 static CCalProgressCallBack* NewL(CActiveSchedulerWait* aWaitSchedular) |
|
50 { |
|
51 return new (ELeave) CCalProgressCallBack( aWaitSchedular ); |
|
52 } |
|
53 |
|
54 /** |
|
55 * MCalProgressCallBack implementation |
|
56 */ |
|
57 void Progress(TInt /*aPercentageCompleted*/) |
|
58 { |
|
59 } |
|
60 |
|
61 /** |
|
62 * MCalProgressCallBack implementation |
|
63 */ |
|
64 void Completed(TInt aError) |
|
65 { |
|
66 iError = aError; |
|
67 |
|
68 if ( iWaitSchedular && iWaitSchedular->IsStarted() ) |
|
69 iWaitSchedular->AsyncStop(); |
|
70 } |
|
71 |
|
72 /** |
|
73 * MCalProgressCallBack implementation |
|
74 */ |
|
75 TBool NotifyProgress() |
|
76 { |
|
77 return EFalse; |
|
78 } |
|
79 |
|
80 /** |
|
81 * Returns error code |
|
82 */ |
|
83 TInt Error() |
|
84 { |
|
85 return iError; |
|
86 } |
|
87 |
|
88 private: |
|
89 |
|
90 /** |
|
91 * CActiveSchedulerWait |
|
92 */ |
|
93 CActiveSchedulerWait* iWaitSchedular; |
|
94 |
|
95 /** |
|
96 * Error code |
|
97 */ |
|
98 TInt iError; |
|
99 }; |
|
100 |
|
101 // --------------------------------------------------------------------------- |
|
102 // Two phase Constructor |
|
103 // --------------------------------------------------------------------------- |
|
104 // |
|
105 CCalendarSessionInfo* CCalendarSessionInfo::NewL( const TDesC& aCalendar ) |
|
106 { |
|
107 CCalendarSessionInfo* self = new (ELeave) CCalendarSessionInfo; |
|
108 CleanupStack::PushL( self ); |
|
109 self->ConstructL( aCalendar ); |
|
110 CleanupStack::Pop( self ); |
|
111 return self; |
|
112 } |
|
113 |
|
114 // --------------------------------------------------------------------------- |
|
115 // Destructor |
|
116 // --------------------------------------------------------------------------- |
|
117 // |
|
118 CCalendarSessionInfo::~CCalendarSessionInfo() |
|
119 { |
|
120 delete iCalName; |
|
121 delete iCalEntView; |
|
122 delete iCalInstView; |
|
123 delete iCalSession; |
|
124 } |
|
125 |
|
126 // --------------------------------------------------------------------------- |
|
127 // Returns calendar name |
|
128 // --------------------------------------------------------------------------- |
|
129 // |
|
130 TPtrC CCalendarSessionInfo::Calendar() |
|
131 { |
|
132 return iCalName ? TPtrC(*iCalName) : TPtrC(); |
|
133 } |
|
134 |
|
135 // --------------------------------------------------------------------------- |
|
136 // Returns calendar session |
|
137 // --------------------------------------------------------------------------- |
|
138 // |
|
139 CCalSession* CCalendarSessionInfo::Session() |
|
140 { |
|
141 return iCalSession; |
|
142 } |
|
143 |
|
144 // --------------------------------------------------------------------------- |
|
145 // Returns calendar entry view |
|
146 // --------------------------------------------------------------------------- |
|
147 // |
|
148 CCalEntryView* CCalendarSessionInfo::EntryView() |
|
149 { |
|
150 return iCalEntView; |
|
151 } |
|
152 |
|
153 // --------------------------------------------------------------------------- |
|
154 // Returns calendar instance view |
|
155 // --------------------------------------------------------------------------- |
|
156 // |
|
157 CCalInstanceView* CCalendarSessionInfo::InstanceView() |
|
158 { |
|
159 return iCalInstView; |
|
160 } |
|
161 |
|
162 // --------------------------------------------------------------------------- |
|
163 // Constructor |
|
164 // --------------------------------------------------------------------------- |
|
165 // |
|
166 CCalendarSessionInfo::CCalendarSessionInfo() |
|
167 { |
|
168 } |
|
169 |
|
170 // --------------------------------------------------------------------------- |
|
171 // Two Phase Constructor |
|
172 // --------------------------------------------------------------------------- |
|
173 // |
|
174 void CCalendarSessionInfo::ConstructL( const TDesC& aCalendar ) |
|
175 { |
|
176 iCalSession = CCalSession::NewL(); |
|
177 |
|
178 // Opens the specified calendar file or the default calendar file |
|
179 // if aCalendar is KNullDesC |
|
180 TRAPD(err, iCalSession->OpenL( aCalendar )); |
|
181 |
|
182 if ( err != KErrNone && |
|
183 ( aCalendar.Length() == 0 || |
|
184 aCalendar.CompareF( iCalSession->DefaultFileNameL() ) == 0 ) ) |
|
185 { |
|
186 // Create and open default calendar file |
|
187 iCalSession->CreateCalFileL( iCalSession->DefaultFileNameL() ); |
|
188 iCalSession->OpenL( aCalendar ); |
|
189 } |
|
190 else if ( err != KErrNone ) |
|
191 User::Leave( err ); |
|
192 |
|
193 if ( aCalendar.Length() ) |
|
194 iCalName = aCalendar.AllocL(); |
|
195 else |
|
196 iCalName = iCalSession->DefaultFileNameL().AllocL(); |
|
197 |
|
198 CActiveSchedulerWait* waitSchedular = new(ELeave) CActiveSchedulerWait; |
|
199 CleanupStack::PushL( waitSchedular ); |
|
200 |
|
201 CCalProgressCallBack* instancecallback = CCalProgressCallBack::NewL( waitSchedular ); |
|
202 CleanupStack::PushL( instancecallback ); |
|
203 |
|
204 // Create an instance of view class for accessing instances of calendar entries |
|
205 iCalInstView = CCalInstanceView::NewL( *iCalSession, *instancecallback ); |
|
206 waitSchedular->Start(); |
|
207 |
|
208 User::LeaveIfError( instancecallback->Error() ); |
|
209 CleanupStack::PopAndDestroy( instancecallback ); |
|
210 instancecallback = NULL; |
|
211 |
|
212 instancecallback = CCalProgressCallBack::NewL( waitSchedular ); |
|
213 CleanupStack::PushL( instancecallback ); |
|
214 // Create an instance of view class for accessing calendar entries |
|
215 iCalEntView = CCalEntryView::NewL( *iCalSession, *instancecallback ); |
|
216 waitSchedular->Start(); |
|
217 |
|
218 User::LeaveIfError( instancecallback->Error() ); |
|
219 |
|
220 CleanupStack::PopAndDestroy( 2, waitSchedular ); |
|
221 } |
|
222 |
|
223 // --------------------------------------------------------------------------- |
|
224 // Two Phase Constructor |
|
225 // --------------------------------------------------------------------------- |
|
226 // |
|
227 EXPORT_C CCalendarFilter* CCalendarFilter::NewL() |
|
228 { |
|
229 CCalendarFilter* self = new (ELeave) CCalendarFilter; |
|
230 CleanupStack::PushL(self); |
|
231 self->ConstructL(); |
|
232 CleanupStack::Pop(self); |
|
233 return self; |
|
234 } |
|
235 |
|
236 // --------------------------------------------------------------------------- |
|
237 // Desstructor |
|
238 // --------------------------------------------------------------------------- |
|
239 // |
|
240 CCalendarFilter::~CCalendarFilter() |
|
241 { |
|
242 delete iTextToSearch; |
|
243 |
|
244 iLocalUidList.Reset(); |
|
245 |
|
246 if ( iGuidList ) |
|
247 { |
|
248 iGuidList->Reset(); |
|
249 |
|
250 delete iGuidList; |
|
251 } |
|
252 } |
|
253 |
|
254 // --------------------------------------------------------------------------- |
|
255 // Constructor |
|
256 // --------------------------------------------------------------------------- |
|
257 // |
|
258 CCalendarFilter::CCalendarFilter() |
|
259 { |
|
260 } |
|
261 |
|
262 // --------------------------------------------------------------------------- |
|
263 // Constructor |
|
264 // --------------------------------------------------------------------------- |
|
265 // |
|
266 void CCalendarFilter::ConstructL() |
|
267 { |
|
268 // initialise start time to minimum calendar time |
|
269 iStartTimeRange.SetTimeUtcL( TCalTime::MinTime() ); |
|
270 // initialise end time to maximum calendar time |
|
271 iEndTimeRange.SetTimeUtcL( TCalTime::MaxTime() ); |
|
272 iFilterType = CalCommon::EIncludeAll; |
|
273 } |
|
274 |
|
275 // --------------------------------------------------------------------------- |
|
276 // Set Start time |
|
277 // --------------------------------------------------------------------------- |
|
278 // |
|
279 EXPORT_C void CCalendarFilter::SetStartTimeL( const TTime& aStartTime ) |
|
280 { |
|
281 iFilterFlags ^= ( iFilterFlags & EFilterStTime ); |
|
282 |
|
283 if ( aStartTime != Time::NullTTime() ) |
|
284 { |
|
285 if( aStartTime < TCalTime::MinTime() || aStartTime > TCalTime::MaxTime() ) |
|
286 User::Leave( KErrArgument ); |
|
287 |
|
288 iStartTimeRange.SetTimeUtcL( aStartTime ); |
|
289 iFilterFlags |= EFilterStTime; |
|
290 } |
|
291 } |
|
292 |
|
293 // --------------------------------------------------------------------------- |
|
294 // Set End time |
|
295 // --------------------------------------------------------------------------- |
|
296 // |
|
297 EXPORT_C void CCalendarFilter::SetEndTimeL( const TTime& aEndTime ) |
|
298 { |
|
299 iFilterFlags ^= ( iFilterFlags & EFilterEndTime ); |
|
300 |
|
301 if ( aEndTime != Time::NullTTime() ) |
|
302 { |
|
303 if( aEndTime < TCalTime::MinTime() || aEndTime > TCalTime::MaxTime() ) |
|
304 User::Leave( KErrArgument ); |
|
305 |
|
306 iEndTimeRange.SetTimeUtcL( aEndTime ); |
|
307 iFilterFlags |= EFilterEndTime; |
|
308 } |
|
309 } |
|
310 |
|
311 // --------------------------------------------------------------------------- |
|
312 // Set Filter type |
|
313 // --------------------------------------------------------------------------- |
|
314 // |
|
315 EXPORT_C void CCalendarFilter::SetFilterTypeL( const TDesC& aType) |
|
316 { |
|
317 if ( aType.CompareF(KEntryAppt) == 0 ) |
|
318 iFilterType = CalCommon::EIncludeAppts; |
|
319 |
|
320 else if ( aType.CompareF(KEntryTodo) == 0 ) |
|
321 iFilterType = CalCommon::EIncludeCompletedTodos|CalCommon::EIncludeIncompletedTodos; |
|
322 |
|
323 else if ( aType.CompareF(KEntryEvent) == 0 ) |
|
324 iFilterType = CalCommon::EIncludeEvents; |
|
325 |
|
326 else if ( aType.CompareF(KEntryReminder) == 0 ) |
|
327 iFilterType = CalCommon::EIncludeReminder; |
|
328 |
|
329 else if ( aType.CompareF(KEntryAnniv) == 0 ) |
|
330 iFilterType = CalCommon::EIncludeAnnivs; |
|
331 |
|
332 else if ( aType.CompareF(KIncludeAll) == 0 ) |
|
333 iFilterType = CalCommon::EIncludeAll; |
|
334 |
|
335 else |
|
336 User::Leave(KErrArgument); |
|
337 |
|
338 iFilterFlags |= EFilterType; |
|
339 } |
|
340 |
|
341 // --------------------------------------------------------------------------- |
|
342 // Set Filter text |
|
343 // --------------------------------------------------------------------------- |
|
344 // |
|
345 EXPORT_C void CCalendarFilter::SetFilterTextL( const TDesC& aTextToSearch ) |
|
346 { |
|
347 iFilterFlags ^= ( iFilterFlags & EFilterText ); |
|
348 |
|
349 if ( iTextToSearch ) |
|
350 { |
|
351 delete iTextToSearch; |
|
352 iTextToSearch = NULL; |
|
353 } |
|
354 |
|
355 if( aTextToSearch.Length() ) |
|
356 { |
|
357 iTextToSearch = aTextToSearch.AllocL(); |
|
358 iFilterFlags |= EFilterText; |
|
359 } |
|
360 } |
|
361 |
|
362 // --------------------------------------------------------------------------- |
|
363 // Set DeleteAll option |
|
364 // --------------------------------------------------------------------------- |
|
365 // |
|
366 EXPORT_C void CCalendarFilter::SetDeleteAll( TBool aDeleteAll ) |
|
367 { |
|
368 if ( aDeleteAll ) |
|
369 iFilterFlags |= EFlagDeleteAll; |
|
370 else |
|
371 iFilterFlags ^= ( iFilterFlags & EFlagDeleteAll ); |
|
372 } |
|
373 |
|
374 // --------------------------------------------------------------------------- |
|
375 // Set IncludeUnDateToDo option |
|
376 // --------------------------------------------------------------------------- |
|
377 // |
|
378 EXPORT_C void CCalendarFilter::SetIncludeUnDateToDo( TBool aInclude ) |
|
379 { |
|
380 if ( aInclude ) |
|
381 iFilterFlags |= EFlagUnDateToDo; |
|
382 else |
|
383 iFilterFlags ^= ( iFilterFlags & EFlagUnDateToDo ); |
|
384 } |
|
385 |
|
386 // --------------------------------------------------------------------------- |
|
387 // Add Global Uid |
|
388 // --------------------------------------------------------------------------- |
|
389 // |
|
390 EXPORT_C void CCalendarFilter::AddGuidL( const TDesC8& aGuid ) |
|
391 { |
|
392 if ( !iGuidList ) |
|
393 iGuidList = new(ELeave) CDesC8ArraySeg( KArrayGran ); |
|
394 |
|
395 TInt pos; |
|
396 if( aGuid.Length() && iGuidList->Find( aGuid, pos ) != 0 ) |
|
397 { |
|
398 iGuidList->AppendL( aGuid ); |
|
399 iFilterFlags |= EFilterGUid; |
|
400 } |
|
401 } |
|
402 |
|
403 // --------------------------------------------------------------------------- |
|
404 // Add Local Uid |
|
405 // --------------------------------------------------------------------------- |
|
406 // |
|
407 EXPORT_C void CCalendarFilter::AddLocalUid( const TCalLocalUid aLocalUid ) |
|
408 { |
|
409 if( iLocalUidList.Find( aLocalUid) == KErrNotFound ) |
|
410 { |
|
411 iLocalUidList.Append( aLocalUid ); |
|
412 iFilterFlags |= EFilterLUid; |
|
413 } |
|
414 } |
|
415 |
|
416 // --------------------------------------------------------------------------- |
|
417 // Return Time Range |
|
418 // --------------------------------------------------------------------------- |
|
419 // |
|
420 EXPORT_C CalCommon::TCalTimeRange CCalendarFilter::TimeRange() const |
|
421 { |
|
422 return CalCommon::TCalTimeRange( iStartTimeRange, iEndTimeRange ); |
|
423 } |
|
424 |
|
425 // --------------------------------------------------------------------------- |
|
426 // Return Filter Entry Type |
|
427 // --------------------------------------------------------------------------- |
|
428 // |
|
429 EXPORT_C TUint CCalendarFilter::FilterType() const |
|
430 { |
|
431 return iFilterType; |
|
432 } |
|
433 |
|
434 // --------------------------------------------------------------------------- |
|
435 // Return Filter Text |
|
436 // --------------------------------------------------------------------------- |
|
437 // |
|
438 EXPORT_C TPtrC CCalendarFilter::FilterText() const |
|
439 { |
|
440 return iTextToSearch ? TPtrC( *iTextToSearch ) : TPtrC(); |
|
441 } |
|
442 |
|
443 // --------------------------------------------------------------------------- |
|
444 // Return Global Uid List |
|
445 // --------------------------------------------------------------------------- |
|
446 // |
|
447 EXPORT_C const CDesC8Array* CCalendarFilter::GuidList() const |
|
448 { |
|
449 return iGuidList; |
|
450 } |
|
451 |
|
452 // --------------------------------------------------------------------------- |
|
453 // Return Local Uid List |
|
454 // --------------------------------------------------------------------------- |
|
455 // |
|
456 EXPORT_C const RArray<TCalLocalUid>& CCalendarFilter::LocalUidList() const |
|
457 { |
|
458 return iLocalUidList; |
|
459 } |
|
460 |
|
461 // --------------------------------------------------------------------------- |
|
462 // Return Filter options selected |
|
463 // --------------------------------------------------------------------------- |
|
464 // |
|
465 EXPORT_C TInt32 CCalendarFilter::Filter() const |
|
466 { |
|
467 return iFilterFlags; |
|
468 } |
|
469 |
|
470 CCalendarFilter& CCalendarFilter::operator=( const CCalendarFilter& aFilter ) |
|
471 { |
|
472 iStartTimeRange = aFilter.iStartTimeRange; |
|
473 iEndTimeRange = aFilter.iEndTimeRange; |
|
474 iFilterType = aFilter.iFilterType; |
|
475 iFilterFlags = aFilter.iFilterFlags; |
|
476 |
|
477 delete iTextToSearch; |
|
478 iTextToSearch = NULL; |
|
479 |
|
480 if ( aFilter.iTextToSearch ) |
|
481 { |
|
482 iTextToSearch = aFilter.iTextToSearch->AllocL(); |
|
483 } |
|
484 |
|
485 if ( iGuidList ) |
|
486 { |
|
487 iGuidList->Reset(); |
|
488 } |
|
489 |
|
490 if ( aFilter.iGuidList ) |
|
491 { |
|
492 TInt count = aFilter.iGuidList->Count(); |
|
493 for( TInt index = 0; index < count; index++ ) |
|
494 { |
|
495 AddGuidL((*(aFilter.iGuidList))[index]); |
|
496 } |
|
497 } |
|
498 |
|
499 iLocalUidList.Reset(); |
|
500 |
|
501 TInt count = aFilter.iLocalUidList.Count(); |
|
502 for( TInt index = 0; index < count; index++ ) |
|
503 { |
|
504 AddLocalUid((aFilter.iLocalUidList)[index]); |
|
505 } |
|
506 |
|
507 return *this; |
|
508 } |
|
509 |
|
510 |
|
511 // --------------------------------------------------------------------------- |
|
512 // Two Phase Constructor of CCalendarExportParams |
|
513 // --------------------------------------------------------------------------- |
|
514 // |
|
515 EXPORT_C CCalendarExportParams* CCalendarExportParams::NewL() |
|
516 { |
|
517 return new (ELeave) CCalendarExportParams; |
|
518 } |
|
519 |
|
520 // --------------------------------------------------------------------------- |
|
521 // Desstructor of CCalendarExportParams |
|
522 // --------------------------------------------------------------------------- |
|
523 // |
|
524 CCalendarExportParams::~CCalendarExportParams() |
|
525 { |
|
526 iInputLocalUIDArray.Reset(); |
|
527 |
|
528 if ( iInputGUIDArray ) |
|
529 { |
|
530 iInputGUIDArray->Reset(); |
|
531 |
|
532 delete iInputGUIDArray; |
|
533 } |
|
534 |
|
535 delete iFileName; |
|
536 } |
|
537 |
|
538 // --------------------------------------------------------------------------- |
|
539 // Constructor |
|
540 // --------------------------------------------------------------------------- |
|
541 // |
|
542 CCalendarExportParams::CCalendarExportParams() |
|
543 { |
|
544 } |
|
545 |
|
546 |
|
547 // --------------------------------------------------------------------------- |
|
548 // Add Global Uid, add one guid per time |
|
549 // --------------------------------------------------------------------------- |
|
550 // |
|
551 EXPORT_C void CCalendarExportParams::AddGuidL( const TDesC8& aGuid ) |
|
552 { |
|
553 if ( !iInputGUIDArray ) |
|
554 { |
|
555 iInputGUIDArray = new(ELeave) CDesC8ArraySeg( KArrayGran ); |
|
556 } |
|
557 |
|
558 TInt pos; |
|
559 if( aGuid.Length() && iInputGUIDArray->Find( aGuid, pos ) != 0 ) |
|
560 { |
|
561 iInputGUIDArray->AppendL( aGuid ); |
|
562 iParamsFlags |= EParamsGUid; |
|
563 } |
|
564 } |
|
565 |
|
566 // --------------------------------------------------------------------------- |
|
567 // Add Global Uid, add an entire GUid array |
|
568 // NOTE: Takes the ownership of aInputGUID Array |
|
569 // --------------------------------------------------------------------------- |
|
570 // |
|
571 EXPORT_C void CCalendarExportParams::AddGuidL( const CDesC8Array* aInputGUIDArray ) |
|
572 { |
|
573 if( !aInputGUIDArray ) |
|
574 return; |
|
575 // append to array the new array elements and delete the input array |
|
576 TInt inputArrayCount = aInputGUIDArray->Count(); |
|
577 |
|
578 if ( !iInputGUIDArray ) |
|
579 { |
|
580 iInputGUIDArray = new(ELeave) CDesC8ArraySeg( KArrayGran ); |
|
581 } |
|
582 |
|
583 for( TInt index = 0; index < inputArrayCount; ++index ) |
|
584 { |
|
585 TInt pos = 0; |
|
586 if( (*aInputGUIDArray)[index].Length() && |
|
587 iInputGUIDArray->Find( (*aInputGUIDArray)[index], pos ) != 0 ) |
|
588 iInputGUIDArray->AppendL( (*aInputGUIDArray)[index] ); |
|
589 } |
|
590 |
|
591 iParamsFlags |= EParamsGUid; |
|
592 } |
|
593 |
|
594 // --------------------------------------------------------------------------- |
|
595 // Add Local Uid, add one localuid per time |
|
596 // --------------------------------------------------------------------------- |
|
597 // |
|
598 EXPORT_C void CCalendarExportParams::AddLocalUid( const TCalLocalUid aLocalUid ) |
|
599 { |
|
600 if( iInputLocalUIDArray.Find( aLocalUid) == KErrNotFound ) |
|
601 { |
|
602 iInputLocalUIDArray.Append( aLocalUid ); |
|
603 iParamsFlags |= EParamsLUid; |
|
604 } |
|
605 } |
|
606 |
|
607 // --------------------------------------------------------------------------- |
|
608 // Add Local Uid, add the entire array |
|
609 // --------------------------------------------------------------------------- |
|
610 // |
|
611 EXPORT_C void CCalendarExportParams::AddLocalUid( const RArray<TCalLocalUid>& aInputLocalUIDArray ) |
|
612 { |
|
613 TInt inputArrayCount = aInputLocalUIDArray.Count(); |
|
614 |
|
615 for (TInt index = 0; index < inputArrayCount; ++index ) |
|
616 { |
|
617 if( iInputLocalUIDArray.Find( aInputLocalUIDArray[index]) == KErrNotFound ) |
|
618 { |
|
619 iInputLocalUIDArray.Append( aInputLocalUIDArray[index] ); |
|
620 iParamsFlags |= EParamsLUid; |
|
621 } |
|
622 } |
|
623 } |
|
624 |
|
625 |
|
626 // --------------------------------------------------------------------------- |
|
627 // SetCallBack |
|
628 // --------------------------------------------------------------------------- |
|
629 // |
|
630 EXPORT_C void CCalendarExportParams::SetExportFileNameL( const TDesC& aExportFileName ) |
|
631 { |
|
632 iParamsFlags ^= ( iParamsFlags & EParamsFileName ); |
|
633 |
|
634 if ( iFileName ) |
|
635 { |
|
636 delete iFileName; |
|
637 iFileName = NULL; |
|
638 } |
|
639 |
|
640 if( aExportFileName.Length() ) |
|
641 { |
|
642 iFileName = aExportFileName.AllocL(); |
|
643 iParamsFlags |= EParamsFileName; |
|
644 } |
|
645 else |
|
646 User::Leave(KErrArgument); |
|
647 } |
|
648 |
|
649 |
|
650 // --------------------------------------------------------------------------- |
|
651 // Return Global Uid Array |
|
652 // --------------------------------------------------------------------------- |
|
653 // |
|
654 EXPORT_C const CDesC8Array* CCalendarExportParams::GuidArray() const |
|
655 { |
|
656 return iInputGUIDArray; |
|
657 } |
|
658 |
|
659 // --------------------------------------------------------------------------- |
|
660 // Return Local Uid Array |
|
661 // --------------------------------------------------------------------------- |
|
662 // |
|
663 EXPORT_C const RArray<TCalLocalUid>& CCalendarExportParams::LocalUidArray() const |
|
664 { |
|
665 return iInputLocalUIDArray; |
|
666 } |
|
667 |
|
668 // --------------------------------------------------------------------------- |
|
669 // Return RequestObserver |
|
670 // --------------------------------------------------------------------------- |
|
671 // |
|
672 EXPORT_C TPtrC CCalendarExportParams::ExportFileName() |
|
673 { |
|
674 return iFileName ? TPtrC(*iFileName) : TPtrC(); |
|
675 } |
|
676 |
|
677 // --------------------------------------------------------------------------- |
|
678 // Return Params options selected |
|
679 // --------------------------------------------------------------------------- |
|
680 // |
|
681 EXPORT_C TInt32 CCalendarExportParams::Params() const |
|
682 { |
|
683 return iParamsFlags; |
|
684 } |
|
685 |
|
686 // --------------------------------------------------------------------------- |
|
687 // Return CCalendarExportParams* exact copy of this object |
|
688 // --------------------------------------------------------------------------- |
|
689 // |
|
690 EXPORT_C CCalendarExportParams* CCalendarExportParams::CloneL() |
|
691 { |
|
692 CCalendarExportParams* cloneObject = CCalendarExportParams::NewL(); |
|
693 |
|
694 CleanupStack::PushL( cloneObject ); |
|
695 |
|
696 if(iParamsFlags & EParamsGUid) |
|
697 { |
|
698 cloneObject->AddGuidL( this->GuidArray() ); |
|
699 } |
|
700 |
|
701 if(iParamsFlags & EParamsLUid) |
|
702 { |
|
703 cloneObject->AddLocalUid( this->LocalUidArray() ); |
|
704 } |
|
705 |
|
706 if(iParamsFlags & EParamsFileName) |
|
707 { |
|
708 cloneObject->SetExportFileNameL( this->ExportFileName() ); |
|
709 } |
|
710 |
|
711 CleanupStack::Pop( cloneObject ); |
|
712 |
|
713 return cloneObject; |
|
714 } |