|
1 /* |
|
2 * Copyright (c) 2002-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: Data model for GSPenInputPlugin. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <gspeninputpluginrsc.rsg> |
|
20 #include <featmgr.h> |
|
21 #include <hal.h> |
|
22 #include <PtiEngine.h> |
|
23 #include <AknFepGlobalEnums.h> |
|
24 #include <PtiDefs.h> |
|
25 #include <settingsinternalcrkeys.h> |
|
26 #include <peninputpluginutils.h> |
|
27 #include <AknFepInternalCRKeys.h> |
|
28 #include <AvkonInternalCRKeys.h> |
|
29 #include <aknfeppeninputenums.h> |
|
30 #include <apgwgnam.h> |
|
31 #include <eikapp.h> |
|
32 #include <eikenv.h> |
|
33 #include <eikappui.h> |
|
34 #include <featmgr.h> |
|
35 #include <peninputsettingappui.h> |
|
36 |
|
37 #include "gspeninputmodel.h" |
|
38 #include "gspeninputcontainer.h" |
|
39 #include "truisupportedlanguageid.h" |
|
40 #include "peninputpluginutils.h" |
|
41 |
|
42 // CONSTANTS |
|
43 const TInt KTwipPerInch = 1440 * 1440; |
|
44 const TInt KMidLeftBounday = 165; |
|
45 const TInt KHigLeftBounday = 225; |
|
46 const TInt KGSLanguageMask = 0x03FF; |
|
47 const TInt KISOCodeLength = 2; |
|
48 const TUid KUidtruiApp = { 0x2000B104 }; |
|
49 const TUid KUidPenInputSettingApp = { 0x2001959B }; |
|
50 |
|
51 _LIT(KLeftBracket, "(" ); |
|
52 _LIT(KRightBracket, ")" ); |
|
53 |
|
54 // ======== MEMBER FUNCTIONS ======== |
|
55 |
|
56 // --------------------------------------------------------- |
|
57 // Constructor |
|
58 // --------------------------------------------------------- |
|
59 // |
|
60 CGSRepositoryWatcher* CGSRepositoryWatcher::NewL(MGsCenRepNotifyHandlerCallback* aOwner, |
|
61 CRepository* aRepository, |
|
62 TUid aRepositoryUid ) |
|
63 { |
|
64 CGSRepositoryWatcher* self = new (ELeave) CGSRepositoryWatcher(aOwner, aRepository, aRepositoryUid); |
|
65 |
|
66 CleanupStack::PushL(self); |
|
67 self->ConstructL(); |
|
68 CleanupStack::Pop(self); |
|
69 |
|
70 return self; |
|
71 } |
|
72 |
|
73 // --------------------------------------------------------- |
|
74 // Destructor |
|
75 // --------------------------------------------------------- |
|
76 // |
|
77 CGSRepositoryWatcher::~CGSRepositoryWatcher() |
|
78 { |
|
79 if(iNotifyHandler) |
|
80 { |
|
81 iNotifyHandler->StopListening(); |
|
82 delete iNotifyHandler; |
|
83 } |
|
84 } |
|
85 |
|
86 // --------------------------------------------------------- |
|
87 // Constructor |
|
88 // --------------------------------------------------------- |
|
89 // |
|
90 CGSRepositoryWatcher::CGSRepositoryWatcher(MGsCenRepNotifyHandlerCallback* aOwner, |
|
91 CRepository* aRepository, |
|
92 TUid aRepositoryUid) |
|
93 :iOwner(aOwner), iRepository(aRepository), iRepositoryUid(aRepositoryUid) |
|
94 { |
|
95 } |
|
96 |
|
97 // --------------------------------------------------------- |
|
98 // Constructor |
|
99 // --------------------------------------------------------- |
|
100 // |
|
101 void CGSRepositoryWatcher::ConstructL() |
|
102 { |
|
103 iNotifyHandler = CCenRepNotifyHandler::NewL(*this, *iRepository); |
|
104 iNotifyHandler->StartListeningL(); |
|
105 } |
|
106 |
|
107 // --------------------------------------------------------- |
|
108 // Notify call back function |
|
109 // --------------------------------------------------------- |
|
110 // |
|
111 void CGSRepositoryWatcher::HandleNotifyInt(TUint32 aKey, TInt aNewValue) |
|
112 { |
|
113 if (iOwner) |
|
114 { |
|
115 iOwner->HandleNotifyInt(iRepositoryUid, aKey, aNewValue); |
|
116 } |
|
117 } |
|
118 |
|
119 // --------------------------------------------------------- |
|
120 // Notify call back function |
|
121 // --------------------------------------------------------- |
|
122 // |
|
123 void CGSRepositoryWatcher::HandleNotifyGeneric(TUint32 aId) |
|
124 { |
|
125 if (iOwner) |
|
126 { |
|
127 iOwner->HandleNotifyInt(iRepositoryUid, aId, 0); |
|
128 } |
|
129 } |
|
130 |
|
131 // --------------------------------------------------------- |
|
132 // Constructor |
|
133 // --------------------------------------------------------- |
|
134 // |
|
135 CGSPenInputModel* CGSPenInputModel::NewL(MGsCenRepNotifyHandlerCallback* aOwner) |
|
136 { |
|
137 CGSPenInputModel* self = new (ELeave) CGSPenInputModel(aOwner); |
|
138 |
|
139 CleanupStack::PushL(self); |
|
140 self->ConstructL(); |
|
141 CleanupStack::Pop(self); |
|
142 |
|
143 return self; |
|
144 } |
|
145 |
|
146 // --------------------------------------------------------- |
|
147 // Constructor |
|
148 // --------------------------------------------------------- |
|
149 // |
|
150 CGSPenInputModel* CGSPenInputModel::NewL() |
|
151 { |
|
152 CGSPenInputModel* self = new (ELeave) CGSPenInputModel(); |
|
153 |
|
154 CleanupStack::PushL(self); |
|
155 self->ConstructL(); |
|
156 CleanupStack::Pop(self); |
|
157 |
|
158 return self; |
|
159 } |
|
160 |
|
161 // --------------------------------------------------------- |
|
162 // Constructor |
|
163 // --------------------------------------------------------- |
|
164 // |
|
165 CGSPenInputModel::CGSPenInputModel(MGsCenRepNotifyHandlerCallback* aOwner) |
|
166 : iOwner(aOwner), iInputLanguage(ELangTest), iSpeed(0), |
|
167 iWidth(0), iColor(0), |
|
168 iLastChineseFindMethodItem(-1), |
|
169 iGuideLine(ETrue), iIsRecognitionWithDictionary(ETrue), iInputMode(ELatin) |
|
170 { |
|
171 } |
|
172 |
|
173 // --------------------------------------------------------- |
|
174 // Constructor |
|
175 // --------------------------------------------------------- |
|
176 // |
|
177 CGSPenInputModel::CGSPenInputModel() |
|
178 : iOwner(NULL), iInputLanguage(ELangTest), iSpeed(0), iWidth(0), |
|
179 iColor(0), |
|
180 iLastChineseFindMethodItem(-1), |
|
181 iGuideLine(ETrue), iIsRecognitionWithDictionary(ETrue),iInputMode(ELatin) |
|
182 { |
|
183 } |
|
184 // --------------------------------------------------------- |
|
185 // Constructor |
|
186 // --------------------------------------------------------- |
|
187 // |
|
188 void CGSPenInputModel::ConstructL() |
|
189 { |
|
190 InitTrailWidthArrayL(); |
|
191 InitWritingSpeedArray(); |
|
192 FeatureManager::InitializeLibL(); |
|
193 iPtiEngine = CPtiEngine::NewL(); |
|
194 InitializeCentralRepositoriesL(); |
|
195 iConnectErr = iPenInputServer.Connect(); |
|
196 } |
|
197 |
|
198 // --------------------------------------------------------- |
|
199 // Initializes writing speed array |
|
200 // --------------------------------------------------------- |
|
201 // |
|
202 void CGSPenInputModel::InitWritingSpeedArray() |
|
203 { |
|
204 iWritingSpeedValue[0] = EPenInputWritingSpeedVeryFast; |
|
205 iWritingSpeedValue[1] = EPenInputWritingSpeedFast; |
|
206 iWritingSpeedValue[2] = EPenInputWritingSpeedNormal; |
|
207 iWritingSpeedValue[3] = EPenInputWritingSpeedSlow; |
|
208 iWritingSpeedValue[4] = EPenInputWritingSpeedVerySlow; |
|
209 } |
|
210 |
|
211 // --------------------------------------------------------- |
|
212 // Initializes pen trail width array |
|
213 // --------------------------------------------------------- |
|
214 // |
|
215 void CGSPenInputModel::InitTrailWidthArrayL() |
|
216 { |
|
217 TInt twipX; |
|
218 TInt twipY; |
|
219 TInt pixelX; |
|
220 TInt pixelY; |
|
221 |
|
222 HAL::Get(HALData::EDisplayXTwips, twipX); |
|
223 HAL::Get(HALData::EDisplayYTwips, twipY); |
|
224 HAL::Get(HALData::EDisplayXPixels, pixelX); |
|
225 HAL::Get(HALData::EDisplayYPixels, pixelY); |
|
226 |
|
227 if (twipX * twipY <= 0 || pixelX * pixelY <= 0) |
|
228 { |
|
229 User::Leave(KErrNotSupported); |
|
230 } |
|
231 |
|
232 TInt dpi = (pixelX * pixelY) / ((twipX * twipY) * KTwipPerInch); |
|
233 |
|
234 if (dpi < KMidLeftBounday) |
|
235 { |
|
236 dpi = EDPILow; |
|
237 } |
|
238 else if (dpi >= KMidLeftBounday && dpi < KHigLeftBounday) |
|
239 { |
|
240 dpi = EDPIMiddle; |
|
241 } |
|
242 else |
|
243 { |
|
244 dpi = EDPIHigh; |
|
245 } |
|
246 |
|
247 switch(dpi) |
|
248 { |
|
249 case EDPILow: |
|
250 { |
|
251 InitLowDPI(); |
|
252 } |
|
253 break; |
|
254 case EDPIMiddle: |
|
255 { |
|
256 InitMiddleDPI(); |
|
257 } |
|
258 break; |
|
259 case EDPIHigh: |
|
260 { |
|
261 InitHighDPI(); |
|
262 } |
|
263 break; |
|
264 default: |
|
265 { |
|
266 InitLowDPI(); |
|
267 break; |
|
268 } |
|
269 } |
|
270 } |
|
271 |
|
272 // --------------------------------------------------------- |
|
273 // Initializes low dpi array |
|
274 // --------------------------------------------------------- |
|
275 // |
|
276 void CGSPenInputModel::InitLowDPI() |
|
277 { |
|
278 iTrailWidthValue[0] = 2; |
|
279 iTrailWidthValue[1] = 3; |
|
280 iTrailWidthValue[2] = 4; |
|
281 } |
|
282 |
|
283 // --------------------------------------------------------- |
|
284 // Initializes middle dpi array |
|
285 // --------------------------------------------------------- |
|
286 // |
|
287 void CGSPenInputModel::InitMiddleDPI() |
|
288 { |
|
289 iTrailWidthValue[0] = 3; |
|
290 iTrailWidthValue[1] = 4; |
|
291 iTrailWidthValue[2] = 6; |
|
292 } |
|
293 |
|
294 // --------------------------------------------------------- |
|
295 // Initializes high dpi array |
|
296 // --------------------------------------------------------- |
|
297 // |
|
298 void CGSPenInputModel::InitHighDPI() |
|
299 { |
|
300 iTrailWidthValue[0] = 3; |
|
301 iTrailWidthValue[1] = 4; |
|
302 iTrailWidthValue[2] = 8; |
|
303 } |
|
304 |
|
305 // --------------------------------------------------------- |
|
306 // Destructor |
|
307 // --------------------------------------------------------- |
|
308 // |
|
309 CGSPenInputModel::~CGSPenInputModel() |
|
310 { |
|
311 delete iPersonalizationWatcher; |
|
312 delete iPersonalizationRepository; |
|
313 |
|
314 delete iAknfepWatcher; |
|
315 delete iAknfepRepository; |
|
316 |
|
317 delete iAknWatcher; |
|
318 delete iAknRepository; |
|
319 |
|
320 FeatureManager::UnInitializeLib(); |
|
321 delete iPtiEngine; |
|
322 |
|
323 iPenInputServer.Close(); |
|
324 } |
|
325 |
|
326 // --------------------------------------------------------- |
|
327 // Initializes Repository |
|
328 // --------------------------------------------------------- |
|
329 // |
|
330 void CGSPenInputModel::InitializeCentralRepositoriesL() |
|
331 { |
|
332 iPersonalizationRepository = CRepository::NewL(KCRUidPersonalizationSettings); |
|
333 iPersonalizationWatcher = CGSRepositoryWatcher::NewL(iOwner, iPersonalizationRepository,KCRUidPersonalizationSettings); |
|
334 |
|
335 iAknfepRepository = CRepository::NewL(KCRUidAknFep); |
|
336 iAknfepWatcher = CGSRepositoryWatcher::NewL(iOwner, iAknfepRepository,KCRUidAknFep); |
|
337 |
|
338 iAknRepository = CRepository::NewL(KCRUidAvkon); |
|
339 iAknWatcher = CGSRepositoryWatcher::NewL(iOwner, iAknRepository,KCRUidAvkon); |
|
340 } |
|
341 |
|
342 // --------------------------------------------------------- |
|
343 // Current input language name in list box item |
|
344 // --------------------------------------------------------- |
|
345 // |
|
346 void CGSPenInputModel::InputLanguage(TDes& aLanguage) |
|
347 { |
|
348 iAknfepRepository->Get(KAknFepInputTxtLang, iInputLanguage); |
|
349 iPtiEngine->GetLocalizedLanguageName(iInputLanguage & KGSLanguageMask, |
|
350 aLanguage); |
|
351 } |
|
352 |
|
353 // --------------------------------------------------------- |
|
354 // Current input languageID |
|
355 // --------------------------------------------------------- |
|
356 // |
|
357 TInt CGSPenInputModel::InputLanguage() |
|
358 { |
|
359 iAknfepRepository->Get(KAknFepInputTxtLang, iInputLanguage); |
|
360 return iInputLanguage; |
|
361 } |
|
362 |
|
363 // --------------------------------------------------------- |
|
364 // Get languages from ptiengine |
|
365 // --------------------------------------------------------- |
|
366 // |
|
367 void CGSPenInputModel::GetLanguagesFromPtiL(TBool aISOCode, CDesCArray* aLanguageNames) |
|
368 { |
|
369 InputLanguage(); |
|
370 RArray<TInt> languageCodeArray; |
|
371 |
|
372 iPtiEngine->GetAvailableLanguagesL(languageCodeArray); |
|
373 |
|
374 const TInt count = languageCodeArray.Count(); |
|
375 TInt langId = 0; |
|
376 HBufC* buffer = HBufC::NewLC(KGSBufSize); |
|
377 TBuf<KISOCodeLength> isoCodeName; |
|
378 |
|
379 for (TInt index = 0; index < count; index ++) |
|
380 { |
|
381 langId = languageCodeArray[index]; |
|
382 |
|
383 TPtr ptrToBuffer(buffer->Des()); |
|
384 iPtiEngine->GetLocalizedLanguageName(langId & KGSLanguageMask, |
|
385 ptrToBuffer); |
|
386 |
|
387 //AdjustLanguageName(langId & KGSLanguageMask, ptrToBuffer); |
|
388 |
|
389 if (aISOCode) |
|
390 { |
|
391 if (AknPenInputUtils::GetISOLanguageCode(TLanguage(langId), isoCodeName)) |
|
392 { |
|
393 ptrToBuffer.Append(KLeftBracket); |
|
394 ptrToBuffer.Append(isoCodeName); |
|
395 ptrToBuffer.Append(KRightBracket); |
|
396 } |
|
397 } |
|
398 |
|
399 aLanguageNames->AppendL(ptrToBuffer); |
|
400 if (iInputLanguage == langId) |
|
401 { |
|
402 iLanguageIndex = index; |
|
403 } |
|
404 |
|
405 ptrToBuffer.Zero(); |
|
406 } |
|
407 |
|
408 CleanupStack::PopAndDestroy(buffer); |
|
409 languageCodeArray.Reset(); |
|
410 languageCodeArray.Close(); |
|
411 } |
|
412 |
|
413 // --------------------------------------------------------- |
|
414 // Get Popup Query languages from ptiengine |
|
415 // --------------------------------------------------------- |
|
416 // |
|
417 void CGSPenInputModel::GetPopupQuerylanguagesFromPtiL(CDesCArray* aLanguageNames) |
|
418 { |
|
419 RArray<TInt> languageCodeArray; |
|
420 |
|
421 iPtiEngine->GetAvailableLanguagesL(languageCodeArray); |
|
422 |
|
423 // Item format should be "<icon_index>\t<item_text>" |
|
424 _LIT( KIconIndexSelected, "0\t" ); |
|
425 _LIT( KIconIndexNotSelected, "\t" );// No icon |
|
426 |
|
427 MPtiLanguage* lang = NULL; |
|
428 TBuf<KISOCodeLength> isoCodeName; |
|
429 |
|
430 for (TInt index = 0; index < languageCodeArray.Count(); index ++) |
|
431 { |
|
432 lang = iPtiEngine->GetLanguage(languageCodeArray[index]); |
|
433 if (!lang) |
|
434 { |
|
435 User::Leave(KErrCorrupt); |
|
436 } |
|
437 |
|
438 // Buffer should contain both tabulator string and localized name: |
|
439 HBufC* langStrBuf = HBufC::NewL(lang->LocalizedName().Length() + 7); |
|
440 CleanupStack::PushL(langStrBuf); |
|
441 |
|
442 TPtr langStrPtr = langStrBuf->Des(); |
|
443 // If language is current language - use selected icon in lbx: |
|
444 if(lang->LanguageCode() == InputLanguage()) |
|
445 { |
|
446 langStrPtr.Append(KIconIndexSelected); |
|
447 iLanguageIndex = index; |
|
448 } |
|
449 else |
|
450 { |
|
451 langStrPtr.Append(KIconIndexNotSelected); |
|
452 } |
|
453 |
|
454 langStrPtr.Append(lang->LocalizedName()); |
|
455 |
|
456 //AdjustLanguageName(lang->LanguageCode(), langStrPtr); |
|
457 |
|
458 /*if (AknPenInputUtils::GetISOLanguageCode(TLanguage(lang->LanguageCode()), |
|
459 isoCodeName)) |
|
460 { |
|
461 langStrPtr.Append(KLeftBracket); |
|
462 langStrPtr.Append(isoCodeName); |
|
463 langStrPtr.Append(KRightBracket); |
|
464 }*/ |
|
465 aLanguageNames->AppendL(langStrPtr); |
|
466 |
|
467 CleanupStack::PopAndDestroy(langStrBuf); |
|
468 } |
|
469 |
|
470 languageCodeArray.Reset(); |
|
471 languageCodeArray.Close(); |
|
472 } |
|
473 |
|
474 // --------------------------------------------------------- |
|
475 // Store input language to Repository |
|
476 // --------------------------------------------------------- |
|
477 // |
|
478 void CGSPenInputModel::SetInputLanguageL() |
|
479 { |
|
480 RArray<TInt> languageCodeArray; |
|
481 iPtiEngine->GetAvailableLanguagesL(languageCodeArray); |
|
482 |
|
483 const TInt count = languageCodeArray.Count(); |
|
484 |
|
485 if (iLanguageIndex <= count) |
|
486 { |
|
487 iInputLanguage = languageCodeArray[iLanguageIndex]; |
|
488 iAknfepRepository->Set(KAknFepInputTxtLang, iInputLanguage); |
|
489 } |
|
490 |
|
491 languageCodeArray.Reset(); |
|
492 languageCodeArray.Close(); |
|
493 |
|
494 // Remember which chinese language variant was used |
|
495 // for the chinese find method setting |
|
496 TUint key = ChineseFindMethodCRKey(); |
|
497 if(key != iLastChineseFindMethodItem) |
|
498 { |
|
499 iAknRepository->Set(KAknAdaptiveSearchLastChinese, (int)key); |
|
500 iLastChineseFindMethodItem = key; |
|
501 } |
|
502 } |
|
503 |
|
504 // --------------------------------------------------------- |
|
505 // Current writing speed index in list box item |
|
506 // --------------------------------------------------------- |
|
507 // |
|
508 TInt CGSPenInputModel::WritingSpeed() |
|
509 { |
|
510 iPersonalizationRepository->Get(KSettingsWritingSpeed, iSpeed); |
|
511 |
|
512 for (TInt index = 0; index < EWritingSpeedArrayLength; index++) |
|
513 { |
|
514 if (iSpeed == iWritingSpeedValue[index]) |
|
515 { |
|
516 return index; |
|
517 } |
|
518 } |
|
519 |
|
520 iSpeed = iWritingSpeedValue[0]; |
|
521 iPersonalizationRepository->Set(KSettingsWritingSpeed, iSpeed); |
|
522 |
|
523 return 0; |
|
524 } |
|
525 |
|
526 // --------------------------------------------------------- |
|
527 // DStore writing speed to Repository |
|
528 // --------------------------------------------------------- |
|
529 // |
|
530 void CGSPenInputModel::SetWritingSpeed(const TInt aSpeed) |
|
531 { |
|
532 iSpeed = iWritingSpeedValue[aSpeed]; |
|
533 iPersonalizationRepository->Set(KSettingsWritingSpeed, iSpeed); |
|
534 } |
|
535 |
|
536 // --------------------------------------------------------- |
|
537 // Store guid line to Repository |
|
538 // --------------------------------------------------------- |
|
539 // |
|
540 void CGSPenInputModel::SetGuideLine(TInt aGuideLine) |
|
541 { |
|
542 iGuideLine = aGuideLine; |
|
543 iPersonalizationRepository->Set(KSettingsPenInputGuideLine, iGuideLine); |
|
544 } |
|
545 |
|
546 // --------------------------------------------------------- |
|
547 // Store recognition with dictionary to Repository |
|
548 // --------------------------------------------------------- |
|
549 // |
|
550 void CGSPenInputModel::SetRecognitionWithDictionary(TInt aRecognitionWithDictionary) |
|
551 { |
|
552 iIsRecognitionWithDictionary = aRecognitionWithDictionary; |
|
553 iPersonalizationRepository->Set(KSettingRecognitionwithdictionary, iIsRecognitionWithDictionary); |
|
554 } |
|
555 // --------------------------------------------------------- |
|
556 // Get current guid line from Repository |
|
557 // --------------------------------------------------------- |
|
558 // |
|
559 TInt CGSPenInputModel::GuideLine() |
|
560 { |
|
561 iPersonalizationRepository->Get(KSettingsPenInputGuideLine, iGuideLine); |
|
562 |
|
563 if (iGuideLine == 0 || iGuideLine == 1) |
|
564 { |
|
565 return iGuideLine; |
|
566 } |
|
567 iGuideLine = 1; //Set default value to repository key |
|
568 iPersonalizationRepository->Set(KSettingsPenInputGuideLine, iGuideLine); |
|
569 |
|
570 return iGuideLine; |
|
571 } |
|
572 |
|
573 // --------------------------------------------------------- |
|
574 // Get the item of recognition with dictionary from Repository |
|
575 // --------------------------------------------------------- |
|
576 // |
|
577 TInt CGSPenInputModel::RecognitionWithDictionary() |
|
578 { |
|
579 iPersonalizationRepository->Get(KSettingRecognitionwithdictionary, iIsRecognitionWithDictionary); |
|
580 |
|
581 if (iIsRecognitionWithDictionary == 0 || iIsRecognitionWithDictionary == 1) |
|
582 { |
|
583 return iIsRecognitionWithDictionary; |
|
584 } |
|
585 iIsRecognitionWithDictionary = 1; //Set default value to repository key |
|
586 iPersonalizationRepository->Set(KSettingRecognitionwithdictionary, iIsRecognitionWithDictionary); |
|
587 |
|
588 return iIsRecognitionWithDictionary; |
|
589 } |
|
590 |
|
591 // --------------------------------------------------------- |
|
592 // Store input method for find to Repository |
|
593 // --------------------------------------------------------- |
|
594 // |
|
595 void CGSPenInputModel::SetInputMethodForFind(TInt aInputMethodForFind) |
|
596 { |
|
597 iInputMethodForFind = aInputMethodForFind; |
|
598 iAknRepository->Set(KAknAvkonAdaptiveSearchEnabled, iInputMethodForFind); |
|
599 } |
|
600 |
|
601 // --------------------------------------------------------- |
|
602 // Get current input method for find from Repository |
|
603 // --------------------------------------------------------- |
|
604 // |
|
605 TInt CGSPenInputModel::InputMethodForFind() |
|
606 { |
|
607 iAknRepository->Get(KAknAvkonAdaptiveSearchEnabled, iInputMethodForFind); |
|
608 |
|
609 if (iInputMethodForFind == 0 || iInputMethodForFind == 1) |
|
610 { |
|
611 return iInputMethodForFind; |
|
612 } |
|
613 |
|
614 // Set default value to qtn_ads_settings_adaptive_grid |
|
615 iInputMethodForFind = 1; |
|
616 iAknRepository->Set(KAknAvkonAdaptiveSearchEnabled, iInputMethodForFind); |
|
617 |
|
618 return iInputMethodForFind; |
|
619 } |
|
620 |
|
621 // --------------------------------------------------------- |
|
622 // Get chinese find method resource id |
|
623 // --------------------------------------------------------- |
|
624 // |
|
625 TInt CGSPenInputModel::ChineseFindMethodResourceID() |
|
626 { |
|
627 TInt resource = -1; |
|
628 switch(ChineseFindMethodCRKey()) |
|
629 { |
|
630 case KAknAdaptiveSearchChinesePRC: |
|
631 { |
|
632 resource = R_GS_CHINESEFINDMETHOD_SIMPLE_SETTING_PAGE_LBX; |
|
633 break; |
|
634 } |
|
635 case KAknAdaptiveSearchChineseTW: |
|
636 { |
|
637 resource = R_GS_CHINESEFINDMETHOD_TAIWAN_SETTING_PAGE_LBX; |
|
638 break; |
|
639 } |
|
640 case KAknAdaptiveSearchChineseHongkong: |
|
641 { |
|
642 resource = R_GS_CHINESEFINDMETHOD_HONGKONG_SETTING_PAGE_LBX; |
|
643 break; |
|
644 } |
|
645 } |
|
646 return resource; |
|
647 } |
|
648 |
|
649 // --------------------------------------------------------- |
|
650 // Get chinese find method cenrep key |
|
651 // --------------------------------------------------------- |
|
652 // |
|
653 TUint CGSPenInputModel::ChineseFindMethodCRKey() |
|
654 { |
|
655 TUint key(0); |
|
656 // For the first time, update value from cenrep. |
|
657 // If key does not exist, set to 0. Then it is not queried again. |
|
658 if(iLastChineseFindMethodItem < 0) |
|
659 { |
|
660 if(iAknRepository->Get(KAknAdaptiveSearchLastChinese, iLastChineseFindMethodItem) |
|
661 != KErrNone) |
|
662 { |
|
663 iLastChineseFindMethodItem = 0; |
|
664 } |
|
665 } |
|
666 |
|
667 // If input language is one of the chinese then show |
|
668 // the setting item for that language |
|
669 if (iInputLanguage == ELangPrcChinese) |
|
670 { |
|
671 key = KAknAdaptiveSearchChinesePRC; |
|
672 } |
|
673 else if (iInputLanguage == ELangTaiwanChinese) |
|
674 { |
|
675 key = KAknAdaptiveSearchChineseTW; |
|
676 } |
|
677 else if (iInputLanguage == ELangHongKongChinese) |
|
678 { |
|
679 key = KAknAdaptiveSearchChineseHongkong; |
|
680 } |
|
681 // If language is not chinese, and there is used chinese item, |
|
682 // then show the last used setting item. |
|
683 else if (iLastChineseFindMethodItem > 0) |
|
684 { |
|
685 key = iLastChineseFindMethodItem; |
|
686 } |
|
687 return key; |
|
688 } |
|
689 |
|
690 // --------------------------------------------------------- |
|
691 // Store chinese find method to Repository |
|
692 // --------------------------------------------------------- |
|
693 // |
|
694 void CGSPenInputModel::SetChineseFindMethod(TInt aChineseFindMethod) |
|
695 { |
|
696 TUint key = ChineseFindMethodCRKey(); |
|
697 |
|
698 iChineseFindMethod = aChineseFindMethod; |
|
699 |
|
700 if(key > 0) |
|
701 { |
|
702 iAknRepository->Set(key, iChineseFindMethod); |
|
703 } |
|
704 } |
|
705 |
|
706 // --------------------------------------------------------- |
|
707 // Get current input method for find from Repository |
|
708 // --------------------------------------------------------- |
|
709 // |
|
710 TInt CGSPenInputModel::ChineseFindMethod() |
|
711 { |
|
712 TUint key = ChineseFindMethodCRKey(); |
|
713 |
|
714 if(key > 0) |
|
715 { |
|
716 if (iAknRepository->Get(key, iChineseFindMethod) == KErrNotFound) |
|
717 { |
|
718 // Set default value to repository key |
|
719 iChineseFindMethod = 0; |
|
720 iAknRepository->Set(key, iChineseFindMethod); |
|
721 } |
|
722 } |
|
723 |
|
724 return iChineseFindMethod; |
|
725 } |
|
726 |
|
727 // --------------------------------------------------------- |
|
728 // Current pen trail width index in list box item |
|
729 // --------------------------------------------------------- |
|
730 // |
|
731 TInt CGSPenInputModel::TrailWidth() |
|
732 { |
|
733 iPersonalizationRepository->Get(KSettingsPenWidth, iWidth); |
|
734 |
|
735 for (TInt index = 0; index < ETrailWidthArrayLength; index++) |
|
736 { |
|
737 if (iWidth == iTrailWidthValue[index]) |
|
738 { |
|
739 return index; |
|
740 } |
|
741 } |
|
742 |
|
743 iWidth = iTrailWidthValue[0]; |
|
744 iPersonalizationRepository->Set(KSettingsPenWidth, iWidth); |
|
745 |
|
746 return 0; |
|
747 } |
|
748 |
|
749 // --------------------------------------------------------- |
|
750 // Store pen trail width to Repository |
|
751 // --------------------------------------------------------- |
|
752 // |
|
753 void CGSPenInputModel::SetTrailWidth(const TInt aWidth) |
|
754 { |
|
755 iWidth = iTrailWidthValue[aWidth]; |
|
756 iPersonalizationRepository->Set(KSettingsPenWidth, iWidth); |
|
757 } |
|
758 |
|
759 // --------------------------------------------------------- |
|
760 // Current pen trail colour index in list box item |
|
761 // --------------------------------------------------------- |
|
762 // |
|
763 TInt CGSPenInputModel::TrailColour() |
|
764 { |
|
765 iPersonalizationRepository->Get(KSettingsPenColor, iColor); |
|
766 if (!AvailableTrailColor(TRgb(iColor))) |
|
767 { |
|
768 iColor = AknPenInputTrailColorUtils::GetTrailColorByTheme(); |
|
769 } |
|
770 |
|
771 return iColor; |
|
772 } |
|
773 |
|
774 // --------------------------------------------------------- |
|
775 // Store pen trail colour to Repository |
|
776 // --------------------------------------------------------- |
|
777 // |
|
778 void CGSPenInputModel::SetTrailColour(const TInt aColour) |
|
779 { |
|
780 iColor = aColour; |
|
781 iPersonalizationRepository->Set(KSettingsPenColor, aColour); |
|
782 } |
|
783 |
|
784 // --------------------------------------------------------- |
|
785 // Set Inpt mode based on current language |
|
786 // --------------------------------------------------------- |
|
787 // |
|
788 void CGSPenInputModel::SetInputModeBySettingPage(const TInt aIndex) |
|
789 { |
|
790 TInt curInputMode = -1; |
|
791 |
|
792 MPtiLanguage* ptiLang = iPtiEngine->GetLanguage(iInputLanguage & KGSLanguageMask); |
|
793 |
|
794 if (iInputLanguage == ELangPrcChinese) |
|
795 { |
|
796 if (aIndex == 0 && ptiLang->HasInputMode(EPtiEnginePinyinByPhrase)) |
|
797 { |
|
798 curInputMode = EPinyin; |
|
799 } |
|
800 else |
|
801 { |
|
802 curInputMode = EStroke; |
|
803 } |
|
804 |
|
805 if (curInputMode != -1) |
|
806 { |
|
807 iPersonalizationRepository->Set(KSettingsDefaultVkbPrc, curInputMode); |
|
808 iInputMode = curInputMode; |
|
809 } |
|
810 } |
|
811 else if (iInputLanguage == ELangHongKongChinese) |
|
812 { |
|
813 if (aIndex == 0 && ptiLang->HasInputMode(EPtiEngineStrokeByPhrase)) |
|
814 { |
|
815 curInputMode = EStroke; |
|
816 } |
|
817 else |
|
818 { |
|
819 curInputMode = ECangJie; |
|
820 } |
|
821 |
|
822 if (curInputMode != -1) |
|
823 { |
|
824 iPersonalizationRepository->Set(KSettingsDefaultVkbHk, curInputMode); |
|
825 iInputMode = curInputMode; |
|
826 } |
|
827 } |
|
828 else if (iInputLanguage == ELangTaiwanChinese) |
|
829 { |
|
830 if (aIndex == 0 && ptiLang->HasInputMode(EPtiEngineZhuyinByPhrase)) |
|
831 { |
|
832 curInputMode = EZhuyin; |
|
833 } |
|
834 else if (aIndex == 0 && ptiLang->HasInputMode(EPtiEngineStrokeByPhrase)) |
|
835 { |
|
836 curInputMode = EStroke; |
|
837 } |
|
838 else if (aIndex == 0 && ptiLang->HasInputMode(EPtiEnginePinyinByPhrase)) |
|
839 { |
|
840 curInputMode = EPinyin; |
|
841 } |
|
842 else if (aIndex == 1 && ptiLang->HasInputMode(EPtiEngineStrokeByPhrase)) |
|
843 { |
|
844 curInputMode = EStroke; |
|
845 } |
|
846 else if (aIndex == 1 && ptiLang->HasInputMode(EPtiEnginePinyinByPhrase)) |
|
847 { |
|
848 curInputMode = EPinyin; |
|
849 } |
|
850 else if (aIndex == 2) |
|
851 { |
|
852 curInputMode = EPinyin; |
|
853 } |
|
854 |
|
855 if (curInputMode != -1) |
|
856 { |
|
857 iPersonalizationRepository->Set(KSettingsDefaultVkbTw, curInputMode); |
|
858 iInputMode = curInputMode; |
|
859 } |
|
860 } |
|
861 } |
|
862 |
|
863 // --------------------------------------------------------- |
|
864 // Get input mode index in setting page |
|
865 // --------------------------------------------------------- |
|
866 // |
|
867 TInt CGSPenInputModel::InputModeInSettingPage() |
|
868 { |
|
869 TInt index = 0; |
|
870 TInt skipCount = 0; |
|
871 MPtiLanguage* ptiLang = iPtiEngine->GetLanguage(iInputLanguage & KGSLanguageMask); |
|
872 |
|
873 if (iInputLanguage == ELangPrcChinese) |
|
874 { |
|
875 if (iInputMode == EPinyin && ptiLang->HasInputMode(EPtiEnginePinyinByPhrase)) |
|
876 { |
|
877 return index; |
|
878 } |
|
879 |
|
880 if (!ptiLang->HasInputMode(EPtiEnginePinyinByPhrase)) |
|
881 { |
|
882 skipCount ++; |
|
883 } |
|
884 |
|
885 if (iInputMode == EStroke && ptiLang->HasInputMode(EPtiEngineStrokeByPhrase)) |
|
886 { |
|
887 index ++; |
|
888 return index - skipCount; |
|
889 } |
|
890 } |
|
891 else if (iInputLanguage == ELangHongKongChinese) |
|
892 { |
|
893 if (iInputMode == EStroke && ptiLang->HasInputMode(EPtiEngineStrokeByPhrase)) |
|
894 { |
|
895 return index; |
|
896 } |
|
897 |
|
898 if (!ptiLang->HasInputMode(EPtiEngineStrokeByPhrase)) |
|
899 { |
|
900 skipCount ++; |
|
901 } |
|
902 |
|
903 if ( iInputMode == ECangJie && ( |
|
904 ptiLang->HasInputMode(EPtiEngineNormalCangjieQwerty)|| |
|
905 ptiLang->HasInputMode(EPtiEngineNormalCangjieVkb) ) ) |
|
906 { |
|
907 index ++; |
|
908 return index - skipCount; |
|
909 } |
|
910 } |
|
911 else if (iInputLanguage == ELangTaiwanChinese) |
|
912 { |
|
913 if (iInputMode == EZhuyin && ptiLang->HasInputMode(EPtiEngineZhuyinByPhrase)) |
|
914 { |
|
915 return index; |
|
916 } |
|
917 |
|
918 if (!ptiLang->HasInputMode(EPtiEngineZhuyinByPhrase)) |
|
919 { |
|
920 skipCount ++; |
|
921 } |
|
922 |
|
923 if (iInputMode == EStroke && ptiLang->HasInputMode(EPtiEngineStrokeByPhrase)) |
|
924 { |
|
925 index ++; |
|
926 return index - skipCount; |
|
927 } |
|
928 if (!ptiLang->HasInputMode(EPtiEngineStrokeByPhrase)) |
|
929 { |
|
930 skipCount ++; |
|
931 } |
|
932 if (iInputMode == EPinyin && ptiLang->HasInputMode(EPtiEnginePinyinByPhrase)) |
|
933 { |
|
934 index ++; |
|
935 return index - skipCount; |
|
936 } |
|
937 } |
|
938 |
|
939 return index; |
|
940 } |
|
941 |
|
942 // --------------------------------------------------------- |
|
943 // Get input mode resource id |
|
944 // --------------------------------------------------------- |
|
945 // |
|
946 TInt CGSPenInputModel::InputModeResourceID() |
|
947 { |
|
948 TInt resource = -1; |
|
949 if (iInputLanguage == ELangPrcChinese) |
|
950 { |
|
951 resource = R_GS_OSK_SIMPLECHINESE_SETTING_PAGE_LBX; |
|
952 } |
|
953 else if (iInputLanguage == ELangHongKongChinese) |
|
954 { |
|
955 resource = R_GS_OSK_HONGKONGCHINESE_SETTING_PAGE_LBX; |
|
956 } |
|
957 else if (iInputLanguage == ELangTaiwanChinese) |
|
958 { |
|
959 resource = R_GS_OSK_TAIWANCHINESE_SETTING_PAGE_LBX; |
|
960 } |
|
961 |
|
962 return resource; |
|
963 } |
|
964 |
|
965 // --------------------------------------------------------- |
|
966 // Reset input mode destription array |
|
967 // --------------------------------------------------------- |
|
968 // |
|
969 void CGSPenInputModel::ResetInputModeArray(CDesCArrayFlat* aInputModeItems) |
|
970 { |
|
971 if ( !aInputModeItems ) |
|
972 { |
|
973 return; |
|
974 } |
|
975 |
|
976 MPtiLanguage* ptiLang = iPtiEngine->GetLanguage(iInputLanguage & KGSLanguageMask); |
|
977 switch(iInputLanguage) |
|
978 { |
|
979 case ELangPrcChinese: |
|
980 { |
|
981 if(!ptiLang->HasInputMode(EPtiEngineStrokeByPhrase)) |
|
982 { |
|
983 aInputModeItems->Delete(1); |
|
984 } |
|
985 if(!ptiLang->HasInputMode(EPtiEnginePinyinByPhrase)) |
|
986 { |
|
987 aInputModeItems->Delete(0); |
|
988 } |
|
989 } |
|
990 break; |
|
991 case ELangHongKongChinese: |
|
992 { |
|
993 if(!ptiLang->HasInputMode(EPtiEngineNormalCangjieVkb)) |
|
994 { |
|
995 aInputModeItems->Delete(1); |
|
996 } |
|
997 if(!ptiLang->HasInputMode(EPtiEngineStrokeByPhrase)) |
|
998 { |
|
999 aInputModeItems->Delete(0); |
|
1000 } |
|
1001 } |
|
1002 break; |
|
1003 case ELangTaiwanChinese: |
|
1004 { |
|
1005 if(!ptiLang->HasInputMode(EPtiEnginePinyinByPhrase)) |
|
1006 { |
|
1007 aInputModeItems->Delete(2); |
|
1008 } |
|
1009 if(!ptiLang->HasInputMode(EPtiEngineStrokeByPhrase)) |
|
1010 { |
|
1011 aInputModeItems->Delete(1); |
|
1012 } |
|
1013 if(!ptiLang->HasInputMode(EPtiEngineZhuyinByPhrase)) |
|
1014 { |
|
1015 aInputModeItems->Delete(0); |
|
1016 } |
|
1017 } |
|
1018 break; |
|
1019 default: |
|
1020 break; |
|
1021 } |
|
1022 } |
|
1023 |
|
1024 // --------------------------------------------------------- |
|
1025 // Reset input mode to default input mode when language changed |
|
1026 // --------------------------------------------------------- |
|
1027 // |
|
1028 void CGSPenInputModel::ResetDefaultInputMode() |
|
1029 { |
|
1030 switch(iInputLanguage) |
|
1031 { |
|
1032 case ELangPrcChinese: |
|
1033 { |
|
1034 if (InputMode() != EPinyin) |
|
1035 { |
|
1036 SetInputMode(EPinyin); |
|
1037 } |
|
1038 } |
|
1039 break; |
|
1040 case ELangHongKongChinese: |
|
1041 { |
|
1042 if (InputMode() != EStroke) |
|
1043 { |
|
1044 SetInputMode(EStroke); |
|
1045 } |
|
1046 } |
|
1047 break; |
|
1048 case ELangTaiwanChinese: |
|
1049 { |
|
1050 if (InputMode() != EZhuyin) |
|
1051 { |
|
1052 SetInputMode(EZhuyin); |
|
1053 } |
|
1054 } |
|
1055 break; |
|
1056 default: |
|
1057 break; |
|
1058 } |
|
1059 } |
|
1060 |
|
1061 // --------------------------------------------------------- |
|
1062 // Reset Fep input mode based on current input language |
|
1063 // --------------------------------------------------------- |
|
1064 // |
|
1065 void CGSPenInputModel::ResetFepDefaultInputMode() |
|
1066 { |
|
1067 switch(iInputLanguage) |
|
1068 { |
|
1069 case ELangPrcChinese: |
|
1070 { |
|
1071 if (GetFepInputMode() != EPinyin) |
|
1072 { |
|
1073 SetFepInputMode(EPinyin); |
|
1074 } |
|
1075 } |
|
1076 break; |
|
1077 case ELangHongKongChinese: |
|
1078 { |
|
1079 if (GetFepInputMode() != EStroke) |
|
1080 { |
|
1081 SetFepInputMode(EStroke); |
|
1082 } |
|
1083 } |
|
1084 break; |
|
1085 case ELangTaiwanChinese: |
|
1086 { |
|
1087 if (GetFepInputMode() != EZhuyin) |
|
1088 { |
|
1089 SetFepInputMode(EZhuyin); |
|
1090 } |
|
1091 } |
|
1092 break; |
|
1093 default: |
|
1094 break; |
|
1095 } |
|
1096 |
|
1097 } |
|
1098 |
|
1099 // --------------------------------------------------------- |
|
1100 // Set input mode to repository |
|
1101 // --------------------------------------------------------- |
|
1102 // |
|
1103 void CGSPenInputModel::SetInputMode(TInt aInputMode) |
|
1104 { |
|
1105 switch(iInputLanguage) |
|
1106 { |
|
1107 case ELangPrcChinese: |
|
1108 { |
|
1109 iPersonalizationRepository->Set(KSettingsDefaultVkbPrc, aInputMode); |
|
1110 } |
|
1111 break; |
|
1112 case ELangHongKongChinese: |
|
1113 { |
|
1114 iPersonalizationRepository->Set(KSettingsDefaultVkbHk, aInputMode); |
|
1115 } |
|
1116 break; |
|
1117 case ELangTaiwanChinese: |
|
1118 { |
|
1119 iPersonalizationRepository->Set(KSettingsDefaultVkbTw, aInputMode); |
|
1120 } |
|
1121 break; |
|
1122 default: |
|
1123 break; |
|
1124 } |
|
1125 |
|
1126 iInputMode = aInputMode; |
|
1127 } |
|
1128 |
|
1129 // --------------------------------------------------------- |
|
1130 // Get input mode from repository |
|
1131 // --------------------------------------------------------- |
|
1132 // |
|
1133 TInt CGSPenInputModel::InputMode() |
|
1134 { |
|
1135 switch(iInputLanguage) |
|
1136 { |
|
1137 case ELangPrcChinese: |
|
1138 { |
|
1139 iPersonalizationRepository->Get(KSettingsDefaultVkbPrc, iInputMode); |
|
1140 } |
|
1141 break; |
|
1142 case ELangHongKongChinese: |
|
1143 { |
|
1144 iPersonalizationRepository->Get(KSettingsDefaultVkbHk, iInputMode); |
|
1145 } |
|
1146 break; |
|
1147 case ELangTaiwanChinese: |
|
1148 { |
|
1149 iPersonalizationRepository->Get(KSettingsDefaultVkbTw, iInputMode); |
|
1150 } |
|
1151 break; |
|
1152 default: |
|
1153 break; |
|
1154 } |
|
1155 |
|
1156 return iInputMode; |
|
1157 } |
|
1158 |
|
1159 // --------------------------------------------------------- |
|
1160 // Set FEP default input mode when language changed |
|
1161 // --------------------------------------------------------- |
|
1162 // |
|
1163 void CGSPenInputModel::SetFepInputMode(TInt aInputMode) |
|
1164 { |
|
1165 switch(iInputLanguage) |
|
1166 { |
|
1167 case ELangPrcChinese: |
|
1168 case ELangHongKongChinese: |
|
1169 case ELangTaiwanChinese: |
|
1170 { |
|
1171 iAknfepRepository->Set(KAknFepChineseInputMode, aInputMode); |
|
1172 } |
|
1173 break; |
|
1174 default: |
|
1175 break; |
|
1176 } |
|
1177 |
|
1178 } |
|
1179 |
|
1180 // --------------------------------------------------------- |
|
1181 // Get FEP default input mode when language changed |
|
1182 // --------------------------------------------------------- |
|
1183 // |
|
1184 TInt CGSPenInputModel::GetFepInputMode() |
|
1185 { |
|
1186 TInt inputMode = 0; |
|
1187 switch(iInputLanguage) |
|
1188 { |
|
1189 case ELangPrcChinese: |
|
1190 case ELangHongKongChinese: |
|
1191 case ELangTaiwanChinese: |
|
1192 { |
|
1193 iAknfepRepository->Get(KAknFepChineseInputMode, inputMode); |
|
1194 } |
|
1195 break; |
|
1196 default: |
|
1197 break; |
|
1198 } |
|
1199 |
|
1200 return inputMode; |
|
1201 } |
|
1202 |
|
1203 // --------------------------------------------------------- |
|
1204 // Adjust language name |
|
1205 // --------------------------------------------------------- |
|
1206 // |
|
1207 void CGSPenInputModel::AdjustLanguageName(TInt aLangId, TDes& aLangName) |
|
1208 { |
|
1209 switch(aLangId) |
|
1210 { |
|
1211 case ELangPrcChinese: |
|
1212 case ELangHongKongChinese: |
|
1213 case ELangTaiwanChinese: |
|
1214 { |
|
1215 TInt index = aLangName.Find(KLeftBracket); |
|
1216 if( index != KErrNotFound) |
|
1217 { |
|
1218 aLangName.SetLength(index); |
|
1219 } |
|
1220 } |
|
1221 } |
|
1222 } |
|
1223 |
|
1224 TBool CGSPenInputModel::IsSettingItemAvailable( TInt aItemId ) |
|
1225 { |
|
1226 TBool res = EFalse; |
|
1227 switch( aItemId ) |
|
1228 { |
|
1229 case EGSInputpenIdHwrTraining: |
|
1230 { |
|
1231 iIsHwrTrainingAviliable = EFalse; |
|
1232 TInt supportMode = EPluginInputModeNone; |
|
1233 if(KErrNone == iConnectErr) |
|
1234 { |
|
1235 supportMode = iPenInputServer.SupportInputMode(); |
|
1236 } |
|
1237 TBool supportHWR = EFalse; |
|
1238 if(supportMode & EPluginInputModeHwr || |
|
1239 supportMode & EPluginInputModeFSc || |
|
1240 supportMode & EPluginInputModeFingerHwr) |
|
1241 { |
|
1242 supportHWR = ETrue; |
|
1243 } |
|
1244 |
|
1245 CEikonEnv* env = CEikonEnv::Static(); |
|
1246 TUid appUid = env->EikAppUi() |
|
1247 ->Application()->AppDllUid(); |
|
1248 if ( appUid == KUidPenInputSettingApp ) |
|
1249 { |
|
1250 // if open from trui, don't show this item |
|
1251 // if not, need to do further check. |
|
1252 // if its parent group is trui |
|
1253 CPenInputSettingAppUi* appui |
|
1254 = static_cast<CPenInputSettingAppUi*>( env->EikAppUi() ); |
|
1255 TUid parentUid = AppUidFromWndGroupId( appui->ParentWindowGroupId() ); |
|
1256 if ( parentUid == KUidtruiApp ) |
|
1257 { |
|
1258 iIsHwrTrainingAviliable = EFalse; |
|
1259 } |
|
1260 else |
|
1261 { |
|
1262 iIsHwrTrainingAviliable = IsTruiSupportedLanguage(); |
|
1263 } |
|
1264 } |
|
1265 else |
|
1266 { |
|
1267 iIsHwrTrainingAviliable = IsTruiSupportedLanguage(); |
|
1268 } |
|
1269 res = ( !ChineseLanguage() && !JapaneseLanguage() && iIsHwrTrainingAviliable && supportHWR); |
|
1270 } |
|
1271 break; |
|
1272 case EGSInputpenIdInputLanguage: |
|
1273 { |
|
1274 res = ETrue; |
|
1275 } |
|
1276 break; |
|
1277 |
|
1278 case EGSDefaultChineseOnscreenKeyboard: |
|
1279 { |
|
1280 // ChineseLanguage() && ( Support VKB or FSQ ) |
|
1281 res = ChineseLanguage() |
|
1282 && ( FeatureManager::FeatureSupported |
|
1283 ( KFeatureIdVirtualKeyboardInput ) |
|
1284 || FeatureManager::FeatureSupported |
|
1285 ( KFeatureIdVirtualFullscrQwertyInput ) ); |
|
1286 } |
|
1287 break; |
|
1288 |
|
1289 case EGSInputpenIdGuidLine: |
|
1290 { |
|
1291 TInt supportMode = EPluginInputModeNone; |
|
1292 if(KErrNone == iConnectErr) |
|
1293 { |
|
1294 supportMode = iPenInputServer.SupportInputMode(); |
|
1295 } |
|
1296 |
|
1297 TBool supportHWR = EFalse; |
|
1298 if(supportMode & EPluginInputModeHwr || |
|
1299 supportMode & EPluginInputModeFSc || |
|
1300 supportMode & EPluginInputModeFingerHwr) |
|
1301 { |
|
1302 supportHWR = ETrue; |
|
1303 } |
|
1304 |
|
1305 res = ( !ChineseLanguage() && !JapaneseLanguage() && supportHWR); |
|
1306 } |
|
1307 break; |
|
1308 |
|
1309 case EGSInputpenIdRecognitionWithDictionary: |
|
1310 { |
|
1311 TInt currentLanguage = InputLanguage(); // add this line |
|
1312 if (currentLanguage == ELangArabic) |
|
1313 { |
|
1314 res = ETrue; |
|
1315 } |
|
1316 } |
|
1317 break; |
|
1318 |
|
1319 case EGSInputpenIdWritingSpeed: |
|
1320 case EGSInputpenIdPenTrailWidth: |
|
1321 case EGSInputpenIdPenTrailColour: |
|
1322 { |
|
1323 TInt supportMode = EPluginInputModeNone; |
|
1324 if(KErrNone == iConnectErr) |
|
1325 { |
|
1326 supportMode = iPenInputServer.SupportInputMode(); |
|
1327 } |
|
1328 |
|
1329 if(supportMode & EPluginInputModeHwr || |
|
1330 supportMode & EPluginInputModeFSc || |
|
1331 supportMode & EPluginInputModeFingerHwr) |
|
1332 { |
|
1333 res = ETrue; |
|
1334 } |
|
1335 } |
|
1336 break; |
|
1337 |
|
1338 case EGSInputpenIdInputMethodForFind: |
|
1339 { |
|
1340 res = ETrue; |
|
1341 } |
|
1342 break; |
|
1343 |
|
1344 case EGSInputpenIdTouchScrCalib: |
|
1345 { |
|
1346 res = ETrue; |
|
1347 } |
|
1348 break; |
|
1349 |
|
1350 case EGSInputpenIdChineseFindMethod: |
|
1351 { |
|
1352 res = ChineseFindMethodCRKey() > 0; |
|
1353 } |
|
1354 break; |
|
1355 } |
|
1356 return res; |
|
1357 } |
|
1358 |
|
1359 // --------------------------------------------------------- |
|
1360 // Return current application's uid. |
|
1361 // --------------------------------------------------------- |
|
1362 // |
|
1363 TUid CGSPenInputModel::AppUidFromWndGroupId( TInt aWndGrpId ) |
|
1364 { |
|
1365 TUid id = {0x00000000}; |
|
1366 TRAP_IGNORE(id = AppUidFromWndGroupIdL(aWndGrpId)); |
|
1367 return id; |
|
1368 } |
|
1369 |
|
1370 TUid CGSPenInputModel::AppUidFromWndGroupIdL( TInt aWndGrpId ) |
|
1371 { |
|
1372 RWsSession &ws = CCoeEnv::Static()->WsSession(); |
|
1373 CApaWindowGroupName* wg = CApaWindowGroupName::NewLC(ws,aWndGrpId); |
|
1374 TUid id = wg->AppUid(); |
|
1375 CleanupStack::PopAndDestroy(wg); |
|
1376 return id; |
|
1377 } |
|
1378 |
|
1379 TBool CGSPenInputModel::IsTruiSupportedLanguage() |
|
1380 { |
|
1381 TInt currentLanguage = InputLanguage(); |
|
1382 TInt count = sizeof(KTruiSupportedLanguages)/sizeof(TInt); |
|
1383 for(TInt i = 0; i < count; i++) |
|
1384 { |
|
1385 if( currentLanguage == KTruiSupportedLanguages[i] ) |
|
1386 { |
|
1387 return ETrue; |
|
1388 } |
|
1389 } |
|
1390 return EFalse; |
|
1391 } |
|
1392 |
|
1393 // End Of File |