phoneapp/phoneuicontrol/src/cphonekeyeventforwarder.cpp
branchRCL_3
changeset 26 8baf28733c3d
parent 25 5266b1f337bd
equal deleted inserted replaced
25:5266b1f337bd 26:8baf28733c3d
   158 
   158 
   159     if ( !aKeyEvent.iRepeats && aKeyEvent.iCode != EKeyEscape )
   159     if ( !aKeyEvent.iRepeats && aKeyEvent.iCode != EKeyEscape )
   160         {
   160         {
   161         // Convert event. Use already converted iKeyPressedDown.
   161         // Convert event. Use already converted iKeyPressedDown.
   162         TKeyEvent keyEvent = aKeyEvent;
   162         TKeyEvent keyEvent = aKeyEvent;
   163         if ( keyEvent.iScanCode == EStdKeyApplication0 )
   163         keyEvent.iCode = iKeyPressedDown;
   164             {
       
   165             keyEvent.iCode = EKeyApplication0;
       
   166             }
       
   167         else
       
   168             {
       
   169             keyEvent.iCode = iKeyPressedDown;
       
   170             }
       
   171         
   164         
   172         // Do not handle dtmf tone if the type is EEventKey but we are not
   165         // Do not handle dtmf tone if the type is EEventKey but we are not
   173         // expecting key up event. This happens if the key up event has been
   166         // expecting key up event. This happens if the key up event has been
   174         // handled by some CActiveSchedulerWait object somewhere in the execution 
   167         // handled by some CActiveSchedulerWait object somewhere in the execution 
   175         // of function OfferKeyEventBeforeControlStackL.
   168         // of function OfferKeyEventBeforeControlStackL.
   538     // value for menubar, so ask visibility also from CEikMenuBar
   531     // value for menubar, so ask visibility also from CEikMenuBar
   539     iDisplayingMenuOrDialogOnEventKeyDown = ( iViewCommandHandle->HandleCommandL(
   532     iDisplayingMenuOrDialogOnEventKeyDown = ( iViewCommandHandle->HandleCommandL(
   540             EPhoneViewIsDisplayingMenuOrDialog ) == 
   533             EPhoneViewIsDisplayingMenuOrDialog ) == 
   541             EPhoneViewResponseSuccess ) || ( iMenu && iMenu->IsDisplayed() );
   534             EPhoneViewResponseSuccess ) || ( iMenu && iMenu->IsDisplayed() );
   542 
   535 
   543 
   536     // Consume dialer simulated key events, pass others on
   544     return ( EKeyWasNotConsumed );
   537     return ( IsKeySimulatedByTouchDialer( aKeyEvent ) ? EKeyWasConsumed : EKeyWasNotConsumed );
   545     }
   538     }
   546 
   539 
   547 // -----------------------------------------------------------
   540 // -----------------------------------------------------------
   548 // CPhoneKeyEventForwarder::HandleEventKeyBeforeControlStackL
   541 // CPhoneKeyEventForwarder::HandleEventKeyBeforeControlStackL
   549 // Both short key press event (iRepeats == 0) and
   542 // Both short key press event (iRepeats == 0) and
   651 
   644 
   652     // Store the previous scan code
   645     // Store the previous scan code
   653     iPreviousScanCode = iScanCode;
   646     iPreviousScanCode = iScanCode;
   654 
   647 
   655     // Consume dialer simulated key events, pass others on
   648     // Consume dialer simulated key events, pass others on
   656     return EKeyWasNotConsumed;
   649     TKeyResponse retValue = IsKeySimulatedByTouchDialer( aKeyEvent ) ? EKeyWasConsumed : EKeyWasNotConsumed;
       
   650     
       
   651     // If event is consumed, reset key specific state variables. Otherwise they may disturb
       
   652     // handling of coming key events originating from a different key.
       
   653     if ( retValue == EKeyWasConsumed )
       
   654         {
       
   655         iKeyPressedDown = EKeyNull;
       
   656         iScanCode = EStdKeyNull; 
       
   657         iDisplayingMenuOrDialogOnEventKeyDown = EFalse;
       
   658         }
       
   659     
       
   660     return retValue;
   657     }
   661     }
   658 
   662 
   659 // ---------------------------------------------------------
   663 // ---------------------------------------------------------
   660 // CPhoneKeyEventForwarder::DoHandleLongPressKeyEventCallback
   664 // CPhoneKeyEventForwarder::DoHandleLongPressKeyEventCallback
   661 //
   665 //
   739     if ( !ConvertHalfQwertySpecialChar( aCode, aKeyEvent ) )
   743     if ( !ConvertHalfQwertySpecialChar( aCode, aKeyEvent ) )
   740         {
   744         {
   741         TBool numMode = iViewCommandHandle->HandleCommandL(
   745         TBool numMode = iViewCommandHandle->HandleCommandL(
   742               EPhoneViewIsNumberEntryNumericMode ) == EPhoneViewResponseSuccess;
   746               EPhoneViewIsNumberEntryNumericMode ) == EPhoneViewResponseSuccess;
   743         TBool simulatedByDialer = IsKeySimulatedByTouchDialer( aKeyEvent );
   747         TBool simulatedByDialer = IsKeySimulatedByTouchDialer( aKeyEvent );
   744     
   748         
       
   749         TUint numCode( EKeyNull );
       
   750         
   745         if ( iQwertyHandler->IsQwertyInput() && numMode && !simulatedByDialer )
   751         if ( iQwertyHandler->IsQwertyInput() && numMode && !simulatedByDialer )
   746             {
   752             {
   747             TUint numCode = iQwertyHandler->NumericKeyCode( aKeyEvent );
   753             numCode = iQwertyHandler->NumericKeyCode( aKeyEvent );
   748             if ( numCode )
   754             }
   749                 {
   755         if ( numCode )
   750                 aCode = numCode;
   756             {
   751                 }
   757             aCode = numCode;
   752             else
       
   753                 {
       
   754                 aCode = aKeyEvent.iScanCode;
       
   755                 }
       
   756             }
   758             }
   757         else 
   759         else 
   758             {
   760             {
   759             switch ( aKeyEvent.iScanCode )
   761             switch ( aKeyEvent.iScanCode )
   760                 {
   762                 {