phoneapp/phoneuicontrol/src/cphonekeyeventforwarder.cpp
branchRCL_3
changeset 20 3c221667e687
parent 14 b8d67d6176f5
child 22 94dc1107e8b2
equal deleted inserted replaced
14:b8d67d6176f5 20:3c221667e687
    33 #include "phonelogger.h"
    33 #include "phonelogger.h"
    34 #include "phoneui.pan"
    34 #include "phoneui.pan"
    35 #include "mphoneviewcommandhandle.h"
    35 #include "mphoneviewcommandhandle.h"
    36 #include "cphoneqwertyhandler.h"
    36 #include "cphoneqwertyhandler.h"
    37 #include "tphonecmdparampointer.h"
    37 #include "tphonecmdparampointer.h"
       
    38 #include "tphonecmdparamboolean.h"
    38 #include "mphoneqwertymodeobserver.h"
    39 #include "mphoneqwertymodeobserver.h"
    39 #include "cdialer.h"
    40 #include "cdialer.h"
    40 
    41 
    41 // CONSTANTS
    42 // CONSTANTS
    42 
    43 
   240         {
   241         {
   241         User::LeaveIfError( iPeninputServer.Connect() );
   242         User::LeaveIfError( iPeninputServer.Connect() );
   242         iPeninputServer.AddPenUiActivationHandler( this, EPluginInputModeAll );
   243         iPeninputServer.AddPenUiActivationHandler( this, EPluginInputModeAll );
   243         iVirtualKeyBoardOpen = iPeninputServer.IsVisible();
   244         iVirtualKeyBoardOpen = iPeninputServer.IsVisible();
   244         }
   245         }
       
   246     
       
   247     CEikonEnv* env = static_cast<CEikonEnv*>( ControlEnv() );
       
   248     if ( env )
       
   249         {
       
   250         iMenu = env->AppUiFactory()->MenuBar();
       
   251         }
   245     }
   252     }
   246 
   253 
   247 // -----------------------------------------------------------------------------
   254 // -----------------------------------------------------------------------------
   248 // CPhoneKeyEventForwarder::IsAlphaNumericKey
   255 // CPhoneKeyEventForwarder::IsAlphaNumericKey
   249 // -----------------------------------------------------------------------------
   256 // -----------------------------------------------------------------------------
   545         // Any key event not originating from dialer interrupts multitap
   552         // Any key event not originating from dialer interrupts multitap
   546         // behaviour.
   553         // behaviour.
   547         iMultitapIndex = 0;
   554         iMultitapIndex = 0;
   548         iPreviousScanCode = 0;
   555         iPreviousScanCode = 0;
   549         }
   556         }
   550 
   557     
   551     // Special handling for QWERTY numeric mode key events
   558     // Special handling for QWERTY numeric mode key events
   552     if ( response == EKeyWasNotConsumed )
   559     if ( response == EKeyWasNotConsumed )
   553         {
   560         {
   554         // FEP treats numeric QWERTY mode of Phone editor as a special case where most
   561         // FEP does not handle numeric characters 0123456789+*#pw correctly
   555         // key events flow through directly to the Phone app (but some don't).
   562         // when in QWERTY mode and number mode. If nothing is done about it, 
   556         // To ensure consistent handling of numeric mode keys and QWERTY modifiers, 
   563         // these problems result in non-hybrid mode qwerty:
   557         // handle those keys manually before FEP has a chance to mess things up.
   564         //      +, # and * cannot be typed without pressing Fn-key
       
   565         //      Fn + <p/0> produces 0 although p is expected.
       
   566         //      Fn + <w/2> produces 2 although w is expected.
       
   567         // To avoid this problems we do the following.
       
   568     
       
   569         // Take numeric keyevent, pass it to number entry and consume it.
   558         TBool numericMode = iViewCommandHandle->HandleCommandL(
   570         TBool numericMode = iViewCommandHandle->HandleCommandL(
   559               EPhoneViewIsNumberEntryNumericMode ) == EPhoneViewResponseSuccess;
   571               EPhoneViewIsNumberEntryNumericMode ) == EPhoneViewResponseSuccess;
   560 
   572         
   561         if ( iQwertyHandler->IsQwertyInput() && numericMode )
   573         TPhoneCmdParamBoolean blockingDialog;
       
   574         iViewCommandHandle->ExecuteCommandL( EPhoneViewGetBlockingDialogStatus, 
       
   575             &blockingDialog );
       
   576 
       
   577         // Handle and consume keyevent only if in qwerty mode, editor is 
       
   578         // in numeric mode, menu is not shown and there is no blocking dialog.
       
   579         if ( iQwertyHandler->IsQwertyInput() && numericMode && 
       
   580              ( !iMenu || !iMenu->IsDisplayed() ) && !blockingDialog.Boolean() )
   562             {
   581             {
   563             iQwertyHandler->ConvertToNumeric( keyEvent );
   582             iQwertyHandler->ConvertToNumeric( keyEvent );
   564             // Send key to editor unless this is a repeat event for dtmf character
   583             
   565             if ( aKeyEvent.iRepeats == 0 ||
   584             // Send key to editor only if a) it is not a repeating keyevent and 
   566                  !CPhoneKeys::IsDtmfTone( keyEvent, EEventKey ) )
   585             // it is a valid number entry character (0123456789+*#pw).
       
   586             if ( aKeyEvent.iRepeats == 0 &&
       
   587                  ( CPhoneKeys::IsDtmfTone( keyEvent, EEventKey ) ||
       
   588                    CPhoneKeys::IsExtraChar( keyEvent.iCode ) ) )
   567                 {
   589                 {
   568                 iStateMachine->State()->HandleKeyEventL( keyEvent, EEventKey );
   590                 iStateMachine->State()->HandleKeyEventL( keyEvent, EEventKey );
       
   591                 response = EKeyWasConsumed;
   569                 }
   592                 }
   570             response = EKeyWasConsumed;
       
   571             }
   593             }
   572         }
   594         }
   573     
   595     
   574     return response;
   596     return response;
   575     }
   597     }