|
1 /* |
|
2 * Copyright (c) 2002 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 TAknFepInputStateInitialNumber methods. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 #include "AknFepUiInputStateInitialNumber.h" |
|
31 #include "AknFepUIManagerStateInterface.h" |
|
32 #include "AknFepManagerUIInterface.h" |
|
33 #include "AknFepManager.h" |
|
34 |
|
35 #include <PtiEngine.h> |
|
36 #include <PtiDefs.h> |
|
37 #include <featmgr.h> //FeatureManager |
|
38 |
|
39 TAknFepInputStateInitialNumber:: |
|
40 TAknFepInputStateInitialNumber(MAknFepUIManagerStateInterface* aOwner) |
|
41 :TAknFepInputStateInitialMultitapBase(aOwner) |
|
42 { |
|
43 CPtiEngine* ptiengine = iOwner->PtiEngine(); |
|
44 ptiengine->SetInputMode(EPtiEngineNumeric); |
|
45 |
|
46 TRAP_IGNORE(ptiengine->SetExternalKeyMapL(EPtiEngineNumeric, EPtiKeyStar, |
|
47 (TDesC&)iOwner->NumberModeKeyMapping(), EPtiCaseLower)) |
|
48 } |
|
49 |
|
50 TBool TAknFepInputStateInitialNumber::HandleKeyL(TInt aKey, TKeyPressLength aLength) |
|
51 { |
|
52 CPtiEngine* ptiengine = iOwner->PtiEngine(); |
|
53 MAknFepManagerUIInterface* fepMan = iOwner->FepMan(); |
|
54 |
|
55 if (aLength == ELongKeyPress) |
|
56 { |
|
57 switch (aKey) |
|
58 { |
|
59 case EKeyRightArrow: |
|
60 case EKeyLeftArrow: |
|
61 case EKeyDownArrow: |
|
62 case EKeyUpArrow: |
|
63 case EKeyBackspace: |
|
64 return EFalse; |
|
65 case EPtiKeyStar: |
|
66 if (fepMan->EditSubmenuInUse() && fepMan->IsAbleToLaunchSCT()) |
|
67 { |
|
68 if (ptiengine->CurrentLanguage()->LanguageCode() == ELangKorean) |
|
69 { |
|
70 fepMan->LaunchSelectModeMenuL(); |
|
71 } |
|
72 else |
|
73 { |
|
74 fepMan->LaunchSpecialCharacterTableL(); |
|
75 } |
|
76 } |
|
77 default: |
|
78 return ETrue; |
|
79 } |
|
80 } |
|
81 |
|
82 if(aKey == EPtiKeyStar) |
|
83 { |
|
84 TBool append = EFalse; |
|
85 if (aLength == EShortKeyPress) |
|
86 { |
|
87 if (fepMan->EditSubmenuInUse()) |
|
88 { |
|
89 if (fepMan->IsOnlyNumericPermitted()) |
|
90 { |
|
91 append = ETrue; |
|
92 } |
|
93 else |
|
94 { |
|
95 fepMan->ClearCcpuFlag(CAknFepManager::ECcpuStateIgnoreStarUp); |
|
96 } |
|
97 } |
|
98 else |
|
99 { |
|
100 if (fepMan->IsAbleToLaunchSCT()) |
|
101 { |
|
102 fepMan->LaunchSpecialCharacterTableL(); |
|
103 } |
|
104 else |
|
105 { |
|
106 append = ETrue; |
|
107 } |
|
108 } |
|
109 } |
|
110 else |
|
111 { |
|
112 if (fepMan->EditSubmenuInUse() && fepMan->IsAbleToLaunchSCT()) |
|
113 { |
|
114 fepMan->LaunchSpecialCharacterTableL(); |
|
115 } |
|
116 } |
|
117 if (append) |
|
118 { |
|
119 #ifdef RD_INTELLIGENT_TEXT_INPUT |
|
120 |
|
121 // check editor is phonenumber editor or not. |
|
122 TBool phoneNumberEditor = (fepMan->EditorType() == CAknExtendedInputCapabilities::EPhoneNumberEditor); |
|
123 |
|
124 if( (fepMan->IsOnlyNumericPermitted()|| phoneNumberEditor ) && fepMan->GetNumericSCTResID()) |
|
125 { |
|
126 TCallBack timerExpire(NumericResourceTimerTimeoutL, this); |
|
127 fepMan->MultitapThroughSCTCharL(timerExpire); |
|
128 return ETrue; |
|
129 } |
|
130 else |
|
131 { |
|
132 NumericResourceKeyTimerTimeoutL(); |
|
133 } |
|
134 |
|
135 #else |
|
136 iData = aKey; |
|
137 TPtrC text = ptiengine->AppendKeyPress((TPtiKey)aKey); |
|
138 |
|
139 // star key is inactive if keymapping is empty. |
|
140 if (text.Length() > 0 && text[0] != 0) |
|
141 { |
|
142 fepMan->NewCharacterL(text); |
|
143 |
|
144 // Commit immediately if there is only one character associated to the key. |
|
145 TBuf<CAknFepManager::EMaximumFepWordLength> mapdata; |
|
146 ptiengine->MappingDataForKey((TPtiKey)aKey, mapdata, ptiengine->Case()); |
|
147 if (mapdata.Length() <= 1) |
|
148 { |
|
149 fepMan->CommitInlineEditL(); |
|
150 ptiengine->ClearCurrentWord(); |
|
151 iData = 0; |
|
152 } |
|
153 } |
|
154 #endif |
|
155 } |
|
156 |
|
157 return ETrue; |
|
158 } |
|
159 |
|
160 if(iData) |
|
161 { |
|
162 fepMan->CommitInlineEditL(); |
|
163 ptiengine->ClearCurrentWord(); |
|
164 |
|
165 iData = 0; |
|
166 } |
|
167 return EFalse; |
|
168 } |
|
169 |
|
170 #ifdef RD_INTELLIGENT_TEXT_INPUT |
|
171 |
|
172 TInt TAknFepInputStateInitialNumber::NumericResourceTimerTimeoutL(TAny* aPtr) |
|
173 { |
|
174 reinterpret_cast<TAknFepInputStateInitialNumber*>(aPtr)->NumericResourceKeyTimerTimeoutL(); |
|
175 return 1; |
|
176 } |
|
177 TInt TAknFepInputStateInitialNumber::NumericResourceKeyTimerTimeoutL() |
|
178 { |
|
179 if(iOwner->FepMan()->IsFlagSet(CAknFepManager::EFlagInsideMultitapInlineEditingTransaction)) |
|
180 { |
|
181 // this function is only called for number only editors |
|
182 |
|
183 iOwner->FepMan()->CommitInlineEditL(); |
|
184 } |
|
185 return 1; |
|
186 } |
|
187 |
|
188 #endif //RD_INTELLIGENT_TEXT_INPUT |
|
189 |
|
190 // End of file |