author | Simon Howkins <simonh@symbian.org> |
Mon, 15 Nov 2010 14:00:51 +0000 | |
branch | RCL_3 |
changeset 59 | 7febbd162ded |
parent 56 | 8152b1f1763a |
permissions | -rw-r--r-- |
44 | 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()); |
|
56
8152b1f1763a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
701 |
maps->SetKeyboardType(ptiengine->KeyboardType()); |
44 | 702 |
TBool keyNotMapToNumeric(ETrue); |
703 |
#ifdef RD_INTELLIGENT_TEXT_INPUT |
|
704 |
if(maps) |
|
705 |
{ |
|
706 |
maps->GetDataForKey((TPtiKey)aInScanCode, keys, EPtiCaseFnLower); |
|
707 |
keyNotMapToNumeric = !(keys.Length() && IsCharacterNumber(keys[0])); |
|
708 |
} |
|
709 |
#endif |
|
710 |
||
711 |
if (keyNotMapToNumeric && langCode == ELangVietnamese && aInScanCode == EPtiKeyQwertyW && |
|
712 |
!aShifted) |
|
713 |
{ |
|
714 |
// This is handled as a special case because 'w' is normally produced by double press |
|
715 |
// of w-key in Vitenamese but in number mode that can't be done. |
|
716 |
aResult = 'w'; |
|
717 |
aEvent = KEventsForSecondPass[KEventIndexForW]; |
|
718 |
return; |
|
719 |
} |
|
720 |
||
721 |
if (langCode == ELangHindi |
|
722 |
#ifdef RD_MARATHI |
|
723 |
|| langCode == ELangMarathi |
|
724 |
#endif // RD_MARATHI |
|
725 |
) |
|
726 |
{ |
|
727 |
if (aInScanCode == EPtiKeyQwertyPlus && aShifted) |
|
728 |
{ |
|
729 |
aResult = '-'; |
|
730 |
aEvent = KEventsForSecondPass[KPtiMinusIndex]; |
|
731 |
return; |
|
732 |
} |
|
733 |
else if (aInScanCode == EPtiKeyQwertyMinus && !aShifted) |
|
734 |
{ |
|
735 |
return; |
|
736 |
} |
|
737 |
} |
|
738 |
||
739 |
if (langCode == ELangArabic) |
|
740 |
{ |
|
741 |
if (aInScanCode == EPtiKeyQwertyComma && !aShifted) |
|
742 |
{ |
|
743 |
aResult = ','; |
|
744 |
aEvent = KEventsForSecondPass[KPtiCommaIndex]; |
|
745 |
return; |
|
746 |
} |
|
747 |
else if (aInScanCode == EPtiKeyQwertyE && aShifted) |
|
748 |
{ |
|
749 |
aResult = 'E'; |
|
750 |
aEvent = KEventsForSecondPass[KPtiCapitalEIndex]; |
|
751 |
return; |
|
752 |
} |
|
753 |
} |
|
754 |
||
755 |
if (langCode == ELangFarsi) |
|
756 |
{ |
|
757 |
// Farsi uses english numeric keymappings with following exceptions. |
|
758 |
if ((aInScanCode == EPtiKeyQwertyPlus && !aShifted) || |
|
759 |
(aInScanCode == EPtiKeyQwertyComma && !aShifted)) |
|
760 |
{ |
|
761 |
return; // Block |
|
762 |
} |
|
763 |
||
764 |
if (aInScanCode == EPtiKeyQwerty7 && aShifted) |
|
765 |
{ |
|
766 |
aResult = '*'; |
|
767 |
aEvent = KEventsForSecondPass[KPtiStarIndex]; |
|
768 |
return; |
|
769 |
} |
|
770 |
if (aInScanCode == EPtiKeyQwerty8 && aShifted) |
|
771 |
{ |
|
772 |
aResult = '-'; |
|
773 |
aEvent = KEventsForSecondPass[KPtiMinusIndex]; |
|
774 |
return; |
|
775 |
} |
|
776 |
if (aInScanCode == EPtiKeyQwerty9 && aShifted) |
|
777 |
{ |
|
778 |
aResult = '+'; |
|
779 |
aEvent = KEventsForSecondPass[KPtiPlusIndex]; |
|
780 |
return; |
|
781 |
} |
|
782 |
if (aInScanCode == EPtiKeyQwerty2 && aShifted) |
|
783 |
{ |
|
784 |
aResult = ','; |
|
785 |
aEvent = KEventsForSecondPass[KPtiCommaIndex]; |
|
786 |
return; |
|
787 |
} |
|
788 |
} |
|
789 |
else if (langCode == ELangUrdu) |
|
790 |
{ |
|
791 |
// urdu uses english numeric keymappings with following exceptions. |
|
792 |
if (aInScanCode == EPtiKeyQwerty0 && aShifted) |
|
793 |
{ |
|
794 |
aResult = '+'; |
|
795 |
aEvent = KEventsForSecondPass[KPtiPlusIndex]; |
|
796 |
return; |
|
797 |
} |
|
798 |
if (aInScanCode == EPtiKeyQwerty3 && aShifted) |
|
799 |
{ |
|
800 |
aResult = '#'; |
|
801 |
aEvent = KEventsForSecondPass[KPtiHashIndex]; |
|
802 |
return; |
|
803 |
} |
|
804 |
if (aInScanCode == EPtiKeyQwertyP) |
|
805 |
{ |
|
806 |
if (iOwner->NumberModeKeyMapping().Locate('p') == KErrNotFound) |
|
807 |
{ |
|
808 |
if (!aShifted) |
|
809 |
{ |
|
810 |
aResult = '-'; |
|
811 |
aEvent = KEventsForSecondPass[KPtiMinusIndex]; |
|
812 |
return; |
|
813 |
} |
|
814 |
else |
|
815 |
{ |
|
816 |
return; |
|
817 |
} |
|
818 |
} |
|
819 |
else |
|
820 |
{ |
|
821 |
if (aShifted) |
|
822 |
{ |
|
823 |
aResult = '-'; |
|
824 |
aEvent = KEventsForSecondPass[KPtiMinusIndex]; |
|
825 |
return; |
|
826 |
} |
|
827 |
else |
|
828 |
{ |
|
829 |
aResult = 'p'; |
|
830 |
aEvent = KEventsForSecondPass[KEventIndexForP]; |
|
831 |
return; |
|
832 |
||
833 |
} |
|
834 |
} |
|
835 |
} |
|
836 |
} |
|
837 |
||
838 |
// Handle other languages, which don't have 'p' and 'w' in normal keymapping data. |
|
839 |
||
840 |
if( keyNotMapToNumeric && |
|
841 |
(langCode == ELangGreek || langCode == ELangRussian || |
|
842 |
langCode == ELangArabic || langCode == ELangHebrew || |
|
843 |
langCode == ELangBulgarian || langCode == ELangThai || |
|
844 |
langCode == ELangUkrainian) && !aShifted) |
|
845 |
{ |
|
846 |
if (aInScanCode == EPtiKeyQwertyW) |
|
847 |
{ |
|
848 |
aResult = 'w'; |
|
849 |
aEvent = KEventsForSecondPass[KEventIndexForW]; |
|
850 |
return; |
|
851 |
} |
|
852 |
else if (aInScanCode == EPtiKeyQwertyP) |
|
853 |
{ |
|
854 |
aResult = 'p'; |
|
855 |
aEvent = KEventsForSecondPass[KEventIndexForP]; |
|
856 |
return; |
|
857 |
} |
|
858 |
} |
|
859 |
||
860 |
||
861 |
if (maps) |
|
862 |
{ |
|
863 |
#ifdef RD_INTELLIGENT_TEXT_INPUT |
|
864 |
if(aShifted) |
|
865 |
{ |
|
866 |
maps->GetDataForKey((TPtiKey)aInScanCode, keys, EPtiCaseUpper); |
|
867 |
} |
|
868 |
else |
|
869 |
{ |
|
870 |
maps->GetDataForKey((TPtiKey)aInScanCode, keys, EPtiCaseFnLower); |
|
871 |
if( !(keys.Length() && IsCharacterNumber(keys[0]))) |
|
872 |
maps->GetDataForKey((TPtiKey)aInScanCode, keys, EPtiCaseFnUpper); |
|
873 |
if( !(keys.Length() && IsCharacterNumber(keys[0]))) |
|
874 |
maps->GetDataForKey((TPtiKey)aInScanCode, keys, EPtiCaseLower); |
|
875 |
if( !(keys.Length() && IsCharacterNumber(keys[0]))) |
|
876 |
maps->GetDataForKey((TPtiKey)aInScanCode, keys, EPtiCaseUpper); |
|
877 |
if( !(keys.Length() && IsCharacterNumber(keys[0]))) |
|
878 |
keys.SetLength(0); |
|
879 |
} |
|
880 |
||
881 |
#else |
|
882 |
if (aShifted) |
|
883 |
{ |
|
884 |
maps->GetDataForKey((TPtiKey)aInScanCode, keys, EPtiCaseUpper); |
|
885 |
} |
|
886 |
else |
|
887 |
{ |
|
888 |
maps->GetDataForKey((TPtiKey)aInScanCode, keys, EPtiCaseLower); |
|
889 |
} |
|
890 |
#endif |
|
891 |
if ( keys.Length() > 0 ) |
|
892 |
{ |
|
893 |
switch (keys[0]) |
|
894 |
{ |
|
895 |
case KPtiPinyinMarker: |
|
896 |
case KPtiStrokeMarker: |
|
897 |
case KPtiZhuyinMarker: |
|
898 |
case KPtiCangjieMarker: |
|
899 |
case KPtiGetAllMarker: |
|
900 |
if (keys.Length() > 1) |
|
901 |
firstChar = keys[1]; |
|
902 |
else |
|
903 |
firstChar = 0; |
|
904 |
break; |
|
905 |
default: |
|
906 |
firstChar = keys[0]; |
|
907 |
} |
|
908 |
||
909 |
for (TInt j = 0; j < KFull_SimpleSymbolMapNumber; j++) |
|
910 |
{ |
|
911 |
if (firstChar == KFull_SimpleSymbolMaps[j][0]) |
|
912 |
{ |
|
913 |
firstChar = KFull_SimpleSymbolMaps[j][1]; |
|
914 |
break; |
|
915 |
} |
|
916 |
} |
|
917 |
||
918 |
for (TInt i = 0; i < KNumAllowedIdleNumericChars; i++) |
|
919 |
{ |
|
920 |
if (firstChar == KAllAllowedNumericChars[i]) |
|
921 |
{ |
|
922 |
aEvent = KEventsForSecondPass[i]; |
|
923 |
aResult = KAllAllowedNumericChars[i]; |
|
924 |
break; |
|
925 |
} |
|
926 |
} |
|
927 |
} |
|
928 |
} |
|
929 |
} |
|
930 |
} |
|
931 |
||
932 |
||
933 |
||
934 |
void TAknFepInputStateQwerty::CustomFilter(TPtrC aInput, TDes& aOutput, TInt /*aLanguage*/, |
|
935 |
TInt aCurrentCase, TBool /*aShiftDown*/) |
|
936 |
{ |
|
937 |
aOutput.Zero(); |
|
938 |
||
939 |
if (aInput.Length() && aInput.Length() <= aOutput.MaxLength()) |
|
940 |
{ |
|
941 |
aOutput.Copy(aInput); |
|
942 |
} |
|
943 |
||
944 |
if (aOutput.Length()) |
|
945 |
{ |
|
946 |
if (aCurrentCase == EAknEditorTextCase || aCurrentCase == EAknEditorUpperCase) |
|
947 |
{ |
|
948 |
if (iCharKeyException && IsExceptionChar(aOutput[0])) |
|
949 |
{ |
|
950 |
TChar chr = aOutput[0]; |
|
951 |
chr.UpperCase(); |
|
952 |
aOutput[0] = chr; |
|
953 |
} |
|
954 |
#ifndef RD_INTELLIGENT_TEXT_INPUT |
|
955 |
else if (aLanguage == ELangCzech) |
|
956 |
{ |
|
957 |
if (aOutput[0] == '/' && !aShiftDown) |
|
958 |
{ |
|
959 |
aOutput[0] = 0x00c4; |
|
960 |
} |
|
961 |
} |
|
962 |
#endif // RD_INTELLIGENT_TEXT_INPUT |
|
963 |
} |
|
964 |
} |
|
965 |
} |
|
966 |
||
967 |
void TAknFepInputStateQwerty::HandleCaseChange(TInt aKey, TBool aIsCharacter) |
|
968 |
{ |
|
969 |
TPtiTextCase caseMode = EPtiCaseLower; |
|
970 |
||
971 |
if (aIsCharacter) |
|
972 |
{ |
|
973 |
if( !( iOwner->FepMan()->IsOnlyNumericPermitted() && !IsNumberKey(aKey) ) ) |
|
974 |
{ |
|
975 |
switch(iOwner->CaseMan()->CurrentCase()) |
|
976 |
{ |
|
977 |
case EAknEditorLowerCase: |
|
978 |
caseMode = EPtiCaseLower; |
|
979 |
break; |
|
980 |
case EAknEditorTextCase: |
|
981 |
case EAknEditorUpperCase: |
|
982 |
caseMode = EPtiCaseUpper; |
|
983 |
default: |
|
984 |
break; |
|
985 |
} |
|
986 |
} |
|
987 |
else |
|
988 |
{ |
|
989 |
caseMode = iOwner->PtiEngine()->Case(); |
|
990 |
} |
|
991 |
} |
|
992 |
||
993 |
TPtiTextCase shiftedCase = caseMode; |
|
994 |
#ifdef RD_INTELLIGENT_TEXT_INPUT |
|
995 |
||
996 |
// If Fn key state is EFnKeyNone, Synchronise PtiEngine Textcase |
|
997 |
if( CAknFepFnKeyManager::EFnKeyNone == iOwner->FepMan()->FnKeyState() ) |
|
998 |
{ |
|
999 |
iOwner->PtiEngine()->SetCase((TPtiTextCase)EPtiCaseLower); |
|
1000 |
} |
|
1001 |
else |
|
1002 |
{ |
|
1003 |
if( (iOwner->FepMan()->IsFlagSet(CAknFepManager::EFlagQwertyShiftMode)|| |
|
1004 |
iOwner->FepMan()->IsFlagSet(CAknFepManager::EFlagLongShiftKeyPress) )) |
|
1005 |
{ |
|
1006 |
iOwner->PtiEngine()->SetCase((TPtiTextCase)EPtiCaseFnUpper); |
|
1007 |
} |
|
1008 |
||
1009 |
TPtiTextCase curCase = iOwner->PtiEngine()->Case(); |
|
1010 |
if( EPtiCaseFnUpper == curCase || EPtiCaseFnLower == curCase ) |
|
1011 |
{ |
|
1012 |
if( EPtiCaseFnUpper == curCase ) |
|
1013 |
{ |
|
1014 |
TBuf<32> keyMappings; |
|
1015 |
iOwner->PtiEngine()->MappingDataForKey( (TPtiKey)aKey, keyMappings, EPtiCaseFnUpper); |
|
1016 |
||
1017 |
if( keyMappings.Length() == 0) |
|
1018 |
{ |
|
1019 |
iOwner->PtiEngine()->SetCase((TPtiTextCase)EPtiCaseFnLower); |
|
1020 |
} |
|
1021 |
} |
|
1022 |
return; |
|
1023 |
} |
|
1024 |
} |
|
1025 |
#endif |
|
1026 |
if ( (iOwner->FepMan()->IsFlagSet(CAknFepManager::EFlagQwertyShiftMode)|| |
|
1027 |
iOwner->FepMan()->IsFlagSet(CAknFepManager::EFlagLongShiftKeyPress) )&& |
|
1028 |
( !aIsCharacter || iOwner->CaseMan()->IsAbleChangeCase() ) ) |
|
1029 |
{ |
|
1030 |
// Case mode is changed to opposite because shift key is/was pressed and |
|
1031 |
// in case of character key case changes are allowed. In case of |
|
1032 |
// number or special key, shift mode is used always when |
|
1033 |
// shift key is pressed |
|
1034 |
switch ( caseMode ) |
|
1035 |
{ |
|
1036 |
case EPtiCaseUpper: |
|
1037 |
shiftedCase = EPtiCaseLower; |
|
1038 |
break; |
|
1039 |
case EPtiCaseLower: |
|
1040 |
shiftedCase = EPtiCaseUpper; |
|
1041 |
break; |
|
1042 |
default: |
|
1043 |
break; |
|
1044 |
} |
|
1045 |
} |
|
1046 |
||
1047 |
if ( iOwner->FepMan()->IsFlagSet(CAknFepManager::EFlagQwertyChrKeyDepressed) ) |
|
1048 |
{ |
|
1049 |
// Chr key is pressed down. Chr mode is used. |
|
1050 |
if (shiftedCase == EPtiCaseLower) |
|
1051 |
{ |
|
1052 |
shiftedCase = EPtiCaseChrLower; |
|
1053 |
} |
|
1054 |
else if (shiftedCase == EPtiCaseUpper) |
|
1055 |
{ |
|
1056 |
shiftedCase = EPtiCaseChrUpper; |
|
1057 |
} |
|
1058 |
} |
|
1059 |
||
1060 |
iOwner->PtiEngine()->SetCase(shiftedCase); |
|
1061 |
||
1062 |
} |
|
1063 |
||
1064 |
#ifdef RD_INTELLIGENT_TEXT_INPUT |
|
1065 |
TBool TAknFepInputStateQwerty::TryGetValidCharForKey(const TInt& aKey, TChar& aChar) |
|
1066 |
{ |
|
1067 |
if( ! TryGetValidCharForKeyAndCase( aKey, aChar, EPtiCaseLower) ) |
|
1068 |
{ |
|
1069 |
if(! TryGetValidCharForKeyAndCase( aKey, aChar, EPtiCaseUpper)) |
|
1070 |
{ |
|
1071 |
#ifdef RD_INTELLIGENT_TEXT_INPUT |
|
1072 |
//Do not check for FnUpper and FnLower case for Greek/Cyrillic/Hebrew script. |
|
1073 |
//This is for handling special characters in numeric editors. |
|
1074 |
if ( IsSpecialNonLatinScript() ) |
|
1075 |
{ |
|
1076 |
return EFalse; |
|
1077 |
} |
|
1078 |
#endif |
|
1079 |
if(! TryGetValidCharForKeyAndCase( aKey, aChar, EPtiCaseFnLower)) |
|
1080 |
{ |
|
1081 |
if(! TryGetValidCharForKeyAndCase( aKey, aChar, EPtiCaseFnUpper)) |
|
1082 |
{ |
|
1083 |
return EFalse; |
|
1084 |
} |
|
1085 |
} |
|
1086 |
} |
|
1087 |
} |
|
1088 |
return ETrue; |
|
1089 |
} |
|
1090 |
||
1091 |
TBool TAknFepInputStateQwerty::TryGetValidCharForKeyAndCase(const TInt& aKey, TChar& aChar, TPtiTextCase aCase) |
|
1092 |
{ |
|
1093 |
TBuf<KMaxName> mappedCharacters; |
|
1094 |
||
1095 |
iOwner->PtiEngine()->MappingDataForKey((TPtiKey)aKey, mappedCharacters, aCase); |
|
1096 |
for (TInt i = 0; i < mappedCharacters.Length(); i++ ) |
|
1097 |
{ |
|
1098 |
if( iOwner->FepMan()->IsValidCharInNumericEditorL( mappedCharacters[i] ) ) |
|
1099 |
{ |
|
1100 |
aChar = mappedCharacters[i]; |
|
1101 |
return ETrue; |
|
1102 |
} |
|
1103 |
} |
|
1104 |
return EFalse; |
|
1105 |
} |
|
1106 |
||
1107 |
TBool TAknFepInputStateQwerty::IsLanguageWithoutCaseChanges() |
|
1108 |
{ |
|
1109 |
CPtiEngine* ptiengine = iOwner->PtiEngine(); |
|
1110 |
TInt currLanguageCode = ptiengine->CurrentLanguage()->LanguageCode(); |
|
1111 |
//update below list as and when required. |
|
1112 |
if ( ELangArabic == currLanguageCode || |
|
1113 |
ELangFarsi == currLanguageCode || |
|
1114 |
ELangHebrew == currLanguageCode || |
|
1115 |
ELangHindi == currLanguageCode || |
|
1116 |
ELangUrdu == currLanguageCode |
|
1117 |
) |
|
1118 |
{ |
|
1119 |
return ETrue; |
|
1120 |
} |
|
1121 |
return EFalse; |
|
1122 |
} |
|
1123 |
||
1124 |
TBool TAknFepInputStateQwerty::IsSpecialNonLatinScript() |
|
1125 |
{ |
|
1126 |
CPtiEngine* ptiengine = iOwner->PtiEngine(); |
|
1127 |
TInt currLanguageCode = ptiengine->CurrentLanguage()->LanguageCode(); |
|
1128 |
//update below list as and when required. |
|
1129 |
if ( ELangGreek == currLanguageCode || |
|
1130 |
ELangRussian == currLanguageCode || |
|
1131 |
ELangUkrainian == currLanguageCode || |
|
1132 |
ELangBulgarian == currLanguageCode || |
|
1133 |
ELangHebrew == currLanguageCode |
|
1134 |
) |
|
1135 |
{ |
|
1136 |
return ETrue; |
|
1137 |
} |
|
1138 |
return EFalse; |
|
1139 |
} |
|
1140 |
#endif |
|
1141 |
||
1142 |
TBool TAknFepInputStateQwerty::CheckForValidNumberEntryForqwerty(TInt aKey) |
|
1143 |
{ |
|
1144 |
TChar chr; |
|
1145 |
TKeyEvent numKey; |
|
1146 |
MAknFepManagerUIInterface* fepMan = iOwner->FepMan(); |
|
1147 |
||
1148 |
NumericCharacterForQwertyKey(aKey, numKey, |
|
1149 |
( fepMan->IsFlagSet(CAknFepManager::EFlagQwertyShiftMode)|| |
|
1150 |
fepMan->IsFlagSet(CAknFepManager::EFlagLongShiftKeyPress) ), chr); |
|
1151 |
if ((chr != 0) && |
|
1152 |
((iOwner->NumberModeKeyMapping().Locate(chr) != KErrNotFound) || |
|
1153 |
(KAknFepPlainNumbers().Locate(chr) != KErrNotFound)) || |
|
1154 |
fepMan->IsAllowedKeymappingForNumberMode(chr)) |
|
1155 |
{ |
|
1156 |
if (chr == 'E') |
|
1157 |
{ |
|
1158 |
TBuf<1> chrTmp; |
|
1159 |
chrTmp.Append(chr); |
|
1160 |
fepMan->NewCharacterL(chrTmp); |
|
1161 |
fepMan->CommitInlineEditL(); |
|
1162 |
} |
|
1163 |
else |
|
1164 |
{ |
|
1165 |
// If editor is in number mode and incoming key press would produce |
|
1166 |
// any of the allowed number mode characters, |
|
1167 |
// resend suitable key event let it pass through FEP. That way phone idle |
|
1168 |
// receives the event too. This also takes care of remapping |
|
1169 |
// different qwerty keymap layouts to edwin events. |
|
1170 |
if(!(fepMan->IsHybridAplhaEditor() && !fepMan->IsHybridAlphaModeChangedtoAplhanumeric())) |
|
1171 |
fepMan->SetFlag(CAknFepManager::EFlagPassNextKey); |
|
1172 |
CPtiEngine* ptiengine = iOwner->PtiEngine(); |
|
1173 |
CPtiCoreLanguage* lang = static_cast<CPtiCoreLanguage*>(ptiengine->CurrentLanguage()); |
|
1174 |
||
1175 |
if (lang && (numKey.iScanCode >= EPtiKeyQwerty0 && numKey.iScanCode <= EPtiKeyQwerty9)) |
|
1176 |
{ |
|
1177 |
const TInt langCode = lang->LanguageCode(); |
|
1178 |
||
1179 |
if(langCode == ELangUrdu || langCode == ELangFarsi) |
|
1180 |
{ |
|
1181 |
numKey.iCode += KLatinToEasternArabicIndicDigitsDelta; |
|
1182 |
numKey.iModifiers = numKey.iModifiers|EModifierSpecial; |
|
1183 |
} |
|
1184 |
else if (langCode == ELangArabic && fepMan->ArabicIndicDigitsInUse()) |
|
1185 |
{ |
|
1186 |
numKey.iCode += KLatinToArabicIndicDigitsDelta; |
|
1187 |
numKey.iModifiers = numKey.iModifiers|EModifierSpecial; |
|
1188 |
} |
|
1189 |
else if(TAknFepUiIndicInputManager::IsIndicLangauge(TLanguage(langCode)) |
|
1190 |
#ifdef RD_HINDI_PHONETIC_INPUT |
|
1191 |
|| TAknFepUiIndicInputManager::IsIndicPhoneticLanguage(TLanguage(langCode)) |
|
1192 |
#endif |
|
1193 |
) |
|
1194 |
{ |
|
1195 |
numKey.iCode += KLatinToDevanagariDigitsDelta; |
|
1196 |
numKey.iModifiers = numKey.iModifiers|EModifierSpecial; |
|
1197 |
} |
|
1198 |
} |
|
1199 |
// Disable UI framewroks's qwerty iCode conversion for simulated event. |
|
56
8152b1f1763a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
1200 |
numKey.iModifiers |= EModifierSpecial; |
8152b1f1763a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
1201 |
if(!(fepMan->IsHybridAplhaEditor() && !fepMan->IsHybridAlphaModeChangedtoAplhanumeric())) |
44 | 1202 |
{ |
1203 |
CCoeEnv::Static()->SimulateKeyEventL(numKey, EEventKey); |
|
1204 |
#ifdef RD_INTELLIGENT_TEXT_INPUT |
|
1205 |
CCoeEnv::Static()->SimulateKeyEventL(numKey, EEventKeyUp); |
|
1206 |
#endif |
|
1207 |
} |
|
1208 |
} |
|
1209 |
} |
|
1210 |
||
1211 |
if((fepMan->IsHybridAplhaEditor() && !fepMan->IsHybridAlphaModeChangedtoAplhanumeric()) |
|
1212 |
&&(numKey.iCode == 112 /*p*/ || numKey.iCode == 119/*w*/)) |
|
1213 |
return EFalse; |
|
1214 |
else if(!fepMan->IsHybridAplhaEditor() || fepMan->IsHybridAlphaModeChangedtoAplhanumeric()) |
|
1215 |
return ETrue; |
|
1216 |
else if(!fepMan->IsHybridAlphaModeChangedtoAplhanumeric() && |
|
1217 |
(chr !=0 || (chr==0 && fepMan->IsFlagSet(CAknFepManager::EFlagQwertyShiftMode)))) |
|
1218 |
return ETrue; |
|
1219 |
else |
|
1220 |
return EFalse; |
|
1221 |
} |
|
1222 |
// End of file |