49 EKey0, |
49 EKey0, |
50 EKeyStar, |
50 EKeyStar, |
51 EKeyHash |
51 EKeyHash |
52 }; |
52 }; |
53 |
53 |
54 #if defined(USE_ORBIT_KEYMAP) |
|
55 const QChar KStar = '*'; |
54 const QChar KStar = '*'; |
56 const QChar KPlus = '+'; |
55 const QChar KPlus = '+'; |
57 const QChar KHash = '#'; |
56 const QChar KHash = '#'; |
58 #endif // #if defined(USE_ORBIT_KEYMAP) |
|
59 |
57 |
60 |
58 |
61 // * key is mapped to this |
59 // * key is mapped to this |
62 const QChar KMappedCharForStar = 'a'; |
60 const QChar KMappedCharForStar = 'a'; |
63 // # key is mapped to this |
61 // # key is mapped to this |
120 default: |
118 default: |
121 return aArrayIndex + '1'; |
119 return aArrayIndex + '1'; |
122 } |
120 } |
123 } |
121 } |
124 |
122 |
125 #if !defined(USE_ORBIT_KEYMAP) |
|
126 // ---------------------------------------------------------------------------- |
|
127 // C12keyKeyMap::UseHardcodedKeyMap |
|
128 // ---------------------------------------------------------------------------- |
|
129 QChar C12keyKeyMap::UseHardcodedKeyMap(QChar input) const |
|
130 { |
|
131 QChar ret = '0'; |
|
132 switch (input.unicode()) |
|
133 { |
|
134 #if defined(THAI_KEYMAP) |
|
135 case 0x21B2: |
|
136 ret = '0'; |
|
137 break; |
|
138 |
|
139 case 0x0E01: |
|
140 case 0x0E02: |
|
141 case 0x0E03: |
|
142 case 0x0E04: |
|
143 case 0x0E05: |
|
144 #endif |
|
145 case '-': |
|
146 case '?': |
|
147 ret = '1'; |
|
148 break; |
|
149 |
|
150 case 'a': |
|
151 case 'A': |
|
152 case 'b': |
|
153 case 'B': |
|
154 case 'c': |
|
155 case 'C': |
|
156 #if defined(THAI_KEYMAP) |
|
157 case 0x0E06: |
|
158 case 0x0E07: |
|
159 case 0x0E08: |
|
160 case 0x0E09: |
|
161 #endif |
|
162 ret = '2'; |
|
163 break; |
|
164 |
|
165 case 'd': |
|
166 case 'D': |
|
167 case 'e': |
|
168 case 'E': |
|
169 case 'f': |
|
170 case 'F': |
|
171 #if defined(THAI_KEYMAP) |
|
172 case 0x0E0A: |
|
173 case 0x0E0B: |
|
174 case 0x0E0C: |
|
175 case 0x0E0D: |
|
176 #endif |
|
177 ret = '3'; |
|
178 break; |
|
179 |
|
180 case 'g': |
|
181 case 'G': |
|
182 case 'h': |
|
183 case 'H': |
|
184 case 'i': |
|
185 case 'I': |
|
186 #if defined(THAI_KEYMAP) |
|
187 case 0x0E0E: |
|
188 case 0x0E0F: |
|
189 case 0x0E10: |
|
190 case 0x0E11: |
|
191 case 0x0E12: |
|
192 case 0x0E13: |
|
193 #endif |
|
194 ret = '4'; |
|
195 break; |
|
196 |
|
197 case 'j': |
|
198 case 'J': |
|
199 case 'k': |
|
200 case 'K': |
|
201 case 'l': |
|
202 case 'L': |
|
203 #if defined(THAI_KEYMAP) |
|
204 case 0x0E14: |
|
205 case 0x0E15: |
|
206 case 0x0E16: |
|
207 case 0x0E17: |
|
208 case 0x0E18: |
|
209 #endif |
|
210 ret = '5'; |
|
211 break; |
|
212 |
|
213 case 'm': |
|
214 case 'M': |
|
215 case 'n': |
|
216 case 'N': |
|
217 case 'o': |
|
218 case 'O': |
|
219 #if defined(THAI_KEYMAP) |
|
220 case 0x0E19: |
|
221 case 0x0E1A: |
|
222 case 0x0E1B: |
|
223 case 0x0E1C: |
|
224 case 0x0E1D: |
|
225 #endif |
|
226 ret = '6'; |
|
227 break; |
|
228 |
|
229 case 'p': |
|
230 case 'P': |
|
231 case 'q': |
|
232 case 'Q': |
|
233 case 'r': |
|
234 case 'R': |
|
235 case 's': |
|
236 case 'S': |
|
237 #if defined(THAI_KEYMAP) |
|
238 case 0x0E1E: |
|
239 case 0x0E1F: |
|
240 case 0x0E20: |
|
241 case 0x0E21: |
|
242 case 0x0E22: |
|
243 #endif |
|
244 ret = '7'; |
|
245 break; |
|
246 |
|
247 case 't': |
|
248 case 'T': |
|
249 case 'u': |
|
250 case 'U': |
|
251 case 'v': |
|
252 case 'V': |
|
253 #if defined(THAI_KEYMAP) |
|
254 case 0x0E23: |
|
255 case 0x0E24: |
|
256 case 0x0E25: |
|
257 case 0x0E26: |
|
258 case 0x0E27: |
|
259 case 0x0E28: |
|
260 case 0x0E29: |
|
261 #endif |
|
262 ret = '8'; |
|
263 break; |
|
264 |
|
265 case 'w': |
|
266 case 'W': |
|
267 case 'X': |
|
268 case 'x': |
|
269 case 'Y': |
|
270 case 'y': |
|
271 case 'z': |
|
272 case 'Z': |
|
273 #if defined(THAI_KEYMAP) |
|
274 case 0x0E2A: |
|
275 case 0x0E2B: |
|
276 case 0x0E2C: |
|
277 case 0x0E2D: |
|
278 case 0x0E2E: |
|
279 #endif |
|
280 ret = '9'; |
|
281 break; |
|
282 |
|
283 case '*': |
|
284 case '+': |
|
285 #if defined(THAI_KEYMAP) |
|
286 case 0x0E2F: |
|
287 case 0x0E3F: |
|
288 case 0x0E31: |
|
289 case 0x0E34: |
|
290 case 0x0E35: |
|
291 case 0x0E36: |
|
292 case 0x0E37: |
|
293 case 0x0E38: |
|
294 case 0x0E39: |
|
295 case 0x0E46: |
|
296 case 0x0E47: |
|
297 case 0x0E48: |
|
298 case 0x0E49: |
|
299 case 0x0E4A: |
|
300 case 0x0E4B: |
|
301 case 0x0E4C: |
|
302 #endif |
|
303 ret = KMappedCharForStar; |
|
304 break; |
|
305 |
|
306 case '#': |
|
307 #if defined(THAI_KEYMAP) |
|
308 case 0x0E30: |
|
309 case 0x0E32: |
|
310 case 0x0E33: |
|
311 case 0x0E40: |
|
312 case 0x0E41: |
|
313 case 0x0E42: |
|
314 case 0x0E43: |
|
315 case 0x0E44: |
|
316 #endif |
|
317 ret = KMappedCharForHash; |
|
318 break; |
|
319 |
|
320 case '0': |
|
321 case '1': |
|
322 case '2': |
|
323 case '3': |
|
324 case '4': |
|
325 case '5': |
|
326 case '6': |
|
327 case '7': |
|
328 case '8': |
|
329 case '9': |
|
330 case ' ': |
|
331 ret = input; // Numbers and space |
|
332 break; |
|
333 |
|
334 default: // Other (unknown) chars |
|
335 ret = KPadChar; |
|
336 } |
|
337 return ret; |
|
338 } |
|
339 #endif // #if !defined(USE_ORBIT_KEYMAP) |
|
340 |
|
341 // ---------------------------------------------------------------------------- |
123 // ---------------------------------------------------------------------------- |
342 // C12keyKeyMap::ComputeValue |
124 // C12keyKeyMap::ComputeValue |
343 // ---------------------------------------------------------------------------- |
125 // ---------------------------------------------------------------------------- |
344 TInt C12keyKeyMap::ComputeValue(QString aString, |
126 TInt C12keyKeyMap::ComputeValue(QString aString, |
345 TBool aUpperLimit, |
127 TBool aUpperLimit, |
383 |
165 |
384 aValue = QString::number(value); // Convert to decimal value |
166 aValue = QString::number(value); // Convert to decimal value |
385 return KErrNone; |
167 return KErrNone; |
386 } |
168 } |
387 |
169 |
388 #if defined(USE_ORBIT_KEYMAP) |
|
389 |
|
390 // ---------------------------------------------------------------------------- |
170 // ---------------------------------------------------------------------------- |
391 // C12keyKeyMap::SetHardcodedCharacters |
171 // C12keyKeyMap::SetHardcodedCharacters |
392 // In emulator (except in unit tests), select just the default language, as new |
172 // In emulator (except in unit tests), select just the default language, as new |
393 // SDKs have over 40 languages, causing out of memory error. |
173 // SDKs have over 40 languages, causing out of memory error. |
394 // In hardware and when compiling unit tests in emulator, select all languages |
174 // In hardware and when compiling unit tests in emulator, select all languages |
416 iKeyMapping[EKeyHash].append(KHash); |
196 iKeyMapping[EKeyHash].append(KHash); |
417 iHardcodedChars.append(KStar); |
197 iHardcodedChars.append(KStar); |
418 iHardcodedChars.append(KPlus); |
198 iHardcodedChars.append(KPlus); |
419 iHardcodedChars.append(KHash); |
199 iHardcodedChars.append(KHash); |
420 } |
200 } |
421 #endif // #if defined(USE_ORBIT_KEYMAP) |
|
422 |
201 |
423 // ---------------------------------------------------------------------------- |
202 // ---------------------------------------------------------------------------- |
424 // C12keyKeyMap::DetermineSpecialCharBehaviour |
203 // C12keyKeyMap::DetermineSpecialCharBehaviour |
425 // If input string is Thai language, skip chars that map to star or hash keys. |
204 // If input string is Thai language, skip chars that map to star or hash keys. |
426 // ---------------------------------------------------------------------------- |
205 // ---------------------------------------------------------------------------- |
461 // ---------------------------------------------------------------------------- |
240 // ---------------------------------------------------------------------------- |
462 void C12keyKeyMap::ConstructL() |
241 void C12keyKeyMap::ConstructL() |
463 { |
242 { |
464 PRINT(_L("Enter C12keyKeyMap::ConstructL")); |
243 PRINT(_L("Enter C12keyKeyMap::ConstructL")); |
465 |
244 |
466 #if defined(USE_ORBIT_KEYMAP) |
|
467 CPcsKeyMap::ConstructL(HbKeyboardVirtual12Key); |
245 CPcsKeyMap::ConstructL(HbKeyboardVirtual12Key); |
468 #else |
|
469 CPcsKeyMap::ConstructL(); |
|
470 #endif |
|
471 |
246 |
472 TInt err(KErrNone); |
247 TInt err(KErrNone); |
473 QT_TRYCATCH_ERROR(err, GetTextCodecs()); |
248 QT_TRYCATCH_ERROR(err, GetTextCodecs()); |
474 if (err != KErrNone) |
249 if (err != KErrNone) |
475 { |
250 { |