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