idlefw/plugins/wsplugin/src/numerickeyhandler.cpp
branchRCL_3
changeset 14 15e4dd19031c
parent 0 79c6a41cd166
equal deleted inserted replaced
12:502e5d91ad42 14:15e4dd19031c
    21 #include "uistate.h"
    21 #include "uistate.h"
    22 
    22 
    23 #include <e32property.h>
    23 #include <e32property.h>
    24 #include <centralrepository.h>
    24 #include <centralrepository.h>
    25 #include <w32adll.h>
    25 #include <w32adll.h>
       
    26 
       
    27 #include <easydialingcrkeys.h>
       
    28 #include <spsettings.h>
       
    29 #include <featmgr.h>
    26 
    30 
    27 #include <PtiEngine.h>
    31 #include <PtiEngine.h>
    28 #include <activeidle2domainpskeys.h>
    32 #include <activeidle2domainpskeys.h>
    29 #include <AvkonInternalCRKeys.h>
    33 #include <AvkonInternalCRKeys.h>
    30 #include <AknFepInternalCRKeys.h>
    34 #include <AknFepInternalCRKeys.h>
   151  * Returns true if event should be forwarded to Phone app.
   155  * Returns true if event should be forwarded to Phone app.
   152  */
   156  */
   153 TBool CNumericKeyHandler::CheckPostToTarget(const TRawEvent& aRawEvent ) const
   157 TBool CNumericKeyHandler::CheckPostToTarget(const TRawEvent& aRawEvent ) const
   154     {
   158     {
   155     const TInt scanCode = aRawEvent.ScanCode();
   159     const TInt scanCode = aRawEvent.ScanCode();
       
   160     const TUint modifiers = iUiState->Modifiers();
   156 
   161 
   157     if ( iQwertyMode ) 
   162     if ( iQwertyMode ) 
   158         {
   163         {
   159         // Don't pass the check if shift is pressed.
   164         // Don't pass the check if shift is pressed.		
   160 		const TUint modifiers = iUiState->Modifiers();
       
   161         if(( modifiers & EModifierShift ) == 0 )
   165         if(( modifiers & EModifierShift ) == 0 )
   162             {
   166             {
   163             TInt numericKeysCount = iNumericKeys.Count();
   167             TInt numericKeysCount = iNumericKeys.Count();
   164             while( numericKeysCount-- )
   168             while( numericKeysCount-- )
   165                 {
   169                 {
   188                 {
   192                 {
   189                 return ETrue;
   193                 return ETrue;
   190                 }
   194                 }
   191             }
   195             }
   192         }
   196         }
   193     return EFalse;
   197     
       
   198     // Homescreen should open dialer also with alpha characters, if dialer is in 
       
   199     // mode that accepts alpha characters into number entry (ou1cimx1#299396)    
       
   200     
       
   201     const TInt  KPhoneKeyStart = 33;
       
   202     const TInt  KPhoneKeyEnd   = 127;
       
   203     
       
   204     return ( ( AllowAlphaNumericMode() ) && ( ( scanCode >= KPhoneKeyStart &&
       
   205              scanCode <= KPhoneKeyEnd ) || modifiers & EModifierSpecial ) );
   194     }
   206     }
   195 
   207 
   196 
   208 
   197 /**
   209 /**
   198  * Load input locales.
   210  * Load input locales.
   294 void CNumericKeyHandler::SetInputLanguage( TInt aValue )
   306 void CNumericKeyHandler::SetInputLanguage( TInt aValue )
   295     {
   307     {
   296     iInputLanguage = aValue;
   308     iInputLanguage = aValue;
   297     }
   309     }
   298 
   310 
       
   311 /**
       
   312  * Check alpha numeric mode.
       
   313  */
       
   314 TBool CNumericKeyHandler::AllowAlphaNumericMode() const
       
   315     {
       
   316     return ( EasyDialingEnabled() || VoIPSupported() );
       
   317     }
       
   318 
       
   319 /**
       
   320  * Check if voip supported.
       
   321  */
       
   322 TBool CNumericKeyHandler::VoIPSupported() const
       
   323     {
       
   324     TBool voipSupported( EFalse );
       
   325     CSPSettings* serviceProviderSettings( NULL );
       
   326 
       
   327     TRAP_IGNORE( serviceProviderSettings = CSPSettings::NewL() );   
       
   328 
       
   329     if ( serviceProviderSettings )
       
   330         {
       
   331         voipSupported = serviceProviderSettings->IsFeatureSupported( 
       
   332                 ESupportInternetCallFeature );
       
   333         
       
   334         delete serviceProviderSettings;
       
   335         }
       
   336 
       
   337     return voipSupported;
       
   338     }
       
   339 
       
   340 /**
       
   341  * Check if easy dialing enabled.
       
   342  */
       
   343 TBool CNumericKeyHandler::EasyDialingEnabled() const
       
   344     {
       
   345     TBool easyDialingEnabled( EFalse );
       
   346     if ( FeatureManager::FeatureSupported( 
       
   347             KFeatureIdProductIncludesHomeScreenEasyDialing ) )
       
   348         {
       
   349         CRepository* cenrep( NULL );
       
   350         TInt easyDialingSetting;
       
   351 
       
   352         TRAP_IGNORE( cenrep = CRepository::NewL( KCRUidEasyDialSettings ) );
       
   353 
       
   354         if ( cenrep )
       
   355             {
       
   356             TInt err = cenrep->Get( KEasyDialing, easyDialingSetting );
       
   357             if ( !err && easyDialingSetting )
       
   358                 {
       
   359                 easyDialingEnabled = ETrue;
       
   360                 }
       
   361 
       
   362             delete cenrep;        
       
   363             }
       
   364         }
       
   365 
       
   366     return easyDialingEnabled;
       
   367     }
       
   368 
   299 void CNumericKeyHandler::HandleNotifyGeneric(TUint32 aKey)
   369 void CNumericKeyHandler::HandleNotifyGeneric(TUint32 aKey)
   300 	{
   370     {
   301 	if( aKey == KAknFepInputTxtLang )
   371     if( aKey == KAknFepInputTxtLang )
   302 		{
   372         {
   303 		TInt newValue = iInputLanguage;
   373         TInt newValue = iInputLanguage;
   304 		iInputLanguageRepository->Get( KAknFepInputTxtLang, newValue );
   374         iInputLanguageRepository->Get( KAknFepInputTxtLang, newValue );
   305 		HandleInputLanguageChanged( newValue );
   375         HandleInputLanguageChanged( newValue );
   306 		}
   376         }
   307 	}
   377     }
   308     
   378     
   309 void CNumericKeyHandler::HandleNotifyError
   379 void CNumericKeyHandler::HandleNotifyError
   310         (TUint32 /*aKey*/, TInt /*aError*/, CCenRepNotifyHandler* /*aHandler*/)
   380         (TUint32 /*aKey*/, TInt /*aError*/, CCenRepNotifyHandler* /*aHandler*/)
   311     {
   381     {
   312     }
   382     }