|
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: |
|
15 * |
|
16 */ |
|
17 |
|
18 #include <calentry.h> |
|
19 #include <calrrule.h> |
|
20 #include <caluser.h> |
|
21 |
|
22 #include "entryattributes.h" |
|
23 #include "calendarconstants.h" |
|
24 |
|
25 // --------------------------------------------------------------------------- |
|
26 // CAttendeeInfo::NewL |
|
27 // --------------------------------------------------------------------------- |
|
28 // |
|
29 EXPORT_C CAttendeeInfo* CAttendeeInfo::NewL( const TDesC& aAddress ) |
|
30 { |
|
31 CAttendeeInfo* self = new (ELeave) CAttendeeInfo; |
|
32 CleanupStack::PushL( self ); |
|
33 self->ConstructL( aAddress ); |
|
34 CleanupStack::Pop( self ); |
|
35 return self; |
|
36 } |
|
37 |
|
38 // --------------------------------------------------------------------------- |
|
39 // Constructor |
|
40 // --------------------------------------------------------------------------- |
|
41 // |
|
42 CAttendeeInfo::CAttendeeInfo() |
|
43 { |
|
44 iResponse = EFalse; |
|
45 } |
|
46 |
|
47 // --------------------------------------------------------------------------- |
|
48 // 2nd-phased constructor of two phase construction |
|
49 // --------------------------------------------------------------------------- |
|
50 // |
|
51 void CAttendeeInfo::ConstructL( const TDesC& aAddress ) |
|
52 { |
|
53 if( aAddress.Length() ) |
|
54 { |
|
55 iAddress = aAddress.AllocL(); |
|
56 } |
|
57 else |
|
58 User::Leave(KErrArgument); |
|
59 } |
|
60 |
|
61 // --------------------------------------------------------------------------- |
|
62 // Destructor |
|
63 // --------------------------------------------------------------------------- |
|
64 // |
|
65 CAttendeeInfo::~CAttendeeInfo() |
|
66 { |
|
67 delete iAddress; |
|
68 delete iCommonName; |
|
69 delete iRole; |
|
70 delete iStatus; |
|
71 } |
|
72 |
|
73 // --------------------------------------------------------------------------- |
|
74 // CAttendeeInfo::SetCommonNameL |
|
75 // --------------------------------------------------------------------------- |
|
76 // |
|
77 EXPORT_C void CAttendeeInfo::SetCommonNameL( const TDesC& aName ) |
|
78 { |
|
79 if( aName.Length() ) |
|
80 { |
|
81 iCommonName = aName.AllocL(); |
|
82 } |
|
83 } |
|
84 |
|
85 // --------------------------------------------------------------------------- |
|
86 // CAttendeeInfo::SetRoleL |
|
87 // --------------------------------------------------------------------------- |
|
88 // |
|
89 EXPORT_C void CAttendeeInfo::SetRoleL( const TDesC& aRole ) |
|
90 { |
|
91 if( aRole.Length() ) |
|
92 { |
|
93 iRole = aRole.AllocL(); |
|
94 } |
|
95 } |
|
96 |
|
97 // --------------------------------------------------------------------------- |
|
98 // CAttendeeInfo::SetStatusL |
|
99 // --------------------------------------------------------------------------- |
|
100 // |
|
101 EXPORT_C void CAttendeeInfo::SetStatusL( const TDesC& aStatus ) |
|
102 { |
|
103 if( aStatus.Length() ) |
|
104 { |
|
105 iStatus = aStatus.AllocL(); |
|
106 } |
|
107 } |
|
108 |
|
109 // --------------------------------------------------------------------------- |
|
110 // CAttendeeInfo::SetRsvp |
|
111 // --------------------------------------------------------------------------- |
|
112 // |
|
113 EXPORT_C void CAttendeeInfo::SetRsvp( const TBool aResponse ) |
|
114 { |
|
115 iResponse = aResponse; |
|
116 } |
|
117 |
|
118 // --------------------------------------------------------------------------- |
|
119 // CAttendeeInfo::Address |
|
120 // --------------------------------------------------------------------------- |
|
121 // |
|
122 EXPORT_C TPtrC CAttendeeInfo::Address() |
|
123 { |
|
124 return iAddress ? TPtrC( *iAddress ) : TPtrC(); |
|
125 } |
|
126 |
|
127 // --------------------------------------------------------------------------- |
|
128 // CAttendeeInfo::CommonName |
|
129 // --------------------------------------------------------------------------- |
|
130 // |
|
131 EXPORT_C TPtrC CAttendeeInfo::CommonName() |
|
132 { |
|
133 return iCommonName ? TPtrC( *iCommonName ) : TPtrC(); |
|
134 } |
|
135 |
|
136 // --------------------------------------------------------------------------- |
|
137 // CAttendeeInfo::Role |
|
138 // --------------------------------------------------------------------------- |
|
139 // |
|
140 EXPORT_C TPtrC CAttendeeInfo::Role() |
|
141 { |
|
142 return iRole ? TPtrC( *iRole ) : TPtrC(); |
|
143 } |
|
144 |
|
145 |
|
146 // --------------------------------------------------------------------------- |
|
147 // CAttendeeInfo::Statuse |
|
148 // --------------------------------------------------------------------------- |
|
149 // |
|
150 EXPORT_C TPtrC CAttendeeInfo::Status() |
|
151 { |
|
152 return iStatus ? TPtrC( *iStatus ) : TPtrC(); |
|
153 } |
|
154 |
|
155 // --------------------------------------------------------------------------- |
|
156 // CAttendeeInfo::ResponseRequested |
|
157 // --------------------------------------------------------------------------- |
|
158 // |
|
159 EXPORT_C TBool CAttendeeInfo::ResponseRequested() |
|
160 { |
|
161 return iResponse; |
|
162 } |
|
163 |
|
164 // --------------------------------------------------------------------------- |
|
165 // CRepeatInfo::NewL |
|
166 // --------------------------------------------------------------------------- |
|
167 // |
|
168 EXPORT_C CRepeatInfo* CRepeatInfo::NewL( const TInt aType ) |
|
169 { |
|
170 CRepeatInfo* self = new (ELeave) CRepeatInfo; |
|
171 CleanupStack::PushL( self ); |
|
172 self->ConstructL( aType ); |
|
173 CleanupStack::Pop( self ); |
|
174 return self; |
|
175 } |
|
176 |
|
177 // --------------------------------------------------------------------------- |
|
178 // Constructor |
|
179 // --------------------------------------------------------------------------- |
|
180 // |
|
181 CRepeatInfo::CRepeatInfo() |
|
182 { |
|
183 iInterval = 1; |
|
184 iType = TCalRRule::EInvalid; |
|
185 } |
|
186 |
|
187 // --------------------------------------------------------------------------- |
|
188 // 2nd-phased constructor of two phase construction |
|
189 // --------------------------------------------------------------------------- |
|
190 // |
|
191 void CRepeatInfo::ConstructL( const TInt aType ) |
|
192 { |
|
193 if ( aType == KRRTypeDaily ) |
|
194 iType = TCalRRule::EDaily; |
|
195 |
|
196 else if ( aType == KRRTypeWeekly ) |
|
197 iType = TCalRRule::EWeekly; |
|
198 |
|
199 else if ( aType == KRRTypeMonthly ) |
|
200 iType = TCalRRule::EMonthly; |
|
201 |
|
202 else if ( aType == KRRTypeYearly ) |
|
203 iType = TCalRRule::EYearly; |
|
204 |
|
205 else |
|
206 User::Leave(KErrArgument); |
|
207 |
|
208 iRule.SetType( iType ); |
|
209 } |
|
210 |
|
211 // --------------------------------------------------------------------------- |
|
212 // Destructor |
|
213 // --------------------------------------------------------------------------- |
|
214 // |
|
215 CRepeatInfo::~CRepeatInfo() |
|
216 { |
|
217 iMonthDays.Close(); |
|
218 iMonthDates.Close(); |
|
219 iWeekDays.Close(); |
|
220 } |
|
221 |
|
222 // --------------------------------------------------------------------------- |
|
223 // CRepeatInfo::SetCount |
|
224 // --------------------------------------------------------------------------- |
|
225 // |
|
226 EXPORT_C void CRepeatInfo::SetCount( const TUint aCount ) |
|
227 { |
|
228 iRule.SetCount( aCount ); |
|
229 } |
|
230 |
|
231 // --------------------------------------------------------------------------- |
|
232 // CRepeatInfo::SetUntilTimeL |
|
233 // --------------------------------------------------------------------------- |
|
234 // |
|
235 EXPORT_C void CRepeatInfo::SetUntilTimeL( const TTime& aUntilTime ) |
|
236 { |
|
237 if( aUntilTime < TCalTime::MinTime() || aUntilTime > TCalTime::MaxTime() ) |
|
238 User::Leave( KErrArgument ); |
|
239 |
|
240 iUntilTime.SetTimeUtcL( aUntilTime ); |
|
241 iRule.SetUntil( iUntilTime ); |
|
242 } |
|
243 |
|
244 // --------------------------------------------------------------------------- |
|
245 // CRepeatInfo::SetStartTimeL |
|
246 // --------------------------------------------------------------------------- |
|
247 // |
|
248 EXPORT_C void CRepeatInfo::SetStartTimeL( const TTime& aStartTime ) |
|
249 { |
|
250 if( aStartTime < TCalTime::MinTime() || aStartTime > TCalTime::MaxTime() ) |
|
251 User::Leave( KErrArgument ); |
|
252 |
|
253 iStartTime.SetTimeUtcL( aStartTime ); |
|
254 iRule.SetDtStart( iStartTime ); |
|
255 } |
|
256 |
|
257 // --------------------------------------------------------------------------- |
|
258 // CRepeatInfo::SetInterval |
|
259 // --------------------------------------------------------------------------- |
|
260 // |
|
261 EXPORT_C void CRepeatInfo::SetInterval( const TInt aInterval ) |
|
262 { |
|
263 iInterval = aInterval; |
|
264 iRule.SetInterval( iInterval ); |
|
265 } |
|
266 |
|
267 // --------------------------------------------------------------------------- |
|
268 // CRepeatInfo::SetDaysInWeek |
|
269 // --------------------------------------------------------------------------- |
|
270 // |
|
271 EXPORT_C void CRepeatInfo::SetDaysInWeek( const RArray<TDay>& aDays ) |
|
272 { |
|
273 if( iType == TCalRRule::EWeekly ) |
|
274 { |
|
275 for( int i=0 ; i<aDays.Count() ; i++) |
|
276 iWeekDays.Append( aDays[i] ); |
|
277 iRule.SetByDay( iWeekDays ); |
|
278 } |
|
279 } |
|
280 |
|
281 // --------------------------------------------------------------------------- |
|
282 // CRepeatInfo::SetMonthDates |
|
283 // --------------------------------------------------------------------------- |
|
284 // |
|
285 EXPORT_C void CRepeatInfo::SetMonthDates( const RArray<TInt>& aMonthDates ) |
|
286 { |
|
287 if( iType == TCalRRule::EMonthly ) |
|
288 { |
|
289 // sets the month dates for the monthly repeat |
|
290 for( int i=0 ; i<aMonthDates.Count() ; i++) |
|
291 iMonthDates.Append( aMonthDates[i] ); |
|
292 iRule.SetByMonthDay( iMonthDates ); |
|
293 } |
|
294 |
|
295 } |
|
296 |
|
297 // --------------------------------------------------------------------------- |
|
298 // CRepeatInfo::SetMonthDays |
|
299 // --------------------------------------------------------------------------- |
|
300 // |
|
301 EXPORT_C void CRepeatInfo::SetMonthDays( const RArray<TCalRRule::TDayOfMonth>& aDays ) |
|
302 { |
|
303 if( iType == TCalRRule::EMonthly || iType == TCalRRule::EYearly ) |
|
304 { |
|
305 TInt count = aDays.Count(); |
|
306 // sets the days of the month for monthly and yearly repeats |
|
307 for( TInt i=0 ; i < count ; i++) |
|
308 { |
|
309 iMonthDays.Append( aDays[i] ); |
|
310 } |
|
311 iRule.SetByDay( iMonthDays ); |
|
312 } |
|
313 |
|
314 } |
|
315 |
|
316 // --------------------------------------------------------------------------- |
|
317 // CRepeatInfo::SetMonth |
|
318 // --------------------------------------------------------------------------- |
|
319 // |
|
320 EXPORT_C void CRepeatInfo::SetMonth( const TInt aMonth) |
|
321 { |
|
322 // sets the month for a yearly repeat |
|
323 if( iType == TCalRRule::EYearly ) |
|
324 { |
|
325 iMonth = TMonth( aMonth ); |
|
326 RArray<TMonth> monthList; |
|
327 monthList.Append( iMonth ); |
|
328 iRule.SetByMonth( monthList ); |
|
329 } |
|
330 } |
|
331 |
|
332 // --------------------------------------------------------------------------- |
|
333 // CRepeatInfo::SetWeekStart |
|
334 // --------------------------------------------------------------------------- |
|
335 // |
|
336 EXPORT_C void CRepeatInfo::SetWeekStart( const TInt aDay ) |
|
337 { |
|
338 iWkSt = TDay( aDay ); |
|
339 iRule.SetWkSt( iWkSt ); |
|
340 } |
|
341 |
|
342 // --------------------------------------------------------------------------- |
|
343 // CRepeatInfo::WeekStart |
|
344 // --------------------------------------------------------------------------- |
|
345 // |
|
346 EXPORT_C TDay CRepeatInfo::WeekStart() |
|
347 { |
|
348 return iWkSt; |
|
349 } |
|
350 |
|
351 // --------------------------------------------------------------------------- |
|
352 // CRepeatInfo::Month |
|
353 // --------------------------------------------------------------------------- |
|
354 // |
|
355 EXPORT_C TMonth CRepeatInfo::Month() |
|
356 { |
|
357 return iMonth; |
|
358 } |
|
359 |
|
360 // --------------------------------------------------------------------------- |
|
361 // CRepeatInfo::DaysInWeek |
|
362 // --------------------------------------------------------------------------- |
|
363 // |
|
364 EXPORT_C RArray<TDay>& CRepeatInfo::DaysInWeek() |
|
365 { |
|
366 return iWeekDays; |
|
367 } |
|
368 |
|
369 // --------------------------------------------------------------------------- |
|
370 // CRepeatInfo::DaysInMonth |
|
371 // --------------------------------------------------------------------------- |
|
372 // |
|
373 EXPORT_C RArray<TCalRRule::TDayOfMonth>& CRepeatInfo::DaysInMonth() |
|
374 { |
|
375 return iMonthDays; |
|
376 } |
|
377 |
|
378 // --------------------------------------------------------------------------- |
|
379 // CRepeatInfo::DatesInMonth |
|
380 // --------------------------------------------------------------------------- |
|
381 // |
|
382 EXPORT_C RArray<TInt>& CRepeatInfo::DatesInMonth() |
|
383 { |
|
384 return iMonthDates; |
|
385 } |
|
386 |
|
387 // --------------------------------------------------------------------------- |
|
388 // CRepeatInfo::Interval |
|
389 // --------------------------------------------------------------------------- |
|
390 // |
|
391 EXPORT_C TInt CRepeatInfo::Interval() |
|
392 { |
|
393 return iInterval; |
|
394 } |
|
395 |
|
396 // --------------------------------------------------------------------------- |
|
397 // CRepeatInfo::UntilDate |
|
398 // --------------------------------------------------------------------------- |
|
399 // |
|
400 EXPORT_C TCalTime& CRepeatInfo::UntilDate() |
|
401 { |
|
402 return iUntilTime; |
|
403 } |
|
404 |
|
405 // --------------------------------------------------------------------------- |
|
406 // CRepeatInfo::Type |
|
407 // --------------------------------------------------------------------------- |
|
408 // |
|
409 EXPORT_C TCalRRule::TType CRepeatInfo::Type() |
|
410 { |
|
411 return iType; |
|
412 } |
|
413 |
|
414 // --------------------------------------------------------------------------- |
|
415 // CRepeatInfo::GetRepeatRule |
|
416 // --------------------------------------------------------------------------- |
|
417 // |
|
418 EXPORT_C TCalRRule& CRepeatInfo::GetRepeatRule() |
|
419 { |
|
420 return iRule; |
|
421 } |
|
422 |
|
423 // --------------------------------------------------------------------------- |
|
424 // CEntryAttributes::NewL |
|
425 // --------------------------------------------------------------------------- |
|
426 // |
|
427 EXPORT_C CEntryAttributes* CEntryAttributes::NewL( const TDesC& aType ) |
|
428 { |
|
429 CEntryAttributes* self = new (ELeave) CEntryAttributes; |
|
430 CleanupStack::PushL( self ); |
|
431 self->ConstructL( aType ); |
|
432 CleanupStack::Pop( self ); |
|
433 return self; |
|
434 } |
|
435 |
|
436 // --------------------------------------------------------------------------- |
|
437 // CEntryAttributes::NewL |
|
438 // --------------------------------------------------------------------------- |
|
439 // |
|
440 EXPORT_C CEntryAttributes* CEntryAttributes::NewL() |
|
441 { |
|
442 return new (ELeave) CEntryAttributes; |
|
443 } |
|
444 |
|
445 // --------------------------------------------------------------------------- |
|
446 // Destructor |
|
447 // --------------------------------------------------------------------------- |
|
448 // |
|
449 CEntryAttributes::~CEntryAttributes() |
|
450 { |
|
451 delete iSummary; |
|
452 delete iDescription; |
|
453 delete iLocation; |
|
454 delete iPhoneOwner; |
|
455 delete iOrganizer; |
|
456 iRepeatDates.Close(); |
|
457 iExDates.Close(); |
|
458 |
|
459 iAttendees.ResetAndDestroy(); |
|
460 } |
|
461 |
|
462 // --------------------------------------------------------------------------- |
|
463 // CEntryAttributes::ConstructL |
|
464 // --------------------------------------------------------------------------- |
|
465 // |
|
466 void CEntryAttributes::ConstructL( const TDesC& aType ) |
|
467 { |
|
468 SetTypeL( aType ); |
|
469 iStartTime.SetTimeUtcL( Time::NullTTime() ); |
|
470 iEndTime.SetTimeUtcL( Time::NullTTime() ); |
|
471 } |
|
472 |
|
473 // --------------------------------------------------------------------------- |
|
474 // CEntryAttributes::SetTypeL |
|
475 // --------------------------------------------------------------------------- |
|
476 // |
|
477 EXPORT_C void CEntryAttributes::SetTypeL( const TDesC& aType ) |
|
478 { |
|
479 if ( aType.CompareF(KEntryAppt) == 0 ) |
|
480 iType = CCalEntry::EAppt; // apointment entry |
|
481 |
|
482 else if ( aType.CompareF(KEntryTodo) == 0 ) |
|
483 iType = CCalEntry::ETodo; // todo entry |
|
484 |
|
485 else if ( aType.CompareF(KEntryEvent) == 0 ) |
|
486 iType = CCalEntry::EEvent; // event entry |
|
487 |
|
488 else if ( aType.CompareF(KEntryReminder) == 0 ) |
|
489 iType = CCalEntry::EReminder; // reminder entry |
|
490 |
|
491 else if ( aType.CompareF(KEntryAnniv) == 0 ) |
|
492 iType = CCalEntry::EAnniv; // anniversary entry |
|
493 |
|
494 else |
|
495 User::Leave(KErrArgument); |
|
496 |
|
497 iSetAttributes |= EEntryType; |
|
498 } |
|
499 |
|
500 |
|
501 // --------------------------------------------------------------------------- |
|
502 // CEntryAttributes::SetStartTimeL |
|
503 // --------------------------------------------------------------------------- |
|
504 // |
|
505 EXPORT_C void CEntryAttributes::SetStartTimeL( const TTime& aStartTime ) |
|
506 { |
|
507 if ( aStartTime != Time::NullTTime()) |
|
508 { |
|
509 if( aStartTime < TCalTime::MinTime() || aStartTime > TCalTime::MaxTime() ) |
|
510 User::Leave( KErrArgument ); |
|
511 |
|
512 iSetAttributes |= EStartTime; |
|
513 iStartTime.SetTimeUtcL( aStartTime ); |
|
514 } |
|
515 } |
|
516 |
|
517 // --------------------------------------------------------------------------- |
|
518 // CEntryAttributes::SetEndTimeL |
|
519 // --------------------------------------------------------------------------- |
|
520 // |
|
521 EXPORT_C void CEntryAttributes::SetEndTimeL( const TTime& aEndTime ) |
|
522 { |
|
523 if ( aEndTime != Time::NullTTime() ) |
|
524 { |
|
525 if( aEndTime < TCalTime::MinTime() || aEndTime > TCalTime::MaxTime() ) |
|
526 User::Leave( KErrArgument ); |
|
527 |
|
528 iEndTime.SetTimeUtcL( aEndTime ); |
|
529 iSetAttributes |= EEndTime; |
|
530 } |
|
531 } |
|
532 |
|
533 // --------------------------------------------------------------------------- |
|
534 // CEntryAttributes::SetInstanceStartTimeL |
|
535 // --------------------------------------------------------------------------- |
|
536 // |
|
537 EXPORT_C void CEntryAttributes::SetInstanceStartTimeL( const TTime& aInsTime ) |
|
538 { |
|
539 if ( aInsTime != Time::NullTTime() ) |
|
540 { |
|
541 if( aInsTime < TCalTime::MinTime() || aInsTime > TCalTime::MaxTime() ) |
|
542 User::Leave( KErrArgument ); |
|
543 |
|
544 iInstanceStartTime.SetTimeUtcL( aInsTime ); |
|
545 iSetAttributes |= EInsStartTime; |
|
546 |
|
547 } |
|
548 } |
|
549 |
|
550 // --------------------------------------------------------------------------- |
|
551 // CEntryAttributes::SetAlarm |
|
552 // --------------------------------------------------------------------------- |
|
553 // |
|
554 EXPORT_C void CEntryAttributes::SetAlarm( const TTime& aAlarmTime) |
|
555 { |
|
556 if( aAlarmTime < TCalTime::MinTime() || aAlarmTime > TCalTime::MaxTime() ) |
|
557 User::Leave( KErrArgument ); |
|
558 |
|
559 iAlarmTime = aAlarmTime; |
|
560 iSetAttributes |= EAlarmTime; |
|
561 } |
|
562 |
|
563 // --------------------------------------------------------------------------- |
|
564 // CEntryAttributes::SetSequenceNumber |
|
565 // --------------------------------------------------------------------------- |
|
566 // |
|
567 EXPORT_C void CEntryAttributes::SetSequenceNumber( TInt aSeqNum ) |
|
568 { |
|
569 iSequenceNum = aSeqNum; |
|
570 iSetAttributes |= ESeqNum; |
|
571 } |
|
572 |
|
573 // --------------------------------------------------------------------------- |
|
574 // CEntryAttributes::SetEntryStatusL |
|
575 // --------------------------------------------------------------------------- |
|
576 // |
|
577 EXPORT_C void CEntryAttributes::SetEntryStatusL( const TDesC& aStatus ) |
|
578 { |
|
579 if ( aStatus.CompareF(KNullStatus) == 0 ) |
|
580 iEntryStatus = CCalEntry::ENullStatus; // null status |
|
581 |
|
582 else if ( aStatus.CompareF(KStatusTentative) == 0 ) |
|
583 iEntryStatus = CCalEntry::ETentative; // status is tentative |
|
584 |
|
585 else if ( aStatus.CompareF(KStatusConfirmed) == 0 ) |
|
586 iEntryStatus = CCalEntry::EConfirmed; // status is confirmed |
|
587 |
|
588 else if ( aStatus.CompareF(KStatusCancelled) == 0 ) |
|
589 iEntryStatus = CCalEntry::ECancelled; // status is cancelled |
|
590 |
|
591 else if ( aStatus.CompareF(KStatusTodoNeedsAction) == 0 ) |
|
592 iEntryStatus = CCalEntry::ETodoNeedsAction; //status of todo is needs action |
|
593 |
|
594 else if ( aStatus.CompareF(KStatusTodoCompleted) == 0 ) |
|
595 iEntryStatus = CCalEntry::ETodoCompleted;//status of todo is completed |
|
596 |
|
597 else if ( aStatus.CompareF(KStatusTodoInProcess) == 0 ) |
|
598 iEntryStatus = CCalEntry::ETodoInProcess; // status of todo is in process |
|
599 |
|
600 else |
|
601 User::Leave(KErrArgument); |
|
602 |
|
603 iSetAttributes |= EStatus; |
|
604 } |
|
605 |
|
606 // --------------------------------------------------------------------------- |
|
607 // CEntryAttributes::SetPhoneOwnerDataL |
|
608 // --------------------------------------------------------------------------- |
|
609 // |
|
610 EXPORT_C void CEntryAttributes::SetPhoneOwnerDataL( const TDesC& aPhoneOwner ) |
|
611 { |
|
612 if( aPhoneOwner.Length() ) |
|
613 { |
|
614 iPhoneOwner = aPhoneOwner.AllocL(); |
|
615 iSetAttributes |= EPhoneOwner; |
|
616 } |
|
617 } |
|
618 |
|
619 // --------------------------------------------------------------------------- |
|
620 // CEntryAttributes::SetOrganizerDataL |
|
621 // --------------------------------------------------------------------------- |
|
622 // |
|
623 EXPORT_C void CEntryAttributes::SetOrganizerDataL( CAttendeeInfo* aOrganizer ) |
|
624 { |
|
625 if( aOrganizer ) |
|
626 { |
|
627 iOrganizer = CCalUser::NewL( aOrganizer->Address() ); |
|
628 |
|
629 if( aOrganizer->CommonName().Length() ) |
|
630 iOrganizer->SetCommonNameL( aOrganizer->CommonName() ); |
|
631 |
|
632 iSetAttributes |= EOrganizer; |
|
633 } |
|
634 } |
|
635 |
|
636 // --------------------------------------------------------------------------- |
|
637 // CEntryAttributes::AddAttendeeL |
|
638 // --------------------------------------------------------------------------- |
|
639 // |
|
640 EXPORT_C void CEntryAttributes::AddAttendeeL( CAttendeeInfo* aAttendee ) |
|
641 { |
|
642 if( aAttendee ) |
|
643 { |
|
644 CCalAttendee* attendee = CCalAttendee::NewL( aAttendee->Address() ); |
|
645 if( aAttendee->CommonName().Length() ) |
|
646 attendee->SetCommonNameL( aAttendee->CommonName() ); |
|
647 TPtrC role = aAttendee->Role(); |
|
648 if( role.Length() ) |
|
649 { |
|
650 CCalAttendee::TCalRole attRole = CCalAttendee::EReqParticipant; |
|
651 |
|
652 if ( role.CompareF(KAttRoleReqParticipant) == 0 ) |
|
653 attRole = CCalAttendee::EReqParticipant; // required participant |
|
654 |
|
655 else if ( role.CompareF(KAttRoleOptParticipant) == 0 ) |
|
656 attRole = CCalAttendee::EOptParticipant; // optional participant |
|
657 |
|
658 else if ( role.CompareF(KAttRoleNonParticipant) == 0 ) |
|
659 attRole = CCalAttendee::ENonParticipant; // non - participant |
|
660 |
|
661 else if ( role.CompareF(KAttRoleChair) == 0 ) |
|
662 attRole = CCalAttendee::EChair; // chair |
|
663 |
|
664 else |
|
665 User::Leave(KErrArgument); |
|
666 |
|
667 attendee->SetRoleL( attRole ); |
|
668 } |
|
669 |
|
670 TPtrC status = aAttendee->Status(); |
|
671 if( status.Length() ) |
|
672 { |
|
673 CCalAttendee::TCalStatus attStatus = CCalAttendee::ENeedsAction; |
|
674 |
|
675 if ( status.CompareF(KAttStatusTentative) == 0 ) |
|
676 attStatus = CCalAttendee::ETentative; // attendee's status is tentative |
|
677 |
|
678 else if ( status.CompareF(KAttStatusConfirmed) == 0 ) |
|
679 attStatus = CCalAttendee::EConfirmed; // attendee has confirmed participation |
|
680 |
|
681 else if ( status.CompareF(KAttStatusAccepted) == 0 ) |
|
682 attStatus = CCalAttendee::EAccepted; // attendee has accepted |
|
683 |
|
684 else if ( status.CompareF(KAttStatusNeedsAction) == 0 ) |
|
685 attStatus = CCalAttendee::ENeedsAction; // status needs action |
|
686 |
|
687 else if ( status.CompareF(KAttStatusDeclined) == 0 ) |
|
688 attStatus = CCalAttendee::EDeclined;// attendee has declined |
|
689 |
|
690 else if ( status.CompareF(KAttStatusInProcess) == 0 ) |
|
691 attStatus = CCalAttendee::EInProcess;// status in process |
|
692 |
|
693 else if ( status.CompareF(KAttStatusCompleted) == 0 ) |
|
694 attStatus = CCalAttendee::ECompleted; // status is completed |
|
695 |
|
696 else if ( status.CompareF(KAttStatusDelegated) == 0 ) |
|
697 attStatus = CCalAttendee::EDelegated;// attendee has delegated request |
|
698 |
|
699 else |
|
700 User::Leave(KErrArgument); |
|
701 |
|
702 attendee->SetStatusL( attStatus ); |
|
703 } |
|
704 attendee->SetResponseRequested( aAttendee->ResponseRequested() ); |
|
705 iAttendees.AppendL( attendee ); |
|
706 iSetAttributes |= EAttendees; |
|
707 } |
|
708 } |
|
709 |
|
710 // --------------------------------------------------------------------------- |
|
711 // CEntryAttributes::AddRepeatDateL |
|
712 // --------------------------------------------------------------------------- |
|
713 // |
|
714 EXPORT_C void CEntryAttributes::AddRepeatDateL( const TTime& aRepeatDate ) |
|
715 { |
|
716 if ( aRepeatDate != Time::NullTTime()) |
|
717 { |
|
718 TCalTime caltime; |
|
719 caltime.SetTimeUtcL( aRepeatDate ); |
|
720 iRepeatDates.Append( caltime ); |
|
721 iSetAttributes |= ERepeatDates; |
|
722 } |
|
723 } |
|
724 |
|
725 // --------------------------------------------------------------------------- |
|
726 // CEntryAttributes::AddExceptionDateL |
|
727 // --------------------------------------------------------------------------- |
|
728 // |
|
729 EXPORT_C void CEntryAttributes::AddExceptionDateL( const TTime& aExDate ) |
|
730 { |
|
731 if ( aExDate != Time::NullTTime()) |
|
732 { |
|
733 TCalTime caltime; |
|
734 caltime.SetTimeUtcL( aExDate ); |
|
735 iExDates.Append( caltime ); |
|
736 iSetAttributes |= EExDates; |
|
737 } |
|
738 } |
|
739 |
|
740 // --------------------------------------------------------------------------- |
|
741 // CEntryAttributes::SetReplicationL |
|
742 // --------------------------------------------------------------------------- |
|
743 // |
|
744 EXPORT_C void CEntryAttributes::SetReplicationL( const TDesC& aRepStatus ) |
|
745 { |
|
746 if ( aRepStatus.CompareF( KReplOpen ) == 0 ) |
|
747 iRepStatus = CCalEntry::EOpen; // open |
|
748 else if ( aRepStatus.CompareF( KReplPrivate ) == 0 ) |
|
749 iRepStatus = CCalEntry::EPrivate; //private |
|
750 else if ( aRepStatus.CompareF( KReplRest ) == 0 ) |
|
751 iRepStatus = CCalEntry::ERestricted;//restricted |
|
752 else |
|
753 User::Leave(KErrArgument); |
|
754 |
|
755 iSetAttributes |= EReplication; |
|
756 } |
|
757 |
|
758 // --------------------------------------------------------------------------- |
|
759 // CEntryAttributes::SetSummaryL |
|
760 // --------------------------------------------------------------------------- |
|
761 // |
|
762 EXPORT_C void CEntryAttributes::SetSummaryL( const TDesC& aSummary ) |
|
763 { |
|
764 if( aSummary.Length() ) |
|
765 { |
|
766 iSummary = aSummary.AllocL(); |
|
767 iSetAttributes |= ESummary; |
|
768 } |
|
769 } |
|
770 |
|
771 // --------------------------------------------------------------------------- |
|
772 // CEntryAttributes::SetDescriptionL |
|
773 // --------------------------------------------------------------------------- |
|
774 // |
|
775 EXPORT_C void CEntryAttributes::SetDescriptionL( const TDesC& aDescription ) |
|
776 { |
|
777 if( aDescription.Length() ) |
|
778 { |
|
779 iDescription = aDescription.AllocL(); |
|
780 iSetAttributes |= EDescription; |
|
781 } |
|
782 } |
|
783 |
|
784 // --------------------------------------------------------------------------- |
|
785 // CEntryAttributes::SetLocationL |
|
786 // --------------------------------------------------------------------------- |
|
787 // |
|
788 EXPORT_C void CEntryAttributes::SetLocationL( const TDesC& aLocation ) |
|
789 { |
|
790 if( aLocation.Length() ) |
|
791 { |
|
792 iLocation = aLocation.AllocL(); |
|
793 iSetAttributes |= ELocation; |
|
794 } |
|
795 } |
|
796 |
|
797 // --------------------------------------------------------------------------- |
|
798 // CEntryAttributes::SetMethodL |
|
799 // --------------------------------------------------------------------------- |
|
800 // |
|
801 EXPORT_C void CEntryAttributes::SetMethodL( const TDesC& aMethod ) |
|
802 { |
|
803 //Sets the entry's method property for group scheduling |
|
804 if ( aMethod.CompareF(KMethodNone) == 0 ) |
|
805 iMethod = CCalEntry::EMethodNone; |
|
806 |
|
807 else if ( aMethod.CompareF(KMethodPublish) == 0 ) |
|
808 iMethod = CCalEntry::EMethodPublish; |
|
809 |
|
810 else if ( aMethod.CompareF(KMethodRequest) == 0 ) |
|
811 iMethod = CCalEntry::EMethodRequest; |
|
812 |
|
813 else if ( aMethod.CompareF(KMethodReply) == 0 ) |
|
814 iMethod = CCalEntry::EMethodReply; |
|
815 |
|
816 else if ( aMethod.CompareF(KMethodAdd) == 0 ) |
|
817 iMethod = CCalEntry::EMethodAdd; |
|
818 |
|
819 else if ( aMethod.CompareF(KMethodCancel) == 0 ) |
|
820 iMethod = CCalEntry::EMethodCancel; |
|
821 |
|
822 else if ( aMethod.CompareF(KMethodRefresh) == 0 ) |
|
823 iMethod = CCalEntry::EMethodRefresh; |
|
824 |
|
825 else if ( aMethod.CompareF(KMethodCounter) == 0 ) |
|
826 iMethod = CCalEntry::EMethodCounter; |
|
827 |
|
828 else if ( aMethod.CompareF(KMethodDecCounter) == 0 ) |
|
829 iMethod = CCalEntry::EMethodDeclineCounter; |
|
830 |
|
831 else |
|
832 User::Leave(KErrArgument); |
|
833 |
|
834 iSetAttributes |= EMethod; |
|
835 } |
|
836 |
|
837 // --------------------------------------------------------------------------- |
|
838 // CEntryAttributes::SetPriority |
|
839 // --------------------------------------------------------------------------- |
|
840 // |
|
841 EXPORT_C int CEntryAttributes::SetPriority( TInt aPriority ) |
|
842 { |
|
843 if( aPriority < 0 || aPriority > 255 ) |
|
844 return KErrArgument; |
|
845 iPriority = aPriority; |
|
846 iSetAttributes |= EPriority; |
|
847 return KErrNone; |
|
848 } |
|
849 |
|
850 // --------------------------------------------------------------------------- |
|
851 // CEntryAttributes::SetLocalUid |
|
852 // --------------------------------------------------------------------------- |
|
853 // |
|
854 EXPORT_C void CEntryAttributes::SetLocalUid( const TCalLocalUid aLUid) |
|
855 { |
|
856 iLocal = aLUid; |
|
857 iSetAttributes |= ELocalUid; |
|
858 } |
|
859 |
|
860 // --------------------------------------------------------------------------- |
|
861 // CEntryAttributes::SetRepeatRule |
|
862 // --------------------------------------------------------------------------- |
|
863 // |
|
864 EXPORT_C void CEntryAttributes::SetRepeatRule( CRepeatInfo* aRptInfo) |
|
865 { |
|
866 if ( aRptInfo ) |
|
867 iRepeatRule = aRptInfo->GetRepeatRule(); |
|
868 } |
|
869 |
|
870 // --------------------------------------------------------------------------- |
|
871 // CEntryAttributes::StartTime |
|
872 // --------------------------------------------------------------------------- |
|
873 // |
|
874 EXPORT_C TCalTime& CEntryAttributes::StartTime() |
|
875 { |
|
876 return iStartTime; |
|
877 } |
|
878 |
|
879 // --------------------------------------------------------------------------- |
|
880 // CEntryAttributes::EndTime |
|
881 // --------------------------------------------------------------------------- |
|
882 // |
|
883 EXPORT_C TCalTime& CEntryAttributes::EndTime() |
|
884 { |
|
885 return iEndTime; |
|
886 } |
|
887 |
|
888 // --------------------------------------------------------------------------- |
|
889 // CEntryAttributes::InstanceStartTime |
|
890 // --------------------------------------------------------------------------- |
|
891 // |
|
892 EXPORT_C TCalTime& CEntryAttributes::InstanceStartTime() |
|
893 { |
|
894 return iInstanceStartTime; |
|
895 } |
|
896 |
|
897 // --------------------------------------------------------------------------- |
|
898 // CEntryAttributes::ReplicationStatus |
|
899 // --------------------------------------------------------------------------- |
|
900 // |
|
901 EXPORT_C CCalEntry::TReplicationStatus CEntryAttributes::ReplicationStatus() |
|
902 { |
|
903 return iRepStatus; |
|
904 } |
|
905 |
|
906 // --------------------------------------------------------------------------- |
|
907 // CEntryAttributes::Summary |
|
908 // --------------------------------------------------------------------------- |
|
909 // |
|
910 EXPORT_C TPtrC CEntryAttributes::Summary() |
|
911 { |
|
912 return iSummary ? TPtrC( *iSummary ) : TPtrC(); |
|
913 } |
|
914 |
|
915 // --------------------------------------------------------------------------- |
|
916 // CEntryAttributes::Description |
|
917 // --------------------------------------------------------------------------- |
|
918 // |
|
919 EXPORT_C TPtrC CEntryAttributes::Description() |
|
920 { |
|
921 return iDescription ? TPtrC( *iDescription ) : TPtrC(); |
|
922 } |
|
923 |
|
924 // --------------------------------------------------------------------------- |
|
925 // CEntryAttributes::Location |
|
926 // --------------------------------------------------------------------------- |
|
927 // |
|
928 EXPORT_C TPtrC CEntryAttributes::Location() |
|
929 { |
|
930 return iLocation ? TPtrC( *iLocation ) : TPtrC(); |
|
931 } |
|
932 |
|
933 // --------------------------------------------------------------------------- |
|
934 // CEntryAttributes::EntryType |
|
935 // --------------------------------------------------------------------------- |
|
936 // |
|
937 EXPORT_C CCalEntry::TType CEntryAttributes::EntryType() |
|
938 { |
|
939 return iType; |
|
940 } |
|
941 |
|
942 // --------------------------------------------------------------------------- |
|
943 // CEntryAttributes::SequenceNumber |
|
944 // --------------------------------------------------------------------------- |
|
945 // |
|
946 EXPORT_C TInt CEntryAttributes::SequenceNumber() |
|
947 { |
|
948 return iSequenceNum; |
|
949 } |
|
950 |
|
951 // --------------------------------------------------------------------------- |
|
952 // CEntryAttributes::AlarmTime |
|
953 // --------------------------------------------------------------------------- |
|
954 // |
|
955 EXPORT_C TTime CEntryAttributes::AlarmTime() |
|
956 { |
|
957 return iAlarmTime; |
|
958 } |
|
959 |
|
960 // --------------------------------------------------------------------------- |
|
961 // CEntryAttributes::EntryStatus |
|
962 // --------------------------------------------------------------------------- |
|
963 // |
|
964 EXPORT_C CCalEntry::TStatus CEntryAttributes::EntryStatus() |
|
965 { |
|
966 return iEntryStatus; |
|
967 } |
|
968 |
|
969 // --------------------------------------------------------------------------- |
|
970 // CEntryAttributes::PhoneOwner |
|
971 // --------------------------------------------------------------------------- |
|
972 // |
|
973 EXPORT_C TPtrC CEntryAttributes::PhoneOwner() |
|
974 { |
|
975 return iPhoneOwner ? *iPhoneOwner : TPtrC(); |
|
976 } |
|
977 |
|
978 // --------------------------------------------------------------------------- |
|
979 // CEntryAttributes::Organizer |
|
980 // --------------------------------------------------------------------------- |
|
981 // |
|
982 EXPORT_C CCalUser* CEntryAttributes::Organizer() |
|
983 { |
|
984 return iOrganizer; |
|
985 } |
|
986 |
|
987 // --------------------------------------------------------------------------- |
|
988 // CEntryAttributes::AttendeeList |
|
989 // --------------------------------------------------------------------------- |
|
990 // |
|
991 EXPORT_C RPointerArray<CCalAttendee>& CEntryAttributes::AttendeeList() |
|
992 { |
|
993 return iAttendees; |
|
994 } |
|
995 |
|
996 // --------------------------------------------------------------------------- |
|
997 // CEntryAttributes::RepeatDates |
|
998 // --------------------------------------------------------------------------- |
|
999 // |
|
1000 EXPORT_C RArray<TCalTime>& CEntryAttributes::RepeatDates() |
|
1001 { |
|
1002 return iRepeatDates; |
|
1003 } |
|
1004 |
|
1005 // --------------------------------------------------------------------------- |
|
1006 // CEntryAttributes::ExceptionDates |
|
1007 // --------------------------------------------------------------------------- |
|
1008 // |
|
1009 EXPORT_C RArray<TCalTime>& CEntryAttributes::ExceptionDates() |
|
1010 { |
|
1011 return iExDates; |
|
1012 } |
|
1013 |
|
1014 // --------------------------------------------------------------------------- |
|
1015 // CEntryAttributes::RepeatRuleL |
|
1016 // --------------------------------------------------------------------------- |
|
1017 // |
|
1018 EXPORT_C TCalRRule& CEntryAttributes::RepeatRuleL() |
|
1019 { |
|
1020 if ( iType == CCalEntry::EAnniv ) |
|
1021 // explicitly set repeat rule for anniversary type entries |
|
1022 { |
|
1023 TTime stTime = iStartTime.TimeLocalL(); |
|
1024 TTime zero(TInt64(0)); |
|
1025 stTime = zero + stTime.DaysFrom(zero); |
|
1026 iStartTime.SetTimeLocalFloatingL( stTime ); |
|
1027 TCalRRule rrule( TCalRRule::EYearly ); |
|
1028 rrule.SetDtStart( iStartTime ); |
|
1029 rrule.SetInterval( 1 ); // once a year |
|
1030 iRepeatRule = rrule ; |
|
1031 } |
|
1032 return iRepeatRule; |
|
1033 } |
|
1034 |
|
1035 // --------------------------------------------------------------------------- |
|
1036 // CEntryAttributes::Method |
|
1037 // --------------------------------------------------------------------------- |
|
1038 // |
|
1039 EXPORT_C CCalEntry::TMethod CEntryAttributes::Method() |
|
1040 { |
|
1041 return iMethod; |
|
1042 } |
|
1043 |
|
1044 // --------------------------------------------------------------------------- |
|
1045 // CEntryAttributes::Priority |
|
1046 // --------------------------------------------------------------------------- |
|
1047 // |
|
1048 EXPORT_C TInt CEntryAttributes::Priority() |
|
1049 { |
|
1050 return iPriority; |
|
1051 } |
|
1052 |
|
1053 // --------------------------------------------------------------------------- |
|
1054 // CEntryAttributes::LocalUid |
|
1055 // --------------------------------------------------------------------------- |
|
1056 // |
|
1057 EXPORT_C TCalLocalUid CEntryAttributes::LocalUid() |
|
1058 { |
|
1059 return iLocal; |
|
1060 } |
|
1061 |
|
1062 // --------------------------------------------------------------------------- |
|
1063 // CEntryAttributes::ModifiedAttributes |
|
1064 // --------------------------------------------------------------------------- |
|
1065 // |
|
1066 EXPORT_C TInt32 CEntryAttributes::ModifiedAttributes() |
|
1067 { |
|
1068 return iSetAttributes; |
|
1069 } |
|
1070 |
|
1071 // --------------------------------------------------------------------------- |
|
1072 // Constructor |
|
1073 // --------------------------------------------------------------------------- |
|
1074 // |
|
1075 CEntryAttributes::CEntryAttributes() |
|
1076 { |
|
1077 iMethod = CCalEntry::EMethodNone; |
|
1078 iSequenceNum = 0; |
|
1079 iRepStatus = CCalEntry::EOpen; |
|
1080 iPriority = 0; |
|
1081 iPhoneOwner = NULL; |
|
1082 iOrganizer = NULL; |
|
1083 iLocation = NULL; |
|
1084 iAlarmTime = NULL; |
|
1085 iEntryStatus = CCalEntry::ENullStatus; |
|
1086 } |
|
1087 |