|
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: Input mode plugin implementation file |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 // System includes |
|
30 #include <ecom.h> |
|
31 #include <AknFepManagerInterface.h> |
|
32 #include <eikmenup.h> |
|
33 #include <coemain.h> |
|
34 #include <aknfepuiinterface.h> |
|
35 #include <aknfepuimenus.h> |
|
36 #include <languages.hrh> |
|
37 #include <bldvariant.hrh> |
|
38 #include <featmgr.h> |
|
39 |
|
40 // User includes |
|
41 #include "peninputimeplugingeneric.h" |
|
42 #include "peninputimeplugingenericdebug.h" |
|
43 #include "pluginfepmanagerhwr.h" |
|
44 #include "pluginfepmanagervkb.h" |
|
45 #include "truisupportedlanguageid.h" |
|
46 |
|
47 const TInt KInvalidImplId = 0; |
|
48 |
|
49 _LIT(KHwrImeName, "Generic HWR"); |
|
50 _LIT(KVkbImeName, "Generic VKB"); |
|
51 _LIT(KFSQImeName, "Generic FSQ"); |
|
52 _LIT(KSSQImeName, "Split View Qwerty"); |
|
53 |
|
54 _LIT(KHwrResourceFormatPattern, "peninputhwrwindowconfiginfo_*.rsc"); |
|
55 _LIT(KVkbResourceFormatPattern, "peninputvkbwindowconfiginfo_*.rsc"); |
|
56 _LIT(KSsqResourceFormatPattern, "peninputssqwinconfiginfo_*.rsc"); |
|
57 |
|
58 _LIT(KPluginResourcePath, "z:\\RESOURCE\\Plugins\\"); |
|
59 |
|
60 class TLangMeritPair |
|
61 { |
|
62 public: |
|
63 TInt iLangStart; |
|
64 TInt iLangEnd; |
|
65 TInt iMerit; |
|
66 }; |
|
67 |
|
68 const TLangMeritPair KSupportLanguages[] = |
|
69 { |
|
70 {ELangEnglish, ELangAmerican, CAknFepPenInputImePlugin::EImeMerit_Preferred}, //01-10 |
|
71 {ELangPortuguese, ELangDutch, CAknFepPenInputImePlugin::EImeMerit_Preferred},//13-18 |
|
72 {ELangCzech, ELangSlovenian, CAknFepPenInputImePlugin::EImeMerit_Preferred}, //25-28 |
|
73 {ELangThai, ELangThai, CAknFepPenInputImePlugin::EImeMerit_Preferred},//33 |
|
74 {ELangArabic, ELangArabic, CAknFepPenInputImePlugin::EImeMerit_Preferred},//37 |
|
75 {ELangTagalog, ELangTagalog, CAknFepPenInputImePlugin::EImeMerit_Preferred},//39 |
|
76 {ELangBulgarian, ELangBulgarian, CAknFepPenInputImePlugin::EImeMerit_Preferred},//42 |
|
77 {ELangCatalan, ELangCatalan, CAknFepPenInputImePlugin::EImeMerit_Preferred},//44 |
|
78 {ELangCroatian, ELangCroatian, CAknFepPenInputImePlugin::EImeMerit_Preferred},//45 |
|
79 {ELangEstonian, ELangCanadianFrench, CAknFepPenInputImePlugin::EImeMerit_Preferred},//49-51 |
|
80 {ELangGreek, ELangGreek, CAknFepPenInputImePlugin::EImeMerit_Preferred},//54 |
|
81 {ELangHebrew, ELangIndonesian, CAknFepPenInputImePlugin::EImeMerit_Preferred},//57-59 |
|
82 {ELangLatvian, ELangLithuanian, CAknFepPenInputImePlugin::EImeMerit_Preferred},//67 -68 |
|
83 {ELangMalay, ELangMalay, CAknFepPenInputImePlugin::EImeMerit_Preferred},//70 |
|
84 #ifdef RD_MARATHI |
|
85 {ELangMarathi, ELangMarathi, CAknFepPenInputImePlugin::EImeMerit_Preferred},//72 |
|
86 #endif |
|
87 {ELangBrazilianPortuguese, ELangBrazilianPortuguese, CAknFepPenInputImePlugin::EImeMerit_Preferred},//76 |
|
88 {ELangRomanian, ELangSerbian, CAknFepPenInputImePlugin::EImeMerit_Preferred},//78 -79 |
|
89 {ELangLatinAmericanSpanish, ELangLatinAmericanSpanish, CAknFepPenInputImePlugin::EImeMerit_Preferred},//83 |
|
90 {ELangUkrainian, ELangUrdu, CAknFepPenInputImePlugin::EImeMerit_Preferred},//93-94 |
|
91 {ELangVietnamese, ELangVietnamese, CAknFepPenInputImePlugin::EImeMerit_Preferred},//96 |
|
92 {KLangBasque, KLangGalician, CAknFepPenInputImePlugin::EImeMerit_Preferred},//401,402 |
|
93 {ELangKorean, ELangKorean, CAknFepPenInputImePlugin::EImeMerit_Preferred} // 65 tp teleca add-on |
|
94 }; |
|
95 |
|
96 // ----------------------------------------------------------------------------- |
|
97 // RImplInfoPtrArray cleanup function |
|
98 // ----------------------------------------------------------------------------- |
|
99 // |
|
100 void Cleanup( TAny* aAny ) |
|
101 { |
|
102 RImplInfoPtrArray* implArray = |
|
103 reinterpret_cast< RImplInfoPtrArray*> ( aAny ); |
|
104 implArray->ResetAndDestroy(); |
|
105 implArray->Close(); |
|
106 } |
|
107 |
|
108 //lint -esym( 960, 58, * ) lint notes: break used outside of a switch |
|
109 |
|
110 // ======== MEMBER FUNCTIONS ======== |
|
111 |
|
112 // ----------------------------------------------------------------------------- |
|
113 // CPenInputImePluginGeneric::NewL |
|
114 // Factory function |
|
115 // (other items were commented in a header). |
|
116 // ----------------------------------------------------------------------------- |
|
117 // |
|
118 CPenInputImePluginGeneric* CPenInputImePluginGeneric::NewL(TAny* aInitParams) |
|
119 { |
|
120 CPenInputImePluginGeneric* self = new ( ELeave ) CPenInputImePluginGeneric( |
|
121 static_cast<RPeninputServer*>( |
|
122 aInitParams ) ); |
|
123 CleanupStack::PushL( self ); |
|
124 self->ConstructL(); |
|
125 CleanupStack::Pop( self ); |
|
126 return self; |
|
127 } |
|
128 |
|
129 // ----------------------------------------------------------------------------- |
|
130 // CPenInputImePluginGeneric::NewLC |
|
131 // factory function |
|
132 // (other items were commented in a header). |
|
133 // ----------------------------------------------------------------------------- |
|
134 // |
|
135 CPenInputImePluginGeneric* CPenInputImePluginGeneric::NewLC( |
|
136 TAny* aInitParams ) |
|
137 { |
|
138 CPenInputImePluginGeneric* self = new ( ELeave ) CPenInputImePluginGeneric( |
|
139 static_cast<RPeninputServer*>( |
|
140 aInitParams ) ); |
|
141 CleanupStack::PushL( self ); |
|
142 self->ConstructL(); |
|
143 return self; |
|
144 } |
|
145 |
|
146 // ----------------------------------------------------------------------------- |
|
147 // CPenInputImePluginGeneric::~CPenInputImePluginGeneric |
|
148 // Destructor |
|
149 // (other items were commented in a header). |
|
150 // ----------------------------------------------------------------------------- |
|
151 // |
|
152 CPenInputImePluginGeneric::~CPenInputImePluginGeneric() |
|
153 { |
|
154 DeActivate(); |
|
155 iUiLayoutImpIdList.Close(); |
|
156 delete iPluginUiManager; |
|
157 } |
|
158 |
|
159 // ----------------------------------------------------------------------------- |
|
160 // CPenInputImePluginGeneric::GetInputMethodUiL |
|
161 // Create layout UI interface |
|
162 // (other items were commented in a header). |
|
163 // ----------------------------------------------------------------------------- |
|
164 // |
|
165 MAknFepManagerInterface* CPenInputImePluginGeneric::GetInputMethodUiL( |
|
166 MAknFepManagerUIInterface* aFepManager, |
|
167 TLanguage aLanguage, |
|
168 TInt aMode, |
|
169 const TDesC8& /*aData*/, |
|
170 const TBool aIsSplitView) |
|
171 { |
|
172 iFepManager = aFepManager; |
|
173 iLanguage = aLanguage; |
|
174 CPluginFepManagerBase* fepmanager = NULL; |
|
175 |
|
176 TUid layoutId; |
|
177 TInt i; |
|
178 |
|
179 switch ( aMode ) |
|
180 { |
|
181 case EPluginInputModeHwr: |
|
182 { |
|
183 if(aLanguage == ELangArabic) |
|
184 { |
|
185 layoutId.iUid = KHwrArabicUiId; |
|
186 } |
|
187 else |
|
188 { |
|
189 layoutId.iUid = KHwrUiId; |
|
190 } |
|
191 } |
|
192 break; |
|
193 case EPluginInputModeVkb: |
|
194 { |
|
195 layoutId.iUid = KVkbUiId; |
|
196 } |
|
197 break; |
|
198 case EPluginInputModeFSQ: |
|
199 { |
|
200 if(aIsSplitView) |
|
201 { |
|
202 layoutId.iUid = KSsqUiId; |
|
203 } |
|
204 else |
|
205 { |
|
206 layoutId.iUid = KFsqUiId; |
|
207 } |
|
208 } |
|
209 break; |
|
210 default: |
|
211 return NULL; |
|
212 } |
|
213 fepmanager = GetPluginUiL( aMode ); |
|
214 |
|
215 for ( i = 0; i < iUiLayoutImpIdList.Count(); ++i ) |
|
216 { |
|
217 if( iUiLayoutImpIdList[i] == layoutId.iUid ) |
|
218 { |
|
219 break; |
|
220 } |
|
221 } |
|
222 |
|
223 if ( i < iUiLayoutImpIdList.Count() ) |
|
224 { |
|
225 iPenInputMode = aMode; |
|
226 TPtrC8 ptr( (TUint8*)&aMode ); |
|
227 |
|
228 TInt errCode; |
|
229 errCode = iPenInputServer->SetUiLayoutId( layoutId ); |
|
230 |
|
231 if ( errCode == KErrNone ) |
|
232 { |
|
233 fepmanager->OnInit(); |
|
234 return fepmanager; |
|
235 } |
|
236 } |
|
237 |
|
238 return NULL; |
|
239 } |
|
240 |
|
241 // ----------------------------------------------------------------------------- |
|
242 // CPenInputImePluginGeneric::GetInputMethodUiL |
|
243 // Create layout UI interface |
|
244 // (other items were commented in a header). |
|
245 // ----------------------------------------------------------------------------- |
|
246 // |
|
247 MAknFepManagerInterface* CPenInputImePluginGeneric::GetInputMethodUiL( |
|
248 MAknFepManagerUIInterface* aFepManager, |
|
249 TInt aLayoutId, |
|
250 const TDesC8& aData ) |
|
251 { |
|
252 iFepManager = aFepManager; |
|
253 CPluginFepManagerBase* fepmanager = NULL; |
|
254 TInt i; |
|
255 TInt mode; |
|
256 |
|
257 if ( aLayoutId == KHwrUiId ) |
|
258 { |
|
259 mode = EPluginInputModeHwr; |
|
260 } |
|
261 else if( aLayoutId == KVkbUiId ) |
|
262 { |
|
263 mode = EPluginInputModeVkb; |
|
264 } |
|
265 else if( aLayoutId == KFsqUiId ) |
|
266 { |
|
267 mode = EPluginInputModeFSQ; |
|
268 } |
|
269 else |
|
270 { |
|
271 return NULL; |
|
272 } |
|
273 |
|
274 fepmanager = GetPluginUiL( mode ); |
|
275 for ( i = 0; i < iUiLayoutImpIdList.Count(); ++i ) |
|
276 { |
|
277 if ( iUiLayoutImpIdList[i] == aLayoutId ) |
|
278 { |
|
279 break; |
|
280 } |
|
281 } |
|
282 |
|
283 if ( i < iUiLayoutImpIdList.Count() ) |
|
284 { |
|
285 iPenInputMode = mode; |
|
286 iPenInputServer->SetUiLayoutId( TUid::Uid( aLayoutId ), aData ); |
|
287 fepmanager->OnInit(); |
|
288 return fepmanager; |
|
289 } |
|
290 |
|
291 return NULL; |
|
292 } |
|
293 |
|
294 // ----------------------------------------------------------------------------- |
|
295 // CPenInputImePluginGeneric::Activate |
|
296 // Activate current IME plugin. |
|
297 // (other items were commented in a header). |
|
298 // ----------------------------------------------------------------------------- |
|
299 // |
|
300 void CPenInputImePluginGeneric::Activate() |
|
301 { |
|
302 if(iPenInputServer) |
|
303 { |
|
304 iPenInputServer->ActivateLayout(ETrue); |
|
305 } |
|
306 } |
|
307 |
|
308 // ----------------------------------------------------------------------------- |
|
309 // CPenInputImePluginGeneric::DeActivate |
|
310 // Deactivate current IME plugin. |
|
311 // (other items were commented in a header). |
|
312 // ----------------------------------------------------------------------------- |
|
313 // |
|
314 void CPenInputImePluginGeneric::DeActivate() |
|
315 { |
|
316 if (iPenInputServer && iPenInputServer->IsVisible()) |
|
317 { |
|
318 iPenInputServer->ActivateLayout(EFalse); |
|
319 } |
|
320 } |
|
321 |
|
322 // ----------------------------------------------------------------------------- |
|
323 // CPenInputImePluginGeneric::ImeImplId |
|
324 // Get current IME plugin implementation ID. |
|
325 // (other items were commented in a header). |
|
326 // ----------------------------------------------------------------------------- |
|
327 // |
|
328 TInt CPenInputImePluginGeneric::ImeImplId() |
|
329 { |
|
330 return KInputMethodImplementationId; |
|
331 } |
|
332 |
|
333 // ----------------------------------------------------------------------------- |
|
334 // CPenInputImePluginGeneric::LayoutUiImplId |
|
335 // Get current layout UI implementation id. |
|
336 // (other items were commented in a header). |
|
337 // ----------------------------------------------------------------------------- |
|
338 // |
|
339 TInt CPenInputImePluginGeneric::LayoutUiImplId() |
|
340 { |
|
341 TInt id; |
|
342 switch ( iPenInputMode ) |
|
343 { |
|
344 case EPluginInputModeHwr: |
|
345 { |
|
346 id = KHwrUiId; |
|
347 } |
|
348 break; |
|
349 case EPluginInputModeVkb: |
|
350 { |
|
351 id = KVkbUiId; |
|
352 } |
|
353 break; |
|
354 case EPluginInputModeFSQ: |
|
355 { |
|
356 id = KFsqUiId; |
|
357 } |
|
358 break; |
|
359 default: |
|
360 { |
|
361 id = KInvalidImplId; |
|
362 } |
|
363 break; |
|
364 } |
|
365 return id; |
|
366 } |
|
367 |
|
368 // ----------------------------------------------------------------------------- |
|
369 // CPenInputImePluginGeneric::SupportModes |
|
370 // Get suppored layout UI modes(VKB/HWR). |
|
371 // (other items were commented in a header). |
|
372 // ----------------------------------------------------------------------------- |
|
373 // |
|
374 TInt CPenInputImePluginGeneric::SupportModes(CPtiEngine* aPtiEngine, |
|
375 RArray<TImePlguinImplDetail>& aSupportList) const |
|
376 { |
|
377 TInt ret = 0; |
|
378 TRAP_IGNORE( ret = SupportModesL( aPtiEngine, aSupportList ) ); |
|
379 return ret; |
|
380 } |
|
381 |
|
382 // ----------------------------------------------------------------------------- |
|
383 // CPenInputImePluginGeneric::SupportModesL |
|
384 // Get suppored layout UI modes(VKB/HWR). |
|
385 // (other items were commented in a header). |
|
386 // ----------------------------------------------------------------------------- |
|
387 // |
|
388 TBool IsFileInDir( CDir* aDir, const TDesC& aFileName ) |
|
389 { |
|
390 if( aDir ) |
|
391 { |
|
392 for( TInt k = 0; k < aDir->Count(); ++k ) |
|
393 { |
|
394 if( aFileName.CompareF( (*aDir)[k].iName ) == 0 ) |
|
395 { |
|
396 return ETrue; |
|
397 } |
|
398 } |
|
399 } |
|
400 return EFalse; |
|
401 } |
|
402 |
|
403 inline void HwrResNameFromLangId( TFileName& aFileName, TInt aLang ) |
|
404 { |
|
405 if( aLang < 10 ) |
|
406 { |
|
407 _LIT(KHwrResourceFormat1, "peninputhwrwindowconfiginfo_%02d.rsc"); |
|
408 aFileName.Format(KHwrResourceFormat1, aLang); |
|
409 } |
|
410 else |
|
411 { |
|
412 _LIT(KHwrResourceFormat, "peninputhwrwindowconfiginfo_%d.rsc"); |
|
413 aFileName.Format(KHwrResourceFormat, aLang); |
|
414 } |
|
415 } |
|
416 |
|
417 inline void VkbResNameFromLangId( TFileName& aFileName, TInt aLang ) |
|
418 { |
|
419 if( aLang < 10 ) |
|
420 { |
|
421 _LIT(KVkbResourceFormat1, "peninputvkbwindowconfiginfo_%02d.rsc"); |
|
422 aFileName.Format(KVkbResourceFormat1, aLang); |
|
423 } |
|
424 else |
|
425 { |
|
426 _LIT(KVkbResourceFormat, "peninputvkbwindowconfiginfo_%d.rsc"); |
|
427 aFileName.Format(KVkbResourceFormat, aLang); |
|
428 } |
|
429 } |
|
430 |
|
431 inline void SsqResNameFromLangId( TFileName& aFileName, TInt aLang ) |
|
432 { |
|
433 if( aLang < 10 ) |
|
434 { |
|
435 _LIT(KSsqResourceFormat1, "peninputssqwinconfiginfo%02d.rsc"); |
|
436 aFileName.Format(KSsqResourceFormat1, aLang); |
|
437 } |
|
438 else |
|
439 { |
|
440 _LIT(KSsqResourceFormat, "peninputssqwinconfiginfo%d.rsc"); |
|
441 aFileName.Format(KSsqResourceFormat, aLang); |
|
442 } |
|
443 } |
|
444 |
|
445 TInt CPenInputImePluginGeneric::SupportModesL(CPtiEngine* /*aPtiEngine*/, |
|
446 RArray<TImePlguinImplDetail>& aSupportList) const |
|
447 { |
|
448 RImplInfoPtrArray infoArray; |
|
449 TUid id; |
|
450 id.iUid = KHwrLayoutInterfaceId; |
|
451 TBool hwr = EFalse; |
|
452 TBool vkb = EFalse; |
|
453 TBool fsq = EFalse; |
|
454 TBool ssq = EFalse; |
|
455 |
|
456 CleanupStack::PushL( TCleanupItem( Cleanup, &infoArray ) ); |
|
457 REComSession::ListImplementationsL(id, infoArray); |
|
458 |
|
459 for (TInt i = 0; i < infoArray.Count(); ++i) |
|
460 { |
|
461 if(infoArray[i]->ImplementationUid().iUid == KHwrUiId ) |
|
462 { |
|
463 hwr = ETrue; |
|
464 } |
|
465 |
|
466 if (infoArray[i]->ImplementationUid().iUid == KVkbUiId |
|
467 && FeatureManager::FeatureSupported(KFeatureIdVirtualKeyboardInput)) |
|
468 { |
|
469 vkb = ETrue; |
|
470 } |
|
471 |
|
472 if (infoArray[i]->ImplementationUid().iUid == KFsqUiId |
|
473 && FeatureManager::FeatureSupported(KFeatureIdVirtualFullscrQwertyInput)) |
|
474 { |
|
475 fsq = ETrue; |
|
476 } |
|
477 |
|
478 if (infoArray[i]->ImplementationUid().iUid == KSsqUiId |
|
479 && FeatureManager::FeatureSupported(KFeatureIdVirtualFullscrQwertyInput)) |
|
480 { |
|
481 ssq = ETrue; |
|
482 } |
|
483 } |
|
484 |
|
485 TImePlguinImplDetail detail; |
|
486 |
|
487 detail.iImplementationId = KInputMethodImplementationId; |
|
488 if( hwr ) |
|
489 { |
|
490 detail.iMode = EPluginInputModeHwr; |
|
491 detail.iDisplayName.Copy(KHwrImeName()); |
|
492 TFindFile fileFinder(CCoeEnv::Static()->FsSession()); |
|
493 TFileName resName; |
|
494 CDir* dir = NULL; |
|
495 TInt result = fileFinder.FindWildByDir( KHwrResourceFormatPattern, |
|
496 KPluginResourcePath, dir ); |
|
497 if( result == KErrNone ) |
|
498 { |
|
499 for(TInt i = 0; i < sizeof(KSupportLanguages)/sizeof(TLangMeritPair); ++i ) |
|
500 { |
|
501 for(TInt j = KSupportLanguages[i].iLangStart; |
|
502 j <= KSupportLanguages[i].iLangEnd; ++j) |
|
503 { |
|
504 HwrResNameFromLangId( resName, j); |
|
505 if( IsFileInDir( dir, resName ) ) |
|
506 { |
|
507 detail.iLanguage = j; |
|
508 detail.iMeritValue = KSupportLanguages[i].iMerit; |
|
509 aSupportList.Append(detail); |
|
510 } |
|
511 } |
|
512 } |
|
513 |
|
514 } |
|
515 delete dir; |
|
516 } |
|
517 |
|
518 if( vkb || fsq ) |
|
519 { |
|
520 TFindFile fileFinder(CCoeEnv::Static()->FsSession()); |
|
521 TFileName resName; |
|
522 CDir* dir = NULL; |
|
523 TInt result = fileFinder.FindWildByDir( KVkbResourceFormatPattern, |
|
524 KPluginResourcePath, dir ); |
|
525 |
|
526 if( vkb ) |
|
527 { |
|
528 detail.iMode = EPluginInputModeVkb; |
|
529 detail.iDisplayName.Copy(KVkbImeName()); |
|
530 for(TInt i = 0; i < sizeof(KSupportLanguages)/sizeof(TLangMeritPair); ++i ) |
|
531 { |
|
532 for(TInt j = KSupportLanguages[i].iLangStart; |
|
533 j <= KSupportLanguages[i].iLangEnd; ++j) |
|
534 { |
|
535 VkbResNameFromLangId( resName, j); |
|
536 if( IsFileInDir( dir, resName ) ) |
|
537 { |
|
538 detail.iLanguage = j; |
|
539 detail.iMeritValue = KSupportLanguages[i].iMerit; |
|
540 aSupportList.Append(detail); |
|
541 } |
|
542 } |
|
543 } |
|
544 } |
|
545 |
|
546 if( fsq ) |
|
547 { |
|
548 detail.iMode = EPluginInputModeFSQ; |
|
549 detail.iDisplayName.Copy(KFSQImeName()); |
|
550 for(TInt i = 0; i < sizeof(KSupportLanguages)/sizeof(TLangMeritPair); ++i ) |
|
551 { |
|
552 for(TInt j = KSupportLanguages[i].iLangStart; |
|
553 j <= KSupportLanguages[i].iLangEnd; ++j) |
|
554 { |
|
555 VkbResNameFromLangId( resName, j); |
|
556 if( IsFileInDir( dir, resName ) ) |
|
557 { |
|
558 detail.iLanguage = j; |
|
559 detail.iMeritValue = KSupportLanguages[i].iMerit; |
|
560 aSupportList.Append(detail); |
|
561 } |
|
562 } |
|
563 } |
|
564 } |
|
565 |
|
566 delete dir; |
|
567 } |
|
568 |
|
569 if( ssq ) |
|
570 { |
|
571 detail.iMode = EPluginInputModeFSQ; |
|
572 detail.iDisplayName.Copy(KSSQImeName()); |
|
573 TFindFile fileFinder(CCoeEnv::Static()->FsSession()); |
|
574 TFileName resName; |
|
575 CDir* dir = NULL; |
|
576 TInt result = fileFinder.FindWildByDir( KSsqResourceFormatPattern, |
|
577 KPluginResourcePath, dir ); |
|
578 |
|
579 for(TInt i = 0; i < sizeof(KSupportLanguages)/sizeof(TLangMeritPair); ++i ) |
|
580 { |
|
581 for(TInt j = KSupportLanguages[i].iLangStart; |
|
582 j <= KSupportLanguages[i].iLangEnd; ++j) |
|
583 { |
|
584 SsqResNameFromLangId( resName, j); |
|
585 if( IsFileInDir( dir, resName ) ) |
|
586 { |
|
587 detail.iLanguage = j; |
|
588 detail.iMeritValue = KSupportLanguages[i].iMerit; |
|
589 aSupportList.Append(detail); |
|
590 } |
|
591 } |
|
592 } |
|
593 delete dir; |
|
594 } |
|
595 |
|
596 CleanupStack::PopAndDestroy(&infoArray); // infoArray |
|
597 |
|
598 return 0; |
|
599 } |
|
600 |
|
601 // ----------------------------------------------------------------------------- |
|
602 // CPenInputImePluginGeneric::CurrentMode |
|
603 // Get current layout UI mode. |
|
604 // (other items were commented in a header). |
|
605 // ----------------------------------------------------------------------------- |
|
606 // |
|
607 TInt CPenInputImePluginGeneric::CurrentMode() const |
|
608 { |
|
609 return iPenInputMode; |
|
610 } |
|
611 |
|
612 // ----------------------------------------------------------------------------- |
|
613 // CPenInputImePluginGeneric::HandleServerEventL |
|
614 // Handle pen input server event.. |
|
615 // (other items were commented in a header). |
|
616 // ----------------------------------------------------------------------------- |
|
617 // |
|
618 TBool CPenInputImePluginGeneric::HandleServerEventL( TInt aEventId, const TDesC& aData ) |
|
619 { |
|
620 TBool bHandled = EFalse; |
|
621 switch ( aEventId ) |
|
622 { |
|
623 case ESignalLayoutICFLengthChanged: |
|
624 { |
|
625 GetCurrentUi()->RetrieveEditorMaxLength(); |
|
626 } |
|
627 break; |
|
628 case ESignalCaseMode: |
|
629 { |
|
630 TInt data = *(TInt*)( aData.Ptr() ); |
|
631 ASSERT( data >= 0 ); |
|
632 //lint !e728 |
|
633 GetCurrentUi()->UpdateCaseMode( data ); |
|
634 } |
|
635 break; |
|
636 default: |
|
637 break; |
|
638 } |
|
639 |
|
640 return bHandled; |
|
641 } |
|
642 |
|
643 // ----------------------------------------------------------------------------- |
|
644 // CPenInputImePluginGeneric::HandleMenuCommandL |
|
645 // Handle the menu command. |
|
646 // (other items were commented in a header). |
|
647 // ----------------------------------------------------------------------------- |
|
648 // |
|
649 TBool CPenInputImePluginGeneric::HandleMenuCommandL( TInt /*aCommandId*/ ) |
|
650 { |
|
651 return EFalse; |
|
652 } |
|
653 |
|
654 // ----------------------------------------------------------------------------- |
|
655 // CPenInputImePluginGeneric::DynInitMenuPaneL |
|
656 // Dynamiclly update menu items during it displays. |
|
657 // (other items were commented in a header). |
|
658 // ----------------------------------------------------------------------------- |
|
659 // |
|
660 void CPenInputImePluginGeneric::DynInitMenuPaneL( CAknFepUiInterfaceMenuPane* aMenuPane ) |
|
661 { |
|
662 TInt currentLanguage = iPluginUiManager->InputLanguage(); |
|
663 TBool isDimTraining = ETrue; |
|
664 TInt count = sizeof(KTruiSupportedLanguages)/sizeof(TInt); |
|
665 for(TInt i = 0; i < count; i++) |
|
666 { |
|
667 if(currentLanguage == KTruiSupportedLanguages[i]) |
|
668 { |
|
669 isDimTraining = EFalse; |
|
670 break; |
|
671 } |
|
672 } |
|
673 if(isDimTraining) |
|
674 { |
|
675 aMenuPane->SetItemDimmed(EPenInputCmdHwrTraining, ETrue); |
|
676 } |
|
677 } |
|
678 |
|
679 // ----------------------------------------------------------------------------- |
|
680 // CPenInputImePluginGeneric::CPenInputImePluginGeneric |
|
681 // C++ default constructor. |
|
682 // (other items were commented in a header). |
|
683 // ----------------------------------------------------------------------------- |
|
684 // |
|
685 CPenInputImePluginGeneric::CPenInputImePluginGeneric( RPeninputServer* aHwrServer ) |
|
686 :iPenInputServer( aHwrServer ) |
|
687 { |
|
688 } |
|
689 |
|
690 // ----------------------------------------------------------------------------- |
|
691 // CPenInputImePluginGeneric::ConstructL |
|
692 // 2nd phase constructor. |
|
693 // (other items were commented in a header). |
|
694 // ----------------------------------------------------------------------------- |
|
695 // |
|
696 void CPenInputImePluginGeneric::ConstructL() |
|
697 { |
|
698 FindUiLayoutImplementationL(); |
|
699 } |
|
700 |
|
701 // ----------------------------------------------------------------------------- |
|
702 // CPenInputImePluginGeneric::FindUiLayoutImplementationL |
|
703 // Enumuate all layout UI ids. |
|
704 // (other items were commented in a header). |
|
705 // ----------------------------------------------------------------------------- |
|
706 // |
|
707 void CPenInputImePluginGeneric::FindUiLayoutImplementationL() |
|
708 { |
|
709 RImplInfoPtrArray infoArray; |
|
710 TUid id; |
|
711 id.iUid = KHwrLayoutInterfaceId; |
|
712 |
|
713 iUiLayoutImpIdList.Reset(); |
|
714 CleanupStack::PushL( TCleanupItem( Cleanup, &infoArray ) ); |
|
715 REComSession::ListImplementationsL( id, infoArray ); |
|
716 |
|
717 for ( TInt i = 0; i < infoArray.Count(); ++i ) |
|
718 { |
|
719 iUiLayoutImpIdList.AppendL( infoArray[i]->ImplementationUid().iUid ); |
|
720 } |
|
721 |
|
722 CleanupStack::PopAndDestroy( &infoArray ); // infoArray |
|
723 } |
|
724 |
|
725 // ----------------------------------------------------------------------------- |
|
726 // CPenInputImePluginGeneric::GetPluginUiL |
|
727 // Get HWR UI interface. |
|
728 // (other items were commented in a header). |
|
729 // ----------------------------------------------------------------------------- |
|
730 // |
|
731 CPluginFepManagerBase* CPenInputImePluginGeneric::GetPluginUiL( TInt aMode ) |
|
732 { |
|
733 delete iPluginUiManager; |
|
734 iPluginUiManager = NULL; |
|
735 |
|
736 switch ( aMode ) |
|
737 { |
|
738 case EPluginInputModeHwr: |
|
739 { |
|
740 return iPluginUiManager = CPluginFepManagerHwr::NewL(*this, iPenInputServer); |
|
741 } |
|
742 case EPluginInputModeVkb: |
|
743 case EPluginInputModeFSQ: |
|
744 { |
|
745 return iPluginUiManager = CPluginFepManagerVkb::NewL(*this, iPenInputServer); |
|
746 } |
|
747 default: |
|
748 { |
|
749 return NULL; |
|
750 } |
|
751 } |
|
752 } |
|
753 //End Of File |