336 static_cast<MESMRMeetingRequestEntry*>( iEntry ); |
353 static_cast<MESMRMeetingRequestEntry*>( iEntry ); |
337 if ( mrEntry->IsRecurrentEventL() && |
354 if ( mrEntry->IsRecurrentEventL() && |
338 MESMRCalEntry::EESMRThisOnly == mrEntry->RecurrenceModRule() ) |
355 MESMRCalEntry::EESMRThisOnly == mrEntry->RecurrenceModRule() ) |
339 { |
356 { |
340 TBool instanceAlreadyOnThisDay( |
357 TBool instanceAlreadyOnThisDay( |
341 mrEntry->AnyInstanceOnDayL(startTime, endTime) ); |
358 mrEntry->AnyInstancesBetweenTimePeriodL( |
|
359 startTime, |
|
360 endTime ) ); |
342 |
361 |
343 if ( instanceAlreadyOnThisDay ) |
362 if ( instanceAlreadyOnThisDay ) |
344 { |
363 { |
345 error = MESMRFieldValidator::EErrorRescheduleInstance; |
364 error = MESMRFieldValidator::EErrorRescheduleInstance; |
346 } |
365 } |
347 } |
366 } |
348 } |
367 } |
|
368 |
|
369 if ( KErrorNone == error && |
|
370 MESMRCalEntry::EESMRCalEntryMeeting == iEntry->Type() ) |
|
371 { |
|
372 // Check that is modified entry |
|
373 if ( iEntry->IsRecurrentEventL() && |
|
374 MESMRCalEntry::EESMRThisOnly == iEntry->RecurrenceModRule() ) |
|
375 { |
|
376 TBool instanceAlreadyOnThisDay( |
|
377 iEntry->AnyInstancesBetweenTimePeriodL( |
|
378 startTime, |
|
379 endTime ) ); |
|
380 |
|
381 if ( instanceAlreadyOnThisDay ) |
|
382 { |
|
383 error = MESMRFieldValidator::EErrorRescheduleInstance; |
|
384 } |
|
385 } |
|
386 } |
|
387 |
|
388 if ( KErrorNone == error && |
|
389 ( MESMRCalEntry::EESMRCalEntryMeetingRequest == iEntry->Type() || |
|
390 MESMRCalEntry::EESMRCalEntryMeeting == iEntry->Type() ) ) |
|
391 { |
|
392 // Check that is modified entry |
|
393 if ( iEntry->IsRecurrentEventL() && |
|
394 MESMRCalEntry::EESMRThisOnly == iEntry->RecurrenceModRule() ) |
|
395 { |
|
396 error = ValidateEditedInstanceTimeL(); |
|
397 } |
|
398 } |
349 |
399 |
350 if ( KErrorNone == error && iAlldayEvent && iAlarmOnOff ) |
400 if ( KErrorNone == error && iAlldayEvent && iAlarmOnOff ) |
351 { |
401 { |
352 TTime alarmTime = AlarmDateTime(); |
402 TTime alarmTime = AlarmDateTime(); |
353 if ( alarmTime > startTime ) |
403 if ( alarmTime > startTime ) |
415 } |
464 } |
416 return error; |
465 return error; |
417 } |
466 } |
418 |
467 |
419 // --------------------------------------------------------------------------- |
468 // --------------------------------------------------------------------------- |
|
469 // CESMRMeetingTimeValidator::ValidateEditedInstanceTimeL |
|
470 // --------------------------------------------------------------------------- |
|
471 // |
|
472 MESMRFieldValidator::TESMRFieldValidatorError CESMRMeetingTimeValidator::ValidateEditedInstanceTimeL() |
|
473 { |
|
474 CESMRRecurrenceInfoHandler* recurrenceHandler = |
|
475 CESMRRecurrenceInfoHandler::NewLC( iEntry->Entry(), &iEntry->GetDBMgr() ); |
|
476 TCalTime preStartTime; |
|
477 TCalTime preEndTime; |
|
478 TCalTime nextStartTime; |
|
479 TCalTime nextEndTime; |
|
480 |
|
481 CCalInstance* instance = iEntry->InstanceL(); |
|
482 CleanupStack::PushL( instance ); |
|
483 TTime instanceDateTime = instance->StartTimeL().TimeLocalL(); |
|
484 CleanupStack::PopAndDestroy( instance ); |
|
485 |
|
486 recurrenceHandler->GetPreviousInstanceTimeL( preStartTime, preEndTime, instanceDateTime ); |
|
487 recurrenceHandler->GetNextInstanceTimeL( nextStartTime, nextEndTime, instanceDateTime ); |
|
488 |
|
489 CleanupStack::PopAndDestroy( recurrenceHandler ); |
|
490 |
|
491 const TTime editedStartDateTime( StartDateTime() ); |
|
492 const TTime editedEndDateTime( EndDateTime() ); |
|
493 |
|
494 if( preStartTime.TimeLocalL() != Time::NullTTime() ) |
|
495 { |
|
496 // Does the exception end on/after prevEnd? |
|
497 if( editedStartDateTime < preEndTime.TimeLocalL() ) |
|
498 { |
|
499 // Does the exception start after prevStart? |
|
500 if( editedStartDateTime > preStartTime.TimeLocalL() ) |
|
501 { |
|
502 return EErrorInstanceOverlapsExistingOne; |
|
503 } |
|
504 else |
|
505 { |
|
506 // Does the exception finish after prevStart? |
|
507 if( editedEndDateTime > preStartTime.TimeLocalL() ) |
|
508 { |
|
509 return EErrorInstanceOverlapsExistingOne; |
|
510 } |
|
511 else |
|
512 { |
|
513 return EErrorInstanceOutOfSequence; |
|
514 } |
|
515 } |
|
516 } |
|
517 |
|
518 // Does the exception start on the same day as prevStart? |
|
519 if( IsSameDay( StartDateTime(), preStartTime.TimeLocalL().DateTime() ) ) |
|
520 { |
|
521 return EErrorInstanceAlreadyExistsOnThisDay; |
|
522 } |
|
523 } |
|
524 |
|
525 |
|
526 if( nextStartTime.TimeLocalL() != Time::NullTTime() ) |
|
527 { |
|
528 // Does the exception finish on/before nextStart? |
|
529 if( editedEndDateTime > nextStartTime.TimeLocalL() ) |
|
530 { |
|
531 // Does the exception finish before nextFinish? |
|
532 if( editedEndDateTime < nextEndTime.TimeLocalL() ) |
|
533 { |
|
534 return EErrorInstanceOverlapsExistingOne; |
|
535 } |
|
536 else |
|
537 { |
|
538 // Does the exception start before nextFinish? |
|
539 if( editedStartDateTime < nextEndTime.TimeLocalL() ) |
|
540 { |
|
541 return EErrorInstanceOverlapsExistingOne; |
|
542 } |
|
543 else |
|
544 { |
|
545 return EErrorInstanceOutOfSequence; |
|
546 } |
|
547 } |
|
548 } |
|
549 |
|
550 // Does the exception start on the same day as nextStart? |
|
551 if( IsSameDay( StartDateTime(), nextStartTime.TimeLocalL().DateTime() ) ) |
|
552 { |
|
553 return EErrorInstanceAlreadyExistsOnThisDay; |
|
554 } |
|
555 } |
|
556 |
|
557 |
|
558 // Does the series have any rdates |
|
559 RArray<TCalTime> rDateArray; |
|
560 CleanupClosePushL( rDateArray ); |
|
561 iEntry->Entry().GetRDatesL( rDateArray ); |
|
562 TInt rDateCount = rDateArray.Count(); |
|
563 |
|
564 if ( rDateCount > 0 ) |
|
565 { |
|
566 // If the series has rdates, check that the exception |
|
567 // does not overlap or start on the same day |
|
568 TTimeIntervalMinutes duration; |
|
569 editedStartDateTime.MinutesFrom( editedEndDateTime, duration ); |
|
570 |
|
571 for ( TInt index = 0; index < rDateCount; index++ ) |
|
572 { |
|
573 const TTime& rDate = rDateArray[ index ].TimeLocalL(); |
|
574 |
|
575 if ( !IsSameDay( iEntry->Entry().StartTimeL().TimeLocalL().DateTime(), rDate.DateTime() ) ) |
|
576 { |
|
577 // Does the exception start or end on the same day as a rdate. |
|
578 if ( IsSameDay( StartDateTime(), rDate.DateTime() ) ) |
|
579 { |
|
580 CleanupStack::PopAndDestroy(); // rDateArray |
|
581 return EErrorInstanceAlreadyExistsOnThisDay; |
|
582 } |
|
583 |
|
584 // Does the exception overlap an rdate? |
|
585 TTime rDateEnd = rDate + duration; |
|
586 if ( editedEndDateTime > rDateEnd && editedStartDateTime < rDate ) |
|
587 { |
|
588 CleanupStack::PopAndDestroy(); // rDateArray |
|
589 return EErrorInstanceOverlapsExistingOne; |
|
590 } |
|
591 } |
|
592 } |
|
593 } |
|
594 |
|
595 CleanupStack::PopAndDestroy(); // rDateArray |
|
596 return EErrorNone; |
|
597 } |
|
598 |
|
599 // --------------------------------------------------------------------------- |
420 // CESMRMeetingTimeValidator::ReadValuesFromEntryL |
600 // CESMRMeetingTimeValidator::ReadValuesFromEntryL |
421 // --------------------------------------------------------------------------- |
601 // --------------------------------------------------------------------------- |
422 // |
602 // |
423 void CESMRMeetingTimeValidator::ReadValuesFromEntryL( |
603 void CESMRMeetingTimeValidator::ReadValuesFromEntryL( |
424 MESMRCalEntry& aEntry ) |
604 MESMRCalEntry& aEntry ) |
623 void CESMRMeetingTimeValidator::SetEndDateFieldL( |
820 void CESMRMeetingTimeValidator::SetEndDateFieldL( |
624 CEikDateEditor& aEndTime ) |
821 CEikDateEditor& aEndTime ) |
625 { |
822 { |
626 FUNC_LOG; |
823 FUNC_LOG; |
627 iEndDate = &aEndTime; |
824 iEndDate = &aEndTime; |
|
825 |
|
826 if ( Time::NullTTime() != iCurrentEndTime ) |
|
827 { |
|
828 SetDateToEditor( *iEndDate, iCurrentEndTime ); |
|
829 } |
628 } |
830 } |
629 |
831 |
630 // --------------------------------------------------------------------------- |
832 // --------------------------------------------------------------------------- |
631 // CESMRMeetingTimeValidator::SetAlarmTimeFieldL |
833 // CESMRMeetingTimeValidator::SetAlarmTimeFieldL |
632 // --------------------------------------------------------------------------- |
834 // --------------------------------------------------------------------------- |
633 // |
835 // |
634 void CESMRMeetingTimeValidator::SetAlarmTimeFieldL( |
836 void CESMRMeetingTimeValidator::SetAlarmTimeFieldL( |
635 CEikTimeEditor& aAlarmTime ) |
837 CEikTimeEditor& aAlarmTime ) |
636 { |
838 { |
637 FUNC_LOG; |
839 FUNC_LOG; |
|
840 |
638 iAlarmTime = &aAlarmTime; |
841 iAlarmTime = &aAlarmTime; |
|
842 |
|
843 if ( iAlarmOnOff ) |
|
844 { |
|
845 SetTimeToEditor( *iAlarmTime, iCurrentAlarmTime ); |
|
846 } |
639 } |
847 } |
640 |
848 |
641 // --------------------------------------------------------------------------- |
849 // --------------------------------------------------------------------------- |
642 // CESMRMeetingTimeValidator::SetAlarmDateFieldL |
850 // CESMRMeetingTimeValidator::SetAlarmDateFieldL |
643 // --------------------------------------------------------------------------- |
851 // --------------------------------------------------------------------------- |
645 void CESMRMeetingTimeValidator::SetAlarmDateFieldL( |
853 void CESMRMeetingTimeValidator::SetAlarmDateFieldL( |
646 CEikDateEditor& aAlarmDate ) |
854 CEikDateEditor& aAlarmDate ) |
647 { |
855 { |
648 FUNC_LOG; |
856 FUNC_LOG; |
649 iAlarmDate = &aAlarmDate; |
857 iAlarmDate = &aAlarmDate; |
650 } |
858 |
651 |
859 if ( iAlarmOnOff ) |
652 // --------------------------------------------------------------------------- |
860 { |
653 // CESMRMeetingTimeValidator::StartTimeChangedL |
861 SetDateToEditor( *iAlarmDate, iCurrentAlarmTime ); |
|
862 } |
|
863 } |
|
864 |
|
865 // --------------------------------------------------------------------------- |
|
866 // CESMRMeetingTimeValidator::SetRecurrenceUntilDateFieldL |
654 // --------------------------------------------------------------------------- |
867 // --------------------------------------------------------------------------- |
655 // |
868 // |
656 void CESMRMeetingTimeValidator::SetRecurrenceUntilDateFieldL( |
869 void CESMRMeetingTimeValidator::SetRecurrenceUntilDateFieldL( |
657 CEikDateEditor& aRecurrenceUntil ) |
870 CEikDateEditor& aRecurrenceUntil ) |
658 { |
871 { |
659 FUNC_LOG; |
872 FUNC_LOG; |
660 iRecurrenceUntilDate = &aRecurrenceUntil; |
873 iRecurrenceUntilDate = &aRecurrenceUntil; |
|
874 |
|
875 if ( Time::NullTTime() != iCurrentRecurrenceUntil ) |
|
876 { |
|
877 SetDateToEditor( *iRecurrenceUntilDate, iCurrentRecurrenceUntil ); |
|
878 } |
|
879 |
|
880 } |
|
881 |
|
882 // --------------------------------------------------------------------------- |
|
883 // CESMRMeetingTimeValidator::SetAbsoluteAlarmOnOffFieldL |
|
884 // --------------------------------------------------------------------------- |
|
885 // |
|
886 void CESMRMeetingTimeValidator::SetAbsoluteAlarmOnOffFieldL( |
|
887 MMRAbsoluteAlarmController& aAbsoluteAlarmController ) |
|
888 { |
|
889 FUNC_LOG; |
|
890 iAbsoluteAlarmController = &aAbsoluteAlarmController; |
661 } |
891 } |
662 |
892 |
663 // --------------------------------------------------------------------------- |
893 // --------------------------------------------------------------------------- |
664 // CESMRMeetingTimeValidator::StartTimeChangedL |
894 // CESMRMeetingTimeValidator::StartTimeChangedL |
665 // --------------------------------------------------------------------------- |
895 // --------------------------------------------------------------------------- |
1001 User::LeaveIfError( |
1238 User::LeaveIfError( |
1002 startTime.MinutesFrom( |
1239 startTime.MinutesFrom( |
1003 iCurrentStartTime, |
1240 iCurrentStartTime, |
1004 startTimeChange ) ); |
1241 startTimeChange ) ); |
1005 |
1242 |
1006 endTime += startTimeChange; |
1243 if ( startTimeChange.Int() ) |
|
1244 { |
|
1245 endTime += startTimeChange; |
|
1246 |
|
1247 if ( MESMRCalEntry::EESMRCalEntryMeetingRequest == iEntry->Type() ) |
|
1248 { |
|
1249 MESMRMeetingRequestEntry* mrEntry = |
|
1250 static_cast<MESMRMeetingRequestEntry*>( iEntry ); |
|
1251 if ( mrEntry->IsRecurrentEventL() && |
|
1252 MESMRCalEntry::EESMRThisOnly == mrEntry->RecurrenceModRule() ) |
|
1253 { |
|
1254 TBool instanceAlreadyOnThisDay( |
|
1255 mrEntry->AnyInstancesBetweenTimePeriodL(startTime, endTime) ); |
|
1256 |
|
1257 if ( instanceAlreadyOnThisDay ) |
|
1258 { |
|
1259 // Restore previous time |
|
1260 SetTimeToEditor( *iStartTime, iCurrentStartTime ); |
|
1261 SetDateToEditor( *iStartDate, iCurrentStartTime ); |
|
1262 |
|
1263 err = KErrOverflow; |
|
1264 } |
|
1265 else |
|
1266 { |
|
1267 TTime firstInstanceStart; |
|
1268 TTime firstInstanceEnd; |
|
1269 mrEntry->GetFirstInstanceStartAndEndTimeL( |
|
1270 firstInstanceStart, |
|
1271 firstInstanceEnd ); |
|
1272 |
|
1273 if ( startTime < firstInstanceStart ) |
|
1274 { |
|
1275 SetTimeToEditor( *iStartTime, iCurrentStartTime ); |
|
1276 SetDateToEditor( *iStartDate, iCurrentStartTime ); |
|
1277 |
|
1278 err = KErrUnderflow; |
|
1279 } |
|
1280 } |
|
1281 } |
|
1282 } |
|
1283 |
|
1284 if ( MESMRCalEntry::EESMRCalEntryMeeting == iEntry->Type() ) |
|
1285 { |
|
1286 if ( iEntry->IsRecurrentEventL() && |
|
1287 MESMRCalEntry::EESMRThisOnly == iEntry->RecurrenceModRule() ) |
|
1288 { |
|
1289 TBool instanceAlreadyOnThisDay( |
|
1290 iEntry->AnyInstancesBetweenTimePeriodL( |
|
1291 startTime, |
|
1292 endTime ) ); |
|
1293 |
|
1294 if ( instanceAlreadyOnThisDay ) |
|
1295 { |
|
1296 // Restore previous time |
|
1297 SetTimeToEditor( *iStartTime, iCurrentStartTime ); |
|
1298 SetDateToEditor( *iStartDate, iCurrentStartTime ); |
|
1299 |
|
1300 err = KErrOverflow; |
|
1301 } |
|
1302 else |
|
1303 { |
|
1304 TTime firstInstanceStart; |
|
1305 TTime firstInstanceEnd; |
|
1306 iEntry->GetFirstInstanceStartAndEndTimeL( |
|
1307 firstInstanceStart, |
|
1308 firstInstanceEnd ); |
|
1309 |
|
1310 if ( startTime < firstInstanceStart ) |
|
1311 { |
|
1312 SetTimeToEditor( *iStartTime, iCurrentStartTime ); |
|
1313 SetDateToEditor( *iStartDate, iCurrentStartTime ); |
|
1314 |
|
1315 err = KErrUnderflow; |
|
1316 } |
|
1317 } |
|
1318 } |
|
1319 } |
|
1320 |
|
1321 if ( KErrNone == err ) |
|
1322 { |
|
1323 SetTimeToEditor( *iEndTime, endTime ); |
|
1324 SetDateToEditor( *iEndDate, endTime ); |
|
1325 |
|
1326 iCurrentStartTime = startTime; |
|
1327 iCurrentEndTime = endTime; |
|
1328 |
|
1329 if ( iAlldayEvent && iAlarmOnOff && |
|
1330 iAlarmTime->IsVisible() && iAlarmDate->IsVisible() ) |
|
1331 { |
|
1332 TTime alarmTime = AlarmDateTime(); |
|
1333 alarmTime += startTimeChange; |
|
1334 |
|
1335 SetTimeToEditor( *iAlarmTime, alarmTime ); |
|
1336 SetDateToEditor( *iAlarmDate, alarmTime ); |
|
1337 |
|
1338 iCurrentAlarmTime = alarmTime; |
|
1339 } |
|
1340 |
|
1341 if ( ERecurrenceNot != iRecurrenceValue && |
|
1342 iRecurrenceUntilDate && iRecurrenceUntilDate->IsVisible() ) |
|
1343 { |
|
1344 TTime recUntil = RecurrenceUntilTime(); |
|
1345 |
|
1346 if ( startTime.DateTime().Day() != iComparativeStartTime.Day() || |
|
1347 startTime.DateTime().Month() != iComparativeStartTime.Month() || |
|
1348 startTime.DateTime().Year() != iComparativeStartTime.Year() ) |
|
1349 { |
|
1350 // We want to update the recurrence until only when |
|
1351 // a) Day, b) Month, c) or Year of the start time has changed |
|
1352 recUntil += startTimeChange; |
|
1353 iComparativeStartTime = startTime.DateTime(); |
|
1354 } |
|
1355 |
|
1356 SetDateToEditor( *iRecurrenceUntilDate, recUntil ); |
|
1357 iCurrentRecurrenceUntil = recUntil; |
|
1358 } |
|
1359 } |
|
1360 } |
1007 |
1361 |
1008 if ( MESMRCalEntry::EESMRCalEntryMeetingRequest == iEntry->Type() ) |
1362 DrawEditorsDeferred(); |
1009 { |
1363 User::LeaveIfError( err ); |
1010 MESMRMeetingRequestEntry* mrEntry = |
|
1011 static_cast<MESMRMeetingRequestEntry*>( iEntry ); |
|
1012 if ( mrEntry->IsRecurrentEventL() && |
|
1013 MESMRCalEntry::EESMRThisOnly == mrEntry->RecurrenceModRule() ) |
|
1014 { |
|
1015 TBool instanceAlreadyOnThisDay( |
|
1016 mrEntry->AnyInstanceOnDayL(startTime, endTime) ); |
|
1017 |
|
1018 if ( instanceAlreadyOnThisDay ) |
|
1019 { |
|
1020 // Restore previous time |
|
1021 SetTimeToEditor( *iStartTime, iCurrentStartTime ); |
|
1022 SetDateToEditor( *iStartDate, iCurrentStartTime ); |
|
1023 |
|
1024 User::Leave( KErrOverflow ); |
|
1025 } |
|
1026 } |
|
1027 } |
|
1028 |
|
1029 SetTimeToEditor( *iEndTime, endTime ); |
|
1030 SetDateToEditor( *iEndDate, endTime ); |
|
1031 |
|
1032 iCurrentStartTime = startTime; |
|
1033 iCurrentEndTime = endTime; |
|
1034 |
|
1035 if ( iAlldayEvent && iAlarmOnOff && |
|
1036 iAlarmTime->IsVisible() && iAlarmDate->IsVisible() ) |
|
1037 { |
|
1038 TTime alarmTime = AlarmDateTime(); |
|
1039 alarmTime += startTimeChange; |
|
1040 |
|
1041 SetTimeToEditor( *iAlarmTime, alarmTime ); |
|
1042 SetDateToEditor( *iAlarmDate, alarmTime ); |
|
1043 |
|
1044 iCurrentAlarmTime = alarmTime; |
|
1045 } |
|
1046 |
|
1047 if ( ERecurrenceNot != iRecurrenceValue && |
|
1048 iRecurrenceUntilDate && iRecurrenceUntilDate->IsVisible() ) |
|
1049 { |
|
1050 TTime recUntil = RecurrenceUntilTime(); |
|
1051 |
|
1052 if ( startTime.DateTime().Day() != iComparativeStartTime.Day() || |
|
1053 startTime.DateTime().Month() != iComparativeStartTime.Month() || |
|
1054 startTime.DateTime().Year() != iComparativeStartTime.Year() ) |
|
1055 { |
|
1056 // We want to update the recurrence until only when |
|
1057 // a) Day, b) Month, c) or Year of the start time has changed |
|
1058 recUntil += startTimeChange; |
|
1059 iComparativeStartTime = startTime.DateTime(); |
|
1060 } |
|
1061 |
|
1062 SetDateToEditor( *iRecurrenceUntilDate, recUntil ); |
|
1063 iCurrentRecurrenceUntil = recUntil; |
|
1064 } |
|
1065 } |
1364 } |
1066 |
1365 |
1067 // --------------------------------------------------------------------------- |
1366 // --------------------------------------------------------------------------- |
1068 // CESMRMeetingTimeValidator::HandleEndTimeChangeL |
1367 // CESMRMeetingTimeValidator::HandleEndTimeChangeL |
1069 // --------------------------------------------------------------------------- |
1368 // --------------------------------------------------------------------------- |
1071 void CESMRMeetingTimeValidator::HandleEndTimeChangeL() |
1370 void CESMRMeetingTimeValidator::HandleEndTimeChangeL() |
1072 { |
1371 { |
1073 FUNC_LOG; |
1372 FUNC_LOG; |
1074 TInt err( KErrNone ); |
1373 TInt err( KErrNone ); |
1075 TTime startTime = StartDateTime(); |
1374 TTime startTime = StartDateTime(); |
1076 TTime endTime = EndDateTime(); |
1375 TTime endTime = EndDateTime(); |
1077 |
1376 |
1078 if ( !iAlldayEvent && endTime < startTime ) |
1377 // Check first if end time has even changed |
1079 { |
1378 TTimeIntervalMinutes endTimeChange; |
1080 if( ERecurrenceNot != iRecurrenceValue ) |
1379 User::LeaveIfError( |
1081 { |
1380 endTime.MinutesFrom( |
1082 err = KErrArgument; |
1381 iCurrentEndTime, |
1083 } |
1382 endTimeChange ) ); |
1084 else |
1383 |
1085 { |
1384 if ( endTimeChange.Int() ) |
1086 // End time is earlier than start time |
1385 { |
1087 // and this is not allday event. |
1386 if ( !iAlldayEvent && endTime < startTime ) |
1088 endTime += TTimeIntervalDays( KOne ); |
1387 { |
1089 } |
1388 if( ERecurrenceNot != iRecurrenceValue ) |
1090 } |
1389 { |
1091 |
1390 err = KErrArgument; |
1092 if ( MESMRCalEntry::EESMRCalEntryMeetingRequest == iEntry->Type() ) |
1391 } |
1093 { |
1392 else |
1094 // Check that is modified entry |
1393 { |
1095 MESMRMeetingRequestEntry* mrEntry = |
1394 // End time is earlier than start time |
1096 static_cast<MESMRMeetingRequestEntry*>( iEntry ); |
1395 // and this is not allday event. |
1097 if ( mrEntry->IsRecurrentEventL() && |
1396 endTime += TTimeIntervalDays( KOne ); |
1098 MESMRCalEntry::EESMRThisOnly == mrEntry->RecurrenceModRule() ) |
1397 } |
1099 { |
1398 } |
1100 TBool instanceAlreadyOnThisDay( |
1399 |
1101 mrEntry->AnyInstanceOnDayL(startTime, endTime) ); |
1400 if ( MESMRCalEntry::EESMRCalEntryMeetingRequest == iEntry->Type() ) |
1102 |
1401 { |
1103 if ( instanceAlreadyOnThisDay ) |
1402 // Check that is modified entry |
1104 { |
1403 MESMRMeetingRequestEntry* mrEntry = |
1105 // Restore previous time |
1404 static_cast<MESMRMeetingRequestEntry*>( iEntry ); |
1106 SetTimeToEditor( *iStartTime, iCurrentStartTime ); |
1405 if ( mrEntry->IsRecurrentEventL() && |
1107 SetDateToEditor( *iStartDate, iCurrentStartTime ); |
1406 MESMRCalEntry::EESMRThisOnly == mrEntry->RecurrenceModRule() ) |
|
1407 { |
|
1408 TBool instanceAlreadyOnThisDay( |
|
1409 mrEntry->AnyInstancesBetweenTimePeriodL(startTime, endTime) ); |
1108 |
1410 |
1109 err = KErrOverflow; |
1411 if ( instanceAlreadyOnThisDay ) |
1110 } |
1412 { |
1111 } |
1413 // Restore previous time |
1112 } |
1414 SetTimeToEditor( *iStartTime, iCurrentStartTime ); |
|
1415 SetDateToEditor( *iStartDate, iCurrentStartTime ); |
|
1416 |
|
1417 err = KErrOverflow; |
|
1418 } |
|
1419 else |
|
1420 { |
|
1421 TTime firstInstanceStart; |
|
1422 TTime firstInstanceEnd; |
|
1423 mrEntry->GetFirstInstanceStartAndEndTimeL( |
|
1424 firstInstanceStart, |
|
1425 firstInstanceEnd ); |
|
1426 |
|
1427 if ( startTime < firstInstanceStart ) |
|
1428 { |
|
1429 // Restore previous time |
|
1430 SetTimeToEditor( *iStartTime, iCurrentStartTime ); |
|
1431 SetTimeToEditor( *iEndTime, iCurrentEndTime ); |
|
1432 |
|
1433 err = KErrUnderflow; |
|
1434 } |
|
1435 } |
|
1436 } |
|
1437 } |
|
1438 |
|
1439 if ( MESMRCalEntry::EESMRCalEntryMeeting == iEntry->Type() ) |
|
1440 { |
|
1441 // Check that is modified entry |
|
1442 if ( iEntry->IsRecurrentEventL() && |
|
1443 MESMRCalEntry::EESMRThisOnly == iEntry->RecurrenceModRule() ) |
|
1444 { |
|
1445 TBool instanceAlreadyOnThisDay( |
|
1446 iEntry->AnyInstancesBetweenTimePeriodL( |
|
1447 startTime, |
|
1448 endTime ) ); |
|
1449 |
|
1450 if ( instanceAlreadyOnThisDay ) |
|
1451 { |
|
1452 // Restore previous time |
|
1453 SetTimeToEditor( *iStartTime, iCurrentStartTime ); |
|
1454 SetDateToEditor( *iStartDate, iCurrentStartTime ); |
|
1455 |
|
1456 err = KErrOverflow; |
|
1457 } |
|
1458 else |
|
1459 { |
|
1460 TTime firstInstanceStart; |
|
1461 TTime firstInstanceEnd; |
|
1462 iEntry->GetFirstInstanceStartAndEndTimeL( |
|
1463 firstInstanceStart, |
|
1464 firstInstanceEnd ); |
|
1465 |
|
1466 if ( startTime < firstInstanceStart ) |
|
1467 { |
|
1468 // Restore previous time |
|
1469 SetTimeToEditor( *iStartTime, iCurrentStartTime ); |
|
1470 SetTimeToEditor( *iEndTime, iCurrentEndTime ); |
|
1471 |
|
1472 err = KErrUnderflow; |
|
1473 } |
|
1474 } |
|
1475 } |
|
1476 } |
|
1477 |
|
1478 if ( KErrNone == err ) |
|
1479 { |
|
1480 iCurrentStartTime = startTime; |
|
1481 iCurrentEndTime = endTime; |
|
1482 } |
1113 |
1483 |
1114 if ( KErrNone == err ) |
1484 if ( !iAlldayEvent ) |
1115 { |
1485 { |
1116 iCurrentStartTime = startTime; |
1486 SetTimeToEditor( *iStartTime, iCurrentStartTime ); |
1117 iCurrentEndTime = endTime; |
1487 SetTimeToEditor( *iEndTime, iCurrentEndTime ); |
1118 } |
1488 } |
1119 |
1489 |
1120 if ( !iAlldayEvent ) |
1490 SetDateToEditor( *iStartDate, iCurrentStartTime ); |
1121 { |
1491 SetDateToEditor( *iEndDate, iCurrentEndTime ); |
1122 SetTimeToEditor( *iStartTime, iCurrentStartTime ); |
1492 |
1123 SetTimeToEditor( *iEndTime, iCurrentEndTime ); |
1493 DrawEditorsDeferred(); |
1124 } |
1494 User::LeaveIfError( err ); |
1125 |
1495 } |
1126 SetDateToEditor( *iStartDate, iCurrentStartTime ); |
|
1127 SetDateToEditor( *iEndDate, iCurrentEndTime ); |
|
1128 |
|
1129 User::LeaveIfError( err ); |
|
1130 } |
1496 } |
1131 |
1497 |
1132 // --------------------------------------------------------------------------- |
1498 // --------------------------------------------------------------------------- |
1133 // CESMRMeetingTimeValidator::HandleAlarmTimeChangedL |
1499 // CESMRMeetingTimeValidator::HandleAlarmTimeChangedL |
1134 // --------------------------------------------------------------------------- |
1500 // --------------------------------------------------------------------------- |
1577 // End |
1947 // End |
1578 SetTimeToEditor( *iEndTime, endTime ); |
1948 SetTimeToEditor( *iEndTime, endTime ); |
1579 SetDateToEditor( *iEndDate, endTime ); |
1949 SetDateToEditor( *iEndDate, endTime ); |
1580 |
1950 |
1581 // Alarm |
1951 // Alarm |
1582 if(iAlarmTime) |
1952 if( iAlarmOnOff && iAlarmTime ) |
1583 { |
1953 { |
1584 SetTimeToEditor( *iAlarmTime, iCurrentAlarmTime ); |
1954 SetTimeToEditor( *iAlarmTime, iCurrentAlarmTime ); |
1585 } |
1955 } |
1586 |
1956 |
1587 if(iAlarmDate) |
1957 if( iAlarmOnOff && iAlarmDate ) |
1588 { |
1958 { |
1589 SetDateToEditor( *iAlarmDate, iCurrentAlarmTime ); |
1959 SetDateToEditor( *iAlarmDate, iCurrentAlarmTime ); |
1590 } |
1960 } |
1591 |
|
1592 |
1961 |
1593 // if editing certain occurance of recurrent event series |
1962 // if editing certain occurance of recurrent event series |
1594 // the repeat until date is not available. |
1963 // the repeat until date is not available. |
1595 if ( iRecurrenceUntilDate ) |
1964 if ( iRecurrenceUntilDate ) |
1596 { |
1965 { |
1597 // Recurrence until |
1966 // Recurrence until |
1598 SetDateToEditor( *iRecurrenceUntilDate, iCurrentRecurrenceUntil ); |
1967 SetDateToEditor( *iRecurrenceUntilDate, iCurrentRecurrenceUntil ); |
1599 } |
1968 } |
1600 |
1969 } |
1601 } |
|
1602 |
|
1603 |
1970 |
1604 // --------------------------------------------------------------------------- |
1971 // --------------------------------------------------------------------------- |
1605 // CESMRMeetingTimeValidator::ForceEndDateTime |
1972 // CESMRMeetingTimeValidator::ForceEndDateTime |
1606 // --------------------------------------------------------------------------- |
1973 // --------------------------------------------------------------------------- |
1607 // |
1974 // |