|
1 /* |
|
2 * Copyright (c) 2005 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 TAknFepInputStateChineseFindQwerty methods. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 #include "AknFepUiInputStateChineseFindQwerty.h" |
|
31 #include "AknFepUIManagerStateInterface.h" |
|
32 #include "AknFepManagerUIInterface.h" |
|
33 |
|
34 #include <e32keys.h> |
|
35 #include <PtiEngine.h> |
|
36 #include <PtiDefs.h> //keys |
|
37 |
|
38 TAknFepInputStateChineseFindQwerty::TAknFepInputStateChineseFindQwerty( |
|
39 MAknFepUIManagerStateInterface* aOwner, |
|
40 MAknFepUICtrlContainerChinese* aUIContainer) |
|
41 :TAknFepInputStateChineseBase(aOwner, aUIContainer) |
|
42 { |
|
43 iState = EQwerty; |
|
44 } |
|
45 |
|
46 TBool TAknFepInputStateChineseFindQwerty::HandleKeyL(TInt aKey, TKeyPressLength aLength) |
|
47 { |
|
48 MAknFepManagerUIInterface* fepMan = iOwner->FepMan(); |
|
49 CPtiEngine* ptiengine = iOwner->PtiEngine(); |
|
50 TBool ret = ETrue; |
|
51 |
|
52 if(!IsQwertyKey(aKey)) |
|
53 { |
|
54 ret = EFalse; |
|
55 } |
|
56 else if (aLength == EShortKeyPress && iOwner->IsValidChineseInputKeyQwerty(aKey)) |
|
57 { |
|
58 ptiengine->AppendKeyPress((TPtiKey)aKey); |
|
59 TPtrC text = ptiengine->GetPhoneticSpelling(1); |
|
60 |
|
61 if(text.Length()) |
|
62 { |
|
63 fepMan->NewCharacterL(text); |
|
64 fepMan->CommitInlineEditL(); |
|
65 ptiengine->ClearCurrentWord(); |
|
66 } |
|
67 else |
|
68 { |
|
69 ret = EFalse; |
|
70 } |
|
71 } |
|
72 return ret; |
|
73 } |
|
74 |
|
75 TBool TAknFepInputStateChineseFindQwerty::IsQwertyKey(const TInt aKey) |
|
76 { |
|
77 TBool response = EFalse; |
|
78 if ( (aKey >= EPtiKeyQwertyA && aKey <= EPtiKeyQwertyZ) || |
|
79 IsNumberKey( aKey ) || |
|
80 aKey == EPtiKeyQwertyPlus || |
|
81 aKey == EPtiKeyQwertyMinus || |
|
82 aKey == EPtiKeyQwertyComma || |
|
83 aKey == EPtiKeyQwertySemicolon || |
|
84 aKey == EPtiKeyQwertyFullstop || |
|
85 aKey == EPtiKeyQwertyHash || |
|
86 aKey == EPtiKeyQwertySlash || |
|
87 aKey == EPtiKeyQwertyApostrophe) |
|
88 { |
|
89 response = ETrue; |
|
90 } |
|
91 return response; |
|
92 } |
|
93 |
|
94 TBool TAknFepInputStateChineseFindQwerty::IsNumberKey(const TInt aKey) |
|
95 { |
|
96 TBool response = EFalse; |
|
97 if (aKey >= EPtiKeyQwerty0 && aKey <= EPtiKeyQwerty9) |
|
98 { |
|
99 response = ETrue; |
|
100 } |
|
101 return response; |
|
102 } |
|
103 |
|
104 // End of file |