fmradio/fmradio/src/fmradioalfvisualizer.cpp
branchRCL_3
changeset 13 4f2584af5a29
parent 8 f73067c3e563
child 15 04aa446da81c
--- a/fmradio/fmradio/src/fmradioalfvisualizer.cpp	Tue May 25 12:42:49 2010 +0300
+++ b/fmradio/fmradio/src/fmradioalfvisualizer.cpp	Wed Jun 09 09:42:10 2010 +0300
@@ -696,42 +696,60 @@
 // ----------------------------------------------------------------------------
 //
 TBool CFMRadioAlfVisualizer::OfferEventL( const TAlfEvent& aEvent )
-	{		
+    {
+    TBool keyHandled = EFalse;
+    
     if ( aEvent.IsKeyEvent() && AknLayoutUtils::PenEnabled() )
         {
         const TKeyEvent& kEvent = aEvent.KeyEvent();
-        if ( kEvent.iScanCode  == EStdKeyRightArrow ||
-            kEvent.iScanCode == EStdKeyLeftArrow ||
-            kEvent.iScanCode == EStdKeyUpArrow ||
-            kEvent.iScanCode == EStdKeyDownArrow )
+        
+        if ( kEvent.iCode == EKeyEnter || kEvent.iCode == EKeyOK )
+            {
+            iAppUi->ActivateLocalViewL( KFMRadioChannelListViewId );
+            keyHandled = ETrue;
+            }
+        
+        switch ( kEvent.iScanCode )
             {
-            iKeyScanCode = kEvent.iScanCode;
-
-            if ( aEvent.Code() == EEventKeyUp )
+            case EStdKeyRightArrow: // check arrow keys
+            case EStdKeyLeftArrow:
+            case EStdKeyUpArrow:
+            case EStdKeyDownArrow:
                 {
-                iLongPressTimer->Cancel();
-                if ( !iLongKeyTriggered )
+                iKeyScanCode = kEvent.iScanCode;
+    
+                if ( aEvent.Code() == EEventKeyUp )
                     {
-                    TriggerCommandL();
+                    iLongPressTimer->Cancel();
+                    if ( !iLongKeyTriggered )
+                        {
+                        TriggerCommandL();
+                        }
                     }
+                else if ( aEvent.Code() == EEventKeyDown )
+                    {
+                    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;
                 }
-            return ETrue;
             }
         }
     if ( aEvent.IsPointerEvent() )
         {
         return CGestureControl::OfferEventL( aEvent );
         }
-    return EFalse;
+    return keyHandled;
     }
 
 // ---------------------------------------------------------------------------
@@ -1070,14 +1088,13 @@
 void CFMRadioAlfVisualizer::TriggerCommandL()
     {
     TVwsViewId viewId( KNullUid, KNullUid );
-    CAknViewAppUi* appUi = static_cast<CAknViewAppUi*>( CCoeEnv::Static()->AppUi() );
-    TInt err = appUi->GetActiveViewId( viewId );
+    TInt err = iAppUi->GetActiveViewId( viewId );
     RProcess process;
     TSecureId id = process.SecureId();
 
     if ( !err && viewId.iAppUid.iUid == id.iId )
         {
-        CAknView* view = appUi->View( viewId.iViewUid );
+        CAknView* view = iAppUi->View( viewId.iViewUid );
         if ( view )
             {
             // command to be generated