518 { |
518 { |
519 CAknPopupField* ctrl = static_cast<CAknPopupField*>( line->iControl ); |
519 CAknPopupField* ctrl = static_cast<CAknPopupField*>( line->iControl ); |
520 ctrl->ActivateSelectionListL(); |
520 ctrl->ActivateSelectionListL(); |
521 } |
521 } |
522 } |
522 } |
523 else if( newCtrlId == ECalenEditorReminder ) |
523 else |
524 { |
524 { |
525 if( iUnifiedEditorControl->IsAlarmActiveInForm() ) |
525 TryToggleOnOffL( newCtrlId ); |
526 { |
526 } |
527 SetAlarmFieldOnOffL( EFalse ); |
|
528 active = EFalse; |
|
529 } |
|
530 else |
|
531 { |
|
532 SetAlarmFieldOnOffL( ETrue ); |
|
533 active = ETrue; |
|
534 } |
|
535 iUnifiedEditorControl->CheckAlarmActive( active ); |
|
536 TryChangeFocusToL( ECalenEditorReminder ); |
|
537 } |
|
538 else if( newCtrlId == ECalenEditorAllDayItem ) |
|
539 { |
|
540 if( iUnifiedEditorControl->IsAllDayEvent() ) |
|
541 { |
|
542 SetAllDayFieldL( EFalse ); |
|
543 active = EFalse; |
|
544 } |
|
545 else |
|
546 { |
|
547 SetAllDayFieldL( ETrue ); |
|
548 active = ETrue; |
|
549 } |
|
550 iUnifiedEditorControl->SetAllDayEvent( active ); |
|
551 |
|
552 } |
|
553 break; |
527 break; |
554 } |
528 } |
555 case EAknSoftkeyOptions: |
529 case EAknSoftkeyOptions: |
556 { |
530 { |
557 DisplayMenuL(); |
531 DisplayMenuL(); |
696 switch ( aKeyEvent.iCode ) |
670 switch ( aKeyEvent.iCode ) |
697 { |
671 { |
698 case EKeyOK: |
672 case EKeyOK: |
699 // TODO: Uncomment this when enabling attachment support |
673 // TODO: Uncomment this when enabling attachment support |
700 |
674 |
701 if(ctrlid == ECalenEditorAttachment) |
675 if(TryToggleOnOffL(ctrlid)) |
702 { |
676 { |
703 if(Edited().AttachmentCount() || iServices->GetAttachmentData()->NumberOfItems()) |
677 keyResponse = EKeyWasConsumed; |
704 { |
|
705 iServices->IssueCommandL( ECalenViewAttachmentList ); |
|
706 } |
|
707 else |
|
708 { |
|
709 iServices->IssueCommandL( ECalenAddAttachment ); |
|
710 } |
|
711 } |
678 } |
|
679 else |
|
680 { |
|
681 if(ctrlid == ECalenEditorAttachment) |
|
682 { |
|
683 if(Edited().AttachmentCount() || iServices->GetAttachmentData()->NumberOfItems()) |
|
684 { |
|
685 iServices->IssueCommandL( ECalenViewAttachmentList ); |
|
686 } |
|
687 else |
|
688 { |
|
689 iServices->IssueCommandL( ECalenAddAttachment ); |
|
690 } |
|
691 } |
|
692 keyResponse = CAknForm::OfferKeyEventL(aKeyEvent,aType); |
|
693 } |
712 break; |
694 break; |
713 case EKeyEscape: |
695 case EKeyEscape: |
714 // Calendar relaunched from cmd line - close viewer |
696 // Calendar relaunched from cmd line - close viewer |
715 // NOTE: This was changed from EAknCmdExit to ECalenCmdCloseDialog since launching |
697 // NOTE: This was changed from EAknCmdExit to ECalenCmdCloseDialog since launching |
716 // the calanedar from cmd line or opening missed alarm view while calendar editor is |
698 // the calanedar from cmd line or opening missed alarm view while calendar editor is |
1163 { |
1145 { |
1164 CAknForm::HandleDialogPageEventL( aEventID ); |
1146 CAknForm::HandleDialogPageEventL( aEventID ); |
1165 if ( aEventID == MEikDialogPageObserver::EDialogPageTapped ) |
1147 if ( aEventID == MEikDialogPageObserver::EDialogPageTapped ) |
1166 { |
1148 { |
1167 TInt focusControl( IdOfFocusControl() ); |
1149 TInt focusControl( IdOfFocusControl() ); |
1168 if ( focusControl == ECalenEditorAttachment |
1150 switch ( focusControl ) |
1169 || focusControl == ECalenEditorDescription ) |
1151 { |
1170 { |
1152 case ECalenEditorAttachment: |
1171 |
1153 { |
1172 |
1154 |
1173 switch ( focusControl ) |
1155 if(Edited().AttachmentCount() || iServices->GetAttachmentData()->NumberOfItems()) |
1174 { |
1156 { |
1175 case ECalenEditorAttachment: |
1157 ProcessCommandL( ECalenCmdViewAttachmentList ); |
1176 { |
1158 } |
1177 |
1159 else |
1178 if(Edited().AttachmentCount() || iServices->GetAttachmentData()->NumberOfItems()) |
1160 { |
1179 { |
1161 ProcessCommandL( ECalenCmdAddAttachment ); |
1180 ProcessCommandL( ECalenCmdViewAttachmentList ); |
1162 } |
1181 } |
1163 break; |
1182 else |
1164 } |
1183 { |
1165 |
1184 ProcessCommandL( ECalenCmdAddAttachment ); |
1166 case ECalenEditorDescription: |
1185 } |
1167 { |
1186 break; |
|
1187 } |
|
1188 |
|
1189 case ECalenEditorDescription: |
|
1190 { |
|
1191 // CEikEdwin* edwin = static_cast<CEikEdwin*>( Control( focusControl ) ); |
1168 // CEikEdwin* edwin = static_cast<CEikEdwin*>( Control( focusControl ) ); |
1192 // if ( edwin && edwin->Text()->DocumentLength() == 0 ) |
1169 // if ( edwin && edwin->Text()->DocumentLength() == 0 ) |
1193 // { |
1170 // { |
1194 // ProcessCommandL( ECalenCmdAddDescription ); |
1171 // ProcessCommandL( ECalenCmdAddDescription ); |
1195 // } |
1172 // } |
1196 // else |
1173 // else |
1197 // { |
1174 // { |
1198 // ProcessCommandL( ECalenCmdShowDescription ); |
1175 // ProcessCommandL( ECalenCmdShowDescription ); |
1199 // } |
1176 // } |
1200 iAsyncCallback->CallBack(); |
1177 iAsyncCallback->CallBack(); |
1201 break; |
1178 break; |
1202 } |
1179 } |
1203 |
1180 |
1204 default: |
1181 default: |
1205 { |
1182 { |
1206 break; |
1183 TryToggleOnOffL( focusControl ); |
1207 } |
1184 break; |
1208 } |
1185 } |
1209 |
1186 } |
1210 } |
1187 } |
1211 else if ( focusControl == ECalenEditorAllDayItem ) |
1188 } |
1212 { |
1189 |
1213 // Tap on AllDay field, Switch the status of AllDay field |
1190 |
1214 iUnifiedEditorControl->SetAllDayEvent( |
1191 TInt CCalenUnifiedEditor::AsyncProcessCommandL( TAny* aThisPtr ) |
1215 !( iUnifiedEditorControl->IsAllDayEvent() ) ); |
1192 { |
1216 } |
1193 TInt focusControl( static_cast<CCalenUnifiedEditor*>(aThisPtr)->IdOfFocusControl() ); |
1217 else if ( focusControl == ECalenEditorReminder ) |
1194 if(focusControl == ECalenEditorDescription) |
1218 { |
1195 { |
1219 TBool active; |
1196 CEikEdwin* edwin = static_cast<CEikEdwin*>( static_cast<CCalenUnifiedEditor*>(aThisPtr)->Control( focusControl ) ); |
1220 if( iUnifiedEditorControl->IsAlarmActiveInForm() ) |
1197 if ( edwin && edwin->Text()->DocumentLength() == 0 ) |
1221 { |
1198 { |
1222 SetAlarmFieldOnOffL( EFalse ); |
1199 static_cast<CCalenUnifiedEditor*>(aThisPtr)->ProcessCommandL(ECalenCmdAddDescription); |
1223 active = EFalse; |
1200 } |
1224 } |
1201 else |
1225 else |
1202 { |
1226 { |
1203 static_cast<CCalenUnifiedEditor*>(aThisPtr)->ProcessCommandL(ECalenCmdShowDescription); |
1227 SetAlarmFieldOnOffL( ETrue ); |
1204 } |
1228 active = ETrue; |
1205 } |
1229 } |
1206 return 0; |
|
1207 } |
|
1208 |
|
1209 TBool CCalenUnifiedEditor::TryToggleOnOffL( TInt aControlId ) |
|
1210 { |
|
1211 TBool res = ETrue; |
|
1212 switch( aControlId ) |
|
1213 { |
|
1214 case ECalenEditorAllDayItem: |
|
1215 iUnifiedEditorControl->SetAllDayEvent( |
|
1216 !( iUnifiedEditorControl->IsAllDayEvent() ) ); |
|
1217 break; |
|
1218 case ECalenEditorReminder: |
|
1219 TBool active = !( iUnifiedEditorControl->IsAlarmActiveInForm() ); |
|
1220 SetAlarmFieldOnOffL( active ); |
1230 iUnifiedEditorControl->CheckAlarmActive( active ); |
1221 iUnifiedEditorControl->CheckAlarmActive( active ); |
1231 TryChangeFocusToL( ECalenEditorReminder ); |
1222 TryChangeFocusToL( ECalenEditorReminder ); |
1232 } |
1223 break; |
1233 } |
1224 default: |
1234 } |
1225 res = EFalse; |
1235 |
1226 break; |
1236 |
1227 } |
1237 TInt CCalenUnifiedEditor::AsyncProcessCommandL( TAny* aThisPtr ) |
1228 return res; |
1238 { |
1229 } |
1239 TInt focusControl( static_cast<CCalenUnifiedEditor*>(aThisPtr)->IdOfFocusControl() ); |
|
1240 if(focusControl == ECalenEditorDescription) |
|
1241 { |
|
1242 CEikEdwin* edwin = static_cast<CEikEdwin*>( static_cast<CCalenUnifiedEditor*>(aThisPtr)->Control( focusControl ) ); |
|
1243 if ( edwin && edwin->Text()->DocumentLength() == 0 ) |
|
1244 { |
|
1245 static_cast<CCalenUnifiedEditor*>(aThisPtr)->ProcessCommandL(ECalenCmdAddDescription); |
|
1246 } |
|
1247 else |
|
1248 { |
|
1249 static_cast<CCalenUnifiedEditor*>(aThisPtr)->ProcessCommandL(ECalenCmdShowDescription); |
|
1250 } |
|
1251 } |
|
1252 return 0; |
|
1253 } |
|
1254 |
|
1255 |
1230 |
1256 // ----------------------------------------------------------------------------- |
1231 // ----------------------------------------------------------------------------- |
1257 // CCalenUnifiedEditor::HandleResourceChange |
1232 // CCalenUnifiedEditor::HandleResourceChange |
1258 // Handdles the resource change |
1233 // Handdles the resource change |
1259 // ----------------------------------------------------------------------------- |
1234 // ----------------------------------------------------------------------------- |