36 #include <Languages.hrh> |
36 #include <Languages.hrh> |
37 #endif |
37 #endif |
38 #include <AknUtils.h> |
38 #include <AknUtils.h> |
39 #include <e32property.h> |
39 #include <e32property.h> |
40 #include <AknFepInternalCRKeys.h> |
40 #include <AknFepInternalCRKeys.h> |
41 #include <AknFepInternalPSKeys.h> |
|
42 #include <AvkonInternalCRKeys.h> |
41 #include <AvkonInternalCRKeys.h> |
43 |
42 |
44 const TInt KDefaultLanguageGran = 5; |
43 const TInt KDefaultLanguageGran = 5; |
45 const TInt KDefaultLangNamesGran = 40; |
44 const TInt KDefaultLangNamesGran = 40; |
46 const TInt KPhraseSeparator = 0x0020; |
45 const TInt KPhraseSeparator = 0x0020; |
132 const TInt16 KStrokeUnicode = 0x2461; |
131 const TInt16 KStrokeUnicode = 0x2461; |
133 const TInt16 KZhuyinIndicator = 0x2462; |
132 const TInt16 KZhuyinIndicator = 0x2462; |
134 |
133 |
135 // Local method declarations. |
134 // Local method declarations. |
136 LOCAL_C TInt RemapVietnameseAccentedCharacter(TUint16 aChr); |
135 LOCAL_C TInt RemapVietnameseAccentedCharacter(TUint16 aChr); |
137 LOCAL_C TBool IsRegionalLang(TInt aVariantCode, TInt& aMainCode) |
|
138 { |
|
139 TBool ret = ETrue; |
|
140 switch(aVariantCode) |
|
141 { |
|
142 case ELangBrazilianPortuguese: |
|
143 aMainCode = ELangPortuguese; |
|
144 break; |
|
145 case ELangCanadianFrench: |
|
146 aMainCode = ELangFrench; |
|
147 break; |
|
148 case ELangLatinAmericanSpanish: |
|
149 aMainCode = ELangSpanish; |
|
150 break; |
|
151 case ELangEnglish_Taiwan: |
|
152 case ELangEnglish_HongKong: |
|
153 case ELangEnglish_Prc: |
|
154 aMainCode = ELangEnglish; |
|
155 break; |
|
156 default: |
|
157 aMainCode = aVariantCode; |
|
158 ret = EFalse; |
|
159 } |
|
160 return ret; |
|
161 } |
|
162 LOCAL_C TBool AlreadyExistLang(CArrayPtrFlat<CPtiCoreLanguage>* aLangArray, TInt aLangCode) |
|
163 { |
|
164 if (aLangArray) |
|
165 { |
|
166 for (TInt i=0; i < aLangArray->Count(); i++) |
|
167 { |
|
168 if (aLangArray->At(i)->LanguageCode() == aLangCode) |
|
169 { |
|
170 return ETrue; |
|
171 } |
|
172 } |
|
173 } |
|
174 return EFalse; |
|
175 } |
|
176 const TUid KXt9ImplementationUid = {0x102830B9}; |
|
177 |
136 |
178 // |
137 // |
179 // CPtiEngineImpl implementation |
138 // CPtiEngineImpl implementation |
180 // |
139 // |
181 |
140 |
324 } |
283 } |
325 } |
284 } |
326 #endif |
285 #endif |
327 for (TInt i = 0; i < count; i++) |
286 for (TInt i = 0; i < count; i++) |
328 { |
287 { |
329 TInt code = 0; |
|
330 if ((iLanguages->At(i)->LanguageCode() != ELangNumeric) |
288 if ((iLanguages->At(i)->LanguageCode() != ELangNumeric) |
331 #ifdef RD_HINDI_PHONETIC_INPUT |
289 #ifdef RD_HINDI_PHONETIC_INPUT |
332 && (iLanguages->At(i)->LanguageCode() != KLangHindiPhonetic) |
290 && (iLanguages->At(i)->LanguageCode() != KLangHindiPhonetic) |
333 #endif |
291 #endif |
334 ) |
292 ) |
335 { |
293 { |
336 if(IsRegionalLang(iLanguages->At(i)->LanguageCode(),code)) |
294 aResult->AppendL(iLanguages->At(i)->LanguageCode()); |
337 { |
|
338 if(AlreadyExistLang(iLanguages,code)) |
|
339 { |
|
340 continue; |
|
341 } |
|
342 } |
|
343 aResult->AppendL(code); |
|
344 #ifdef RD_HINDI_PHONETIC_INPUT |
295 #ifdef RD_HINDI_PHONETIC_INPUT |
345 if (iLanguages->At(i)->LanguageCode() == ELangHindi && isIndicPhoneticInputPresent) |
296 if (iLanguages->At(i)->LanguageCode() == ELangHindi && isIndicPhoneticInputPresent) |
346 aResult->AppendL(KLangHindiPhonetic); |
297 aResult->AppendL(KLangHindiPhonetic); |
347 #endif |
298 #endif |
348 } |
299 } |
710 else if (!iCurrentLanguage->HasInputMode(aMode)) |
661 else if (!iCurrentLanguage->HasInputMode(aMode)) |
711 { |
662 { |
712 return KErrNoSuitableCore; |
663 return KErrNoSuitableCore; |
713 } |
664 } |
714 } |
665 } |
715 |
666 |
716 if (iInputMode != aMode) |
667 iInputMode = aMode; |
717 { |
|
718 OnInputModeChanged(iInputMode, aMode); |
|
719 iInputMode = aMode; |
|
720 } |
|
721 |
668 |
722 TFileName temp; |
669 TFileName temp; |
723 temp.Copy(iTextBuffer); |
670 temp.Copy(iTextBuffer); |
724 return SetCurrentWord( temp ); |
671 return SetCurrentWord( temp ); |
725 } |
672 } |
726 |
673 |
727 void CPtiEngineImpl::OnInputModeChanged(TPtiEngineInputMode /*aOldMode*/, TPtiEngineInputMode aNewMode) |
|
728 { |
|
729 if (aNewMode == EPtiEngineQwertyPredictive) |
|
730 { |
|
731 HBufC16* oldTextBuf = iTextBuffer.Alloc(); |
|
732 ClearCurrentWord(); |
|
733 if (oldTextBuf) |
|
734 { |
|
735 // why assigned here? eh, I don't want to do that either. |
|
736 // SetCurrentWord will use core(), which will use iInputMode, and |
|
737 // obviously, the core should return the new core, that is why. |
|
738 iInputMode = aNewMode; |
|
739 |
|
740 SetCurrentWord(oldTextBuf->Des()); |
|
741 delete oldTextBuf; |
|
742 } |
|
743 } |
|
744 } |
|
745 |
674 |
746 // --------------------------------------------------------------------------- |
675 // --------------------------------------------------------------------------- |
747 // CPtiEngineImpl::CountToneMarks |
676 // CPtiEngineImpl::CountToneMarks |
748 // |
677 // |
749 // --------------------------------------------------------------------------- |
678 // --------------------------------------------------------------------------- |
1105 |
1034 |
1106 case EPtiEngineStrokeQwerty: |
1035 case EPtiEngineStrokeQwerty: |
1107 case EPtiEngineStrokePhraseHalfQwerty: |
1036 case EPtiEngineStrokePhraseHalfQwerty: |
1108 case EPtiEngineStrokePhraseQwerty: |
1037 case EPtiEngineStrokePhraseQwerty: |
1109 { |
1038 { |
1110 TPtiKeyboardType keyboardType = ActiveKeyboardType(); |
1039 TPtiKeyboardType keyboardType = EPtiKeyboardNone; |
1111 TBool IsStokeKey = EFalse; |
1040 TBool IsStokeKey = EFalse; |
|
1041 TRAP_IGNORE(keyboardType = ActiveKeyboardTypeL()); |
1112 if(EPtiKeyboardQwerty4x10 == keyboardType || |
1042 if(EPtiKeyboardQwerty4x10 == keyboardType || |
1113 EPtiKeyboardQwerty3x11 == keyboardType ) |
1043 EPtiKeyboardQwerty3x11 == keyboardType ) |
1114 { |
1044 { |
1115 TBuf<KMaxName> lowerdata; |
1045 TBuf<KMaxName> lowerdata; |
1116 TInt StrokeUnicodePosition =0; |
1046 TInt StrokeUnicodePosition =0; |
2120 __ASSERT_DEBUG(iCurrentLanguage, User::Panic(KPtiEngineImplPanic, KErrCorrupt)); |
2050 __ASSERT_DEBUG(iCurrentLanguage, User::Panic(KPtiEngineImplPanic, KErrCorrupt)); |
2121 |
2051 |
2122 // Predictive QWERTY (XT9) changes ----> |
2052 // Predictive QWERTY (XT9) changes ----> |
2123 // PtiXt9Core handles the capitalization it self, and it should not be overriden |
2053 // PtiXt9Core handles the capitalization it self, and it should not be overriden |
2124 // byt the PtiEngine. |
2054 // byt the PtiEngine. |
2125 if ( IsCurrentCoreSupportCaseInfo() ) |
2055 if ( iInputMode==EPtiEngineQwertyPredictive ) |
2126 { |
2056 { |
2127 return; |
2057 return; |
2128 } |
2058 } |
2129 // Predictive QWERTY (XT9) changes <---- |
2059 // Predictive QWERTY (XT9) changes <---- |
2130 |
2060 |
2725 // |
2655 // |
2726 // --------------------------------------------------------------------------- |
2656 // --------------------------------------------------------------------------- |
2727 // |
2657 // |
2728 void CPtiEngineImpl::GetModeNameIndexL(TPtiChineseVariant aVariant, RArray<TInt>& aResult) |
2658 void CPtiEngineImpl::GetModeNameIndexL(TPtiChineseVariant aVariant, RArray<TInt>& aResult) |
2729 { |
2659 { |
2730 CleanupClosePushL( aResult ); |
|
2731 TResourceReader reader; |
2660 TResourceReader reader; |
2732 TFileName fileName; |
2661 TFileName fileName; |
2733 |
2662 |
2734 TParse* fp = new(ELeave) TParse(); |
2663 TParse* fp = new(ELeave) TParse(); |
2735 fp->Set(KCEResourceFile, &KDC_RESOURCE_FILES_DIR, NULL); |
2664 fp->Set(KCEResourceFile, &KDC_RESOURCE_FILES_DIR, NULL); |
2955 // |
2883 // |
2956 // --------------------------------------------------------------------------- |
2884 // --------------------------------------------------------------------------- |
2957 // |
2885 // |
2958 void CPtiEngineImpl::GetAvailableLanguagesL(RArray<TInt>& aResult) |
2886 void CPtiEngineImpl::GetAvailableLanguagesL(RArray<TInt>& aResult) |
2959 { |
2887 { |
2960 CleanupClosePushL( aResult ); |
|
2961 aResult.Reset(); |
2888 aResult.Reset(); |
2962 |
2889 |
2963 const TInt count = iLanguages->Count(); |
2890 const TInt count = iLanguages->Count(); |
2964 for (TInt i = 0; i < count; i++) |
2891 for (TInt i = 0; i < count; i++) |
2965 { |
2892 { |
2966 TInt code = 0; |
|
2967 if (iLanguages->At(i)->LanguageCode() != ELangNumeric) |
2893 if (iLanguages->At(i)->LanguageCode() != ELangNumeric) |
2968 { |
2894 { |
2969 if(IsRegionalLang(iLanguages->At(i)->LanguageCode(),code)) |
2895 aResult.AppendL(iLanguages->At(i)->LanguageCode()); |
2970 { |
2896 } |
2971 if(AlreadyExistLang(iLanguages,code)) |
2897 } |
2972 { |
|
2973 continue; |
|
2974 } |
|
2975 } |
|
2976 aResult.AppendL(code); |
|
2977 } |
|
2978 } |
|
2979 CleanupStack::Pop(); |
|
2980 } |
2898 } |
2981 |
2899 |
2982 |
2900 |
2983 // --------------------------------------------------------------------------- |
2901 // --------------------------------------------------------------------------- |
2984 // CPtiEngineImpl::CreateDefaultUserDictionaryFileL |
2902 // CPtiEngineImpl::CreateDefaultUserDictionaryFileL |
3333 void CPtiEngineImpl::NumericModeKeysForQwertyL(TInt aLanguage, |
3251 void CPtiEngineImpl::NumericModeKeysForQwertyL(TInt aLanguage, |
3334 RArray<TPtiNumericKeyBinding>& aResult, |
3252 RArray<TPtiNumericKeyBinding>& aResult, |
3335 TBool aUseExtendedSet, |
3253 TBool aUseExtendedSet, |
3336 TPtiKeyboardType aKeyboardType) |
3254 TPtiKeyboardType aKeyboardType) |
3337 { |
3255 { |
3338 CleanupClosePushL( aResult ); |
|
3339 aResult.Reset(); |
3256 aResult.Reset(); |
3340 TPtiNumericKeyBinding bind; |
3257 TPtiNumericKeyBinding bind; |
3341 |
3258 |
3342 TPtiKeyboardType keyboardType = aKeyboardType; |
3259 TPtiKeyboardType keyboardType = aKeyboardType; |
3343 if (keyboardType == EPtiKeyboardNone) |
3260 if (keyboardType == EPtiKeyboardNone) |
3344 { |
3261 { |
3345 keyboardType = ActiveKeyboardType(); |
3262 keyboardType = ActiveKeyboardTypeL(); |
3346 |
3263 |
3347 if (keyboardType == EPtiKeyboard12Key || |
3264 if (keyboardType == EPtiKeyboard12Key || |
3348 keyboardType == EPtiKeyboardNone) |
3265 keyboardType == EPtiKeyboardNone) |
3349 { |
3266 { |
3350 keyboardType = FindFirstAvailableQwertyKeyboardType(aLanguage); |
3267 keyboardType = FindFirstAvailableQwertyKeyboardType(aLanguage); |
3808 { |
3722 { |
3809 return maps->KeyboardType(); |
3723 return maps->KeyboardType(); |
3810 } |
3724 } |
3811 |
3725 |
3812 return EPtiKeyboardNone;*/ |
3726 return EPtiKeyboardNone;*/ |
3813 TInt keyboardLayout = ActiveKeyboardType(); |
3727 TInt keyboardLayout = 0; |
|
3728 |
|
3729 RProperty::Get(KCRUidAvkon, KAknKeyBoardLayout, keyboardLayout); |
3814 |
3730 |
3815 if (keyboardLayout <= 0 || |
3731 if (keyboardLayout <= 0 || |
3816 keyboardLayout > EPtiKeyboardMaxLayout - 1) |
3732 keyboardLayout > EPtiKeyboardMaxLayout - 1) |
3817 { |
3733 { |
3818 return EPtiKeyboardNone; |
3734 return EPtiKeyboardNone; |
3899 // --------------------------------------------------------------------------- |
3815 // --------------------------------------------------------------------------- |
3900 // |
3816 // |
3901 void CPtiEngineImpl::KeyboardTypesSupportedByLanguageL(TInt aLanguage, |
3817 void CPtiEngineImpl::KeyboardTypesSupportedByLanguageL(TInt aLanguage, |
3902 RArray<TPtiKeyboardType>& aResult) |
3818 RArray<TPtiKeyboardType>& aResult) |
3903 { |
3819 { |
3904 CleanupClosePushL( aResult ); |
|
3905 CPtiCoreLanguage* lang = NULL; |
3820 CPtiCoreLanguage* lang = NULL; |
3906 |
3821 |
3907 if (iCurrentLanguage && iCurrentLanguage->LanguageCode() == aLanguage) |
3822 if (iCurrentLanguage && iCurrentLanguage->LanguageCode() == aLanguage) |
3908 { |
3823 { |
3909 lang = iCurrentLanguage; |
3824 lang = iCurrentLanguage; |
3961 hmaps->KeyMapData()->KeyData(EPtiKeyboardHalfQwerty, tmpSize)) |
3876 hmaps->KeyMapData()->KeyData(EPtiKeyboardHalfQwerty, tmpSize)) |
3962 { |
3877 { |
3963 User::LeaveIfError(aResult.Append(EPtiKeyboardHalfQwerty)); |
3878 User::LeaveIfError(aResult.Append(EPtiKeyboardHalfQwerty)); |
3964 } |
3879 } |
3965 } |
3880 } |
3966 CleanupStack::Pop(); |
|
3967 } |
3881 } |
3968 |
3882 |
3969 |
3883 |
3970 // --------------------------------------------------------------------------- |
3884 // --------------------------------------------------------------------------- |
3971 // CPtiEngineImpl::ActiveKeyboardType |
3885 // CPtiEngineImpl::ActiveKeyboardTypeL |
3972 // |
3886 // |
3973 // --------------------------------------------------------------------------- |
3887 // --------------------------------------------------------------------------- |
3974 // |
3888 // |
3975 TPtiKeyboardType CPtiEngineImpl::ActiveKeyboardType() const |
3889 TPtiKeyboardType CPtiEngineImpl::ActiveKeyboardTypeL() |
3976 { |
3890 { |
3977 TInt keyboardType = EPtiKeyboardNone; |
3891 // Qwerty Keyboard layout |
3978 #ifdef RD_SCALABLE_UI_V2 |
3892 TInt keyboardLayout = 0; |
3979 // Get physical keyboard type |
3893 |
3980 RProperty::Get(KCRUidAvkon, KAknKeyBoardLayout, keyboardType ); |
3894 RProperty::Get(KCRUidAvkon, KAknKeyBoardLayout, keyboardLayout); |
3981 |
3895 |
3982 // When active keyboard is virtual keyboard, |
3896 if (keyboardLayout <= 0 || |
3983 // need to get the active virtual keyboard type |
3897 keyboardLayout > EPtiKeyboardMaxLayout - 1) |
3984 // and set keyboardType again. |
3898 { |
3985 |
3899 return EPtiKeyboardNone; |
3986 // When the default physical keyboard is 0, |
3900 } |
3987 // it means that there is no physical keyboard, |
3901 |
3988 // also need to get the active virtual keyboard type. |
3902 return (TPtiKeyboardType)keyboardLayout; |
3989 TInt isQwertyOn = 0; |
|
3990 RProperty::Get(KCRUidAvkon, KAknQwertyInputModeActive, isQwertyOn); |
|
3991 TInt isVirtualInputActive = 0; |
|
3992 RProperty::Get( KPSUidAknFep, KAknFepTouchInputActive, |
|
3993 isVirtualInputActive ); |
|
3994 if (( isVirtualInputActive > 0 || keyboardType == 0) && !isQwertyOn) |
|
3995 { |
|
3996 // Active keyboard is virtual keyboard |
|
3997 RProperty::Get( KPSUidAknFep, KAknFepVirtualKeyboardType, |
|
3998 keyboardType ); |
|
3999 } |
|
4000 #else |
|
4001 // Get physical keyboard type |
|
4002 RProperty::Get(KCRUidAvkon, KAknKeyBoardLayout, keyboardType ); |
|
4003 #endif |
|
4004 |
|
4005 if ( keyboardType <= 0 || keyboardType >= EPtiKeyboardMaxLayout ) |
|
4006 { |
|
4007 keyboardType = EPtiKeyboardNone; |
|
4008 } |
|
4009 return (TPtiKeyboardType)keyboardType; |
|
4010 } |
3903 } |
|
3904 |
4011 |
3905 |
4012 // --------------------------------------------------------------------------- |
3906 // --------------------------------------------------------------------------- |
4013 // CPtiEngineImpl::GetNumericModeKeysForQwertyL |
3907 // CPtiEngineImpl::GetNumericModeKeysForQwertyL |
4014 // |
3908 // |
4015 // --------------------------------------------------------------------------- |
3909 // --------------------------------------------------------------------------- |