# HG changeset patch # User Toni Lehtonen # Date 1288698340 -7200 # Node ID 250f0dfb7d22c42bb69f5190892bb79512fc4f95 # Parent 9dfcaf1038dd607c1942dd8df307851784605da6 Bug 2257 - The alarm setting cannot be set to "On" in the Calendar application. diff -r 9dfcaf1038dd -r 250f0dfb7d22 calendarui/editors/inc/calenunifiededitor.h --- a/calendarui/editors/inc/calenunifiededitor.h Thu Oct 28 13:23:18 2010 +0100 +++ b/calendarui/editors/inc/calenunifiededitor.h Tue Nov 02 13:45:40 2010 +0200 @@ -665,6 +665,12 @@ static TInt AsyncProcessCommandL(TAny* aThisPtr); + /** + * @brief Tries to toggle on/off field + * @param aControlId The id of the field to toggle + * @return Indicates whether or not the field has been handled + */ + TBool TryToggleOnOffL( TInt aControlId ); private: /** diff -r 9dfcaf1038dd -r 250f0dfb7d22 calendarui/editors/src/calenunifiededitor.cpp --- a/calendarui/editors/src/calenunifiededitor.cpp Thu Oct 28 13:23:18 2010 +0100 +++ b/calendarui/editors/src/calenunifiededitor.cpp Tue Nov 02 13:45:40 2010 +0200 @@ -520,36 +520,10 @@ ctrl->ActivateSelectionListL(); } } - else if( newCtrlId == ECalenEditorReminder ) - { - if( iUnifiedEditorControl->IsAlarmActiveInForm() ) - { - SetAlarmFieldOnOffL( EFalse ); - active = EFalse; - } - else - { - SetAlarmFieldOnOffL( ETrue ); - active = ETrue; - } - iUnifiedEditorControl->CheckAlarmActive( active ); - TryChangeFocusToL( ECalenEditorReminder ); - } - else if( newCtrlId == ECalenEditorAllDayItem ) - { - if( iUnifiedEditorControl->IsAllDayEvent() ) - { - SetAllDayFieldL( EFalse ); - active = EFalse; - } - else - { - SetAllDayFieldL( ETrue ); - active = ETrue; - } - iUnifiedEditorControl->SetAllDayEvent( active ); - - } + else + { + TryToggleOnOffL( newCtrlId ); + } break; } case EAknSoftkeyOptions: @@ -698,17 +672,25 @@ case EKeyOK: // TODO: Uncomment this when enabling attachment support - if(ctrlid == ECalenEditorAttachment) + if(TryToggleOnOffL(ctrlid)) + { + keyResponse = EKeyWasConsumed; + } + else { - if(Edited().AttachmentCount() || iServices->GetAttachmentData()->NumberOfItems()) - { - iServices->IssueCommandL( ECalenViewAttachmentList ); - } - else - { - iServices->IssueCommandL( ECalenAddAttachment ); - } - } + if(ctrlid == ECalenEditorAttachment) + { + if(Edited().AttachmentCount() || iServices->GetAttachmentData()->NumberOfItems()) + { + iServices->IssueCommandL( ECalenViewAttachmentList ); + } + else + { + iServices->IssueCommandL( ECalenAddAttachment ); + } + } + keyResponse = CAknForm::OfferKeyEventL(aKeyEvent,aType); + } break; case EKeyEscape: // Calendar relaunched from cmd line - close viewer @@ -750,7 +732,7 @@ case EKeyLeftArrow: case EKeyRightArrow: { - if( ECalenEditorEventType == IdOfFocusControl() ) + if( ECalenEditorEventType == IdOfFocusControl() || TryToggleOnOffL( ctrlid ) ) { keyResponse = EKeyWasConsumed; } @@ -1165,29 +1147,24 @@ if ( aEventID == MEikDialogPageObserver::EDialogPageTapped ) { TInt focusControl( IdOfFocusControl() ); - if ( focusControl == ECalenEditorAttachment - || focusControl == ECalenEditorDescription ) - { - - - switch ( focusControl ) - { - case ECalenEditorAttachment: - { - - if(Edited().AttachmentCount() || iServices->GetAttachmentData()->NumberOfItems()) - { - ProcessCommandL( ECalenCmdViewAttachmentList ); - } - else - { - ProcessCommandL( ECalenCmdAddAttachment ); - } - break; - } - - case ECalenEditorDescription: - { + switch ( focusControl ) + { + case ECalenEditorAttachment: + { + + if(Edited().AttachmentCount() || iServices->GetAttachmentData()->NumberOfItems()) + { + ProcessCommandL( ECalenCmdViewAttachmentList ); + } + else + { + ProcessCommandL( ECalenCmdAddAttachment ); + } + break; + } + + case ECalenEditorDescription: + { // CEikEdwin* edwin = static_cast( Control( focusControl ) ); // if ( edwin && edwin->Text()->DocumentLength() == 0 ) // { @@ -1197,40 +1174,17 @@ // { // ProcessCommandL( ECalenCmdShowDescription ); // } - iAsyncCallback->CallBack(); - break; - } - - default: - { - break; - } - } - - } - else if ( focusControl == ECalenEditorAllDayItem ) - { - // Tap on AllDay field, Switch the status of AllDay field - iUnifiedEditorControl->SetAllDayEvent( - !( iUnifiedEditorControl->IsAllDayEvent() ) ); - } - else if ( focusControl == ECalenEditorReminder ) - { - TBool active; - if( iUnifiedEditorControl->IsAlarmActiveInForm() ) - { - SetAlarmFieldOnOffL( EFalse ); - active = EFalse; - } - else - { - SetAlarmFieldOnOffL( ETrue ); - active = ETrue; - } - iUnifiedEditorControl->CheckAlarmActive( active ); - TryChangeFocusToL( ECalenEditorReminder ); - } - } + iAsyncCallback->CallBack(); + break; + } + + default: + { + TryToggleOnOffL( focusControl ); + break; + } + } + } } @@ -1252,6 +1206,27 @@ return 0; } +TBool CCalenUnifiedEditor::TryToggleOnOffL( TInt aControlId ) + { + TBool res = ETrue; + switch( aControlId ) + { + case ECalenEditorAllDayItem: + iUnifiedEditorControl->SetAllDayEvent( + !( iUnifiedEditorControl->IsAllDayEvent() ) ); + break; + case ECalenEditorReminder: + TBool active = !( iUnifiedEditorControl->IsAlarmActiveInForm() ); + SetAlarmFieldOnOffL( active ); + iUnifiedEditorControl->CheckAlarmActive( active ); + TryChangeFocusToL( ECalenEditorReminder ); + break; + default: + res = EFalse; + break; + } + return res; + } // ----------------------------------------------------------------------------- // CCalenUnifiedEditor::HandleResourceChange