fep/aknfep/src/AknFepUiInputStateEntryQwertyWesternPredictive.cpp
branchRCL_3
changeset 22 bd83ceabce89
parent 21 ecbabf52600f
equal deleted inserted replaced
21:ecbabf52600f 22:bd83ceabce89
    40 #include <PtiDefs.h>                //keys
    40 #include <PtiDefs.h>                //keys
    41 #include <PtiCompositionDataIF.h>   //MPtiEngineCompositionDataInterface
    41 #include <PtiCompositionDataIF.h>   //MPtiEngineCompositionDataInterface
    42 #include <featmgr.h>                //FeatureManager
    42 #include <featmgr.h>                //FeatureManager
    43 #include <e32keys.h>
    43 #include <e32keys.h>
    44 #include <aknfep.rsg>
    44 #include <aknfep.rsg>
       
    45 #include <PtiKeyMappings.h>
    45 
    46 
    46 
    47 
    47 static const TInt KKeyMappingsLength = 63;
    48 static const TInt KKeyMappingsLength = 63;
       
    49 
    48 
    50 
    49 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    51 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    50 //
    52 //
    51 TAknFepInputStateEntryQwertyWesternPredictive::
    53 TAknFepInputStateEntryQwertyWesternPredictive::
    52 TAknFepInputStateEntryQwertyWesternPredictive(MAknFepUIManagerStateInterface* aOwner)
    54 TAknFepInputStateEntryQwertyWesternPredictive(MAknFepUIManagerStateInterface* aOwner)
   602         	return ETrue;
   604         	return ETrue;
   603         
   605         
   604         // Framework will handle the key event.
   606         // Framework will handle the key event.
   605        	return EFalse;
   607        	return EFalse;
   606     }
   608     }
       
   609 
       
   610 
       
   611 // use ptiengine's api to tell whether a character mapped on a given key.	
       
   612 TBool TAknFepInputStateEntryQwertyWesternPredictive::MapAgainst(TInt aKey, TInt aMode, TInt16 aAgainst, TInt aCase) const
       
   613     {    
       
   614     CPtiEngine* ptiengine = iOwner->PtiEngine();
       
   615     if(ptiengine)
       
   616         {
       
   617         ptiengine->SetInputMode((TPtiEngineInputMode)aMode);
       
   618         TBuf<KMaxName> data;
       
   619         ptiengine->MappingDataForKey((TPtiKey)aKey, data, (TPtiTextCase)aCase);
       
   620         if(data.Length() > 0)
       
   621             {
       
   622             return (data[0] == aAgainst);                
       
   623             }
       
   624         }
       
   625     return EFalse;        
       
   626     }
       
   627 	
       
   628 	
       
   629 // Get Scancode from a given character and tell the case at the same time.
       
   630 TInt TAknFepInputStateEntryQwertyWesternPredictive::ScanCodeForCharacter( TUint aChar, TPtiTextCase& aCase )
       
   631     {
       
   632     MAknFepManagerUIInterface* fepMan = iOwner->FepMan();
       
   633     CPtiEngine* ptiengine = iOwner->PtiEngine();
       
   634 #ifdef RD_INTELLIGENT_TEXT_INPUT
       
   635     CPtiCoreLanguage *lang = static_cast<CPtiCoreLanguage*>( ptiengine->CurrentLanguage() );
       
   636     MPtiKeyMappings* keymapping = lang->GetQwertyKeymappings();
       
   637     if ( keymapping )
       
   638         {
       
   639         TPtiEngineInputMode oldInputMode = ptiengine->InputMode();
       
   640         ptiengine->SetInputMode( EPtiEngineQwertyPredictive );
       
   641         TInt retKey = keymapping->KeyForCharacter( (TUint16)aChar );
       
   642         if(MapAgainst(retKey, EPtiEngineQwertyPredictive, aChar, EPtiCaseLower))
       
   643             {
       
   644             aCase = EPtiCaseLower;
       
   645             }
       
   646         else if(MapAgainst(retKey, EPtiEngineQwertyPredictive, aChar, EPtiCaseUpper))
       
   647             {
       
   648             aCase = EPtiCaseUpper;
       
   649             }
       
   650         else if(MapAgainst(retKey, EPtiEngineQwertyPredictive, aChar, EPtiCaseFnLower))
       
   651             {
       
   652             aCase = EPtiCaseFnLower;
       
   653             }
       
   654         else if(MapAgainst(retKey, EPtiEngineQwertyPredictive, aChar, EPtiCaseFnUpper))
       
   655             {
       
   656             aCase = EPtiCaseFnUpper;
       
   657             }
       
   658         else
       
   659             {
       
   660             }
       
   661         ptiengine->SetInputMode( oldInputMode );
       
   662 #if defined(__WINS__)
       
   663     if (retKey == EPtiKeyQwertyPlus)
       
   664         {
       
   665         retKey = EStdKeyNkpPlus;
       
   666         }
       
   667 #endif
       
   668         return retKey;
       
   669         }
       
   670     return EPtiKeyNone;
       
   671 #else
       
   672     return EPtiKeyNone;
       
   673 #endif // RD_INTELLIGENT_TEXT_INPUT
       
   674     }
   607     
   675     
   608 
   676 
   609 ////////////////////////////////////////////////////////////////////////////////////////////////////////////
   677 ////////////////////////////////////////////////////////////////////////////////////////////////////////////
   610 //
   678 //
   611 TBool TAknFepInputStateEntryQwertyWesternPredictive::HandleNaviKeysL(TInt aKey, TKeyPressLength /*aLength*/)
   679 TBool TAknFepInputStateEntryQwertyWesternPredictive::HandleNaviKeysL(TInt aKey, TKeyPressLength /*aLength*/)