textinput/GSLangPlugin/src/GSLangModel.cpp
branchRCL_3
changeset 12 4eb1ae11334f
parent 0 eb1f2e154e89
child 14 e6a39382bb9c
equal deleted inserted replaced
10:6defe5d1bd39 12:4eb1ae11334f
    53 #include <AknSettingCache.h>
    53 #include <AknSettingCache.h>
    54 
    54 
    55 
    55 
    56 //CONSTANTS
    56 //CONSTANTS
    57 const TInt KGSDiskSpaceLimitForLanguageChange = 300000;
    57 const TInt KGSDiskSpaceLimitForLanguageChange = 300000;
       
    58 
       
    59 const TInt KFepChineseInputModeLength = 10;
    58 
    60 
    59 // ================= MEMBER FUNCTIONS =======================
    61 // ================= MEMBER FUNCTIONS =======================
    60 
    62 
    61 // ----------------------------------------------------------------------------
    63 // ----------------------------------------------------------------------------
    62 // CGSLangModel::NewL
    64 // CGSLangModel::NewL
   839     {
   841     {
   840     if ( FeatureManager::FeatureSupported( KFeatureIdChinese ) )
   842     if ( FeatureManager::FeatureSupported( KFeatureIdChinese ) )
   841         {
   843         {
   842         // fetch the setting value from shared data etc.
   844         // fetch the setting value from shared data etc.
   843         // return the value
   845         // return the value
   844         TInt MethodItem;
   846         TUint MethodItem;
       
   847         _LIT(Kx, "x");
       
   848         // This conversion is needed because KAknFepChineseInputMode cenrep key original type was 16bit int.
       
   849         // now type is changed to string, so that it can accommodate bigger values like EHangul 0x16000. 
       
   850         TBuf<KFepChineseInputModeLength> conversion;
   845         User::LeaveIfError( iAknFepRepository->
   851         User::LeaveIfError( iAknFepRepository->
   846             Get( KAknFepChineseInputMode, MethodItem ) );
   852                     Get( KAknFepChineseInputMode, conversion ) );
       
   853         TInt len = conversion.Find(Kx);
       
   854         TLex lex;
       
   855         
       
   856         if(len)
       
   857             {
       
   858             TPtrC ptr = conversion.Mid(len +1);
       
   859             lex.Assign(ptr);
       
   860             }
       
   861         else
       
   862             {
       
   863             lex.Assign(conversion);
       
   864             }
       
   865         
       
   866         lex.Val(MethodItem, EHex);
   847         return MethodItem;
   867         return MethodItem;
   848         }
   868         }
   849     else
   869     else
   850         {
   870         {
   851         return KErrNotSupported;
   871         return KErrNotSupported;
   861 //
   881 //
   862 void CGSLangModel::SetDefaultInputMethodL( TInt aMethod )
   882 void CGSLangModel::SetDefaultInputMethodL( TInt aMethod )
   863     {
   883     {
   864     if ( FeatureManager::FeatureSupported( KFeatureIdChinese ) )
   884     if ( FeatureManager::FeatureSupported( KFeatureIdChinese ) )
   865         {
   885         {
       
   886         TBuf<KFepChineseInputModeLength> conversion;
       
   887         conversion.Num(aMethod, EHex);
       
   888 
   866         User::LeaveIfError(
   889         User::LeaveIfError(
   867             iAknFepRepository->Set( KAknFepChineseInputMode, aMethod ) );
   890                     iAknFepRepository->Set( KAknFepChineseInputMode, conversion ) );
   868 
   891 
   869         // See if it cannot do predictive text entry
   892         // See if it cannot do predictive text entry
   870         if( !CheckDictionaryFromPtiL( aMethod ) )
   893         if( !CheckDictionaryFromPtiL( aMethod ) )
   871             {
   894             {
   872             SetPredictiveOnOff( EGSLangOther, 0 );
   895             SetPredictiveOnOff( EGSLangOther, 0 );