|
1 /* |
|
2 * Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0"" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * Provides the TAknFepInputStateQwerty methods. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 #include "AknFepUiInputStateQwerty.h" |
|
31 #include "AknFepUIManagerStateInterface.h" //MAknFepUIManagerStateInterface |
|
32 #include "AknFepManagerUIInterface.h" //MAknFepManagerUIInterface |
|
33 #include "AknFepCaseManager.h" |
|
34 #include "AknFepUiIndicInputManager.h" |
|
35 |
|
36 |
|
37 #include <PtiEngine.h> |
|
38 #include <PtiDefs.h> |
|
39 #include <PtiKeyMappings.h> |
|
40 #include <PtiDefs.h> |
|
41 #include <centralrepository.h> |
|
42 #include <AknFepInternalCRKeys.h> |
|
43 #ifdef RD_HINDI_PHONETIC_INPUT |
|
44 #include <PtiIndicDefs.h> |
|
45 #endif |
|
46 const TInt KEventIndexForW = 3; |
|
47 const TInt KEventIndexForP = 2; |
|
48 const TInt KPtiCapitalEIndex = 19; |
|
49 const TInt KPtiStarIndex = 0; |
|
50 const TInt KPtiPlusIndex = 1; |
|
51 const TInt KPtiMinusIndex = 18; |
|
52 const TInt KPtiCommaIndex = 17; |
|
53 const TInt KPtiHashIndex = 4; |
|
54 const TInt KMaxOutputSizeForAKeyPress = 10; |
|
55 |
|
56 _LIT(KAknFepPlainNumbers, "1234567890"); |
|
57 const TInt KNumAllowedIdleNumericChars = 22; |
|
58 const TUint16 KAllAllowedNumericChars[] = |
|
59 {'*','+','p','w','#','1','2','3','4','5','6','7','8','9','0', ';','.',',','-','E','?','/'}; |
|
60 const TKeyEvent KEventsForSecondPass[] = |
|
61 { |
|
62 {42, EStdKeyNkpAsterisk, 3, 0}, |
|
63 {43, EStdKeyNkpPlus, 3, 0}, |
|
64 {112, 80, EModifierAutorepeatable, 0}, |
|
65 {119, 87, EModifierAutorepeatable, 0}, |
|
66 {35, EStdKeyHash, EModifierAutorepeatable, 0}, |
|
67 {EPtiKey1, EPtiKey1, EModifierAutorepeatable, 0}, |
|
68 {EPtiKey2, EPtiKey2, EModifierAutorepeatable, 0}, |
|
69 {EPtiKey3, EPtiKey3, EModifierAutorepeatable, 0}, |
|
70 {EPtiKey4, EPtiKey4, EModifierAutorepeatable, 0}, |
|
71 {EPtiKey5, EPtiKey5, EModifierAutorepeatable, 0}, |
|
72 {EPtiKey6, EPtiKey6, EModifierAutorepeatable, 0}, |
|
73 {EPtiKey7, EPtiKey7, EModifierAutorepeatable, 0}, |
|
74 {EPtiKey8, EPtiKey8, EModifierAutorepeatable, 0}, |
|
75 {EPtiKey9, EPtiKey9, EModifierAutorepeatable, 0}, |
|
76 {EPtiKey0, EPtiKey0, EModifierAutorepeatable, 0}, |
|
77 {59, EStdKeySemiColon, EModifierAutorepeatable, 0}, |
|
78 {46, 122, EModifierAutorepeatable, 0}, |
|
79 {44, 121, EModifierAutorepeatable, 0}, |
|
80 {45, 130, EModifierAutorepeatable, 0}, |
|
81 {101, 69, EModifierAutorepeatable|EModifierLeftShift, 0}, |
|
82 {63, EStdKeyForwardSlash, EModifierAutorepeatable|EModifierLeftShift, 0}, |
|
83 {47, 123, EModifierAutorepeatable, 0} |
|
84 }; |
|
85 |
|
86 const TInt KFull_SimpleSymbolMapNumber = 8; |
|
87 const TUint16 KFull_SimpleSymbolMaps[KFull_SimpleSymbolMapNumber][2] = |
|
88 { {0xFF0A,'*'},{0xFF0B,'+'},{0xFF0D,'-'},{0xFF03,'#'}, |
|
89 {0xFF1B,';'},{0xFF0E,'.'},{0xFF0C,','},{0x3002, '.'}}; |
|
90 |
|
91 const TInt KNumCharKeyExceptions = 14; |
|
92 const TUint16 CharKeyExceptions[] = {0x00f2, 0x00e0, 0x00e8, 0x00e9, 0x00e7, 0x00f9, |
|
93 0x0161, 0x010d, 0x017e, 0x00fd, 0x00e1, 0x00ed, |
|
94 0x00e9, 0x00ec}; |
|
95 |
|
96 TAknFepInputStateQwerty::TAknFepInputStateQwerty(MAknFepUIManagerStateInterface* aOwner) |
|
97 :TAknFepInputStateBase(aOwner) |
|
98 { |
|
99 iState = EInitial; |
|
100 CPtiEngine* ptiengine = iOwner->PtiEngine(); |
|
101 #ifdef RD_INTELLIGENT_TEXT_INPUT |
|
102 // Predictive QWERTY (XT9) changes ----> |
|
103 // The order of the following two commands has been swapped. This way the Xt9 core will keep its |
|
104 // internal state while a dialog with no prediction is opened on top (like the "Edit word" query). |
|
105 ptiengine->SetInputMode(EPtiEngineQwerty); |
|
106 ptiengine->ClearCurrentWord(); |
|
107 // Predictive QWERTY (XT9) changes <---- |
|
108 |
|
109 MAknFepManagerUIInterface *fepMan = iOwner->FepMan(); |
|
110 TPtiKeyboardType keyLayout = fepMan->KeyboardLayout(); |
|
111 ptiengine->SetKeyboardType(keyLayout); |
|
112 if (keyLayout == EPtiKeyboardHalfQwerty) |
|
113 { |
|
114 ptiengine->SetInputMode(EPtiEngineHalfQwerty); |
|
115 } |
|
116 #else |
|
117 ptiengine->ClearCurrentWord(); |
|
118 ptiengine->SetInputMode(EPtiEngineQwerty); |
|
119 #endif //RD_INTELLIGENT_TEXT_INPUT |
|
120 } |
|
121 |
|
122 TBool TAknFepInputStateQwerty::HandleKeyL(TInt aKey, TKeyPressLength aLength) |
|
123 { |
|
124 TBool ret = EFalse; |
|
125 CPtiEngine* ptiengine = iOwner->PtiEngine(); |
|
126 #ifdef RD_INTELLIGENT_TEXT_INPUT |
|
127 MAknFepManagerUIInterface* fepMan = iOwner->FepMan(); |
|
128 CAknFepFnKeyManager::TFnKeyState fnKeyState = fepMan->FnKeyState(); |
|
129 #endif |
|
130 const TInt KDeleteKeyScanCode = 1; |
|
131 |
|
132 if (aKey == KDeleteKeyScanCode |
|
133 #ifdef RD_INTELLIGENT_TEXT_INPUT |
|
134 || CAknFepFnKeyManager::EFnKeyNone != fnKeyState |
|
135 #endif |
|
136 ) |
|
137 { |
|
138 // Pending dead key is handled as a special case. |
|
139 if (ptiengine->HandleCommandL(EPtiCommandDeadKeyWaiting, NULL) == 1) |
|
140 { |
|
141 ptiengine->HandleCommandL(EPtiCommandGetAndClearDeadKeyRootChar, NULL); |
|
142 return ETrue; |
|
143 } |
|
144 if (iFakeDelete) |
|
145 { |
|
146 ptiengine->HandleCommandL(EPtiCommandClearVowelSeq, NULL); |
|
147 ptiengine->HandleCommandL(EPtiCommandGetAndClearLastVietnameseChar, NULL); |
|
148 } |
|
149 else |
|
150 { |
|
151 ptiengine->HandleCommandL(EPtiCommandResetVietnameseVowelSeqAndToneMark, NULL); |
|
152 } |
|
153 } |
|
154 else if (aKey == EPtiKeyQwertySpace |
|
155 #ifdef RD_INTELLIGENT_TEXT_INPUT |
|
156 && (fnKeyState == CAknFepFnKeyManager::EFnKeyNone) |
|
157 #endif |
|
158 ) |
|
159 { |
|
160 // Space clears vietnamese vowels and tones. |
|
161 ptiengine->HandleCommandL(EPtiCommandResetVietnameseVowelSeqAndToneMark, NULL); |
|
162 } |
|
163 if( aLength == ELongKeyPress ) |
|
164 { |
|
165 // the vowel seq tone mark of the short key press should be reset |
|
166 ptiengine->HandleCommandL(EPtiCommandResetVietnameseVowelSeqAndToneMark, NULL); |
|
167 } |
|
168 iFakeDelete = EFalse; |
|
169 iCharKeyException = EFalse; |
|
170 |
|
171 #ifdef RD_INTELLIGENT_TEXT_INPUT |
|
172 CPtiCoreLanguage* langCur = static_cast<CPtiCoreLanguage*>(ptiengine->CurrentLanguage()); |
|
173 TBool chinese = EFalse; |
|
174 if(langCur->LanguageCode()==ELangPrcChinese || |
|
175 langCur->LanguageCode()==ELangHongKongChinese || |
|
176 langCur->LanguageCode()==ELangTaiwanChinese ) |
|
177 { |
|
178 chinese = ETrue; |
|
179 } |
|
180 if (chinese && fepMan->IsOnlyNumericPermitted()) |
|
181 { |
|
182 ptiengine->ActivateLanguageL(ELangEnglish); |
|
183 ptiengine->SetInputMode(EPtiEngineQwerty); |
|
184 ptiengine->SetKeyboardType( iOwner->FepMan()->KeyboardLayout()); |
|
185 } |
|
186 const TBool isQwertyKey = ptiengine->IsValidKey((TPtiKey)aKey); |
|
187 #else |
|
188 const TBool isQwertyKey = IsQwertyKey(aKey); |
|
189 #endif |
|
190 |
|
191 #ifdef RD_INTELLIGENT_TEXT_INPUT |
|
192 if (aKey == EStdKeyEnter) |
|
193 { |
|
194 fepMan->SimulateKeyEventL(EKeyF19); // Asynchronous case update. |
|
195 } |
|
196 #endif |
|
197 |
|
198 if ( !isQwertyKey ) |
|
199 { |
|
200 return EFalse; |
|
201 } |
|
202 #ifndef RD_INTELLIGENT_TEXT_INPUT |
|
203 MAknFepManagerUIInterface* fepMan = iOwner->FepMan(); |
|
204 #endif |
|
205 CAknFepCaseManager* caseMan = iOwner->CaseMan(); |
|
206 |
|
207 fepMan->ClearFlag(CAknFepManager::EFlagNoActionDuringShiftKeyPress); |
|
208 |
|
209 #ifdef RD_INTELLIGENT_TEXT_INPUT |
|
210 #ifdef __REVERSE_FN_KEY_SUPPORTED |
|
211 //Reverse Fn key mapping needs to be checked. |
|
212 if ( fepMan->IsOnlyNumericPermitted() && !fepMan->IsReverseFnkeyInput()) |
|
213 #else |
|
214 if ( fepMan->IsOnlyNumericPermitted() ) |
|
215 #endif //__REVERSE_FN_KEY_SUPPORTED |
|
216 { |
|
217 if ((fnKeyState == CAknFepFnKeyManager::EFnKeyNone) && |
|
218 (aKey == EStdKeySpace || aKey == EStdKeyEnter)) |
|
219 #else |
|
220 if ( fepMan->IsOnlyNumericPermitted() ) |
|
221 { |
|
222 if (aKey == EStdKeyEnter) |
|
223 { |
|
224 return EFalse; |
|
225 } |
|
226 if (aKey == EStdKeySpace) |
|
227 #endif |
|
228 { |
|
229 return ETrue; |
|
230 } |
|
231 |
|
232 return CheckForValidNumberEntryForqwerty(aKey); |
|
233 } |
|
234 |
|
235 if (fepMan->IsFlagSet(CAknFepManager::EFlagQwertyChrKeyDepressed) && |
|
236 iData && (iData != aKey) ) |
|
237 { |
|
238 // Chr key is still pressed down but character key was changed from previous one |
|
239 // to new one. The previous character is committed to the editor and we continue |
|
240 // prosessing new key. |
|
241 fepMan->CommitInlineEditL(); |
|
242 ptiengine->ClearCurrentWord(); |
|
243 iData = 0; |
|
244 caseMan->UpdateCase(ENullNaviEvent); |
|
245 } |
|
246 |
|
247 TBool isCharacter = ETrue; |
|
248 if (!iData) |
|
249 { |
|
250 isCharacter = IsCharacterKey(aKey); |
|
251 } |
|
252 |
|
253 HandleCaseChange(aKey, isCharacter); |
|
254 |
|
255 #ifdef RD_INTELLIGENT_TEXT_INPUT |
|
256 #ifdef __REVERSE_FN_KEY_SUPPORTED |
|
257 |
|
258 TInt origLanguage = ptiengine->CurrentLanguage()->LanguageCode(); |
|
259 TPtiEngineInputMode origInputMode = ptiengine->InputMode(); |
|
260 TBool languageChanged = EFalse; |
|
261 // In reverse fn key mapping filter the char applicable for |
|
262 // Numeric editor. |
|
263 if( fepMan->IsOnlyNumericPermitted() && fepMan->IsReverseFnkeyInput()) |
|
264 { |
|
265 if( !fepMan->IsValidCharForNumericInFnReverseL(aKey, iOwner->PtiEngine()->Case()) ) |
|
266 { |
|
267 TChar chr; |
|
268 |
|
269 if( ! TryGetValidCharForKey(aKey, chr) ) |
|
270 { |
|
271 // If the key in not valid char in the current input language in Fn reverse mode, |
|
272 // then we will check if against English language. And if its valid then we will |
|
273 // insert the char based out of key for English input language and revert back |
|
274 // the change in input language at the end. |
|
275 |
|
276 if(ptiengine->CurrentLanguage()->LanguageCode() == ELangEnglish) |
|
277 { |
|
278 return ETrue; |
|
279 } |
|
280 |
|
281 languageChanged = ETrue; |
|
282 ptiengine->ActivateLanguageL(ELangEnglish); |
|
283 ptiengine->SetInputMode(EPtiEngineQwerty); |
|
284 |
|
285 if( !fepMan->IsValidCharForNumericInFnReverseL(aKey, iOwner->PtiEngine()->Case()) ) |
|
286 { |
|
287 if( ! TryGetValidCharForKey(aKey, chr) ) |
|
288 { |
|
289 ptiengine->ActivateLanguageL(origLanguage); |
|
290 ptiengine->SetInputMode(origInputMode ); |
|
291 |
|
292 return ETrue; |
|
293 } |
|
294 else |
|
295 { |
|
296 if(languageChanged) |
|
297 { |
|
298 ptiengine->ActivateLanguageL(origLanguage); |
|
299 ptiengine->SetInputMode(origInputMode ); |
|
300 } |
|
301 |
|
302 TBuf<1> buf; |
|
303 buf.Append(chr); |
|
304 fepMan->NewCharacterL(buf); |
|
305 fepMan->CommitInlineEditL(); |
|
306 ptiengine->ClearCurrentWord(); |
|
307 iData = 0; |
|
308 ptiengine->CancelTimerActivity(); |
|
309 return ETrue; |
|
310 } |
|
311 } |
|
312 } |
|
313 else |
|
314 { |
|
315 if(languageChanged) |
|
316 { |
|
317 ptiengine->ActivateLanguageL(origLanguage); |
|
318 ptiengine->SetInputMode(origInputMode ); |
|
319 } |
|
320 |
|
321 TBuf<1> buf; |
|
322 buf.Append(chr); |
|
323 fepMan->NewCharacterL(buf); |
|
324 fepMan->CommitInlineEditL(); |
|
325 ptiengine->ClearCurrentWord(); |
|
326 iData = 0; |
|
327 ptiengine->CancelTimerActivity(); |
|
328 return ETrue; |
|
329 } |
|
330 } |
|
331 } |
|
332 |
|
333 #endif //__REVERSE_FN_KEY_SUPPORTED |
|
334 #endif //RD_INTELLIGENT_TEXT_INPUT |
|
335 |
|
336 iData = aKey; |
|
337 |
|
338 TBool keyEventHandledByFep = ETrue; |
|
339 TInt languageCode = 0; |
|
340 MPtiLanguage* curlang = ptiengine->CurrentLanguage(); |
|
341 if (curlang) |
|
342 { |
|
343 languageCode = curlang->LanguageCode(); |
|
344 } |
|
345 |
|
346 TBuf<KMaxOutputSizeForAKeyPress> filtered; |
|
347 if ( keyEventHandledByFep && |
|
348 (isCharacter || isQwertyKey) ) |
|
349 { |
|
350 TPtrC text; |
|
351 #ifdef RD_INTELLIGENT_TEXT_INPUT |
|
352 #ifdef __ITI_LONGPRESS_NUM_SHIFT_COPYPASTE__ |
|
353 TBool fnCaseActive = (ptiengine->Case()==EPtiCaseFnLower || ptiengine->Case()==EPtiCaseFnUpper); |
|
354 if (aKey == EStdKeySpace && !fnCaseActive /*(fnKeyState == CAknFepFnKeyManager::EFnKeyNone)*/) |
|
355 |
|
356 #else |
|
357 if (aKey == EStdKeySpace && (fnKeyState == CAknFepFnKeyManager::EFnKeyNone)) |
|
358 #endif // __ITI_LONGPRESS_NUM_SHIFT_COPYPASTE__ |
|
359 #else |
|
360 if (aKey == EStdKeySpace) |
|
361 #endif |
|
362 { |
|
363 // PtiEngine does not have mapping for the space key. |
|
364 TUint16 deadRoot = ptiengine->HandleCommandL(EPtiCommandGetAndClearDeadKeyRootChar); |
|
365 if (deadRoot) |
|
366 { |
|
367 // There was a dead key press waiting. Space will cancel it and |
|
368 // insert the root char. |
|
369 TBuf<1> dbuf; |
|
370 dbuf.Append(deadRoot); |
|
371 text.Set(dbuf); |
|
372 } |
|
373 else |
|
374 { |
|
375 _LIT(KSpaceCharacter, " "); |
|
376 text.Set(KSpaceCharacter); |
|
377 } |
|
378 } |
|
379 else if (aKey == EStdKeyEnter) |
|
380 { |
|
381 // PtiEngine does not have mapping for the enter key. |
|
382 const TText KAknFEPLineFeedSymbol = 0x21B2; |
|
383 TBuf<1> lineFeed; |
|
384 lineFeed.Zero(); |
|
385 lineFeed.Append(KAknFEPLineFeedSymbol); |
|
386 text.Set(lineFeed); |
|
387 } |
|
388 else |
|
389 { |
|
390 TPtiTextCase CurCase = ptiengine->Case(); |
|
391 if(fepMan->IsHybridAplhaEditor() && !fepMan->IsHybridAlphaModeChangedtoAplhanumeric()) |
|
392 { |
|
393 if(CheckForValidNumberEntryForqwerty(aKey)) |
|
394 ptiengine->SetCase((TPtiTextCase)EPtiCaseFnLower); |
|
395 else |
|
396 ptiengine->SetCase((TPtiTextCase)EPtiCaseLower); |
|
397 } |
|
398 // Get keymapping from PtiEngine. |
|
399 text.Set(ptiengine->AppendKeyPress((TPtiKey)aKey)); |
|
400 // Handle all exception cases. |
|
401 CustomFilter(text, filtered, languageCode, caseMan->CurrentCase(), |
|
402 ( fepMan->IsFlagSet(CAknFepManager::EFlagQwertyShiftMode)|| |
|
403 fepMan->IsFlagSet(CAknFepManager::EFlagLongShiftKeyPress))); |
|
404 text.Set(filtered); |
|
405 #ifdef RD_INTELLIGENT_TEXT_INPUT |
|
406 SetShortKeyPressText(text); |
|
407 if( text.Length() == 0 ) // no mapping available |
|
408 { |
|
409 if( ( EStdKeySpace == aKey || EKeySpace == aKey )) |
|
410 { |
|
411 // Launching the Edit menu on press of Fn key and space |
|
412 if(fnKeyState == CAknFepFnKeyManager::EFnKeyDown) |
|
413 fepMan->LaunchSelectModeMenuL(); |
|
414 else |
|
415 { |
|
416 // Editor should insert space when function key is in |
|
417 // locked state and space key is pressed. |
|
418 _LIT(KSpaceCharacter, " "); |
|
419 text.Set(KSpaceCharacter); |
|
420 } |
|
421 } |
|
422 } |
|
423 #endif |
|
424 if(fepMan->IsHybridAplhaEditor() && !fepMan->IsHybridAlphaModeChangedtoAplhanumeric()) |
|
425 ptiengine->SetCase(CurCase); |
|
426 } |
|
427 |
|
428 TBuf<5> replacedText; |
|
429 if (text.Length()) |
|
430 { |
|
431 MPtiLanguage* lang = ptiengine->CurrentLanguage(); |
|
432 if (lang->LanguageCode() == ELangVietnamese) |
|
433 { |
|
434 if (ptiengine->HandleCommandL(EPtiCommandGetAndClearVowelSequence, NULL) > 0) |
|
435 { |
|
436 // This key press produced Vietnamese vowel sequence. |
|
437 // Delete previous char, it will be replaced with accented char. |
|
438 // This is done by sending delete event before accented character is |
|
439 // added to buffer. |
|
440 TInt lastChar = ptiengine->HandleCommandL(EPtiCommandGetAndClearLastVietnameseChar, |
|
441 NULL); |
|
442 iFakeDelete = ETrue; |
|
443 TKeyEvent delKey = {8, EStdKeyBackspace, 1, 0}; |
|
444 CCoeEnv::Static()->SimulateKeyEventL(delKey, EEventKey); |
|
445 // Restore last char. |
|
446 ptiengine->HandleCommandL(EPtiCommandSetVietnameseLastChar, (TAny*)lastChar); |
|
447 } |
|
448 else |
|
449 { |
|
450 TUint16 replaced = ptiengine->HandleCommandL(EPtiCommandQueryReplacePrevious, NULL); |
|
451 if (replaced) |
|
452 { |
|
453 // Remember last key press, since delete will destroy it. |
|
454 TInt last = ptiengine->HandleCommandL(EPtiCommandGetVietnameseLastKey, NULL); |
|
455 if(!fepMan->IsFlagSet(CAknFepManager::EFlagQwertyChrKeyDepressed)) |
|
456 iFakeDelete = ETrue; |
|
457 TKeyEvent delKey = {8, EStdKeyBackspace, 1, 0}; |
|
458 CCoeEnv::Static()->SimulateKeyEventL(delKey, EEventKey); |
|
459 replacedText.Append(replaced); |
|
460 replacedText.Append(text); |
|
461 text.Set(replacedText); |
|
462 // Restore last key. |
|
463 ptiengine->HandleCommandL(EPtiCommandSetLastKeyForVietnamese, (TAny*)last); |
|
464 } |
|
465 } |
|
466 } |
|
467 |
|
468 // Because of dead key functionality there may be several characters waiting. |
|
469 TBuf<1> chr; |
|
470 for (TInt jj = 0; jj < text.Length(); jj++) |
|
471 { |
|
472 chr.Zero(); |
|
473 chr.Append(text[jj]); |
|
474 fepMan->NewCharacterL(chr); |
|
475 if ( !fepMan->IsFlagSet(CAknFepManager::EFlagQwertyChrKeyDepressed) || |
|
476 (ELongKeyPress == aLength) ) |
|
477 { |
|
478 // Commit the character if chr key is not pressed. |
|
479 fepMan->CommitInlineEditL(); |
|
480 ptiengine->ClearCurrentWord(); |
|
481 iData = 0; |
|
482 } |
|
483 else |
|
484 { |
|
485 fepMan->ClearFlag(CAknFepManager::EFlagNoActionDuringChrKeyPress); |
|
486 } |
|
487 } |
|
488 ret = ETrue; |
|
489 } |
|
490 else |
|
491 { |
|
492 if (ptiengine->HandleCommandL(EPtiCommandDeadKeyWaiting, NULL) == 1) |
|
493 { |
|
494 if (caseMan->CurrentCase() == EAknEditorTextCase |
|
495 || caseMan->CurrentCase() == EAknEditorUpperCase) |
|
496 { |
|
497 ptiengine->SetCase(EPtiCaseUpper); |
|
498 } |
|
499 else if (fepMan->IsFlagSet(CAknFepManager::EFlagQwertyShiftMode) || |
|
500 fepMan->IsFlagSet(CAknFepManager::EFlagLongShiftKeyPress)) |
|
501 { |
|
502 ptiengine->SetCase(EPtiCaseLower); |
|
503 } |
|
504 } |
|
505 #ifdef RD_INTELLIGENT_TEXT_INPUT |
|
506 else |
|
507 { |
|
508 fepMan->SimulateKeyEventL(EKeyF19); |
|
509 } |
|
510 #endif |
|
511 ret = ETrue; |
|
512 } |
|
513 } |
|
514 |
|
515 #ifdef RD_INTELLIGENT_TEXT_INPUT |
|
516 #ifdef __REVERSE_FN_KEY_SUPPORTED |
|
517 |
|
518 if(languageChanged) |
|
519 { |
|
520 ptiengine->ActivateLanguageL(origLanguage); |
|
521 ptiengine->SetInputMode(origInputMode ); |
|
522 } |
|
523 |
|
524 #endif //__REVERSE_FN_KEY_SUPPORTED |
|
525 #endif //RD_INTELLIGENT_TEXT_INPUT |
|
526 |
|
527 return ret; |
|
528 } |
|
529 |
|
530 // Functions from MPtiObserver interface |
|
531 void TAknFepInputStateQwerty::KeyTimerExpired() |
|
532 { |
|
533 if (iData) |
|
534 { |
|
535 MAknFepManagerUIInterface* fepMan = iOwner->FepMan(); |
|
536 TRAP_IGNORE(fepMan->CommitInlineEditL()) |
|
537 //do something if error?? |
|
538 |
|
539 CPtiEngine* ptiengine = iOwner->PtiEngine(); |
|
540 ptiengine->ClearCurrentWord(); |
|
541 |
|
542 CAknFepCaseManager* caseMan = iOwner->CaseMan(); |
|
543 caseMan->UpdateCase(ENullNaviEvent); |
|
544 |
|
545 iData = 0; |
|
546 } |
|
547 } |
|
548 |
|
549 |
|
550 |
|
551 TBool TAknFepInputStateQwerty::IsExceptionChar(TUint16 aChar) |
|
552 { |
|
553 for (TInt i = 0; i < KNumCharKeyExceptions; i++) |
|
554 { |
|
555 if (CharKeyExceptions[i] == aChar) |
|
556 { |
|
557 return ETrue; |
|
558 } |
|
559 } |
|
560 |
|
561 return EFalse; |
|
562 } |
|
563 |
|
564 |
|
565 TBool TAknFepInputStateQwerty::IsCharacterKey(const TInt aKey) |
|
566 { |
|
567 CPtiEngine* ptiengine = iOwner->PtiEngine(); |
|
568 MAknFepManagerUIInterface* fepMan = iOwner->FepMan(); |
|
569 // Max length doesn't matter because we'll need only the first character. |
|
570 TBuf<KMaxName> lowerdata; |
|
571 |
|
572 ptiengine->MappingDataForKey((TPtiKey)aKey, lowerdata, EPtiCaseLower); |
|
573 if (lowerdata.Length() > 0) |
|
574 { |
|
575 TChar lower = lowerdata[0]; |
|
576 |
|
577 if (IsExceptionChar(lower)) |
|
578 { |
|
579 TBuf<KMaxName> upperdata; |
|
580 ptiengine->MappingDataForKey((TPtiKey)aKey, upperdata, EPtiCaseUpper); |
|
581 if (upperdata.Length() > 0) |
|
582 { |
|
583 TChar upperchr = upperdata[0]; |
|
584 upperchr.LowerCase(); |
|
585 if (upperchr != lower) |
|
586 { |
|
587 iCharKeyException = ETrue; |
|
588 return EFalse; |
|
589 } |
|
590 } |
|
591 } |
|
592 |
|
593 TUint upper = lower.GetUpperCase(); |
|
594 |
|
595 if ( TUint(lower) != upper ) |
|
596 { |
|
597 return ETrue; |
|
598 } |
|
599 #ifdef RD_INTELLIGENT_TEXT_INPUT |
|
600 //Characters from languages without case changes like Arabic/Urdu |
|
601 //cannot be identified with above logic. Hence, a special check below: |
|
602 else if ( IsLanguageWithoutCaseChanges() && fepMan->IsOnlyNumericPermitted() && lower.IsAlpha() ) |
|
603 { |
|
604 return ETrue; |
|
605 } |
|
606 #endif |
|
607 } |
|
608 |
|
609 return EFalse; |
|
610 } |
|
611 |
|
612 TBool TAknFepInputStateQwerty::IsNumberKey(const TInt aKey) |
|
613 { |
|
614 TBool response = EFalse; |
|
615 if (aKey >= EPtiKeyQwerty0 && aKey <= EPtiKeyQwerty9) |
|
616 { |
|
617 response = ETrue; |
|
618 } |
|
619 return response; |
|
620 } |
|
621 |
|
622 TBool TAknFepInputStateQwerty::IsQwertyKey(const TInt aKey) |
|
623 { |
|
624 TBool response = EFalse; |
|
625 if ( (aKey >= EPtiKeyQwertyA && aKey <= EPtiKeyQwertyZ) || |
|
626 IsNumberKey( aKey ) || |
|
627 aKey == EStdKeySpace || |
|
628 aKey == EStdKeyEnter || |
|
629 aKey == EPtiKeyQwertyPlus || |
|
630 aKey == EPtiKeyQwertyMinus || |
|
631 aKey == EPtiKeyQwertyComma || |
|
632 aKey == EPtiKeyQwertySemicolon || |
|
633 aKey == EPtiKeyQwertyFullstop || |
|
634 aKey == EPtiKeyQwertyHash || |
|
635 aKey == EPtiKeyQwertySlash || |
|
636 aKey == EPtiKeyQwertyApostrophe |
|
637 #ifdef RD_INTELLIGENT_TEXT_INPUT |
|
638 || aKey == EPtiKeyQwertyAtCharacter |
|
639 #endif |
|
640 ) |
|
641 { |
|
642 response = ETrue; |
|
643 } |
|
644 return response; |
|
645 } |
|
646 |
|
647 |
|
648 |
|
649 #ifdef RD_INTELLIGENT_TEXT_INPUT |
|
650 TBool TAknFepInputStateQwerty::IsCharacterNumber(TChar aChar) |
|
651 { |
|
652 TBool isNumber; |
|
653 isNumber = (iOwner->NumberModeKeyMapping().Locate(aChar) != KErrNotFound) || |
|
654 (KAknFepPlainNumbers().Locate(aChar) != KErrNotFound) || |
|
655 iOwner->FepMan()->IsAllowedKeymappingForNumberMode(aChar); |
|
656 return isNumber; |
|
657 } |
|
658 #endif |
|
659 |
|
660 void TAknFepInputStateQwerty::NumericCharacterForQwertyKey(TInt aInScanCode, |
|
661 TKeyEvent& aEvent, |
|
662 TBool aShifted, TChar& aResult) |
|
663 { |
|
664 CPtiEngine* ptiengine = iOwner->PtiEngine(); |
|
665 #ifdef RD_INTELLIGENT_TEXT_INPUT |
|
666 MAknFepManagerUIInterface *fepMan = iOwner->FepMan(); |
|
667 #endif |
|
668 aResult = 0; |
|
669 TUint16 firstChar; |
|
670 |
|
671 const TInt KMaxNumCharsPerCase = 50; |
|
672 TBuf<KMaxNumCharsPerCase> keys; |
|
673 TInt langCode = 0; |
|
674 |
|
675 CPtiCoreLanguage* lang = static_cast<CPtiCoreLanguage*>(ptiengine->CurrentLanguage()); |
|
676 if (lang) |
|
677 { |
|
678 langCode = lang->LanguageCode(); |
|
679 if (langCode == ELangFarsi || langCode == ELangUrdu || langCode == ELangHindi |
|
680 || langCode == ELangPrcChinese || langCode == ELangHongKongChinese |
|
681 || langCode == ELangTaiwanChinese || langCode == ELangArabic |
|
682 || TAknFepUiIndicInputManager :: IsIndicLangauge((TLanguage) langCode ) |
|
683 #ifdef RD_HINDI_PHONETIC_INPUT |
|
684 || TAknFepUiIndicInputManager :: IsIndicPhoneticLanguage( (TLanguage)langCode ) |
|
685 #endif |
|
686 ) |
|
687 { |
|
688 lang = static_cast<CPtiCoreLanguage*>(ptiengine->GetLanguage(ELangEnglish)); |
|
689 } |
|
690 } |
|
691 |
|
692 if (lang) |
|
693 { |
|
694 |
|
695 // If the key have scancode EPtiKeyQwertyW, EPtiKeyQwertyP map to any valid |
|
696 // numeric character that valid numeric character never be inserted. |
|
697 // Earlier this was not happening, because key map with numeric key always |
|
698 |
|
699 |
|
700 CPtiQwertyKeyMappings* maps = static_cast<CPtiQwertyKeyMappings*>(lang->GetQwertyKeymappings()); |
|
701 TBool keyNotMapToNumeric(ETrue); |
|
702 #ifdef RD_INTELLIGENT_TEXT_INPUT |
|
703 if(maps) |
|
704 { |
|
705 maps->GetDataForKey((TPtiKey)aInScanCode, keys, EPtiCaseFnLower); |
|
706 keyNotMapToNumeric = !(keys.Length() && IsCharacterNumber(keys[0])); |
|
707 } |
|
708 #endif |
|
709 |
|
710 if (keyNotMapToNumeric && langCode == ELangVietnamese && aInScanCode == EPtiKeyQwertyW && |
|
711 !aShifted) |
|
712 { |
|
713 // This is handled as a special case because 'w' is normally produced by double press |
|
714 // of w-key in Vitenamese but in number mode that can't be done. |
|
715 aResult = 'w'; |
|
716 aEvent = KEventsForSecondPass[KEventIndexForW]; |
|
717 return; |
|
718 } |
|
719 |
|
720 if (langCode == ELangHindi |
|
721 #ifdef RD_MARATHI |
|
722 || langCode == ELangMarathi |
|
723 #endif // RD_MARATHI |
|
724 ) |
|
725 { |
|
726 if (aInScanCode == EPtiKeyQwertyPlus && aShifted) |
|
727 { |
|
728 aResult = '-'; |
|
729 aEvent = KEventsForSecondPass[KPtiMinusIndex]; |
|
730 return; |
|
731 } |
|
732 else if (aInScanCode == EPtiKeyQwertyMinus && !aShifted) |
|
733 { |
|
734 return; |
|
735 } |
|
736 } |
|
737 |
|
738 if (langCode == ELangArabic) |
|
739 { |
|
740 if (aInScanCode == EPtiKeyQwertyComma && !aShifted) |
|
741 { |
|
742 aResult = ','; |
|
743 aEvent = KEventsForSecondPass[KPtiCommaIndex]; |
|
744 return; |
|
745 } |
|
746 else if (aInScanCode == EPtiKeyQwertyE && aShifted) |
|
747 { |
|
748 aResult = 'E'; |
|
749 aEvent = KEventsForSecondPass[KPtiCapitalEIndex]; |
|
750 return; |
|
751 } |
|
752 } |
|
753 |
|
754 if (langCode == ELangFarsi) |
|
755 { |
|
756 // Farsi uses english numeric keymappings with following exceptions. |
|
757 if ((aInScanCode == EPtiKeyQwertyPlus && !aShifted) || |
|
758 (aInScanCode == EPtiKeyQwertyComma && !aShifted)) |
|
759 { |
|
760 return; // Block |
|
761 } |
|
762 |
|
763 if (aInScanCode == EPtiKeyQwerty7 && aShifted) |
|
764 { |
|
765 aResult = '*'; |
|
766 aEvent = KEventsForSecondPass[KPtiStarIndex]; |
|
767 return; |
|
768 } |
|
769 if (aInScanCode == EPtiKeyQwerty8 && aShifted) |
|
770 { |
|
771 aResult = '-'; |
|
772 aEvent = KEventsForSecondPass[KPtiMinusIndex]; |
|
773 return; |
|
774 } |
|
775 if (aInScanCode == EPtiKeyQwerty9 && aShifted) |
|
776 { |
|
777 aResult = '+'; |
|
778 aEvent = KEventsForSecondPass[KPtiPlusIndex]; |
|
779 return; |
|
780 } |
|
781 if (aInScanCode == EPtiKeyQwerty2 && aShifted) |
|
782 { |
|
783 aResult = ','; |
|
784 aEvent = KEventsForSecondPass[KPtiCommaIndex]; |
|
785 return; |
|
786 } |
|
787 } |
|
788 else if (langCode == ELangUrdu) |
|
789 { |
|
790 // urdu uses english numeric keymappings with following exceptions. |
|
791 if (aInScanCode == EPtiKeyQwerty0 && aShifted) |
|
792 { |
|
793 aResult = '+'; |
|
794 aEvent = KEventsForSecondPass[KPtiPlusIndex]; |
|
795 return; |
|
796 } |
|
797 if (aInScanCode == EPtiKeyQwerty3 && aShifted) |
|
798 { |
|
799 aResult = '#'; |
|
800 aEvent = KEventsForSecondPass[KPtiHashIndex]; |
|
801 return; |
|
802 } |
|
803 if (aInScanCode == EPtiKeyQwertyP) |
|
804 { |
|
805 if (iOwner->NumberModeKeyMapping().Locate('p') == KErrNotFound) |
|
806 { |
|
807 if (!aShifted) |
|
808 { |
|
809 aResult = '-'; |
|
810 aEvent = KEventsForSecondPass[KPtiMinusIndex]; |
|
811 return; |
|
812 } |
|
813 else |
|
814 { |
|
815 return; |
|
816 } |
|
817 } |
|
818 else |
|
819 { |
|
820 if (aShifted) |
|
821 { |
|
822 aResult = '-'; |
|
823 aEvent = KEventsForSecondPass[KPtiMinusIndex]; |
|
824 return; |
|
825 } |
|
826 else |
|
827 { |
|
828 aResult = 'p'; |
|
829 aEvent = KEventsForSecondPass[KEventIndexForP]; |
|
830 return; |
|
831 |
|
832 } |
|
833 } |
|
834 } |
|
835 } |
|
836 |
|
837 // Handle other languages, which don't have 'p' and 'w' in normal keymapping data. |
|
838 |
|
839 if( keyNotMapToNumeric && |
|
840 (langCode == ELangGreek || langCode == ELangRussian || |
|
841 langCode == ELangArabic || langCode == ELangHebrew || |
|
842 langCode == ELangBulgarian || langCode == ELangThai || |
|
843 langCode == ELangUkrainian) && !aShifted) |
|
844 { |
|
845 if (aInScanCode == EPtiKeyQwertyW) |
|
846 { |
|
847 aResult = 'w'; |
|
848 aEvent = KEventsForSecondPass[KEventIndexForW]; |
|
849 return; |
|
850 } |
|
851 else if (aInScanCode == EPtiKeyQwertyP) |
|
852 { |
|
853 aResult = 'p'; |
|
854 aEvent = KEventsForSecondPass[KEventIndexForP]; |
|
855 return; |
|
856 } |
|
857 } |
|
858 |
|
859 |
|
860 if (maps) |
|
861 { |
|
862 #ifdef RD_INTELLIGENT_TEXT_INPUT |
|
863 if(aShifted) |
|
864 { |
|
865 maps->GetDataForKey((TPtiKey)aInScanCode, keys, EPtiCaseUpper); |
|
866 } |
|
867 else |
|
868 { |
|
869 maps->GetDataForKey((TPtiKey)aInScanCode, keys, EPtiCaseFnLower); |
|
870 if( !(keys.Length() && IsCharacterNumber(keys[0]))) |
|
871 maps->GetDataForKey((TPtiKey)aInScanCode, keys, EPtiCaseFnUpper); |
|
872 if( !(keys.Length() && IsCharacterNumber(keys[0]))) |
|
873 maps->GetDataForKey((TPtiKey)aInScanCode, keys, EPtiCaseLower); |
|
874 if( !(keys.Length() && IsCharacterNumber(keys[0]))) |
|
875 maps->GetDataForKey((TPtiKey)aInScanCode, keys, EPtiCaseUpper); |
|
876 if( !(keys.Length() && IsCharacterNumber(keys[0]))) |
|
877 keys.SetLength(0); |
|
878 } |
|
879 |
|
880 #else |
|
881 if (aShifted) |
|
882 { |
|
883 maps->GetDataForKey((TPtiKey)aInScanCode, keys, EPtiCaseUpper); |
|
884 } |
|
885 else |
|
886 { |
|
887 maps->GetDataForKey((TPtiKey)aInScanCode, keys, EPtiCaseLower); |
|
888 } |
|
889 #endif |
|
890 if ( keys.Length() > 0 ) |
|
891 { |
|
892 switch (keys[0]) |
|
893 { |
|
894 case KPtiPinyinMarker: |
|
895 case KPtiStrokeMarker: |
|
896 case KPtiZhuyinMarker: |
|
897 case KPtiCangjieMarker: |
|
898 case KPtiGetAllMarker: |
|
899 if (keys.Length() > 1) |
|
900 firstChar = keys[1]; |
|
901 else |
|
902 firstChar = 0; |
|
903 break; |
|
904 default: |
|
905 firstChar = keys[0]; |
|
906 } |
|
907 |
|
908 for (TInt j = 0; j < KFull_SimpleSymbolMapNumber; j++) |
|
909 { |
|
910 if (firstChar == KFull_SimpleSymbolMaps[j][0]) |
|
911 { |
|
912 firstChar = KFull_SimpleSymbolMaps[j][1]; |
|
913 break; |
|
914 } |
|
915 } |
|
916 |
|
917 for (TInt i = 0; i < KNumAllowedIdleNumericChars; i++) |
|
918 { |
|
919 if (firstChar == KAllAllowedNumericChars[i]) |
|
920 { |
|
921 aEvent = KEventsForSecondPass[i]; |
|
922 aResult = KAllAllowedNumericChars[i]; |
|
923 break; |
|
924 } |
|
925 } |
|
926 } |
|
927 } |
|
928 } |
|
929 } |
|
930 |
|
931 |
|
932 |
|
933 void TAknFepInputStateQwerty::CustomFilter(TPtrC aInput, TDes& aOutput, TInt /*aLanguage*/, |
|
934 TInt aCurrentCase, TBool /*aShiftDown*/) |
|
935 { |
|
936 aOutput.Zero(); |
|
937 |
|
938 if (aInput.Length() && aInput.Length() <= aOutput.MaxLength()) |
|
939 { |
|
940 aOutput.Copy(aInput); |
|
941 } |
|
942 |
|
943 if (aOutput.Length()) |
|
944 { |
|
945 if (aCurrentCase == EAknEditorTextCase || aCurrentCase == EAknEditorUpperCase) |
|
946 { |
|
947 if (iCharKeyException && IsExceptionChar(aOutput[0])) |
|
948 { |
|
949 TChar chr = aOutput[0]; |
|
950 chr.UpperCase(); |
|
951 aOutput[0] = chr; |
|
952 } |
|
953 #ifndef RD_INTELLIGENT_TEXT_INPUT |
|
954 else if (aLanguage == ELangCzech) |
|
955 { |
|
956 if (aOutput[0] == '/' && !aShiftDown) |
|
957 { |
|
958 aOutput[0] = 0x00c4; |
|
959 } |
|
960 } |
|
961 #endif // RD_INTELLIGENT_TEXT_INPUT |
|
962 } |
|
963 } |
|
964 } |
|
965 |
|
966 void TAknFepInputStateQwerty::HandleCaseChange(TInt aKey, TBool aIsCharacter) |
|
967 { |
|
968 TPtiTextCase caseMode = EPtiCaseLower; |
|
969 |
|
970 if (aIsCharacter) |
|
971 { |
|
972 if( !( iOwner->FepMan()->IsOnlyNumericPermitted() && !IsNumberKey(aKey) ) ) |
|
973 { |
|
974 switch(iOwner->CaseMan()->CurrentCase()) |
|
975 { |
|
976 case EAknEditorLowerCase: |
|
977 caseMode = EPtiCaseLower; |
|
978 break; |
|
979 case EAknEditorTextCase: |
|
980 case EAknEditorUpperCase: |
|
981 caseMode = EPtiCaseUpper; |
|
982 default: |
|
983 break; |
|
984 } |
|
985 } |
|
986 else |
|
987 { |
|
988 caseMode = iOwner->PtiEngine()->Case(); |
|
989 } |
|
990 } |
|
991 |
|
992 TPtiTextCase shiftedCase = caseMode; |
|
993 #ifdef RD_INTELLIGENT_TEXT_INPUT |
|
994 |
|
995 // If Fn key state is EFnKeyNone, Synchronise PtiEngine Textcase |
|
996 if( CAknFepFnKeyManager::EFnKeyNone == iOwner->FepMan()->FnKeyState() ) |
|
997 { |
|
998 iOwner->PtiEngine()->SetCase((TPtiTextCase)EPtiCaseLower); |
|
999 } |
|
1000 else |
|
1001 { |
|
1002 if( (iOwner->FepMan()->IsFlagSet(CAknFepManager::EFlagQwertyShiftMode)|| |
|
1003 iOwner->FepMan()->IsFlagSet(CAknFepManager::EFlagLongShiftKeyPress) )) |
|
1004 { |
|
1005 iOwner->PtiEngine()->SetCase((TPtiTextCase)EPtiCaseFnUpper); |
|
1006 } |
|
1007 |
|
1008 TPtiTextCase curCase = iOwner->PtiEngine()->Case(); |
|
1009 if( EPtiCaseFnUpper == curCase || EPtiCaseFnLower == curCase ) |
|
1010 { |
|
1011 if( EPtiCaseFnUpper == curCase ) |
|
1012 { |
|
1013 TBuf<32> keyMappings; |
|
1014 iOwner->PtiEngine()->MappingDataForKey( (TPtiKey)aKey, keyMappings, EPtiCaseFnUpper); |
|
1015 |
|
1016 if( keyMappings.Length() == 0) |
|
1017 { |
|
1018 iOwner->PtiEngine()->SetCase((TPtiTextCase)EPtiCaseFnLower); |
|
1019 } |
|
1020 } |
|
1021 return; |
|
1022 } |
|
1023 } |
|
1024 #endif |
|
1025 if ( (iOwner->FepMan()->IsFlagSet(CAknFepManager::EFlagQwertyShiftMode)|| |
|
1026 iOwner->FepMan()->IsFlagSet(CAknFepManager::EFlagLongShiftKeyPress) )&& |
|
1027 ( !aIsCharacter || iOwner->CaseMan()->IsAbleChangeCase() ) ) |
|
1028 { |
|
1029 // Case mode is changed to opposite because shift key is/was pressed and |
|
1030 // in case of character key case changes are allowed. In case of |
|
1031 // number or special key, shift mode is used always when |
|
1032 // shift key is pressed |
|
1033 switch ( caseMode ) |
|
1034 { |
|
1035 case EPtiCaseUpper: |
|
1036 shiftedCase = EPtiCaseLower; |
|
1037 break; |
|
1038 case EPtiCaseLower: |
|
1039 shiftedCase = EPtiCaseUpper; |
|
1040 break; |
|
1041 default: |
|
1042 break; |
|
1043 } |
|
1044 } |
|
1045 |
|
1046 if ( iOwner->FepMan()->IsFlagSet(CAknFepManager::EFlagQwertyChrKeyDepressed) ) |
|
1047 { |
|
1048 // Chr key is pressed down. Chr mode is used. |
|
1049 if (shiftedCase == EPtiCaseLower) |
|
1050 { |
|
1051 shiftedCase = EPtiCaseChrLower; |
|
1052 } |
|
1053 else if (shiftedCase == EPtiCaseUpper) |
|
1054 { |
|
1055 shiftedCase = EPtiCaseChrUpper; |
|
1056 } |
|
1057 } |
|
1058 |
|
1059 iOwner->PtiEngine()->SetCase(shiftedCase); |
|
1060 |
|
1061 } |
|
1062 |
|
1063 #ifdef RD_INTELLIGENT_TEXT_INPUT |
|
1064 TBool TAknFepInputStateQwerty::TryGetValidCharForKey(const TInt& aKey, TChar& aChar) |
|
1065 { |
|
1066 if( ! TryGetValidCharForKeyAndCase( aKey, aChar, EPtiCaseLower) ) |
|
1067 { |
|
1068 if(! TryGetValidCharForKeyAndCase( aKey, aChar, EPtiCaseUpper)) |
|
1069 { |
|
1070 #ifdef RD_INTELLIGENT_TEXT_INPUT |
|
1071 //Do not check for FnUpper and FnLower case for Greek/Cyrillic/Hebrew script. |
|
1072 //This is for handling special characters in numeric editors. |
|
1073 if ( IsSpecialNonLatinScript() ) |
|
1074 { |
|
1075 return EFalse; |
|
1076 } |
|
1077 #endif |
|
1078 if(! TryGetValidCharForKeyAndCase( aKey, aChar, EPtiCaseFnLower)) |
|
1079 { |
|
1080 if(! TryGetValidCharForKeyAndCase( aKey, aChar, EPtiCaseFnUpper)) |
|
1081 { |
|
1082 return EFalse; |
|
1083 } |
|
1084 } |
|
1085 } |
|
1086 } |
|
1087 return ETrue; |
|
1088 } |
|
1089 |
|
1090 TBool TAknFepInputStateQwerty::TryGetValidCharForKeyAndCase(const TInt& aKey, TChar& aChar, TPtiTextCase aCase) |
|
1091 { |
|
1092 TBuf<KMaxName> mappedCharacters; |
|
1093 |
|
1094 iOwner->PtiEngine()->MappingDataForKey((TPtiKey)aKey, mappedCharacters, aCase); |
|
1095 for (TInt i = 0; i < mappedCharacters.Length(); i++ ) |
|
1096 { |
|
1097 if( iOwner->FepMan()->IsValidCharInNumericEditorL( mappedCharacters[i] ) ) |
|
1098 { |
|
1099 aChar = mappedCharacters[i]; |
|
1100 return ETrue; |
|
1101 } |
|
1102 } |
|
1103 return EFalse; |
|
1104 } |
|
1105 |
|
1106 TBool TAknFepInputStateQwerty::IsLanguageWithoutCaseChanges() |
|
1107 { |
|
1108 CPtiEngine* ptiengine = iOwner->PtiEngine(); |
|
1109 TInt currLanguageCode = ptiengine->CurrentLanguage()->LanguageCode(); |
|
1110 //update below list as and when required. |
|
1111 if ( ELangArabic == currLanguageCode || |
|
1112 ELangFarsi == currLanguageCode || |
|
1113 ELangHebrew == currLanguageCode || |
|
1114 ELangHindi == currLanguageCode || |
|
1115 ELangUrdu == currLanguageCode |
|
1116 ) |
|
1117 { |
|
1118 return ETrue; |
|
1119 } |
|
1120 return EFalse; |
|
1121 } |
|
1122 |
|
1123 TBool TAknFepInputStateQwerty::IsSpecialNonLatinScript() |
|
1124 { |
|
1125 CPtiEngine* ptiengine = iOwner->PtiEngine(); |
|
1126 TInt currLanguageCode = ptiengine->CurrentLanguage()->LanguageCode(); |
|
1127 //update below list as and when required. |
|
1128 if ( ELangGreek == currLanguageCode || |
|
1129 ELangRussian == currLanguageCode || |
|
1130 ELangUkrainian == currLanguageCode || |
|
1131 ELangBulgarian == currLanguageCode || |
|
1132 ELangHebrew == currLanguageCode |
|
1133 ) |
|
1134 { |
|
1135 return ETrue; |
|
1136 } |
|
1137 return EFalse; |
|
1138 } |
|
1139 #endif |
|
1140 |
|
1141 TBool TAknFepInputStateQwerty::CheckForValidNumberEntryForqwerty(TInt aKey) |
|
1142 { |
|
1143 TChar chr; |
|
1144 TKeyEvent numKey; |
|
1145 MAknFepManagerUIInterface* fepMan = iOwner->FepMan(); |
|
1146 |
|
1147 NumericCharacterForQwertyKey(aKey, numKey, |
|
1148 ( fepMan->IsFlagSet(CAknFepManager::EFlagQwertyShiftMode)|| |
|
1149 fepMan->IsFlagSet(CAknFepManager::EFlagLongShiftKeyPress) ), chr); |
|
1150 if ((chr != 0) && |
|
1151 ((iOwner->NumberModeKeyMapping().Locate(chr) != KErrNotFound) || |
|
1152 (KAknFepPlainNumbers().Locate(chr) != KErrNotFound)) || |
|
1153 fepMan->IsAllowedKeymappingForNumberMode(chr)) |
|
1154 { |
|
1155 if (chr == 'E') |
|
1156 { |
|
1157 TBuf<1> chrTmp; |
|
1158 chrTmp.Append(chr); |
|
1159 fepMan->NewCharacterL(chrTmp); |
|
1160 fepMan->CommitInlineEditL(); |
|
1161 } |
|
1162 else |
|
1163 { |
|
1164 // If editor is in number mode and incoming key press would produce |
|
1165 // any of the allowed number mode characters, |
|
1166 // resend suitable key event let it pass through FEP. That way phone idle |
|
1167 // receives the event too. This also takes care of remapping |
|
1168 // different qwerty keymap layouts to edwin events. |
|
1169 if(!(fepMan->IsHybridAplhaEditor() && !fepMan->IsHybridAlphaModeChangedtoAplhanumeric())) |
|
1170 fepMan->SetFlag(CAknFepManager::EFlagPassNextKey); |
|
1171 CPtiEngine* ptiengine = iOwner->PtiEngine(); |
|
1172 CPtiCoreLanguage* lang = static_cast<CPtiCoreLanguage*>(ptiengine->CurrentLanguage()); |
|
1173 |
|
1174 if (lang && (numKey.iScanCode >= EPtiKeyQwerty0 && numKey.iScanCode <= EPtiKeyQwerty9)) |
|
1175 { |
|
1176 const TInt langCode = lang->LanguageCode(); |
|
1177 |
|
1178 if(langCode == ELangUrdu || langCode == ELangFarsi) |
|
1179 { |
|
1180 numKey.iCode += KLatinToEasternArabicIndicDigitsDelta; |
|
1181 numKey.iModifiers = numKey.iModifiers|EModifierSpecial; |
|
1182 } |
|
1183 else if (langCode == ELangArabic && fepMan->ArabicIndicDigitsInUse()) |
|
1184 { |
|
1185 numKey.iCode += KLatinToArabicIndicDigitsDelta; |
|
1186 numKey.iModifiers = numKey.iModifiers|EModifierSpecial; |
|
1187 } |
|
1188 else if(TAknFepUiIndicInputManager::IsIndicLangauge(TLanguage(langCode)) |
|
1189 #ifdef RD_HINDI_PHONETIC_INPUT |
|
1190 || TAknFepUiIndicInputManager::IsIndicPhoneticLanguage(TLanguage(langCode)) |
|
1191 #endif |
|
1192 ) |
|
1193 { |
|
1194 numKey.iCode += KLatinToDevanagariDigitsDelta; |
|
1195 numKey.iModifiers = numKey.iModifiers|EModifierSpecial; |
|
1196 } |
|
1197 } |
|
1198 // Disable UI framewroks's qwerty iCode conversion for simulated event. |
|
1199 numKey.iModifiers |= EModifierSpecial; |
|
1200 if(!(fepMan->IsHybridAplhaEditor() && !fepMan->IsHybridAlphaModeChangedtoAplhanumeric())) |
|
1201 { |
|
1202 CCoeEnv::Static()->SimulateKeyEventL(numKey, EEventKey); |
|
1203 #ifdef RD_INTELLIGENT_TEXT_INPUT |
|
1204 CCoeEnv::Static()->SimulateKeyEventL(numKey, EEventKeyUp); |
|
1205 #endif |
|
1206 } |
|
1207 } |
|
1208 } |
|
1209 |
|
1210 if((fepMan->IsHybridAplhaEditor() && !fepMan->IsHybridAlphaModeChangedtoAplhanumeric()) |
|
1211 &&(numKey.iCode == 112 /*p*/ || numKey.iCode == 119/*w*/)) |
|
1212 return EFalse; |
|
1213 else if(!fepMan->IsHybridAplhaEditor() || fepMan->IsHybridAlphaModeChangedtoAplhanumeric()) |
|
1214 return ETrue; |
|
1215 else if(!fepMan->IsHybridAlphaModeChangedtoAplhanumeric() && |
|
1216 (chr !=0 || (chr==0 && fepMan->IsFlagSet(CAknFepManager::EFlagQwertyShiftMode)))) |
|
1217 return ETrue; |
|
1218 else |
|
1219 return EFalse; |
|
1220 } |
|
1221 // End of file |