694 // CFMRadioAlfVisualizer::OfferEventL |
694 // CFMRadioAlfVisualizer::OfferEventL |
695 // From CAlfControl, takes care of alfred event handling. |
695 // From CAlfControl, takes care of alfred event handling. |
696 // ---------------------------------------------------------------------------- |
696 // ---------------------------------------------------------------------------- |
697 // |
697 // |
698 TBool CFMRadioAlfVisualizer::OfferEventL( const TAlfEvent& aEvent ) |
698 TBool CFMRadioAlfVisualizer::OfferEventL( const TAlfEvent& aEvent ) |
699 { |
699 { |
|
700 TBool keyHandled = EFalse; |
|
701 |
700 if ( aEvent.IsKeyEvent() && AknLayoutUtils::PenEnabled() ) |
702 if ( aEvent.IsKeyEvent() && AknLayoutUtils::PenEnabled() ) |
701 { |
703 { |
702 const TKeyEvent& kEvent = aEvent.KeyEvent(); |
704 const TKeyEvent& kEvent = aEvent.KeyEvent(); |
703 if ( kEvent.iScanCode == EStdKeyRightArrow || |
705 |
704 kEvent.iScanCode == EStdKeyLeftArrow || |
706 if ( kEvent.iCode == EKeyEnter || kEvent.iCode == EKeyOK ) |
705 kEvent.iScanCode == EStdKeyUpArrow || |
707 { |
706 kEvent.iScanCode == EStdKeyDownArrow ) |
708 iAppUi->ActivateLocalViewL( KFMRadioChannelListViewId ); |
707 { |
709 keyHandled = ETrue; |
708 iKeyScanCode = kEvent.iScanCode; |
710 } |
709 |
711 |
710 if ( aEvent.Code() == EEventKeyUp ) |
712 switch ( kEvent.iScanCode ) |
711 { |
713 { |
712 iLongPressTimer->Cancel(); |
714 case EStdKeyRightArrow: // check arrow keys |
713 if ( !iLongKeyTriggered ) |
715 case EStdKeyLeftArrow: |
714 { |
716 case EStdKeyUpArrow: |
715 TriggerCommandL(); |
717 case EStdKeyDownArrow: |
716 } |
718 { |
717 } |
719 iKeyScanCode = kEvent.iScanCode; |
|
720 |
|
721 if ( aEvent.Code() == EEventKeyUp ) |
|
722 { |
|
723 iLongPressTimer->Cancel(); |
|
724 if ( !iLongKeyTriggered ) |
|
725 { |
|
726 TriggerCommandL(); |
|
727 } |
|
728 } |
718 else if ( aEvent.Code() == EEventKeyDown ) |
729 else if ( aEvent.Code() == EEventKeyDown ) |
719 { |
730 { |
720 iLongKeyTriggered = EFalse; |
731 iLongKeyTriggered = EFalse; |
721 // Start the long key press timer |
732 // Start the long key press timer |
722 iLongPressTimer->Cancel(); |
733 iLongPressTimer->Cancel(); |
723 iLongPressTimer->Start( KFMRadioRockerLongPressDelay, |
734 iLongPressTimer->Start( KFMRadioRockerLongPressDelay, |
724 0, |
735 0, |
725 TCallBack( CFMRadioAlfVisualizer::StaticLongPressCallBack, this ) ); |
736 TCallBack( CFMRadioAlfVisualizer::StaticLongPressCallBack, this ) ); |
726 } |
737 |
727 return ETrue; |
738 } |
|
739 keyHandled = ETrue; |
|
740 break; |
|
741 } |
|
742 default: |
|
743 { |
|
744 break; |
|
745 } |
728 } |
746 } |
729 } |
747 } |
730 if ( aEvent.IsPointerEvent() ) |
748 if ( aEvent.IsPointerEvent() ) |
731 { |
749 { |
732 return CGestureControl::OfferEventL( aEvent ); |
750 return CGestureControl::OfferEventL( aEvent ); |
733 } |
751 } |
734 return EFalse; |
752 return keyHandled; |
735 } |
753 } |
736 |
754 |
737 // --------------------------------------------------------------------------- |
755 // --------------------------------------------------------------------------- |
738 // Sets the display style in use. |
756 // Sets the display style in use. |
739 // --------------------------------------------------------------------------- |
757 // --------------------------------------------------------------------------- |
1068 // --------------------------------------------------------------------------- |
1086 // --------------------------------------------------------------------------- |
1069 // |
1087 // |
1070 void CFMRadioAlfVisualizer::TriggerCommandL() |
1088 void CFMRadioAlfVisualizer::TriggerCommandL() |
1071 { |
1089 { |
1072 TVwsViewId viewId( KNullUid, KNullUid ); |
1090 TVwsViewId viewId( KNullUid, KNullUid ); |
1073 CAknViewAppUi* appUi = static_cast<CAknViewAppUi*>( CCoeEnv::Static()->AppUi() ); |
1091 TInt err = iAppUi->GetActiveViewId( viewId ); |
1074 TInt err = appUi->GetActiveViewId( viewId ); |
|
1075 RProcess process; |
1092 RProcess process; |
1076 TSecureId id = process.SecureId(); |
1093 TSecureId id = process.SecureId(); |
1077 |
1094 |
1078 if ( !err && viewId.iAppUid.iUid == id.iId ) |
1095 if ( !err && viewId.iAppUid.iUid == id.iId ) |
1079 { |
1096 { |
1080 CAknView* view = appUi->View( viewId.iViewUid ); |
1097 CAknView* view = iAppUi->View( viewId.iViewUid ); |
1081 if ( view ) |
1098 if ( view ) |
1082 { |
1099 { |
1083 // command to be generated |
1100 // command to be generated |
1084 TInt commandId = 0; |
1101 TInt commandId = 0; |
1085 |
1102 |