diff -r 4f2584af5a29 -r 04aa446da81c fmradio/fmradio/src/fmradioalfvisualizer.cpp --- a/fmradio/fmradio/src/fmradioalfvisualizer.cpp Wed Jun 09 09:42:10 2010 +0300 +++ b/fmradio/fmradio/src/fmradioalfvisualizer.cpp Mon Jun 21 15:40:50 2010 +0300 @@ -539,16 +539,15 @@ TGestureCode eventCode( aEvent.Code( MGestureEvent::EAxisBoth ) ); FTRACE( FPrint( _L("CFMRadioAlfVisualizer::HandleGestureL(eventCode=%d)"), eventCode ) ); - CFMRadioAppUi* appUi = static_cast( CCoeEnv::Static()->AppUi() ); // handle gestures only if there is no call or tuning ongoing - if ( !appUi->RadioEngine()->IsInCall() && - appUi->RadioState() != CFMRadioAppUi::EFMRadioStateBusySeek ) + if ( !iAppUi->RadioEngine()->IsInCall() && + iAppUi->RadioState() != CFMRadioAppUi::EFMRadioStateBusySeek ) { switch ( eventCode ) { case EGestureTap: { - CAknVolumePopup* volPopup = appUi->ActiveVolumePopup(); + CAknVolumePopup* volPopup = iAppUi->ActiveVolumePopup(); if ( volPopup ) { if ( volPopup->IsVisible() ) @@ -567,11 +566,11 @@ { if ( iDragAxis == EFMRadioDragAxisX ) { - if ( appUi->NumberOfChannelsStored() ) + if ( iAppUi->NumberOfChannelsStored() ) { iRevertGestureDrag = EFalse; } - appUi->HandleCommandL( EFMRadioCmdNextChannel ); + iAppUi->HandleCommandL( EFMRadioCmdNextChannel ); } break; } @@ -579,11 +578,11 @@ { if ( iDragAxis == EFMRadioDragAxisX ) { - if ( appUi->NumberOfChannelsStored() ) + if ( iAppUi->NumberOfChannelsStored() ) { iRevertGestureDrag = EFalse; } - appUi->HandleCommandL( EFMRadioCmdPrevChannel ); + iAppUi->HandleCommandL( EFMRadioCmdPrevChannel ); } break; } @@ -592,7 +591,7 @@ if ( iDragAxis == EFMRadioDragAxisY ) { iRevertGestureDrag = EFalse; - appUi->HandleCommandL( EFMRadioCmdSeekUp ); + iAppUi->HandleCommandL( EFMRadioCmdSeekUp ); } break; } @@ -601,7 +600,7 @@ if ( iDragAxis == EFMRadioDragAxisY ) { iRevertGestureDrag = EFalse; - appUi->HandleCommandL( EFMRadioCmdSeekDown ); + iAppUi->HandleCommandL( EFMRadioCmdSeekDown ); } break; } @@ -699,56 +698,60 @@ { TBool keyHandled = EFalse; - if ( aEvent.IsKeyEvent() && AknLayoutUtils::PenEnabled() ) + if ( !iAppUi->RadioEngine()->IsInCall() ) { - const TKeyEvent& kEvent = aEvent.KeyEvent(); - - if ( kEvent.iCode == EKeyEnter || kEvent.iCode == EKeyOK ) + if ( aEvent.IsKeyEvent() && AknLayoutUtils::PenEnabled() ) { - iAppUi->ActivateLocalViewL( KFMRadioChannelListViewId ); - keyHandled = ETrue; - } - - switch ( kEvent.iScanCode ) - { - case EStdKeyRightArrow: // check arrow keys - case EStdKeyLeftArrow: - case EStdKeyUpArrow: - case EStdKeyDownArrow: + const TKeyEvent& kEvent = aEvent.KeyEvent(); + + if ( kEvent.iCode == EKeyEnter || kEvent.iCode == EKeyOK ) { - iKeyScanCode = kEvent.iScanCode; - - if ( aEvent.Code() == EEventKeyUp ) + TriggerCommandL( EFMRadioCmdChannelList ); + keyHandled = ETrue; + } + + switch ( kEvent.iScanCode ) + { + case EStdKeyRightArrow: // check arrow keys + case EStdKeyLeftArrow: + case EStdKeyUpArrow: + case EStdKeyDownArrow: { - iLongPressTimer->Cancel(); - if ( !iLongKeyTriggered ) + iKeyScanCode = kEvent.iScanCode; + + if ( aEvent.Code() == EEventKeyUp ) + { + iLongPressTimer->Cancel(); + if ( !iLongKeyTriggered ) + { + TriggerCommandL(); + } + } + else if ( aEvent.Code() == EEventKeyDown ) { - TriggerCommandL(); + iLongKeyTriggered = EFalse; + // Start the long key press timer + iLongPressTimer->Cancel(); + iLongPressTimer->Start( KFMRadioRockerLongPressDelay, + 0, + TCallBack( CFMRadioAlfVisualizer::StaticLongPressCallBack, this ) ); + } + keyHandled = ETrue; + break; } - else if ( aEvent.Code() == EEventKeyDown ) + default: { - iLongKeyTriggered = EFalse; - // Start the long key press timer - iLongPressTimer->Cancel(); - iLongPressTimer->Start( KFMRadioRockerLongPressDelay, - 0, - TCallBack( CFMRadioAlfVisualizer::StaticLongPressCallBack, this ) ); - + break; } - keyHandled = ETrue; - break; - } - default: - { - break; } } + if ( aEvent.IsPointerEvent() ) + { + return CGestureControl::OfferEventL( aEvent ); + } } - if ( aEvent.IsPointerEvent() ) - { - return CGestureControl::OfferEventL( aEvent ); - } + return keyHandled; } @@ -1085,7 +1088,7 @@ // Triggers the command to view handling // --------------------------------------------------------------------------- // -void CFMRadioAlfVisualizer::TriggerCommandL() +void CFMRadioAlfVisualizer::TriggerCommandL( TInt aCommand ) { TVwsViewId viewId( KNullUid, KNullUid ); TInt err = iAppUi->GetActiveViewId( viewId ); @@ -1138,6 +1141,10 @@ break; } } + if ( aCommand == EFMRadioCmdChannelList ) + { + commandId = EFMRadioCmdChannelList; + } // send command to view view->ProcessCommandL( commandId ); }