textinput/ptienginev2/src/PtiEngineImpl.cpp
branchRCL_3
changeset 9 e6a39382bb9c
parent 8 4eb1ae11334f
child 11 c8fb4cf7b3ae
equal deleted inserted replaced
8:4eb1ae11334f 9:e6a39382bb9c
   132 const TInt16 KStrokeUnicode = 0x2461;
   132 const TInt16 KStrokeUnicode = 0x2461;
   133 const TInt16 KZhuyinIndicator = 0x2462;
   133 const TInt16 KZhuyinIndicator = 0x2462;
   134 
   134 
   135 // Local method declarations.
   135 // Local method declarations.
   136 LOCAL_C TInt RemapVietnameseAccentedCharacter(TUint16 aChr);
   136 LOCAL_C TInt RemapVietnameseAccentedCharacter(TUint16 aChr);
       
   137 const TUid KXt9ImplementationUid = {0x102830B9};
   137 	
   138 	
   138 //
   139 //
   139 // CPtiEngineImpl implementation
   140 // CPtiEngineImpl implementation
   140 //
   141 //
   141 
   142 
  2050 	__ASSERT_DEBUG(iCurrentLanguage, User::Panic(KPtiEngineImplPanic, KErrCorrupt));
  2051 	__ASSERT_DEBUG(iCurrentLanguage, User::Panic(KPtiEngineImplPanic, KErrCorrupt));
  2051 	
  2052 	
  2052 	// Predictive QWERTY (XT9) changes ---->
  2053 	// Predictive QWERTY (XT9) changes ---->
  2053 	// PtiXt9Core handles the capitalization it self, and it should not be overriden 
  2054 	// PtiXt9Core handles the capitalization it self, and it should not be overriden 
  2054 	// byt the PtiEngine.
  2055 	// byt the PtiEngine.
  2055 	if ( iInputMode==EPtiEngineQwertyPredictive )
  2056 	if ( IsCurrentCoreSupportCaseInfo() )
  2056 	    {
  2057 	    {
  2057 	    return;
  2058 	    return;
  2058 	    }
  2059 	    }
  2059 	// Predictive QWERTY (XT9) changes <----
  2060 	// Predictive QWERTY (XT9) changes <----
  2060 	
  2061 	
  2655 // 
  2656 // 
  2656 // ---------------------------------------------------------------------------
  2657 // ---------------------------------------------------------------------------
  2657 //
  2658 //
  2658 void CPtiEngineImpl::GetModeNameIndexL(TPtiChineseVariant aVariant, RArray<TInt>& aResult)
  2659 void CPtiEngineImpl::GetModeNameIndexL(TPtiChineseVariant aVariant, RArray<TInt>& aResult)
  2659 	{
  2660 	{
       
  2661 	CleanupClosePushL( aResult );
  2660 	TResourceReader reader;	
  2662 	TResourceReader reader;	
  2661 	TFileName fileName;
  2663 	TFileName fileName;
  2662 
  2664 
  2663 	TParse* fp = new(ELeave) TParse(); 
  2665 	TParse* fp = new(ELeave) TParse(); 
  2664 	fp->Set(KCEResourceFile, &KDC_RESOURCE_FILES_DIR, NULL); 
  2666 	fp->Set(KCEResourceFile, &KDC_RESOURCE_FILES_DIR, NULL); 
  2701 			User::LeaveIfError(aResult.Append(value));
  2703 			User::LeaveIfError(aResult.Append(value));
  2702 			}
  2704 			}
  2703 		}
  2705 		}
  2704 
  2706 
  2705 	CleanupStack::PopAndDestroy(3);   // fsSession, rsFile, rBuffer
  2707 	CleanupStack::PopAndDestroy(3);   // fsSession, rsFile, rBuffer
       
  2708     CleanupStack::Pop();
  2706 	}
  2709 	}
  2707 
  2710 
  2708 
  2711 
  2709 // ---------------------------------------------------------------------------
  2712 // ---------------------------------------------------------------------------
  2710 // CPtiEngineImpl::IsValidKey
  2713 // CPtiEngineImpl::IsValidKey
  2883 // 
  2886 // 
  2884 // ---------------------------------------------------------------------------
  2887 // ---------------------------------------------------------------------------
  2885 //	
  2888 //	
  2886 void CPtiEngineImpl::GetAvailableLanguagesL(RArray<TInt>& aResult)
  2889 void CPtiEngineImpl::GetAvailableLanguagesL(RArray<TInt>& aResult)
  2887 	{
  2890 	{
       
  2891 	CleanupClosePushL( aResult ); 
  2888 	aResult.Reset();
  2892 	aResult.Reset();
  2889 	
  2893 	
  2890 	const TInt count = iLanguages->Count();
  2894 	const TInt count = iLanguages->Count();
  2891 	for (TInt i = 0; i < count; i++)
  2895 	for (TInt i = 0; i < count; i++)
  2892 		{
  2896 		{
  2893 		if (iLanguages->At(i)->LanguageCode() != ELangNumeric)
  2897 		if (iLanguages->At(i)->LanguageCode() != ELangNumeric)
  2894 			{
  2898 			{
  2895 			aResult.AppendL(iLanguages->At(i)->LanguageCode());
  2899 			aResult.AppendL(iLanguages->At(i)->LanguageCode());
  2896 			}
  2900 			}
  2897 		}	
  2901 		}	
       
  2902     CleanupStack::Pop();
  2898 	}
  2903 	}
  2899 
  2904 
  2900 
  2905 
  2901 // ---------------------------------------------------------------------------
  2906 // ---------------------------------------------------------------------------
  2902 // CPtiEngineImpl::CreateDefaultUserDictionaryFileL
  2907 // CPtiEngineImpl::CreateDefaultUserDictionaryFileL
  3251 void CPtiEngineImpl::NumericModeKeysForQwertyL(TInt aLanguage,
  3256 void CPtiEngineImpl::NumericModeKeysForQwertyL(TInt aLanguage,
  3252                                                RArray<TPtiNumericKeyBinding>& aResult,
  3257                                                RArray<TPtiNumericKeyBinding>& aResult,
  3253                                                TBool aUseExtendedSet,
  3258                                                TBool aUseExtendedSet,
  3254                                                TPtiKeyboardType aKeyboardType)
  3259                                                TPtiKeyboardType aKeyboardType)
  3255 	{
  3260 	{
       
  3261 	CleanupClosePushL( aResult );
  3256 	aResult.Reset();		
  3262 	aResult.Reset();		
  3257 	TPtiNumericKeyBinding bind;		
  3263 	TPtiNumericKeyBinding bind;		
  3258 	
  3264 	
  3259 	TPtiKeyboardType keyboardType = aKeyboardType;
  3265 	TPtiKeyboardType keyboardType = aKeyboardType;
  3260 	if (keyboardType == EPtiKeyboardNone)
  3266 	if (keyboardType == EPtiKeyboardNone)
  3269 	    }		 
  3275 	    }		 
  3270 	
  3276 	
  3271 	if (keyboardType == EPtiKeyboard12Key ||
  3277 	if (keyboardType == EPtiKeyboard12Key ||
  3272 	    keyboardType == EPtiKeyboardNone)
  3278 	    keyboardType == EPtiKeyboardNone)
  3273 	    {
  3279 	    {
       
  3280 		CleanupStack::Pop();
  3274 	    // No qwerty data available, can't go on.
  3281 	    // No qwerty data available, can't go on.
  3275 	    return;
  3282 	    return;
  3276 	    }
  3283 	    }
  3277 	
  3284 	
  3278 	if (aLanguage == ELangJapanese)	
  3285 	if (aLanguage == ELangJapanese)	
  3287 		for (TInt i = 0; i < count; i++)
  3294 		for (TInt i = 0; i < count; i++)
  3288 			{
  3295 			{
  3289 			bind = NumericModeKeysForNonLatinNumberLanguages[i];
  3296 			bind = NumericModeKeysForNonLatinNumberLanguages[i];
  3290 			User::LeaveIfError(aResult.Append(bind));		
  3297 			User::LeaveIfError(aResult.Append(bind));		
  3291 			}	
  3298 			}	
       
  3299 		CleanupStack::Pop();
  3292 		
  3300 		
  3293 		return;			
  3301 		return;			
  3294 		}
  3302 		}
  3295 		
  3303 		
  3296     TPtiEngineInputMode mode = EPtiEngineQwerty;
  3304     TPtiEngineInputMode mode = EPtiEngineQwerty;
  3370                 {
  3378                 {
  3371                 qmappings->SetKeyboardType(origKeyb);
  3379                 qmappings->SetKeyboardType(origKeyb);
  3372                 }				
  3380                 }				
  3373 			}			      
  3381 			}			      
  3374 		}		
  3382 		}		
       
  3383 	CleanupStack::Pop();
  3375 	}	
  3384 	}	
  3376 	
  3385 	
  3377 	
  3386 	
  3378 // ---------------------------------------------------------------------------
  3387 // ---------------------------------------------------------------------------
  3379 // CPtiEngineImpl::GetNumericModeKeysForQwertyL
  3388 // CPtiEngineImpl::GetNumericModeKeysForQwertyL
  3813 // ---------------------------------------------------------------------------
  3822 // ---------------------------------------------------------------------------
  3814 //
  3823 //
  3815 void CPtiEngineImpl::KeyboardTypesSupportedByLanguageL(TInt aLanguage,
  3824 void CPtiEngineImpl::KeyboardTypesSupportedByLanguageL(TInt aLanguage,
  3816                                                        RArray<TPtiKeyboardType>& aResult)
  3825                                                        RArray<TPtiKeyboardType>& aResult)
  3817     {
  3826     {
       
  3827 	CleanupClosePushL( aResult );
  3818     CPtiCoreLanguage* lang = NULL;
  3828     CPtiCoreLanguage* lang = NULL;
  3819     
  3829     
  3820     if (iCurrentLanguage && iCurrentLanguage->LanguageCode() == aLanguage)
  3830     if (iCurrentLanguage && iCurrentLanguage->LanguageCode() == aLanguage)
  3821         {
  3831         {
  3822         lang = iCurrentLanguage;
  3832         lang = iCurrentLanguage;
  3874             hmaps->KeyMapData()->KeyData(EPtiKeyboardHalfQwerty, tmpSize))
  3884             hmaps->KeyMapData()->KeyData(EPtiKeyboardHalfQwerty, tmpSize))
  3875             {
  3885             {
  3876             User::LeaveIfError(aResult.Append(EPtiKeyboardHalfQwerty));
  3886             User::LeaveIfError(aResult.Append(EPtiKeyboardHalfQwerty));
  3877             }            
  3887             }            
  3878         }                
  3888         }                
       
  3889     CleanupStack::Pop();
  3879     }
  3890     }
  3880 
  3891 
  3881 
  3892 
  3882 // ---------------------------------------------------------------------------
  3893 // ---------------------------------------------------------------------------
  3883 // CPtiEngineImpl::ActiveKeyboardType
  3894 // CPtiEngineImpl::ActiveKeyboardType
  3905 		{
  3916 		{
  3906 		// Active keyboard is virtual keyboard          
  3917 		// Active keyboard is virtual keyboard          
  3907 		RProperty::Get( KPSUidAknFep, KAknFepVirtualKeyboardType, 
  3918 		RProperty::Get( KPSUidAknFep, KAknFepVirtualKeyboardType, 
  3908 						keyboardType );      
  3919 						keyboardType );      
  3909 		}
  3920 		}
  3910 #else if
  3921 #else
  3911 	// Get physical keyboard type
  3922 	// Get physical keyboard type
  3912 	RProperty::Get(KCRUidAvkon, KAknKeyBoardLayout, keyboardType );	    
  3923 	RProperty::Get(KCRUidAvkon, KAknKeyBoardLayout, keyboardType );	    
  3913 #endif
  3924 #endif
  3914 
  3925 
  3915 	if ( keyboardType <= 0 || keyboardType >= EPtiKeyboardMaxLayout )
  3926 	if ( keyboardType <= 0 || keyboardType >= EPtiKeyboardMaxLayout )
  4227                 
  4238                 
  4228         return err;    
  4239         return err;    
  4229     
  4240     
  4230     }
  4241     }
  4231 #endif //FF_DUAL_LANGUAGE_SUPPORT
  4242 #endif //FF_DUAL_LANGUAGE_SUPPORT
       
  4243 TBool CPtiEngineImpl::IsCurrentCoreSupportCaseInfo()
       
  4244     {
       
  4245     if ( Core() )
       
  4246         {
       
  4247         if ( Core()->GetCoreInfo()->Uid() == KXt9ImplementationUid.iUid )
       
  4248             {
       
  4249             return ETrue;
       
  4250             }
       
  4251         }
       
  4252     return EFalse;
       
  4253     }
  4232 // End of file
  4254 // End of file
  4233 
  4255