phoneapp/phoneuicontrol/src/cphonekeyeventforwarder.cpp
changeset 0 5f000ab63145
child 5 2a26698d78ba
equal deleted inserted replaced
-1:000000000000 0:5f000ab63145
       
     1 /*
       
     2 * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Key event forwarder.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include <eikenv.h>
       
    21 #include <eikappui.h>
       
    22 #include <bldvariant.hrh>
       
    23 #include <featmgr.h>
       
    24 #include <PtiDefs.h>
       
    25 
       
    26 #include "mphonestatemachine.h"
       
    27 #include "mphonekeyeventhandler.h"
       
    28 #include "cphonekeys.h"
       
    29 #include "cphonekeyeventforwarder.h"
       
    30 #include "cphonepubsubproxy.h"
       
    31 #include "cphonetimer.h"
       
    32 #include "phonelogger.h"
       
    33 #include "phoneui.pan"
       
    34 
       
    35 // CONSTANTS
       
    36 
       
    37 //Avkon P&S keys
       
    38 const TUid KCRUidAvkon = { 0x101F876E };
       
    39 const TUint32 KAknKeyBoardLayout = 0x0000000B;
       
    40 
       
    41 // ============================ MEMBER FUNCTIONS ===============================
       
    42 
       
    43 // -----------------------------------------------------------------------------
       
    44 // CPhoneKeyEventForwarder::NewL
       
    45 // -----------------------------------------------------------------------------
       
    46 //
       
    47 CPhoneKeyEventForwarder* CPhoneKeyEventForwarder::NewL(
       
    48         const TRect& aRect,
       
    49         MPhoneStateMachine* aStateMachine,
       
    50         MPhoneViewCommandHandle* aViewCommandHandle )
       
    51     {
       
    52     CPhoneKeyEventForwarder* self =
       
    53         new (ELeave) CPhoneKeyEventForwarder( aStateMachine, aViewCommandHandle );
       
    54 
       
    55     CleanupStack::PushL( self );
       
    56     self->ConstructL( aRect );
       
    57     CleanupStack::Pop( self );
       
    58 
       
    59     return self;
       
    60     }
       
    61 
       
    62 // -----------------------------------------------------------------------------
       
    63 // CPhoneKeyEventForwarder::~CPhoneKeyEventForwarder
       
    64 // -----------------------------------------------------------------------------
       
    65 //
       
    66 CPhoneKeyEventForwarder::~CPhoneKeyEventForwarder()
       
    67     {
       
    68     __LOGMETHODSTARTEND( EPhoneControl, "CPhoneKeyEventForwarder::~CPhoneKeyEventForwarder");
       
    69 
       
    70     CEikonEnv* env = static_cast<CEikonEnv*>(ControlEnv());
       
    71     if( env )
       
    72         {
       
    73         env->EikAppUi()->RemoveFromStack( this );
       
    74         }
       
    75     delete iLongPressKeyEventTimer;
       
    76     }
       
    77 
       
    78 // -----------------------------------------------------------------------------
       
    79 // CPhoneKeyEventForwarder::CountComponentControls
       
    80 // -----------------------------------------------------------------------------
       
    81 //
       
    82 TInt CPhoneKeyEventForwarder::CountComponentControls() const
       
    83     {
       
    84     __LOGMETHODSTARTEND( EPhoneControl, "CPhoneKeyEventForwarder::CountComponentControls");
       
    85     return 0;
       
    86     }
       
    87 
       
    88 // -----------------------------------------------------------------------------
       
    89 // CPhoneKeyEventForwarder::ComponentControl
       
    90 // -----------------------------------------------------------------------------
       
    91 //
       
    92 CCoeControl* CPhoneKeyEventForwarder::ComponentControl(
       
    93         TInt /*aIndex*/ ) const
       
    94     {
       
    95     __LOGMETHODSTARTEND( EPhoneControl, "CPhoneKeyEventForwarder::ComponentControl");
       
    96     return NULL;
       
    97     }
       
    98 
       
    99 // -----------------------------------------------------------------------------
       
   100 // CPhoneKeyEventForwarder::SizeChanged
       
   101 // -----------------------------------------------------------------------------
       
   102 //
       
   103 void CPhoneKeyEventForwarder::SizeChanged()
       
   104     {
       
   105     __LOGMETHODSTARTEND( EPhoneControl, "CPhoneKeyEventForwarder::SizeChanged");
       
   106     }
       
   107 
       
   108 // -----------------------------------------------------------------------------
       
   109 // CPhoneKeyEventForwarder::Draw
       
   110 // -----------------------------------------------------------------------------
       
   111 //
       
   112 void CPhoneKeyEventForwarder::Draw(
       
   113         const TRect& /*aRect*/ ) const
       
   114     {
       
   115     __LOGMETHODSTARTEND( EPhoneControl, "CPhoneKeyEventForwarder::Draw");
       
   116     }
       
   117 
       
   118 // -----------------------------------------------------------------------------
       
   119 // CPhoneKeyEventForwarder::OfferKeyEventL
       
   120 // Checks is hte keyevent such that the number entry can be opened
       
   121 // -----------------------------------------------------------------------------
       
   122 //
       
   123 TKeyResponse CPhoneKeyEventForwarder::OfferKeyEventL(
       
   124         const TKeyEvent& aKeyEvent,
       
   125         TEventCode aType )
       
   126     {
       
   127     __LOGMETHODSTARTEND( EPhoneControl,
       
   128         "CPhoneKeyEventForwarder::OfferKeyEventL");
       
   129 
       
   130     TKeyResponse ret( EKeyWasNotConsumed );
       
   131     TKeyEvent keyEvent = aKeyEvent;
       
   132 
       
   133     ret = OfferKeyEventBeforeControlStackL( aKeyEvent, aType );
       
   134 
       
   135     // Convert event. Use already converted iKeyPressedDown.
       
   136     // Do not convert other than DTMF tones
       
   137     if( CPhoneKeys::IsDtmfTone( aKeyEvent, aType ) )
       
   138         {
       
   139         keyEvent.iCode = iKeyPressedDown;
       
   140         }
       
   141 
       
   142     if ( !keyEvent.iRepeats )
       
   143         {
       
   144         // Start and stop dtmf
       
   145         iStateMachine->State()->HandleDtmfKeyToneL( keyEvent, aType );
       
   146         if( aType != EEventKeyUp &&
       
   147             ( CPhoneKeys::IsNumericKey( keyEvent, aType ) ||
       
   148               IsAlphaNumericKey( keyEvent ) )
       
   149           )
       
   150             {
       
   151             // Do not open number entry with up key
       
   152             iStateMachine->State()->HandleCreateNumberEntryL( keyEvent, aType );
       
   153             }
       
   154         }
       
   155 
       
   156     return ret;
       
   157     }
       
   158 
       
   159 // -----------------------------------------------------------------------------
       
   160 // CPhoneKeyEventForwarder::CPhoneKeyEventForwarder
       
   161 // -----------------------------------------------------------------------------
       
   162 //
       
   163 CPhoneKeyEventForwarder::CPhoneKeyEventForwarder(
       
   164     MPhoneStateMachine* aStateMachine,
       
   165     MPhoneViewCommandHandle* aViewCommandHandle  )
       
   166     : iStateMachine( aStateMachine ),
       
   167     iViewCommandHandle( aViewCommandHandle )
       
   168     {
       
   169     __LOGMETHODSTARTEND( EPhoneControl,
       
   170         "CPhoneKeyEventForwarder::CPhoneKeyEventForwarder");
       
   171     }
       
   172 
       
   173 // -----------------------------------------------------------------------------
       
   174 // CPhoneKeyEventForwarder::ConstructL
       
   175 // -----------------------------------------------------------------------------
       
   176 //
       
   177 void CPhoneKeyEventForwarder::ConstructL( const TRect& aRect )
       
   178     {
       
   179     __LOGMETHODSTARTEND( EPhoneControl,
       
   180         "CPhoneKeyEventForwarder::ConstructL");
       
   181 
       
   182     if ( FeatureManager::FeatureSupported( KFeatureIdKeypadNoSlider ) )
       
   183         {
       
   184         RWindowGroup& groupWin = iCoeEnv->RootWin();
       
   185         }
       
   186     // Create invisible control.
       
   187     CreateWindowL();
       
   188     MakeVisible( EFalse );
       
   189     SetRect( aRect );
       
   190 
       
   191     CEikonEnv* env = static_cast<CEikonEnv*>(ControlEnv());
       
   192     if( env )
       
   193         {
       
   194         env->EikAppUi()->AddToStackL(
       
   195             this,
       
   196             ECoeStackPriorityEnvironmentFilter,
       
   197             ECoeStackFlagRefusesFocus );
       
   198         }
       
   199 
       
   200     // Create the long press key event timer
       
   201     iLongPressKeyEventTimer = CPhoneTimer::NewL();
       
   202     }
       
   203 
       
   204 // -----------------------------------------------------------------------------
       
   205 // CPhoneKeyEventForwarder::IsAlphaNumericKey
       
   206 // -----------------------------------------------------------------------------
       
   207 //
       
   208 TBool CPhoneKeyEventForwarder::IsAlphaNumericKey( const TKeyEvent& aKeyEvent )
       
   209     {
       
   210     __LOGMETHODSTARTEND( EPhoneControl,
       
   211         "CPhoneKeyEventForwarder::IsAlphaNumericKey");
       
   212 
       
   213     TBool alphaNumeric =
       
   214        iStateMachine->State()->IsAlphanumericSupportedAndCharInput( aKeyEvent );
       
   215 
       
   216     return alphaNumeric;
       
   217     }
       
   218 
       
   219 // -----------------------------------------------------------------------------
       
   220 // CPhoneKeyEventForwarder::ConvertHalfQwertySpecialChar
       
   221 // -----------------------------------------------------------------------------
       
   222 //
       
   223 TBool CPhoneKeyEventForwarder::ConvertHalfQwertySpecialChar( TUint& aCode,
       
   224         const TKeyEvent& aKeyEvent )
       
   225     {
       
   226     __LOGMETHODSTARTEND( EPhoneControl,
       
   227         "CPhoneKeyEventForwarder::ConvertHalfQwertySpecialChar");
       
   228 
       
   229     TBool ret( EFalse );
       
   230     TInt keyboard( CPhonePubSubProxy::Instance()->Value(
       
   231           KCRUidAvkon,
       
   232           KAknKeyBoardLayout ) );
       
   233 
       
   234     if( keyboard == EPtiKeyboardHalfQwerty )
       
   235         {
       
   236         switch ( aKeyEvent.iScanCode )
       
   237            {
       
   238            case EStdKeyLeftShift:
       
   239                ret = ETrue;
       
   240                aCode = KPhoneDtmfHashCharacter;
       
   241                break;
       
   242            case EStdKeyLeftFunc:
       
   243                ret = ETrue;
       
   244                aCode = KPhoneDtmfStarCharacter;
       
   245                break;
       
   246            case EStdKeySpace:
       
   247                ret = ETrue;
       
   248                aCode = KPhoneDtmf0Character;
       
   249                break;
       
   250            default:
       
   251                break;
       
   252            }
       
   253         }
       
   254 
       
   255     __PHONELOG1( EBasic, EPhoneControl,
       
   256         "CPhoneKeyEventForwarder::ConvertHalfQwertySpecialChar =%d ",
       
   257         ret );
       
   258 
       
   259     return ret;
       
   260     }
       
   261 
       
   262 // -----------------------------------------------------------------------------
       
   263 // CPhoneKeyEventForwarder::OfferKeyEventBeforeControlStackL
       
   264 // Let phone handle before other components in control stack
       
   265 // -----------------------------------------------------------------------------
       
   266 //
       
   267 TKeyResponse CPhoneKeyEventForwarder::OfferKeyEventBeforeControlStackL(
       
   268     const TKeyEvent& aKeyEvent,
       
   269     TEventCode aType )
       
   270     {
       
   271     __LOGMETHODSTARTEND( EPhoneControl,
       
   272         "CPhoneKeyEventForwarder::OfferKeyEventBeforeControlStackL");
       
   273 
       
   274     TKeyResponse response( EKeyWasNotConsumed );
       
   275     if( !IsKeyBlocked( aKeyEvent ) )
       
   276         {
       
   277         // Handle key events before FEP
       
   278         // This is must becouse FEP consumes * key and when
       
   279         // editor is in alphanumeric mode FEP consumes all alphanumeric
       
   280         // keys
       
   281         switch( aType )
       
   282             {
       
   283              // EEventKeyDown
       
   284             case EEventKeyDown:
       
   285                 response = HandleEventKeyDownBeforeControlStackL( aKeyEvent );
       
   286                 break;
       
   287             // EEventKey
       
   288             case EEventKey:
       
   289                 response = HandleEventKeyBeforeControlStackL( aKeyEvent );
       
   290                 break;
       
   291             // EEventKeyUp
       
   292             case EEventKeyUp:
       
   293                 response = HandleEventKeyUpBeforeControlStackL( aKeyEvent );
       
   294                 break;
       
   295             default:
       
   296                 break;
       
   297             }
       
   298 
       
   299         }
       
   300     return response;
       
   301     }
       
   302 
       
   303 
       
   304 // -----------------------------------------------------------------------------
       
   305 // CPhoneKeyEventForwarder::OfferKeyEventAfterControlStackL
       
   306 // Let phone handle keys if no one has done it already
       
   307 // -----------------------------------------------------------------------------
       
   308 //
       
   309 TKeyResponse CPhoneKeyEventForwarder::OfferKeyEventAfterControlStackL(
       
   310     const TKeyEvent& aKeyEvent,
       
   311     TEventCode aType )
       
   312     {
       
   313     __LOGMETHODSTARTEND( EPhoneControl,
       
   314         "CPhoneKeyEventForwarder::OfferKeyEventAfterControlStackL");
       
   315     
       
   316 	if( !IsKeyBlocked( aKeyEvent ) )
       
   317         {
       
   318         // Send key to editor
       
   319         iStateMachine->State()->HandleKeyEventL( aKeyEvent, aType );
       
   320         
       
   321         if( EEventKeyUp == aType 
       
   322                 && EKeyNull != iKeyPressedDown )
       
   323             {
       
   324             // Handle short key press
       
   325             iStateMachine->State()->HandleKeyMessageL( 
       
   326                 MPhoneKeyEvents::EPhoneKeyShortPress, 
       
   327                 TKeyCode( iKeyPressedDown ) );
       
   328 
       
   329             // Reset key code
       
   330             iScanCode = EStdKeyNull;
       
   331             iKeyPressedDown = EKeyNull;
       
   332             }
       
   333         }
       
   334 
       
   335     return EKeyWasNotConsumed;
       
   336     }
       
   337 
       
   338 // -----------------------------------------------------------
       
   339 // CPhoneKeyEventForwarder::HandleEventKeyDownBeforeControlStackL
       
   340 // -----------------------------------------------------------
       
   341 //
       
   342 TKeyResponse CPhoneKeyEventForwarder::HandleEventKeyDownBeforeControlStackL(
       
   343     const TKeyEvent& aKeyEvent )
       
   344     {
       
   345     __LOGMETHODSTARTEND( EPhoneControl,
       
   346         "CPhoneKeyEventForwarder::HandleEventKeyDownBeforeControlStackL");
       
   347 
       
   348     // Convert key code
       
   349     ConvertKeyCode( iKeyPressedDown, aKeyEvent );
       
   350     // Save key scan code
       
   351     iScanCode = aKeyEvent.iScanCode;
       
   352 
       
   353     // Start the key press timer
       
   354     iKeyPressTime.UniversalTime();
       
   355 
       
   356     // Cancel the long press key event timer, if it is active
       
   357     if ( iLongPressKeyEventTimer->IsActive() )
       
   358         {
       
   359         iLongPressKeyEventTimer->CancelTimer();
       
   360         }
       
   361 
       
   362     // Re-start the timer
       
   363     iLongPressKeyEventTimer->After(
       
   364         KPhoneLongPressKeyEventDuration,
       
   365         TCallBack( DoHandleLongPressKeyEventCallbackL,
       
   366         this ) );
       
   367 
       
   368     return ( EKeyWasNotConsumed );
       
   369     }
       
   370 
       
   371 // -----------------------------------------------------------
       
   372 // CPhoneKeyEventForwarder::HandleEventKeyBeforeControlStackL
       
   373 // Both short key press event (iRepeats == 0) and
       
   374 // long key press event (iRepeats == 1) are handled here
       
   375 // -----------------------------------------------------------
       
   376 //
       
   377 TKeyResponse CPhoneKeyEventForwarder::HandleEventKeyBeforeControlStackL(
       
   378     const TKeyEvent& aKeyEvent )
       
   379     {
       
   380     __LOGMETHODSTARTEND( EPhoneControl,
       
   381         "CPhoneKeyEventForwarder::HandleEventKeyBeforeControlStackL");
       
   382 
       
   383     TKeyResponse response( EKeyWasNotConsumed );
       
   384 
       
   385     // Convert event.
       
   386     TKeyEvent keyEvent = aKeyEvent;
       
   387     keyEvent.iCode = iKeyPressedDown;
       
   388 
       
   389     if(  aKeyEvent.iRepeats > 0 &&
       
   390         CPhoneKeys::IsDtmfTone( keyEvent, EEventKey ) )
       
   391         {
       
   392         // Do not repeat dtmf characters
       
   393         response = EKeyWasConsumed;
       
   394         }
       
   395 
       
   396     return response;
       
   397     }
       
   398 
       
   399 // -----------------------------------------------------------
       
   400 // CPhoneKeyEventForwarder::HandleEventKeyUpBeforeControlStackL
       
   401 // -----------------------------------------------------------
       
   402 //
       
   403 TKeyResponse CPhoneKeyEventForwarder::HandleEventKeyUpBeforeControlStackL(
       
   404     const TKeyEvent& aKeyEvent )
       
   405     {
       
   406     __LOGMETHODSTARTEND( EPhoneControl,
       
   407         "CPhoneKeyEventForwarder::HandleEventKeyUpBeforeControlStackL");
       
   408 
       
   409     // Send a long press key event to the current state provided
       
   410     // that the key scan code is the same as the key that was pressed
       
   411     if ( iScanCode == aKeyEvent.iScanCode )
       
   412         {
       
   413         // Pass the key press duration to the current state
       
   414         TTime now;
       
   415         now.UniversalTime();
       
   416         TTimeIntervalMicroSeconds keyPressDuration = now.MicroSecondsFrom(
       
   417            iKeyPressTime );
       
   418         iStateMachine->State()->HandleKeyPressDurationL(
       
   419             TKeyCode( iKeyPressedDown ),
       
   420             keyPressDuration );
       
   421 
       
   422         // Cancel the long press timer, if it is active. Otherwise
       
   423         // ignore the key event since it was already handled as a long press
       
   424         // key event.
       
   425         if ( iLongPressKeyEventTimer->IsActive() )
       
   426             {
       
   427             iLongPressKeyEventTimer->CancelTimer();
       
   428             }
       
   429         }
       
   430 
       
   431     return EKeyWasNotConsumed;
       
   432     }
       
   433 
       
   434 // ---------------------------------------------------------
       
   435 // CPhoneKeyEventForwarder::DoHandleLongPressKeyEventCallback
       
   436 //
       
   437 // This routine is called when the long press key event timer expires
       
   438 // after KPhoneLongPressKeyEventDuration.
       
   439 // ---------------------------------------------------------
       
   440 //
       
   441 TInt CPhoneKeyEventForwarder::DoHandleLongPressKeyEventCallbackL( TAny* aAny )
       
   442     {
       
   443     __LOGMETHODSTARTEND( EPhoneControl,
       
   444         "CPhoneKeyEventForwarder::DoHandleLongPressKeyEventCallbackL");
       
   445 
       
   446     __ASSERT_DEBUG( aAny,
       
   447         Panic( EPhoneCtrlUnknownPanic ) );
       
   448 
       
   449     reinterpret_cast< CPhoneKeyEventForwarder* >( aAny )->
       
   450         HandleLongPressKeyEventL();
       
   451 
       
   452     return KErrNone;
       
   453     }
       
   454 
       
   455 // ---------------------------------------------------------
       
   456 // CPhoneKeyEventForwarder::HandleLongPressKeyEventL
       
   457 // Handle long press key event
       
   458 // ---------------------------------------------------------
       
   459 //
       
   460 void CPhoneKeyEventForwarder::HandleLongPressKeyEventL()
       
   461     {
       
   462     __LOGMETHODSTARTEND( EPhoneControl,
       
   463         "CPhoneKeyEventForwarder::HandleLongPressKeyEventL");
       
   464 
       
   465     // In alphanumeric mode EEventKey-event is not received so we must
       
   466     // compare also with scan code.
       
   467     if ( KPhoneDtmfHashCharacter == iKeyPressedDown )
       
   468         {
       
   469         // Separate handling for long hash key because there is so much
       
   470         // different functionality under it and it works differently
       
   471         // in different protocols.
       
   472         iStateMachine->State()->HandleLongHashL();
       
   473         }
       
   474     else if ( KPhoneDtmfStarCharacter == iKeyPressedDown )
       
   475         {
       
   476         // KPhoneDtmfStarCharacter value used in configuration file for
       
   477         // long key press application launching
       
   478         iStateMachine->State()->HandleKeyMessageL(
       
   479                MPhoneKeyEvents::EPhoneKeyLongPress,
       
   480                TKeyCode( KPhoneDtmfStarCharacter ) );
       
   481         }
       
   482     else
       
   483         {
       
   484         __PHONELOG1(
       
   485             EBasic, EPhoneControl,
       
   486             "CPhoneKeyEventHandler::HandleLongPressKeyEventL iCode(%d)",
       
   487             iKeyPressedDown );
       
   488         iStateMachine->State()->HandleKeyMessageL(
       
   489             MPhoneKeyEvents::EPhoneKeyLongPress,
       
   490             TKeyCode( iKeyPressedDown ) );
       
   491         }
       
   492 
       
   493     // Reset key code
       
   494     iScanCode = EStdKeyNull;
       
   495     iKeyPressedDown = EKeyNull;
       
   496     }
       
   497 
       
   498 // -----------------------------------------------------------
       
   499 // CPhoneKeyEventForwarder::ConvertKeyCode
       
   500 // -----------------------------------------------------------
       
   501 //
       
   502 void CPhoneKeyEventForwarder::ConvertKeyCode( TUint& aCode,
       
   503         const TKeyEvent& aKeyEvent )
       
   504     {
       
   505     __LOGMETHODSTARTEND( EPhoneControl,
       
   506         "CPhoneKeyEventForwarder::ConvertKeyCode");
       
   507 
       
   508     // Handler for special device key mapping in case iScanCode
       
   509     // to iCode conversion hasn't been handled by CAknAppUi::GetAliasKeyCodeL
       
   510     __PHONELOG1( EBasic, EPhoneControl,
       
   511         "CPhoneKeyEventHandler::ConvertKeyCode scan code (%d)",
       
   512         aKeyEvent.iScanCode );
       
   513 
       
   514     if( !ConvertHalfQwertySpecialChar( aCode, aKeyEvent ) )
       
   515         {
       
   516         switch ( aKeyEvent.iScanCode )
       
   517             {
       
   518             case EStdKeyEnter:
       
   519                 aCode = EKeyEnter;
       
   520                 break;
       
   521             case EStdKeyYes:
       
   522                 aCode = EKeyYes;
       
   523                 break;
       
   524             case EStdKeyNo:
       
   525                 aCode = EKeyNo;
       
   526                 break;
       
   527             case EStdKeyDeviceF:
       
   528                 aCode = EKeyDeviceF;  // EStdKeyDeviceF mapping for unlock switch.
       
   529                 break;
       
   530             case EStdKeyHash:
       
   531                 aCode = KPhoneDtmfHashCharacter;
       
   532                 break;
       
   533             case EStdKeyNkpAsterisk:
       
   534                 aCode = KPhoneDtmfStarCharacter;
       
   535                 break;              
       
   536             case EStdKeyApplication0:
       
   537                 aCode = EKeyApplication0;
       
   538                 break;
       
   539 
       
   540             default:
       
   541                 aCode = aKeyEvent.iScanCode; // Use default code
       
   542                 break;
       
   543             }
       
   544         }
       
   545 
       
   546     __PHONELOG1( EBasic, EPhoneControl,
       
   547         "CPhoneKeyEventHandler::ConvertKeyCode aCode (%d)", aCode );
       
   548     }
       
   549 
       
   550 // -----------------------------------------------------------------------------
       
   551 // CPhoneKeyEventForwarder::IsKeyBlocked
       
   552 // -----------------------------------------------------------------------------
       
   553 //
       
   554 TBool CPhoneKeyEventForwarder::IsKeyBlocked( const TKeyEvent& aKeyEvent ) const
       
   555     {
       
   556     TBool ret = EFalse;
       
   557     
       
   558     // Check blocked keys
       
   559     const RArray<TInt>& keyScanCodeList = iStateMachine->State()->GetBlockedKeyList();
       
   560     TInt count = keyScanCodeList.Count();
       
   561     if( count )
       
   562         {
       
   563         for( TInt i = 0; i < count; i++ )
       
   564             {
       
   565             if( keyScanCodeList[i] == aKeyEvent.iScanCode )
       
   566                 {
       
   567                 ret = ETrue;
       
   568                 }
       
   569             }
       
   570         }
       
   571     __PHONELOG1( EBasic, EPhoneControl,
       
   572         "CPhoneKeyEventHandler::IsKeyBlocked return (%d)", ret );
       
   573     
       
   574     return ret;
       
   575     }
       
   576 
       
   577 //  End of File
       
   578