44
|
1 |
/*
|
|
2 |
* Copyright (c) 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 GSLangPlugin.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
// INCLUDE FILES
|
|
19 |
|
|
20 |
#include "GSLangModel.h"
|
|
21 |
#include "GSLangContainer.h"
|
|
22 |
#include "GSLangPlugin.h"
|
|
23 |
#include <gslangpluginrsc.rsg>
|
|
24 |
|
|
25 |
#include <AknFepInternalCRKeys.h>
|
|
26 |
#include <aknnotedialog.h>
|
|
27 |
#include <aknradiobuttonsettingpage.h>
|
|
28 |
#include <aknViewAppUi.h>
|
|
29 |
#include <avkon.rsg>
|
|
30 |
#include <CommonEngineDomainCRKeys.h> //Ui language
|
|
31 |
#include <e32math.h>
|
|
32 |
#include <featmgr.h>
|
|
33 |
#include <hal.h>
|
|
34 |
#include <PtiEngine.h>
|
|
35 |
#include <ScreensaverInternalCRKeys.h> //double declaration of KScreenSaverPluginName
|
|
36 |
#include <settingsinternalcrkeys.h>
|
|
37 |
#include <startupdomaincrkeys.h>
|
|
38 |
#include <ctsydomainpskeys.h>
|
|
39 |
#include <languages.hrh>
|
|
40 |
|
|
41 |
#include <AknFepGlobalEnums.h> //For chinese input modes
|
|
42 |
|
|
43 |
// For Phonetic Input of Hindi
|
|
44 |
#include <PtiIndicDefs.h>
|
|
45 |
#include <sysutil.h>
|
|
46 |
#ifdef RD_INTELLIGENT_TEXT_INPUT
|
|
47 |
#include <AvkonInternalCRKeys.h>
|
|
48 |
#include <StringLoader.h>
|
|
49 |
#include <coemain.h>
|
|
50 |
#endif
|
|
51 |
|
|
52 |
#include <aknenv.h>
|
|
53 |
#include <AknSettingCache.h>
|
|
54 |
|
|
55 |
|
|
56 |
//CONSTANTS
|
|
57 |
const TInt KGSDiskSpaceLimitForLanguageChange = 300000;
|
|
58 |
|
|
59 |
const TInt KFepChineseInputModeLength = 10;
|
|
60 |
|
|
61 |
// ================= MEMBER FUNCTIONS =======================
|
|
62 |
|
|
63 |
// ----------------------------------------------------------------------------
|
|
64 |
// CGSLangModel::NewL
|
|
65 |
//
|
|
66 |
// EPOC two-phased constructor
|
|
67 |
// ----------------------------------------------------------------------------
|
|
68 |
//
|
|
69 |
CGSLangModel* CGSLangModel::NewL( CGSLangContainer* aContainer )
|
|
70 |
{
|
|
71 |
CGSLangModel* self = new( ELeave ) CGSLangModel( aContainer );
|
|
72 |
CleanupStack::PushL( self );
|
|
73 |
self->ConstructL();
|
|
74 |
CleanupStack::Pop( self );
|
|
75 |
return self;
|
|
76 |
}
|
|
77 |
|
|
78 |
|
|
79 |
// ----------------------------------------------------------------------------
|
|
80 |
// CGSLangModel::CGSLangModel
|
|
81 |
//
|
|
82 |
// C++ default constructor can NOT contain any code, that
|
|
83 |
// might leave.
|
|
84 |
// ----------------------------------------------------------------------------
|
|
85 |
//
|
|
86 |
CGSLangModel::CGSLangModel( CGSLangContainer* aContainer )
|
|
87 |
: iContainer( aContainer )
|
|
88 |
{
|
|
89 |
|
|
90 |
}
|
|
91 |
|
|
92 |
|
|
93 |
// ----------------------------------------------------------------------------
|
|
94 |
// CGSLangModel::ConstructL
|
|
95 |
//
|
|
96 |
// EPOC default constructor can leave.
|
|
97 |
// ----------------------------------------------------------------------------
|
|
98 |
//
|
|
99 |
void CGSLangModel::ConstructL()
|
|
100 |
{
|
|
101 |
InitializeCentralRepositoriesL();
|
|
102 |
|
|
103 |
// start listening to CenRep key changes for ITL
|
|
104 |
iNotifyHandlerForITL = CCenRepNotifyHandler::NewL( *this,
|
|
105 |
*iAknFepRepository,
|
|
106 |
CCenRepNotifyHandler::EIntKey,
|
|
107 |
KAknFepInputTxtLang );
|
|
108 |
iNotifyHandlerForITL->StartListeningL();
|
|
109 |
|
|
110 |
// start listening to CenRep key changes for T9 on/off
|
|
111 |
iNotifyHandlerForT9 = CCenRepNotifyHandler::NewL( *this,
|
|
112 |
*iAknFepRepository,
|
|
113 |
CCenRepNotifyHandler::EIntKey,
|
|
114 |
KAknFepPredTxtFlag );
|
|
115 |
iNotifyHandlerForT9->StartListeningL();
|
|
116 |
|
|
117 |
if ( FeatureManager::FeatureSupported( KFeatureIdJapanese ) )
|
|
118 |
{
|
|
119 |
// start listening to CenRep key changes for Japanese predictive mode
|
|
120 |
iNotifyHandlerForJapanesePredTxt = CCenRepNotifyHandler::NewL( *this,
|
|
121 |
*iAknFepRepository,
|
|
122 |
CCenRepNotifyHandler::EIntKey,
|
|
123 |
KAknFepJapanesePredTxtFlag );
|
|
124 |
iNotifyHandlerForJapanesePredTxt->StartListeningL();
|
|
125 |
}
|
|
126 |
|
|
127 |
|
|
128 |
#ifdef RD_INTELLIGENT_TEXT_INPUT
|
|
129 |
// start listening to CenRep key changes for T9 on/off
|
|
130 |
iNotifyHandlerForPredExt = CCenRepNotifyHandler::NewL( *this,
|
|
131 |
*iAknFepRepository,
|
|
132 |
CCenRepNotifyHandler::EIntKey,
|
|
133 |
KAknFepPredTxtFlagExtension );
|
|
134 |
iNotifyHandlerForPredExt->StartListeningL();
|
|
135 |
#endif
|
|
136 |
|
|
137 |
}
|
|
138 |
|
|
139 |
|
|
140 |
// ----------------------------------------------------------------------------
|
|
141 |
// CGSLangModel::~CGSLangModel
|
|
142 |
//
|
|
143 |
// Destructor
|
|
144 |
// ----------------------------------------------------------------------------
|
|
145 |
//
|
|
146 |
CGSLangModel::~CGSLangModel()
|
|
147 |
{
|
|
148 |
if ( iNotifyHandlerForITL )
|
|
149 |
{
|
|
150 |
iNotifyHandlerForITL->StopListening();
|
|
151 |
}
|
|
152 |
delete iNotifyHandlerForITL;
|
|
153 |
|
|
154 |
if ( iNotifyHandlerForT9 )
|
|
155 |
{
|
|
156 |
iNotifyHandlerForT9->StopListening();
|
|
157 |
}
|
|
158 |
delete iNotifyHandlerForT9;
|
|
159 |
|
|
160 |
if ( iNotifyHandlerForJapanesePredTxt )
|
|
161 |
{
|
|
162 |
iNotifyHandlerForJapanesePredTxt->StopListening();
|
|
163 |
}
|
|
164 |
delete iNotifyHandlerForJapanesePredTxt;
|
|
165 |
|
|
166 |
#ifdef RD_INTELLIGENT_TEXT_INPUT
|
|
167 |
if ( iNotifyHandlerForPredExt )
|
|
168 |
{
|
|
169 |
iNotifyHandlerForPredExt->StopListening();
|
|
170 |
}
|
|
171 |
delete iNotifyHandlerForPredExt;
|
|
172 |
#endif
|
|
173 |
|
|
174 |
|
|
175 |
CloseCentralRepositories();
|
|
176 |
}
|
|
177 |
|
|
178 |
|
|
179 |
// ----------------------------------------------------------------------------
|
|
180 |
// CGSLangModel::InitializeCentralRepositoriesL
|
|
181 |
//
|
|
182 |
// Creating and setting keys for the Central Repository
|
|
183 |
// ----------------------------------------------------------------------------
|
|
184 |
//
|
|
185 |
void CGSLangModel::InitializeCentralRepositoriesL()
|
|
186 |
{
|
|
187 |
|
|
188 |
iPersonalizationRepository =
|
|
189 |
CRepository::NewL( KCRUidPersonalizationSettings );
|
|
190 |
iLocaleRepository = CRepository::NewL( KCRUidLocaleSettings );
|
|
191 |
iStartupConfRepository = CRepository::NewL( KCRUidStartupConf );
|
|
192 |
iAknFepRepository = CRepository::NewL( KCRUidAknFep );
|
|
193 |
iCommonEngineRepository = CRepository::NewL( KCRUidCommonEngineKeys );
|
|
194 |
iScreensaverRepository = CRepository::NewL( KCRUidScreenSaver );
|
|
195 |
|
|
196 |
}
|
|
197 |
|
|
198 |
// ----------------------------------------------------------------------------
|
|
199 |
// CGSLangModel::CloseCentralRepositoriesL
|
|
200 |
//
|
|
201 |
// Creating and setting keys for the Central Repository
|
|
202 |
// ----------------------------------------------------------------------------
|
|
203 |
//
|
|
204 |
void CGSLangModel::CloseCentralRepositories()
|
|
205 |
{
|
|
206 |
if ( iPersonalizationRepository )
|
|
207 |
{
|
|
208 |
delete iPersonalizationRepository;
|
|
209 |
iPersonalizationRepository = NULL;
|
|
210 |
}
|
|
211 |
if ( iLocaleRepository )
|
|
212 |
{
|
|
213 |
delete iLocaleRepository;
|
|
214 |
iLocaleRepository = NULL;
|
|
215 |
}
|
|
216 |
if ( iStartupConfRepository )
|
|
217 |
{
|
|
218 |
delete iStartupConfRepository;
|
|
219 |
iStartupConfRepository = NULL;
|
|
220 |
}
|
|
221 |
if ( iAknFepRepository )
|
|
222 |
{
|
|
223 |
delete iAknFepRepository;
|
|
224 |
iAknFepRepository = NULL;
|
|
225 |
}
|
|
226 |
if ( iCommonEngineRepository )
|
|
227 |
{
|
|
228 |
delete iCommonEngineRepository;
|
|
229 |
iCommonEngineRepository = NULL;
|
|
230 |
}
|
|
231 |
if ( iScreensaverRepository )
|
|
232 |
{
|
|
233 |
delete iScreensaverRepository;
|
|
234 |
iScreensaverRepository = NULL;
|
|
235 |
}
|
|
236 |
}
|
|
237 |
|
|
238 |
// ================= DATA ACCESS FUNCTIONS ==================
|
|
239 |
|
|
240 |
// ----------------------------------------------------------------------------
|
|
241 |
// CGSLangModel::GetLanguagesFromPtiL
|
|
242 |
//
|
|
243 |
// Utility routine to get available languages with Symbian OS codes
|
|
244 |
// ----------------------------------------------------------------------------
|
|
245 |
//
|
|
246 |
void CGSLangModel::GetLanguagesFromPtiL(
|
|
247 |
CArrayFix<TInt>* aInstalledLangCodes,
|
|
248 |
CArrayFix<TInt>* aSeedLanguages,
|
|
249 |
CDesCArray* aLanguageNames )
|
|
250 |
{
|
|
251 |
CPtiEngine* ptiEngine = CPtiEngine::NewL();
|
|
252 |
CleanupStack::PushL( ptiEngine );
|
|
253 |
|
|
254 |
CArrayFix<TInt>* languageCodeArray = aSeedLanguages;
|
|
255 |
if ( aInstalledLangCodes )
|
|
256 |
{
|
|
257 |
languageCodeArray = aInstalledLangCodes;
|
|
258 |
}
|
|
259 |
else
|
|
260 |
{
|
|
261 |
ptiEngine->GetAvailableLanguagesL( languageCodeArray );
|
|
262 |
}
|
|
263 |
|
|
264 |
HBufC* buffer = HBufC::NewLC( KGSBufSize128 );
|
|
265 |
const TInt count = languageCodeArray->Count();
|
|
266 |
for ( TInt index = 0; index < count; ++index )
|
|
267 |
{
|
|
268 |
const TInt langId = languageCodeArray->At( index );
|
|
269 |
|
|
270 |
TPtr ptrToBuffer( buffer->Des() );
|
|
271 |
ptiEngine->GetLocalizedLanguageName( langId & KGSLanguageMask,
|
|
272 |
ptrToBuffer );
|
|
273 |
|
|
274 |
if ( aInstalledLangCodes )
|
|
275 |
{
|
|
276 |
aSeedLanguages->AppendL( langId );
|
|
277 |
}
|
|
278 |
aLanguageNames->AppendL( ptrToBuffer );
|
|
279 |
|
|
280 |
ptrToBuffer.Zero();
|
|
281 |
}
|
|
282 |
|
|
283 |
CleanupStack::PopAndDestroy( buffer );
|
|
284 |
CleanupStack::PopAndDestroy( ptiEngine );
|
|
285 |
}
|
|
286 |
|
|
287 |
|
|
288 |
// -----------------------------------------------------------------------------
|
|
289 |
// CGSLangModel::LanguageL
|
|
290 |
//
|
|
291 |
//
|
|
292 |
// -----------------------------------------------------------------------------
|
|
293 |
//
|
|
294 |
TInt CGSLangModel::LanguageL( TLanguage aType )
|
|
295 |
{
|
|
296 |
TInt Language = KErrNone;
|
|
297 |
|
|
298 |
switch ( aType )
|
|
299 |
{
|
|
300 |
case EGSUiLanguage:
|
|
301 |
{
|
|
302 |
User::LeaveIfError(
|
|
303 |
iCommonEngineRepository->Get( KGSDisplayTxtLang, Language ) );
|
|
304 |
}
|
|
305 |
break;
|
|
306 |
case EGSInputLanguage:
|
|
307 |
{
|
|
308 |
User::LeaveIfError(
|
|
309 |
iAknFepRepository->Get( KAknFepInputTxtLang, Language ) );
|
|
310 |
}
|
|
311 |
break;
|
|
312 |
#ifdef RD_INTELLIGENT_TEXT_INPUT
|
|
313 |
#ifdef FF_DUAL_LANGUAGE_SUPPORT
|
|
314 |
case EGSInputLanguageSecondary:
|
|
315 |
{
|
|
316 |
User::LeaveIfError(
|
|
317 |
iAknFepRepository->Get( KAknFepInputTxtLangSecondary, Language ) );
|
|
318 |
}
|
|
319 |
break;
|
|
320 |
#endif
|
|
321 |
#endif
|
|
322 |
default:
|
|
323 |
break;
|
|
324 |
}
|
|
325 |
|
|
326 |
return Language;
|
|
327 |
}
|
|
328 |
|
|
329 |
|
|
330 |
// -----------------------------------------------------------------------------
|
|
331 |
// CGSLangModel::SetLanguageL
|
|
332 |
//
|
|
333 |
//
|
|
334 |
// -----------------------------------------------------------------------------
|
|
335 |
//
|
|
336 |
TBool CGSLangModel::SetLanguageL( TLanguage aType, TInt aLanguage )
|
|
337 |
{
|
|
338 |
TBool ret = ETrue;
|
|
339 |
|
|
340 |
switch( aType )
|
|
341 |
{
|
|
342 |
case EGSUiLanguage:
|
|
343 |
{
|
|
344 |
// Never set Language code 0 to HAL
|
|
345 |
if ( aLanguage !=0 )
|
|
346 |
{
|
|
347 |
if ( HAL::Set( HAL::ELanguageIndex, aLanguage ) != KErrNone )
|
|
348 |
{
|
|
349 |
ret = EFalse;
|
|
350 |
}
|
|
351 |
}
|
|
352 |
|
|
353 |
if ( iCommonEngineRepository->
|
|
354 |
Set( KGSDisplayTxtLang, aLanguage ) != KErrNone )
|
|
355 |
{
|
|
356 |
ret = EFalse;
|
|
357 |
}
|
|
358 |
|
|
359 |
TBool NbrModeSaved = EFalse;
|
|
360 |
if ( aLanguage == ELangArabic || User::Language() == ELangArabic )
|
|
361 |
{
|
|
362 |
//numberMode = EGSNumberModeArabicIndic;
|
|
363 |
SetDefaultNumberMode( EGSNbrModeArabic,
|
|
364 |
EGSNbrModeTypeArabic );
|
|
365 |
NbrModeSaved = ETrue;
|
|
366 |
}
|
|
367 |
else if ( ( aLanguage == ELangUrdu || User::Language() == ELangUrdu ) ||
|
|
368 |
( aLanguage == ELangFarsi || User::Language() == ELangFarsi ) )
|
|
369 |
{
|
|
370 |
//numberMode = EGSNumberModeEasternArabicIndic;
|
|
371 |
SetDefaultNumberMode( EGSNbrModeLatin,
|
|
372 |
EGSNbrModeTypeEasternArabic );
|
|
373 |
NbrModeSaved = ETrue;
|
|
374 |
}
|
|
375 |
else if ( aLanguage == ELangHindi || User::Language() == ELangHindi ||
|
|
376 |
aLanguage == ELangMarathi || User::Language() == ELangMarathi )
|
|
377 |
{
|
|
378 |
//numberMode = EGSNumberModeIndic;
|
|
379 |
SetDefaultNumberMode( EGSNbrModeLatin,
|
|
380 |
EGSNbrModeTypeIndic );
|
|
381 |
NbrModeSaved = ETrue;
|
|
382 |
}
|
|
383 |
|
|
384 |
//if number mode is not set above, then set it to Latin with respective
|
|
385 |
//number mode types. This part might be executed when Automatic is
|
|
386 |
//selected and the SIM card does not support the language.
|
|
387 |
if ( !NbrModeSaved )
|
|
388 |
{
|
|
389 |
TInt nbrModeType = EGSNbrModeTypeIndic;
|
|
390 |
if ( aLanguage == ELangArabic || User::Language() == ELangArabic )
|
|
391 |
{
|
|
392 |
nbrModeType = EGSNbrModeTypeArabic;
|
|
393 |
}
|
|
394 |
else if ( ( aLanguage == ELangUrdu || User::Language() == ELangUrdu )
|
|
395 |
|| ( aLanguage == ELangFarsi || User::Language() == ELangFarsi ) )
|
|
396 |
{
|
|
397 |
nbrModeType = EGSNbrModeTypeEasternArabic;
|
|
398 |
}
|
|
399 |
|
|
400 |
//EGSNumberModeLatin is true in both cases;
|
|
401 |
SetDefaultNumberMode( EGSNbrModeLatin,
|
|
402 |
nbrModeType );
|
|
403 |
}
|
|
404 |
}
|
|
405 |
break;
|
|
406 |
case EGSInputLanguage:
|
|
407 |
{
|
|
408 |
if( iAknFepRepository->Set( KAknFepInputTxtLang,
|
|
409 |
aLanguage ) != KErrNone )
|
|
410 |
{
|
|
411 |
ret = EFalse;
|
|
412 |
}
|
|
413 |
|
|
414 |
if(ret)
|
|
415 |
{
|
|
416 |
//inform all other apps about language change.
|
|
417 |
TWsEvent event;
|
|
418 |
event.SetType( KEikInputLanguageChange );
|
|
419 |
CEikonEnv::Static()->WsSession().SendEventToAllWindowGroups(event);
|
|
420 |
CAknEnv::Static()->SettingCache().Update(KEikInputLanguageChange);
|
|
421 |
}
|
|
422 |
|
|
423 |
// See if it cannot do predictive text entry
|
|
424 |
TBool checkEngine = EFalse;
|
|
425 |
|
|
426 |
|
|
427 |
if (!( aLanguage == ELangPrcChinese ||
|
|
428 |
aLanguage == ELangHongKongChinese ||
|
|
429 |
aLanguage == ELangTaiwanChinese )
|
|
430 |
)
|
|
431 |
{
|
|
432 |
if ( FeatureManager::FeatureSupported( KFeatureIdChinese ) )
|
|
433 |
{
|
|
434 |
aLanguage = ELangEnglish;
|
|
435 |
checkEngine = ETrue;
|
|
436 |
}
|
|
437 |
if (!CheckDictionaryFromPtiL( aLanguage, checkEngine))
|
|
438 |
{
|
|
439 |
CAknNoteDialog* dlg = new (ELeave) CAknNoteDialog( );
|
|
440 |
dlg->ExecuteDlgLD(
|
|
441 |
CAknNoteDialog::EShortTimeout,
|
|
442 |
CAknNoteDialog::ENoTone,
|
|
443 |
R_AVKON_T9_NOTE_NO_AVAILABLE );
|
|
444 |
|
|
445 |
//SetT9OnOffMode(0);
|
|
446 |
SetPredictiveOnOff( EGSLangOther, 0 );
|
|
447 |
}
|
|
448 |
}
|
|
449 |
}
|
|
450 |
break;
|
|
451 |
#ifdef RD_INTELLIGENT_TEXT_INPUT
|
|
452 |
#ifdef FF_DUAL_LANGUAGE_SUPPORT
|
|
453 |
case EGSInputLanguageSecondary:
|
|
454 |
{
|
|
455 |
if( iAknFepRepository->Set( KAknFepInputTxtLangSecondary,
|
|
456 |
aLanguage ) != KErrNone )
|
|
457 |
{
|
|
458 |
ret = EFalse;
|
|
459 |
}
|
|
460 |
|
|
461 |
if(ret)
|
|
462 |
{
|
|
463 |
//inform all other apps about language change.
|
|
464 |
TWsEvent event;
|
|
465 |
event.SetType( KEikInputLanguageChange );
|
|
466 |
CEikonEnv::Static()->WsSession().SendEventToAllWindowGroups(event);
|
|
467 |
CAknEnv::Static()->SettingCache().Update(KEikInputLanguageChange);
|
|
468 |
}
|
|
469 |
|
|
470 |
// Secondary input language does not need prediction
|
|
471 |
// so we don't check for it
|
|
472 |
}
|
|
473 |
break;
|
|
474 |
#endif
|
|
475 |
#endif
|
|
476 |
default:
|
|
477 |
break;
|
|
478 |
}
|
|
479 |
|
|
480 |
return ret;
|
|
481 |
}
|
|
482 |
|
|
483 |
|
|
484 |
// -----------------------------------------------------------------------------
|
|
485 |
// CGSLangModel::DefaultNumberMode
|
|
486 |
//
|
|
487 |
//
|
|
488 |
// -----------------------------------------------------------------------------
|
|
489 |
//
|
|
490 |
TInt CGSLangModel::DefaultNumberMode( TInt aNbrModeType )
|
|
491 |
{
|
|
492 |
TInt value = KGSSettingOff;
|
|
493 |
|
|
494 |
switch ( aNbrModeType )
|
|
495 |
{
|
|
496 |
case EGSNbrModeTypeArabic:
|
|
497 |
case EGSNbrModeTypeEasternArabic:
|
|
498 |
iLocaleRepository->Get( KSettingsDefaultNumberMode, value );
|
|
499 |
break;
|
|
500 |
case EGSNbrModeTypeIndic:
|
|
501 |
iLocaleRepository->Get( KSettingsIndicDefaultNumberMode, value );
|
|
502 |
break;
|
|
503 |
default:
|
|
504 |
break;
|
|
505 |
}
|
|
506 |
|
|
507 |
return value;
|
|
508 |
}
|
|
509 |
|
|
510 |
|
|
511 |
// -----------------------------------------------------------------------------
|
|
512 |
// CGSLangModel::SetDefaultNumberMode
|
|
513 |
//
|
|
514 |
// Set default number mode for non-latin languagues
|
|
515 |
// -----------------------------------------------------------------------------
|
|
516 |
//
|
|
517 |
void CGSLangModel::SetDefaultNumberMode( TInt aMode, TInt aNbrModeType )
|
|
518 |
{
|
|
519 |
if ( aNbrModeType == EGSNbrModeTypeArabic ||
|
|
520 |
aNbrModeType == EGSNbrModeTypeEasternArabic )
|
|
521 |
{
|
|
522 |
iLocaleRepository->Set( KSettingsDefaultNumberMode, aMode );
|
|
523 |
}
|
|
524 |
else
|
|
525 |
{
|
|
526 |
iLocaleRepository->Set( KSettingsIndicDefaultNumberMode, aMode );
|
|
527 |
}
|
|
528 |
|
|
529 |
TLocale locale;
|
|
530 |
if ( aMode == EGSNbrModeLatin )
|
|
531 |
{
|
|
532 |
locale.SetDigitType( EDigitTypeWestern );
|
|
533 |
}
|
|
534 |
else
|
|
535 |
{
|
|
536 |
//if aMode <> EGSNbrModeLatin, then it should be either latin or arabic. However
|
|
537 |
//as EGSNbrModeArabic and EGsNbrModeIndic both have a value = 1, we can't use
|
|
538 |
//that constant for below comparison. Hence, need to depend on the 2nd param.
|
|
539 |
switch ( aNbrModeType )
|
|
540 |
{
|
|
541 |
case EGSNbrModeTypeArabic:
|
|
542 |
locale.SetDigitType( EDigitTypeArabicIndic );
|
|
543 |
break;
|
|
544 |
case EGSNbrModeTypeIndic:
|
|
545 |
locale.SetDigitType( EDigitTypeDevanagari );
|
|
546 |
break;
|
|
547 |
case EGSNbrModeTypeEasternArabic:
|
|
548 |
locale.SetDigitType( EDigitTypeEasternArabicIndic );
|
|
549 |
break;
|
|
550 |
default:
|
|
551 |
break;
|
|
552 |
}
|
|
553 |
}
|
|
554 |
|
|
555 |
locale.Set();
|
|
556 |
}
|
|
557 |
|
|
558 |
|
|
559 |
// -----------------------------------------------------------------------------
|
|
560 |
// CGSLangModel::PredictiveOnOff
|
|
561 |
//
|
|
562 |
//
|
|
563 |
// -----------------------------------------------------------------------------
|
|
564 |
//
|
|
565 |
TInt CGSLangModel::PredictiveOnOff( TPredictiveType aPredictive )
|
|
566 |
{
|
|
567 |
TInt onOffMode = KGSPredTxtFlagDefault;
|
|
568 |
#ifdef RD_INTELLIGENT_TEXT_INPUT
|
|
569 |
TInt onOffBitMask = KGSPredTxtBitMaskDefault;
|
|
570 |
#endif
|
|
571 |
|
|
572 |
switch( aPredictive )
|
|
573 |
{
|
|
574 |
case EGSLangJapanese:
|
|
575 |
{
|
|
576 |
if( iAknFepRepository->Get( KAknFepJapanesePredTxtFlag,
|
|
577 |
onOffMode ) != KErrNone )
|
|
578 |
{
|
|
579 |
iAknFepRepository->Set( KAknFepJapanesePredTxtFlag,
|
|
580 |
onOffMode );
|
|
581 |
}
|
|
582 |
}
|
|
583 |
break;
|
|
584 |
case EGSLangOther:
|
|
585 |
{
|
|
586 |
#ifdef RD_INTELLIGENT_TEXT_INPUT
|
|
587 |
if ( iAknFepRepository->Get( KAknFepPredTxtFlagExtension,
|
|
588 |
onOffBitMask ) != KErrNone )
|
|
589 |
{
|
|
590 |
iAknFepRepository->Set( KAknFepPredTxtFlagExtension, onOffBitMask );
|
|
591 |
}
|
|
592 |
|
|
593 |
// Parse keyboard dependent settings for current keyboard from bitmask
|
|
594 |
// We'll only use this function to get prediction value if we have one
|
|
595 |
// keyboard on the device, so we can just check the current keyb. layout
|
|
596 |
TInt keyboardLayout = 0;
|
|
597 |
RProperty::Get(KCRUidAvkon, KAknKeyBoardLayout, keyboardLayout);
|
|
598 |
TPtiKeyboardType layout = (TPtiKeyboardType)keyboardLayout;
|
|
599 |
TInt predTmp = onOffBitMask;
|
|
600 |
switch(layout)
|
|
601 |
{
|
|
602 |
case EPtiKeyboardNone:
|
|
603 |
break;
|
|
604 |
case EPtiKeyboard12Key:
|
|
605 |
predTmp &= EKeyboardStyle12Key;
|
|
606 |
break;
|
|
607 |
case EPtiKeyboardHalfQwerty:
|
|
608 |
predTmp &= EKeyboardStyleHalfQwerty;
|
|
609 |
break;
|
|
610 |
case EPtiKeyboardQwerty4x12:
|
|
611 |
case EPtiKeyboardQwerty4x10:
|
|
612 |
case EPtiKeyboardQwerty3x11:
|
|
613 |
case EPtiKeyboardCustomQwerty:
|
|
614 |
predTmp &= EKeyboardStyleQwerty;
|
|
615 |
break;
|
|
616 |
default:
|
|
617 |
break;
|
|
618 |
}
|
|
619 |
onOffMode = ( predTmp ? 1 : 0);
|
|
620 |
|
|
621 |
#else
|
|
622 |
if ( iAknFepRepository->Get( KAknFepPredTxtFlag,
|
|
623 |
onOffMode ) != KErrNone )
|
|
624 |
{
|
|
625 |
iAknFepRepository->Set( KAknFepPredTxtFlag, onOffMode );
|
|
626 |
}
|
|
627 |
#endif
|
|
628 |
}
|
|
629 |
break;
|
|
630 |
default:
|
|
631 |
break;
|
|
632 |
}
|
|
633 |
|
|
634 |
return onOffMode;
|
|
635 |
}
|
|
636 |
|
|
637 |
|
|
638 |
// -----------------------------------------------------------------------------
|
|
639 |
// CGSLangModel::SetPredictiveOnOff
|
|
640 |
//
|
|
641 |
//
|
|
642 |
// -----------------------------------------------------------------------------
|
|
643 |
//
|
|
644 |
TBool CGSLangModel::SetPredictiveOnOff( TPredictiveType aPredictive,
|
|
645 |
TInt aMode )
|
|
646 |
{
|
|
647 |
TBool ret = EFalse;
|
|
648 |
switch( aPredictive )
|
|
649 |
{
|
|
650 |
case EGSLangJapanese:
|
|
651 |
{
|
|
652 |
if ( iAknFepRepository->Set( KAknFepJapanesePredTxtFlag,
|
|
653 |
aMode ) != KErrNone )
|
|
654 |
{
|
|
655 |
ret = ETrue;
|
|
656 |
}
|
|
657 |
}
|
|
658 |
break;
|
|
659 |
case EGSLangOther:
|
|
660 |
{
|
|
661 |
#ifdef RD_INTELLIGENT_TEXT_INPUT
|
|
662 |
TInt predFlag = 0;
|
|
663 |
iAknFepRepository->Get(KAknFepPredTxtFlagExtension, predFlag);
|
|
664 |
|
|
665 |
// Parse keyboard dependent settings for current keyboard from bitmask
|
|
666 |
// We'll only use this function to set prediction value if we have one
|
|
667 |
// keyboard on the device, so we can just check the current keyb. layout
|
|
668 |
TInt keyboardLayout = 0;
|
|
669 |
RProperty::Get(KCRUidAvkon, KAknKeyBoardLayout, keyboardLayout);
|
|
670 |
TPtiKeyboardType layout = (TPtiKeyboardType)keyboardLayout;
|
|
671 |
switch(layout)
|
|
672 |
{
|
|
673 |
case EPtiKeyboardNone:
|
|
674 |
break;
|
|
675 |
case EPtiKeyboard12Key:
|
|
676 |
if ( aMode )
|
|
677 |
{
|
|
678 |
predFlag |= EKeyboardStyle12Key;
|
|
679 |
}
|
|
680 |
else
|
|
681 |
{
|
|
682 |
predFlag &= ~EKeyboardStyle12Key;
|
|
683 |
}
|
|
684 |
break;
|
|
685 |
case EPtiKeyboardHalfQwerty:
|
|
686 |
if ( aMode )
|
|
687 |
{
|
|
688 |
predFlag |= EKeyboardStyleHalfQwerty;
|
|
689 |
}
|
|
690 |
else
|
|
691 |
{
|
|
692 |
predFlag &= ~EKeyboardStyleHalfQwerty;
|
|
693 |
}
|
|
694 |
break;
|
|
695 |
|
|
696 |
case EPtiKeyboardQwerty4x12:
|
|
697 |
case EPtiKeyboardQwerty4x10:
|
|
698 |
case EPtiKeyboardQwerty3x11:
|
|
699 |
|
|
700 |
case EPtiKeyboardCustomQwerty:
|
|
701 |
if (aMode)
|
|
702 |
{
|
|
703 |
predFlag |= EKeyboardStyleQwerty;
|
|
704 |
}
|
|
705 |
else
|
|
706 |
{
|
|
707 |
predFlag &= ~EKeyboardStyleQwerty;
|
|
708 |
}
|
|
709 |
break;
|
|
710 |
default:
|
|
711 |
break;
|
|
712 |
}
|
|
713 |
iAknFepRepository->Set(KAknFepPredTxtFlagExtension, predFlag);
|
|
714 |
iAknFepRepository->Set(KAknFepPredTxtFlag, aMode); // For backwards compatibility
|
|
715 |
}
|
|
716 |
#else
|
|
717 |
if( iAknFepRepository->Set( KAknFepPredTxtFlag,
|
|
718 |
aMode ) != KErrNone )
|
|
719 |
{
|
|
720 |
ret = ETrue;
|
|
721 |
}
|
|
722 |
}
|
|
723 |
#endif
|
|
724 |
break;
|
|
725 |
default:
|
|
726 |
break;
|
|
727 |
}
|
|
728 |
|
|
729 |
return ret;
|
|
730 |
}
|
|
731 |
|
|
732 |
|
|
733 |
// ----------------------------------------------------------------------------
|
|
734 |
// CGSLangModel::CheckDictionaryFromPtiL
|
|
735 |
//
|
|
736 |
// Checks if the selected language supports predictive text input.
|
|
737 |
// In case this returns EFalse, the UI display's "Not available"
|
|
738 |
// for Predictive text input.
|
|
739 |
// ----------------------------------------------------------------------------
|
|
740 |
//
|
|
741 |
TBool CGSLangModel::CheckDictionaryFromPtiL( TInt aLangCode, TBool aCheckEngine)
|
|
742 |
{
|
|
743 |
TBool langSupport = EFalse;
|
|
744 |
|
|
745 |
if (!aCheckEngine && (FeatureManager::FeatureSupported( KFeatureIdChinese ) ||
|
|
746 |
FeatureManager::FeatureSupported( KFeatureIdJapanese ) ))
|
|
747 |
{
|
|
748 |
langSupport = ETrue;
|
|
749 |
}
|
|
750 |
else
|
|
751 |
{
|
|
752 |
CPtiEngine* ptiEngine = CPtiEngine::NewL();
|
|
753 |
CleanupStack::PushL( ptiEngine );
|
|
754 |
|
|
755 |
MPtiLanguage* ptiLang = ptiEngine->GetLanguage( aLangCode & KGSLanguageMask );
|
|
756 |
if ( ptiLang )
|
|
757 |
{
|
|
758 |
// the check here should be based on the keyboard
|
|
759 |
#ifdef RD_INTELLIGENT_TEXT_INPUT
|
|
760 |
TInt keyboardLayout = 0;
|
|
761 |
RProperty::Get(KCRUidAvkon, KAknKeyBoardLayout, keyboardLayout);
|
|
762 |
TPtiKeyboardType layout = (TPtiKeyboardType)keyboardLayout;
|
|
763 |
switch(layout)
|
|
764 |
{
|
|
765 |
case EPtiKeyboardHalfQwerty:
|
|
766 |
langSupport = ptiLang->HasInputMode( (TPtiEngineInputMode)EPtiEngineHalfQwertyPredictive);
|
|
767 |
break;
|
|
768 |
case EPtiKeyboardQwerty4x12:
|
|
769 |
case EPtiKeyboardQwerty4x10:
|
|
770 |
case EPtiKeyboardQwerty3x11:
|
|
771 |
case EPtiKeyboardCustomQwerty:
|
|
772 |
langSupport = ptiLang->HasInputMode( (TPtiEngineInputMode)EPtiEngineQwertyPredictive);
|
|
773 |
break;
|
|
774 |
case EPtiKeyboardNone:
|
|
775 |
case EPtiKeyboard12Key:
|
|
776 |
langSupport = ptiLang->HasInputMode( (TPtiEngineInputMode)EPtiEnginePredictive);
|
|
777 |
break;
|
|
778 |
default:
|
|
779 |
langSupport = ptiLang->HasInputMode( (TPtiEngineInputMode)EPtiEnginePredictive);
|
|
780 |
break;
|
|
781 |
}
|
|
782 |
#else
|
|
783 |
langSupport = ptiLang->HasInputMode( (TPtiEngineInputMode)EPtiEnginePredictive);
|
|
784 |
#endif
|
|
785 |
}
|
|
786 |
CleanupStack::PopAndDestroy( ptiEngine );
|
|
787 |
ptiLang = NULL;
|
|
788 |
}
|
|
789 |
|
|
790 |
return langSupport;
|
|
791 |
}
|
|
792 |
|
|
793 |
// ----------------------------------------------------------------------------
|
|
794 |
// CGSLangModel::CheckT9FromPtiLForPrediction
|
|
795 |
//
|
|
796 |
// Checks if the selected language supports predictive text input.
|
|
797 |
// In case this returns EFalse, the UI display's "Predictive text Not available
|
|
798 |
// for selected language" for Predictive text input.
|
|
799 |
// ----------------------------------------------------------------------------
|
|
800 |
//
|
|
801 |
|
|
802 |
#ifdef RD_INTELLIGENT_TEXT_INPUT
|
|
803 |
TBool CGSLangModel::CheckT9FromPtiLForPredictionL(TPtiEngineInputMode inputMode, TInt aLangCode)
|
|
804 |
{
|
|
805 |
TBool langSupport=EFalse;
|
|
806 |
|
|
807 |
CPtiEngine* ptiEngine = CPtiEngine::NewL();
|
|
808 |
CleanupStack::PushL( ptiEngine );
|
|
809 |
|
|
810 |
MPtiLanguage* ptiLang = NULL;
|
|
811 |
if(0 == aLangCode)
|
|
812 |
iAknFepRepository->Get( KAknFepInputTxtLang, aLangCode );
|
|
813 |
if ( aLangCode == ELangPrcChinese ||
|
|
814 |
aLangCode == ELangHongKongChinese ||
|
|
815 |
aLangCode == ELangTaiwanChinese )
|
|
816 |
{
|
|
817 |
aLangCode = ELangEnglish;
|
|
818 |
}
|
|
819 |
|
|
820 |
ptiLang = ptiEngine->GetLanguage( aLangCode );
|
|
821 |
if ( ptiLang )
|
|
822 |
{
|
|
823 |
langSupport = ptiLang->HasInputMode( inputMode );
|
|
824 |
}
|
|
825 |
|
|
826 |
CleanupStack::PopAndDestroy( ptiEngine );
|
|
827 |
ptiLang = NULL;
|
|
828 |
|
|
829 |
return langSupport;
|
|
830 |
}
|
|
831 |
#endif
|
|
832 |
|
|
833 |
|
|
834 |
// -----------------------------------------------------------------------------
|
|
835 |
// CGSLangModel::DefaultInputMethodL
|
|
836 |
//
|
|
837 |
//
|
|
838 |
// -----------------------------------------------------------------------------
|
|
839 |
//
|
|
840 |
TInt CGSLangModel::DefaultInputMethodL()
|
|
841 |
{
|
|
842 |
if ( FeatureManager::FeatureSupported( KFeatureIdChinese ) )
|
|
843 |
{
|
|
844 |
// fetch the setting value from shared data etc.
|
|
845 |
// return the value
|
|
846 |
TUint MethodItem;
|
|
847 |
_LIT(Kx, "x");
|
|
848 |
// This conversion is needed because KAknFepChineseInputMode cenrep key original type was 16bit int.
|
|
849 |
// now type is changed to string, so that it can accommodate bigger values like EHangul 0x16000.
|
|
850 |
TBuf<KFepChineseInputModeLength> conversion;
|
|
851 |
User::LeaveIfError( iAknFepRepository->
|
|
852 |
Get( KAknFepChineseInputMode, conversion ) );
|
|
853 |
TInt len = conversion.Find(Kx);
|
|
854 |
TLex lex;
|
|
855 |
|
|
856 |
if(len)
|
|
857 |
{
|
|
858 |
TPtrC ptr = conversion.Mid(len +1);
|
|
859 |
lex.Assign(ptr);
|
|
860 |
}
|
|
861 |
else
|
|
862 |
{
|
|
863 |
lex.Assign(conversion);
|
|
864 |
}
|
|
865 |
|
|
866 |
lex.Val(MethodItem, EHex);
|
|
867 |
return MethodItem;
|
|
868 |
}
|
|
869 |
else
|
|
870 |
{
|
|
871 |
return KErrNotSupported;
|
|
872 |
}
|
|
873 |
}
|
|
874 |
|
|
875 |
|
|
876 |
// -----------------------------------------------------------------------------
|
|
877 |
// CGSLangModel::SetDefaultInputMethodL
|
|
878 |
//
|
|
879 |
//
|
|
880 |
// -----------------------------------------------------------------------------
|
|
881 |
//
|
|
882 |
void CGSLangModel::SetDefaultInputMethodL( TInt aMethod )
|
|
883 |
{
|
|
884 |
if ( FeatureManager::FeatureSupported( KFeatureIdChinese ) )
|
|
885 |
{
|
|
886 |
TBuf<KFepChineseInputModeLength> conversion;
|
|
887 |
conversion.Num(aMethod, EHex);
|
|
888 |
|
|
889 |
User::LeaveIfError(
|
|
890 |
iAknFepRepository->Set( KAknFepChineseInputMode, conversion ) );
|
|
891 |
|
|
892 |
// See if it cannot do predictive text entry
|
|
893 |
if( !CheckDictionaryFromPtiL( aMethod ) )
|
|
894 |
{
|
|
895 |
SetPredictiveOnOff( EGSLangOther, 0 );
|
|
896 |
}
|
|
897 |
}
|
|
898 |
}
|
|
899 |
|
|
900 |
|
|
901 |
// -----------------------------------------------------------------------------
|
|
902 |
// CGSLangModel::ChangePredictiveOnOffSettingL
|
|
903 |
//
|
|
904 |
//
|
|
905 |
// -----------------------------------------------------------------------------
|
|
906 |
//
|
|
907 |
void CGSLangModel::ChangePredictiveOnOffSettingL( TBool aShowOnOffSettingPage,
|
|
908 |
TPredictiveType aPredictive )
|
|
909 |
{
|
|
910 |
TInt currentValue = PredictiveOnOff( aPredictive );
|
|
911 |
TBool updateValue = ETrue;
|
|
912 |
|
|
913 |
// Following code potentially changes the value of currrent value
|
|
914 |
if ( aShowOnOffSettingPage )
|
|
915 |
{
|
|
916 |
updateValue = ShowPredictiveOnOffSettingPageL( currentValue );
|
|
917 |
}
|
|
918 |
else
|
|
919 |
{
|
|
920 |
currentValue = !PredictiveOnOff( aPredictive );
|
|
921 |
}
|
|
922 |
|
|
923 |
if ( updateValue )
|
|
924 |
{
|
|
925 |
// Treat on and off separately for clarity
|
|
926 |
if ( currentValue )
|
|
927 |
{
|
|
928 |
// See if it can do predictive text entry
|
|
929 |
if( CheckDictionaryFromPtiL( LanguageL( EGSInputLanguage ) ) )
|
|
930 |
{
|
|
931 |
SetPredictiveOnOff( aPredictive, currentValue );
|
|
932 |
}
|
|
933 |
else
|
|
934 |
{
|
|
935 |
CAknNoteDialog* dlg = new (ELeave) CAknNoteDialog( );
|
|
936 |
dlg->ExecuteDlgLD(
|
|
937 |
CAknNoteDialog::EShortTimeout,
|
|
938 |
CAknNoteDialog::ENoTone,
|
|
939 |
R_AVKON_T9_NOTE_NO_AVAILABLE );
|
|
940 |
}
|
|
941 |
}
|
|
942 |
else
|
|
943 |
{
|
|
944 |
// We are always able to turn T9 off:
|
|
945 |
SetPredictiveOnOff( aPredictive, currentValue );
|
|
946 |
}
|
|
947 |
// value should really be being updated, so update listbox
|
|
948 |
if ( FeatureManager::FeatureSupported( KFeatureIdJapanese ) )
|
|
949 |
{
|
|
950 |
// Update English Predictive list item
|
|
951 |
if ( aPredictive == CGSLangModel::EGSLangJapanese )
|
|
952 |
{
|
|
953 |
iContainer->UpdateListBoxL( EGSLangIdJPT );
|
|
954 |
}
|
|
955 |
else
|
|
956 |
{
|
|
957 |
iContainer->UpdateListBoxL( EGSLangIdEPT );
|
|
958 |
}
|
|
959 |
}
|
|
960 |
else
|
|
961 |
{
|
|
962 |
//EGSLangIdT9L
|
|
963 |
iContainer->UpdateListBoxL( iContainer->CurrentFeatureId() );
|
|
964 |
}
|
|
965 |
}
|
|
966 |
}
|
|
967 |
|
|
968 |
|
|
969 |
// -----------------------------------------------------------------------------
|
|
970 |
// CGSLangModel::ShowPredictiveOnOffSettingPageL
|
|
971 |
//
|
|
972 |
//
|
|
973 |
// -----------------------------------------------------------------------------
|
|
974 |
//
|
|
975 |
TBool CGSLangModel::ShowPredictiveOnOffSettingPageL( TInt& aOnOffcurrent )
|
|
976 |
{
|
|
977 |
// Default is to act as if the user cancelled the setting page
|
|
978 |
TBool ret = EFalse;
|
|
979 |
|
|
980 |
if ( CheckDictionaryFromPtiL( LanguageL( EGSInputLanguage ) ) )
|
|
981 |
{
|
|
982 |
CDesCArrayFlat* items =
|
|
983 |
CCoeEnv::Static()->ReadDesC16ArrayResourceL(
|
|
984 |
R_T9_ON_OFF_SETTING_PAGE_LBX );
|
|
985 |
|
|
986 |
CleanupStack::PushL( items );
|
|
987 |
|
|
988 |
TInt dispOnOff = !aOnOffcurrent;
|
|
989 |
|
|
990 |
CAknRadioButtonSettingPage* dlg =
|
|
991 |
new ( ELeave ) CAknRadioButtonSettingPage(
|
|
992 |
R_T9_ON_OFF_SETTING_PAGE, dispOnOff, items );
|
|
993 |
ret = dlg->ExecuteLD( CAknSettingPage::EUpdateWhenChanged );
|
|
994 |
if ( ret )
|
|
995 |
{
|
|
996 |
aOnOffcurrent = !dispOnOff;
|
|
997 |
}
|
|
998 |
CleanupStack::PopAndDestroy( items );
|
|
999 |
}
|
|
1000 |
else
|
|
1001 |
{
|
|
1002 |
CAknNoteDialog* dlg = new( ELeave ) CAknNoteDialog();
|
|
1003 |
dlg->ExecuteDlgLD( CAknNoteDialog::EShortTimeout,
|
|
1004 |
CAknNoteDialog::ENoTone,
|
|
1005 |
R_AVKON_T9_NOTE_NO_AVAILABLE );
|
|
1006 |
}
|
|
1007 |
return ret;
|
|
1008 |
}
|
|
1009 |
|
|
1010 |
|
|
1011 |
// -----------------------------------------------------------------------------
|
|
1012 |
// CGSLangModel::CheckCallStateL
|
|
1013 |
//
|
|
1014 |
//
|
|
1015 |
// -----------------------------------------------------------------------------
|
|
1016 |
//
|
|
1017 |
TInt CGSLangModel::CheckCallStateL()
|
|
1018 |
{
|
|
1019 |
TInt callState = KErrNone;
|
|
1020 |
|
|
1021 |
//here are open connections or not
|
|
1022 |
RProperty::Get( KPSUidCtsyCallInformation,
|
|
1023 |
KCTsyCallState,
|
|
1024 |
callState );
|
|
1025 |
return callState;
|
|
1026 |
}
|
|
1027 |
|
|
1028 |
|
|
1029 |
// -----------------------------------------------------------------------------
|
|
1030 |
// CGSLangModel::HandleNotifyInt
|
|
1031 |
//
|
|
1032 |
//
|
|
1033 |
// -----------------------------------------------------------------------------
|
|
1034 |
//
|
|
1035 |
void CGSLangModel::HandleNotifyInt( TUint32 aId, TInt /*aNewValue*/ )
|
|
1036 |
{
|
|
1037 |
TRAP_IGNORE( HandleCenrepValueChangedL( aId ) );
|
|
1038 |
}
|
|
1039 |
|
|
1040 |
|
|
1041 |
// -----------------------------------------------------------------------------
|
|
1042 |
// CGSLangModel::HandleCenrepValueChangedL
|
|
1043 |
//
|
|
1044 |
//
|
|
1045 |
// -----------------------------------------------------------------------------
|
|
1046 |
//
|
|
1047 |
void CGSLangModel::HandleCenrepValueChangedL( TUint32 aId )
|
|
1048 |
{
|
|
1049 |
if ( aId == KAknFepInputTxtLang )
|
|
1050 |
{
|
|
1051 |
iContainer->UpdateListBoxL( EGSLangIdITL );
|
|
1052 |
iContainer->UpdateListBoxL( EGSLangIdT9L );
|
|
1053 |
|
|
1054 |
TInt inputLanguage;
|
|
1055 |
iAknFepRepository->Get( KAknFepInputTxtLang, inputLanguage );
|
|
1056 |
//Updating default input method based on input text language
|
|
1057 |
//Chinese specific feature
|
|
1058 |
TBool listboxUpdateReqd(EFalse);
|
|
1059 |
if ( inputLanguage == ELangPrcChinese )
|
|
1060 |
{
|
|
1061 |
SetDefaultInputMethodL( EPinyin );
|
|
1062 |
listboxUpdateReqd = ETrue;
|
|
1063 |
}
|
|
1064 |
else if ( inputLanguage == ELangHongKongChinese )
|
|
1065 |
{
|
|
1066 |
SetDefaultInputMethodL( EStroke );
|
|
1067 |
listboxUpdateReqd = ETrue;
|
|
1068 |
}
|
|
1069 |
else if ( inputLanguage == ELangTaiwanChinese )
|
|
1070 |
{
|
|
1071 |
SetDefaultInputMethodL( EZhuyin );
|
|
1072 |
listboxUpdateReqd = ETrue;
|
|
1073 |
}
|
|
1074 |
if (listboxUpdateReqd)
|
|
1075 |
{
|
|
1076 |
iContainer->UpdateListBoxL( EGSLangIdDIM );
|
|
1077 |
}
|
|
1078 |
#ifdef RD_HINDI_PHONETIC_INPUT
|
|
1079 |
//check if this is Hindi Phonetic - hide T9 item if it is.
|
|
1080 |
if( inputLanguage == KLangHindiPhonetic )
|
|
1081 |
{
|
|
1082 |
iContainer->SetT9ItemVisibilityL( EFalse );
|
|
1083 |
}
|
|
1084 |
else
|
|
1085 |
{
|
|
1086 |
iContainer->SetT9ItemVisibilityL( ETrue );
|
|
1087 |
}
|
|
1088 |
#endif //RD_HINDI_PHONETIC_INPUT
|
|
1089 |
}
|
|
1090 |
else if ( aId == KAknFepPredTxtFlag
|
|
1091 |
#ifdef RD_INTELLIGENT_TEXT_INPUT
|
|
1092 |
|| aId == KAknFepPredTxtFlagExtension
|
|
1093 |
#endif
|
|
1094 |
)
|
|
1095 |
{
|
|
1096 |
iContainer->UpdateListBoxL( EGSLangIdT9L );
|
|
1097 |
iContainer->UpdateListBoxL( EGSLangIdEPT );
|
|
1098 |
}
|
|
1099 |
|
|
1100 |
else if ( aId == KAknFepJapanesePredTxtFlag)
|
|
1101 |
{
|
|
1102 |
iContainer->UpdateListBoxL( EGSLangIdJPT);
|
|
1103 |
}
|
|
1104 |
|
|
1105 |
else if ( aId == KSettingsIndicDefaultNumberMode )
|
|
1106 |
{
|
|
1107 |
iContainer->UpdateListBoxL( EGSLangHindiNumberMode );
|
|
1108 |
}
|
|
1109 |
}
|
|
1110 |
|
|
1111 |
|
|
1112 |
// ----------------------------------------------------------------------------
|
|
1113 |
// CGSLangModel::KeypressTimeout
|
|
1114 |
//
|
|
1115 |
// Get Keypress timeout (means Multitap timer).
|
|
1116 |
// ----------------------------------------------------------------------------
|
|
1117 |
//
|
|
1118 |
TInt CGSLangModel::KeypressTimeout()
|
|
1119 |
{
|
|
1120 |
TInt msec;
|
|
1121 |
if ( iAknFepRepository->Get( KAknFepMultiTapTimer, msec ) != KErrNone )
|
|
1122 |
{
|
|
1123 |
msec = KGSMultiTapTimerDefault;
|
|
1124 |
iAknFepRepository->Set( KAknFepMultiTapTimer, msec );
|
|
1125 |
}
|
|
1126 |
|
|
1127 |
return msec;
|
|
1128 |
}
|
|
1129 |
|
|
1130 |
// ----------------------------------------------------------------------------
|
|
1131 |
// CGSLangModel::SetKeypressTimeout
|
|
1132 |
//
|
|
1133 |
// Writes Keypress timeout (means Multitap timer).
|
|
1134 |
// ----------------------------------------------------------------------------
|
|
1135 |
//
|
|
1136 |
TBool CGSLangModel::SetKeypressTimeout( TInt aMilliSecond )
|
|
1137 |
{
|
|
1138 |
TBool ret = EFalse;
|
|
1139 |
if ( iAknFepRepository->Set( KAknFepMultiTapTimer, aMilliSecond )
|
|
1140 |
== KErrNone )
|
|
1141 |
{
|
|
1142 |
ret = ETrue;
|
|
1143 |
}
|
|
1144 |
|
|
1145 |
return ret;
|
|
1146 |
}
|
|
1147 |
|
|
1148 |
// ----------------------------------------------------------------------------
|
|
1149 |
// CGSLangModel::JapanQwertyFlags
|
|
1150 |
//
|
|
1151 |
// Get setting value of each apanese qwerty specific flags
|
|
1152 |
// ----------------------------------------------------------------------------
|
|
1153 |
//
|
|
1154 |
TBool CGSLangModel::JapanQwertyFlags( const TGSJapQwertyFlags aFlag )
|
|
1155 |
{
|
|
1156 |
TInt value;
|
|
1157 |
if ( iAknFepRepository->Get( KAknFepJapaneseSpecialCharFlag, value )
|
|
1158 |
!= KErrNone )
|
|
1159 |
{
|
|
1160 |
value = KGSJapaneseSpecialCharFlagDefault;
|
|
1161 |
iAknFepRepository->Set( KAknFepJapaneseSpecialCharFlag, value );
|
|
1162 |
}
|
|
1163 |
|
|
1164 |
return ( value&aFlag );
|
|
1165 |
}
|
|
1166 |
|
|
1167 |
// ----------------------------------------------------------------------------
|
|
1168 |
// CGSLangModel::SetJapanQwertyFlags
|
|
1169 |
//
|
|
1170 |
// Set value of each Japanese qwerty specific flags
|
|
1171 |
// ----------------------------------------------------------------------------
|
|
1172 |
//
|
|
1173 |
TBool CGSLangModel::SetJapanQwertyFlags( const TGSJapQwertyFlags aFlag,
|
|
1174 |
TBool aValue )
|
|
1175 |
{
|
|
1176 |
TBool ret = EFalse;
|
|
1177 |
TInt value;
|
|
1178 |
if ( iAknFepRepository->Get( KAknFepJapaneseSpecialCharFlag, value )
|
|
1179 |
== KErrNone )
|
|
1180 |
{
|
|
1181 |
if ( aValue )
|
|
1182 |
{
|
|
1183 |
value |= aFlag;
|
|
1184 |
}
|
|
1185 |
else
|
|
1186 |
{
|
|
1187 |
value &= ~( aFlag );
|
|
1188 |
}
|
|
1189 |
if ( iAknFepRepository->Set( KAknFepJapaneseSpecialCharFlag, value )
|
|
1190 |
== KErrNone )
|
|
1191 |
{
|
|
1192 |
ret = ETrue;
|
|
1193 |
}
|
|
1194 |
}
|
|
1195 |
|
|
1196 |
return ret;
|
|
1197 |
}
|
|
1198 |
|
|
1199 |
|
|
1200 |
// ----------------------------------------------------------------------------
|
|
1201 |
// CGSLangModel::ChiCangJieInput
|
|
1202 |
//
|
|
1203 |
// Get Chinese CangJie input method value
|
|
1204 |
// ----------------------------------------------------------------------------
|
|
1205 |
//
|
|
1206 |
TInt CGSLangModel::ChiCangJieInputL()
|
|
1207 |
{
|
|
1208 |
TInt value;
|
|
1209 |
User::LeaveIfError( iAknFepRepository->
|
|
1210 |
Get( KAknFepCangJieMode, value ) );
|
|
1211 |
|
|
1212 |
return value;
|
|
1213 |
}
|
|
1214 |
|
|
1215 |
// ----------------------------------------------------------------------------
|
|
1216 |
// CGSLangModel::SetChiCangJieInput
|
|
1217 |
//
|
|
1218 |
// Set Chinese CangJie input method value
|
|
1219 |
// ----------------------------------------------------------------------------
|
|
1220 |
//
|
|
1221 |
void CGSLangModel::SetChiCangJieInputL( TInt aMode )
|
|
1222 |
{
|
|
1223 |
User::LeaveIfError(
|
|
1224 |
iAknFepRepository->Set( KAknFepCangJieMode, aMode ) );
|
|
1225 |
}
|
|
1226 |
|
|
1227 |
|
|
1228 |
// ----------------------------------------------------------------------------
|
|
1229 |
// CGSLangModel::CheckCangjieSupportL
|
|
1230 |
//
|
|
1231 |
// Check if the Cangjie is supported by the language
|
|
1232 |
// @param aLangCode i.e. Code for the language
|
|
1233 |
// ----------------------------------------------------------------------------
|
|
1234 |
//
|
|
1235 |
TBool CGSLangModel:: CheckCangjieSupportL( TInt aLangCode )
|
|
1236 |
{
|
|
1237 |
TBool langSupport=EFalse;
|
|
1238 |
CPtiEngine* ptiEngine = CPtiEngine::NewL();
|
|
1239 |
CleanupStack::PushL( ptiEngine );
|
|
1240 |
|
|
1241 |
MPtiLanguage* ptiLang = NULL;
|
|
1242 |
//Check if HK variant support CangJie input mode
|
|
1243 |
TPtiEngineInputMode inputMode = EPtiEngineNormalCangjieQwerty;
|
|
1244 |
|
|
1245 |
//Chinese languages do not need a mask.
|
|
1246 |
ptiLang = ptiEngine->GetLanguage( aLangCode );
|
|
1247 |
if ( ptiLang )
|
|
1248 |
{
|
|
1249 |
langSupport = ptiLang->HasInputMode( inputMode );
|
|
1250 |
}
|
|
1251 |
|
|
1252 |
CleanupStack::PopAndDestroy( ptiEngine );
|
|
1253 |
ptiLang = NULL;
|
|
1254 |
return langSupport;
|
|
1255 |
}
|
|
1256 |
|
|
1257 |
// ----------------------------------------------------------------------------
|
|
1258 |
// CGSLangModel::PredictiveModeL
|
|
1259 |
//
|
|
1260 |
// Get Predictive mode value
|
|
1261 |
// 0 --> Normal
|
|
1262 |
// 1 --> Autocompletion
|
|
1263 |
// ----------------------------------------------------------------------------
|
|
1264 |
//
|
|
1265 |
TInt CGSLangModel::PredictiveModeL()
|
|
1266 |
{
|
|
1267 |
TInt value = 0;
|
|
1268 |
#ifndef RD_INTELLIGENT_TEXT_INPUT
|
|
1269 |
User::LeaveIfError( iAknFepRepository->
|
|
1270 |
Get( KAknFepAutoCompleteFlag, value ) );
|
|
1271 |
#endif
|
|
1272 |
return value;
|
|
1273 |
}
|
|
1274 |
|
|
1275 |
// ----------------------------------------------------------------------------
|
|
1276 |
// CGSLangModel::SetPredictiveModeL
|
|
1277 |
//
|
|
1278 |
// Get Predictive mode value
|
|
1279 |
// 0 --> Normal
|
|
1280 |
// 1 --> Autocompletion
|
|
1281 |
// ----------------------------------------------------------------------------
|
|
1282 |
//
|
|
1283 |
void CGSLangModel::SetPredictiveModeL( TInt aMode )
|
|
1284 |
{
|
|
1285 |
#ifndef RD_INTELLIGENT_TEXT_INPUT
|
|
1286 |
User::LeaveIfError( iAknFepRepository->
|
|
1287 |
Set( KAknFepAutoCompleteFlag, aMode ) );
|
|
1288 |
#endif
|
|
1289 |
}
|
|
1290 |
|
|
1291 |
// ----------------------------------------------------------------------------
|
|
1292 |
// CGSLangModel::CheckAutoWordCompletionSupportL
|
|
1293 |
//
|
|
1294 |
// Checking autoword completion feature support
|
|
1295 |
// ----------------------------------------------------------------------------
|
|
1296 |
//
|
|
1297 |
TBool CGSLangModel::CheckAutoWordCompletionSupportL()
|
|
1298 |
{
|
|
1299 |
TBool langSupport=EFalse;
|
|
1300 |
|
|
1301 |
#ifndef RD_INTELLIGENT_TEXT_INPUT
|
|
1302 |
CPtiEngine* ptiEngine = CPtiEngine::NewL();
|
|
1303 |
CleanupStack::PushL( ptiEngine );
|
|
1304 |
|
|
1305 |
MPtiLanguage* ptiLang = NULL;
|
|
1306 |
TPtiEngineInputMode inputMode = EPtiEngineWordCompletion;
|
|
1307 |
|
|
1308 |
TInt aLangCode = 0;
|
|
1309 |
User::LeaveIfError( iAknFepRepository->Get( KAknFepInputTxtLang, aLangCode ) );
|
|
1310 |
|
|
1311 |
ptiLang = ptiEngine->GetLanguage( aLangCode );
|
|
1312 |
if ( ptiLang )
|
|
1313 |
{
|
|
1314 |
langSupport = ptiLang->HasInputMode( inputMode );
|
|
1315 |
}
|
|
1316 |
|
|
1317 |
CleanupStack::PopAndDestroy( ptiEngine );
|
|
1318 |
ptiLang = NULL;
|
|
1319 |
#endif //RD_INTELLIGENT_TEXT_INPUT
|
|
1320 |
|
|
1321 |
return langSupport;
|
|
1322 |
}
|
|
1323 |
|
|
1324 |
// ----------------------------------------------------------------------------
|
|
1325 |
// CGSLangModel::CheckDiskSpaceL
|
|
1326 |
//
|
|
1327 |
// Checking if there is enough free space for language switch
|
|
1328 |
// ----------------------------------------------------------------------------
|
|
1329 |
//
|
|
1330 |
TBool CGSLangModel::CheckDiskSpaceL()
|
|
1331 |
{
|
|
1332 |
// Check if there is enough space in disk
|
|
1333 |
if ( SysUtil::FFSSpaceBelowCriticalLevelL( NULL,
|
|
1334 |
KGSDiskSpaceLimitForLanguageChange ) )
|
|
1335 |
{
|
|
1336 |
return ETrue;
|
|
1337 |
}
|
|
1338 |
else
|
|
1339 |
{
|
|
1340 |
return EFalse;
|
|
1341 |
}
|
|
1342 |
}
|
|
1343 |
|
|
1344 |
#ifdef RD_INTELLIGENT_TEXT_INPUT
|
|
1345 |
TBool CGSLangModel::DeviceHasMultipleKeyboardsL()
|
|
1346 |
{
|
|
1347 |
TInt physicalKeyboards = 0;
|
|
1348 |
User::LeaveIfError( iAknFepRepository->Get( KAknFepPhysicalKeyboards, physicalKeyboards ));
|
|
1349 |
// Check virtual keyboards
|
|
1350 |
if ( FeatureManager::FeatureSupported(KFeatureIdVirtualItutInput) )
|
|
1351 |
{
|
|
1352 |
physicalKeyboards = physicalKeyboards | 0x01;
|
|
1353 |
}
|
|
1354 |
if ( FeatureManager::FeatureSupported(KFeatureIdVirtualFullscrQwertyInput) )
|
|
1355 |
{
|
|
1356 |
physicalKeyboards = physicalKeyboards | 0x02;
|
|
1357 |
}
|
|
1358 |
// Check virtual keyboards end
|
|
1359 |
TBool firstFound = EFalse;
|
|
1360 |
for(TUint i = 0x01; i <= 0xF0; i = i << 1)
|
|
1361 |
{
|
|
1362 |
if(physicalKeyboards & i)
|
|
1363 |
{
|
|
1364 |
if (firstFound)
|
|
1365 |
{
|
|
1366 |
return ETrue;
|
|
1367 |
}
|
|
1368 |
else
|
|
1369 |
{
|
|
1370 |
firstFound = ETrue;
|
|
1371 |
}
|
|
1372 |
}
|
|
1373 |
}
|
|
1374 |
return EFalse;
|
|
1375 |
}
|
|
1376 |
|
|
1377 |
TInt CGSLangModel::PredictionBitMaskL()
|
|
1378 |
{
|
|
1379 |
TInt value = 0;
|
|
1380 |
User::LeaveIfError( iAknFepRepository->Get( KAknFepPredTxtFlagExtension, value ) );
|
|
1381 |
return value;
|
|
1382 |
}
|
|
1383 |
|
|
1384 |
void CGSLangModel::SetPredictionBitMaskL(TInt aBitMask)
|
|
1385 |
{
|
|
1386 |
User::LeaveIfError( iAknFepRepository->Set( KAknFepPredTxtFlagExtension, aBitMask ) );
|
|
1387 |
}
|
|
1388 |
|
|
1389 |
TInt CGSLangModel::PhysicalKeyboardsL()
|
|
1390 |
{
|
|
1391 |
TInt physicalKeyboards = 0;
|
|
1392 |
User::LeaveIfError( iAknFepRepository->Get( KAknFepPhysicalKeyboards, physicalKeyboards ));
|
|
1393 |
// Check virtual keyboards
|
|
1394 |
if ( FeatureManager::FeatureSupported(KFeatureIdVirtualItutInput) )
|
|
1395 |
{
|
|
1396 |
physicalKeyboards = physicalKeyboards | 0x01;
|
|
1397 |
}
|
|
1398 |
if ( FeatureManager::FeatureSupported(KFeatureIdVirtualFullscrQwertyInput) )
|
|
1399 |
{
|
|
1400 |
physicalKeyboards = physicalKeyboards | 0x02;
|
|
1401 |
}
|
|
1402 |
// Check virtual keyboards end
|
|
1403 |
return physicalKeyboards;
|
|
1404 |
}
|
|
1405 |
|
|
1406 |
void CGSLangModel::GetSecondaryInputLanguagesL(
|
|
1407 |
CArrayFix<TInt>* aSeedLanguages,
|
|
1408 |
CDesCArray* aLanguageNames,
|
|
1409 |
CCoeEnv* aCoeEnv)
|
|
1410 |
{
|
|
1411 |
CPtiEngine* ptiEngine = CPtiEngine::NewL();
|
|
1412 |
CleanupStack::PushL( ptiEngine );
|
|
1413 |
|
|
1414 |
CArrayFix<TInt>* languageCodeArray = aSeedLanguages;
|
|
1415 |
ptiEngine->GetAvailableLanguagesL( languageCodeArray );
|
|
1416 |
languageCodeArray->InsertL(0,0); // No secondary input language as the first item
|
|
1417 |
|
|
1418 |
TInt count = languageCodeArray->Count();
|
|
1419 |
for ( TInt index = 0; index < count; ++index )
|
|
1420 |
{
|
|
1421 |
const TInt langCode = languageCodeArray->At(index);
|
|
1422 |
if(langCode == ELangTaiwanChinese ||
|
|
1423 |
langCode == ELangHongKongChinese ||
|
|
1424 |
langCode == ELangPrcChinese ||
|
|
1425 |
langCode == ELangJapanese ||
|
|
1426 |
langCode == ELangKorean )
|
|
1427 |
{
|
|
1428 |
languageCodeArray->Delete(index);
|
|
1429 |
count--;
|
|
1430 |
index--;
|
|
1431 |
}
|
|
1432 |
}
|
|
1433 |
|
|
1434 |
HBufC* noneString = StringLoader::LoadLC( R_SECONDARY_WRITING_LANG_NONE, aCoeEnv);
|
|
1435 |
TPtr nonePtr( noneString->Des() );
|
|
1436 |
aLanguageNames->AppendL(nonePtr);
|
|
1437 |
CleanupStack::PopAndDestroy( noneString );
|
|
1438 |
|
|
1439 |
HBufC* buffer = HBufC::NewLC( KGSBufSize128 );
|
|
1440 |
for ( TInt index = 1; index < count; ++index )
|
|
1441 |
{
|
|
1442 |
const TInt langId = languageCodeArray->At( index );
|
|
1443 |
|
|
1444 |
TPtr ptrToBuffer( buffer->Des() );
|
|
1445 |
ptiEngine->GetLocalizedLanguageName( langId & KGSLanguageMask,
|
|
1446 |
ptrToBuffer );
|
|
1447 |
|
|
1448 |
aLanguageNames->AppendL( ptrToBuffer );
|
|
1449 |
|
|
1450 |
ptrToBuffer.Zero();
|
|
1451 |
}
|
|
1452 |
|
|
1453 |
CleanupStack::PopAndDestroy( buffer );
|
|
1454 |
CleanupStack::PopAndDestroy( ptiEngine );
|
|
1455 |
}
|
|
1456 |
#endif
|
|
1457 |
|
|
1458 |
// End of File
|