19 #include <e32base.h> |
19 #include <e32base.h> |
20 #include <calsession.h> |
20 #include <calsession.h> |
21 #include <calinstance.h> |
21 #include <calinstance.h> |
22 #include <calentryview.h> |
22 #include <calentryview.h> |
23 #include <calinstanceview.h> |
23 #include <calinstanceview.h> |
24 #include <caleninterimutils2.h> |
24 #include <CalenInterimUtils2.h> |
25 #include <calrrule.h> |
25 #include <calrrule.h> |
26 #include <calalarm.h> |
26 #include <calalarm.h> |
27 #include <caluser.h> |
27 #include <caluser.h> |
28 |
28 |
29 #include "calendarheader.h" |
29 #include "calendarheader.h" |
523 temp = temp + TTimeIntervalDays(1); |
523 temp = temp + TTimeIntervalDays(1); |
524 if( alarmTime >= temp ) |
524 if( alarmTime >= temp ) |
525 User::Leave( KErrNotSupported ); |
525 User::Leave( KErrNotSupported ); |
526 } |
526 } |
527 |
527 |
528 TDateTime stTime; |
528 if( aEntry->EntryTypeL() != CCalEntry::ETodo ) |
529 stTime = aEntry->StartTimeL().TimeUtcL().DateTime(); |
529 { |
530 alTime.MinutesFrom( stTime, minutes );// calculate the offset between alarm time and start time |
530 TDateTime stTime; |
531 CCalAlarm* alarm = CCalAlarm::NewL(); |
531 stTime = aEntry->StartTimeL().TimeUtcL().DateTime(); |
532 CleanupStack::PushL( alarm ); |
532 alTime.MinutesFrom( stTime, minutes );// calculate the offset between alarm time and start time |
533 alarm->SetTimeOffset(-minutes.Int()); |
533 CCalAlarm* alarm = CCalAlarm::NewL(); |
534 aEntry->SetAlarmL(alarm); // set the alarm for the entry |
534 CleanupStack::PushL( alarm ); |
535 CleanupStack::PopAndDestroy( alarm ); |
535 alarm->SetTimeOffset(-minutes.Int()); |
|
536 aEntry->SetAlarmL(alarm); // set the alarm for the entry |
|
537 CleanupStack::PopAndDestroy( alarm ); |
|
538 } |
|
539 else |
|
540 { |
|
541 TTime endTime; |
|
542 endTime = aEntry->EndTimeL().TimeUtcL(); |
|
543 if ( endTime != Time::NullTTime() ) |
|
544 { |
|
545 alTime.MinutesFrom( endTime, minutes );// calculate the offset between alarm time and start time |
|
546 if(minutes.Int() < 0 ) |
|
547 { |
|
548 CCalAlarm* alarm = CCalAlarm::NewL(); |
|
549 CleanupStack::PushL( alarm ); |
|
550 alarm->SetTimeOffset(-minutes.Int()); |
|
551 aEntry->SetAlarmL(alarm); // set the alarm for the entry |
|
552 CleanupStack::PopAndDestroy( alarm ); |
|
553 } |
|
554 else |
|
555 { |
|
556 User::Leave( KErrNotSupported ); |
|
557 } |
|
558 } |
|
559 } |
536 } |
560 } |
537 } |
561 } |
538 |
562 |
539 TBool parentEntry = EFalse; |
563 TBool parentEntry = EFalse; |
540 |
564 |