|
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: GSLangPlugin implementation. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // Includes |
|
20 #include "GSLangPlugin.h" |
|
21 #include "GSLangContainer.h" |
|
22 #include "GSLangModel.h" |
|
23 #include <gsfwviewuids.h> |
|
24 #include <gslangpluginrsc.rsg> |
|
25 #include <gslistbox.h> |
|
26 #include <gsprivatepluginproviderids.h> |
|
27 |
|
28 #include <AknDateFormatUtils.h> |
|
29 #include <AknFepGlobalEnums.h> // EPinyin |
|
30 #include <aknnotewrappers.h> |
|
31 #include <aknradiobuttonsettingpage.h> |
|
32 #include <aknsettingpage.h> |
|
33 #include <akntextsettingpage.h> |
|
34 #include <aknViewAppUi.h> |
|
35 #include <AknWaitDialog.h> |
|
36 #include <eikapp.h> |
|
37 #include <featmgr.h> |
|
38 #include <hlplch.h> // HlpLauncher |
|
39 #include <PSVariables.h> |
|
40 #include <PtiEngine.h> |
|
41 #include <StringLoader.h> |
|
42 #include <syslangutil.h> // Display UI language |
|
43 #include <ctsydomainpskeys.h> |
|
44 #include <satdomainpskeys.h> |
|
45 #include <e32property.h> |
|
46 #ifdef RD_INTELLIGENT_TEXT_INPUT |
|
47 #include "PredictiveSettingDialog.h" |
|
48 #include <aknfep.rsg> |
|
49 #include <akntitle.h> |
|
50 #ifdef FF_DUAL_LANGUAGE_SUPPORT |
|
51 #include "DualLanguageDialog.h" |
|
52 #endif |
|
53 #include <aknnotedialog.h> //CAknNoteDialog |
|
54 #include <AvkonInternalCRKeys.h> |
|
55 #endif |
|
56 #include <gslangplugin.mbg> |
|
57 |
|
58 #ifndef RD_STARTUP_CHANGE |
|
59 #include <sysstartup.h> // Startup reasons |
|
60 #else |
|
61 #include <starterclient.h> // Startup reasons |
|
62 #endif // RD_STARTUP_CHANGE |
|
63 |
|
64 // Constants |
|
65 |
|
66 // ========================= MEMBER FUNCTIONS ================================ |
|
67 |
|
68 // --------------------------------------------------------------------------- |
|
69 // CGSLangPlugin::CGSLangPlugin() |
|
70 // Constructor |
|
71 // |
|
72 // --------------------------------------------------------------------------- |
|
73 // |
|
74 CGSLangPlugin::CGSLangPlugin(): |
|
75 iCascadeOptionsOpen(EFalse), |
|
76 iDialog(NULL) |
|
77 { |
|
78 } |
|
79 |
|
80 |
|
81 // --------------------------------------------------------------------------- |
|
82 // CGSLangPlugin::~CGSLangPlugin() |
|
83 // Destructor |
|
84 // |
|
85 // --------------------------------------------------------------------------- |
|
86 // |
|
87 CGSLangPlugin::~CGSLangPlugin() |
|
88 { |
|
89 FeatureManager::UnInitializeLib(); |
|
90 if( iContainer ) |
|
91 { |
|
92 AppUi()->RemoveFromViewStack( *this, iContainer ); |
|
93 delete iContainer; |
|
94 } |
|
95 if(iDialog) |
|
96 { |
|
97 delete iDialog; |
|
98 } |
|
99 |
|
100 #ifdef RD_INTELLIGENT_TEXT_INPUT |
|
101 #ifdef __ITI_VIRTUAL_TOUCH_FIRST_GENERATION_SUPPORT__ |
|
102 if (iKeyboardLayoutStatusSubscriber) |
|
103 { |
|
104 iKeyboardLayoutStatusSubscriber->StopSubscribe(); |
|
105 } |
|
106 iKeyboardLayoutStatusProperty.Close(); |
|
107 delete iKeyboardLayoutStatusSubscriber; |
|
108 #endif |
|
109 #endif |
|
110 } |
|
111 |
|
112 |
|
113 // --------------------------------------------------------------------------- |
|
114 // CGSLangPlugin::ConstructL(const TRect& aRect) |
|
115 // Symbian OS two-phased constructor |
|
116 // (other items were commented in a header). |
|
117 // --------------------------------------------------------------------------- |
|
118 // |
|
119 void CGSLangPlugin::ConstructL() |
|
120 { |
|
121 FeatureManager::InitializeLibL(); |
|
122 OpenLocalizedResourceFileL( KGSLangPluginResourceFileName, |
|
123 iResourceLoader ); |
|
124 BaseConstructL( R_GS_LANG_VIEW ); |
|
125 |
|
126 #ifdef RD_INTELLIGENT_TEXT_INPUT |
|
127 #ifdef __ITI_VIRTUAL_TOUCH_FIRST_GENERATION_SUPPORT__ |
|
128 //Attach the P&S property to the keyboardlayout and subscribe to the P&S framework |
|
129 // for any keyboard layout change. |
|
130 User::LeaveIfError(iKeyboardLayoutStatusProperty.Attach(KCRUidAvkon, KAknKeyBoardLayout)); |
|
131 iKeyboardLayoutStatusSubscriber = new (ELeave) CSubscriber( |
|
132 TCallBack(HandleKeyboardLayoutChangeNotification, this), |
|
133 iKeyboardLayoutStatusProperty); |
|
134 iKeyboardLayoutStatusSubscriber->SubscribeL(); |
|
135 #endif |
|
136 #endif |
|
137 } |
|
138 |
|
139 |
|
140 // --------------------------------------------------------------------------- |
|
141 // CGSLangPlugin::NewL() |
|
142 // Static constructor |
|
143 // |
|
144 // --------------------------------------------------------------------------- |
|
145 // |
|
146 CGSLangPlugin* CGSLangPlugin::NewL( TAny* /*aInitParams*/ ) |
|
147 { |
|
148 CGSLangPlugin* self = new(ELeave) CGSLangPlugin(); |
|
149 CleanupStack::PushL(self); |
|
150 self->ConstructL(); |
|
151 CleanupStack::Pop(self); |
|
152 return self; |
|
153 } |
|
154 |
|
155 |
|
156 // ----------------------------------------------------------------------------- |
|
157 // CGSLangPlugin::Id |
|
158 // |
|
159 // |
|
160 // ----------------------------------------------------------------------------- |
|
161 // |
|
162 TUid CGSLangPlugin::Id() const |
|
163 { |
|
164 return KGSLangPluginUID; |
|
165 } |
|
166 |
|
167 |
|
168 // ----------------------------------------------------------------------------- |
|
169 // CGSLangPlugin::HandleClientRectChange |
|
170 // |
|
171 // |
|
172 // ----------------------------------------------------------------------------- |
|
173 // |
|
174 void CGSLangPlugin::HandleClientRectChange() |
|
175 { |
|
176 if ( iContainer ) |
|
177 { |
|
178 iContainer->SetRect( ClientRect() ); |
|
179 } |
|
180 } |
|
181 |
|
182 |
|
183 // ----------------------------------------------------------------------------- |
|
184 // CGSLangPlugin::DoActivateL |
|
185 // |
|
186 // |
|
187 // ----------------------------------------------------------------------------- |
|
188 // |
|
189 void CGSLangPlugin::DoActivateL( const TVwsViewId& aPrevViewId, |
|
190 TUid aCustomMessageId, |
|
191 const TDesC8& aCustomMessage ) |
|
192 { |
|
193 CGSBaseView::DoActivateL( aPrevViewId, aCustomMessageId, aCustomMessage ); |
|
194 } |
|
195 |
|
196 |
|
197 // ----------------------------------------------------------------------------- |
|
198 // CGSLangPlugin::DoDeactivate |
|
199 // |
|
200 // |
|
201 // ----------------------------------------------------------------------------- |
|
202 // |
|
203 void CGSLangPlugin::DoDeactivate() |
|
204 { |
|
205 CGSBaseView::DoDeactivate(); |
|
206 } |
|
207 |
|
208 |
|
209 // ----------------------------------------------------------------------------- |
|
210 // CGSLangPlugin::HandleCommandL |
|
211 // |
|
212 // |
|
213 // ----------------------------------------------------------------------------- |
|
214 // |
|
215 void CGSLangPlugin::HandleCommandL( TInt aCommand ) |
|
216 { |
|
217 switch ( aCommand ) |
|
218 { |
|
219 case EGSMSKCmdAppChange: |
|
220 HandleListBoxSelectionL(); |
|
221 break; |
|
222 case EGSCmdAppChange: |
|
223 if ( Container()->CurrentFeatureId() == EGSLangIdT9L ) |
|
224 { |
|
225 #ifdef RD_INTELLIGENT_TEXT_INPUT |
|
226 // Launch Predictive mode setting page if >1 keyboards available on device |
|
227 // Otherwise just change the setting value for the only keyboard |
|
228 ShowITIMultiSettingPageL(ETrue); |
|
229 #else |
|
230 // If EGSLangIdT9L is selected, change T9 |
|
231 // setting using setting page. |
|
232 Container()->Model()->ChangePredictiveOnOffSettingL( |
|
233 ETrue, |
|
234 CGSLangModel::EGSLangOther ); |
|
235 #endif |
|
236 } |
|
237 else if( Container()->CurrentFeatureId() == EGSLangIdEPT ) |
|
238 { |
|
239 // If EGSLangIdEPT is selected, change T9 |
|
240 // setting using setting page. |
|
241 Container()->Model()->ChangePredictiveOnOffSettingL( |
|
242 ETrue, |
|
243 CGSLangModel::EGSLangOther ); |
|
244 } |
|
245 else if( Container()->CurrentFeatureId() == EGSLangIdJPT ) |
|
246 { |
|
247 Container()->Model()->ChangePredictiveOnOffSettingL( |
|
248 ETrue, |
|
249 CGSLangModel::EGSLangJapanese ); |
|
250 } |
|
251 else if( Container()->CurrentFeatureId() == EGSLangIdJQC ) |
|
252 { |
|
253 ChangeJapQwertySettingL( EGSJapQwertyFlagComma, |
|
254 EGSLangIdJQC, ETrue ); |
|
255 } |
|
256 else if( Container()->CurrentFeatureId() == EGSLangIdJQP ) |
|
257 { |
|
258 ChangeJapQwertySettingL( EGSJapQwertyFlagPeriod, |
|
259 EGSLangIdJQP, ETrue ); |
|
260 } |
|
261 else if( Container()->CurrentFeatureId() == EGSLangIdJQWSP ) |
|
262 { |
|
263 ChangeJapQwertySettingL( EGSJapQwertyFlagSpaceFullWidth, |
|
264 EGSLangIdJQWSP, ETrue ); |
|
265 } |
|
266 else if ( Container()->CurrentFeatureId() == EGSLangIdPredictiveMode ) |
|
267 { |
|
268 #ifndef RD_INTELLIGENT_TEXT_INPUT |
|
269 if( Container()->Model()->CheckAutoWordCompletionSupportL() ) |
|
270 { |
|
271 ShowPredictiveModeSettingPageL( ETrue ); |
|
272 } |
|
273 #endif |
|
274 } |
|
275 #ifdef RD_INTELLIGENT_TEXT_INPUT |
|
276 else if ( Container()->CurrentFeatureId() == EGSLangIdPredictiveOptions ) |
|
277 { |
|
278 // Show full ITI predictive settings list |
|
279 ShowPredictiveSettingListL(); |
|
280 } |
|
281 #endif // RD_INTELLIGENT_TEXT_INPUT |
|
282 else |
|
283 { |
|
284 HandleListBoxSelectionL(); |
|
285 } |
|
286 break; |
|
287 case EAknSoftkeyBack: |
|
288 //In 5.0 "Language" settings were moved from Psln to Device view |
|
289 #ifdef RD_CONTROL_PANEL //For S60 5.0 |
|
290 AppUi()->ActivateLocalViewL( KGSGenPluginUid ); |
|
291 #else //RD_CONTROL_PANEL |
|
292 AppUi()->ActivateLocalViewL( KGSPrslnPluginUid ); |
|
293 #endif //RD_CONTROL_PANEL |
|
294 break; |
|
295 case EAknCmdHelp: |
|
296 { |
|
297 if( FeatureManager::FeatureSupported( KFeatureIdHelp ) ) |
|
298 { |
|
299 HlpLauncher::LaunchHelpApplicationL( |
|
300 iEikonEnv->WsSession(), AppUi()->AppHelpContextL() ); |
|
301 } |
|
302 break; |
|
303 } |
|
304 default: |
|
305 AppUi()->HandleCommandL( aCommand ); |
|
306 break; |
|
307 } |
|
308 } |
|
309 |
|
310 // ========================= From CGSPluginInterface ================== |
|
311 |
|
312 |
|
313 // ----------------------------------------------------------------------------- |
|
314 // CGSLangPlugin::GetCaptionL |
|
315 // |
|
316 // |
|
317 // ----------------------------------------------------------------------------- |
|
318 // |
|
319 void CGSLangPlugin::GetCaptionL( TDes& aCaption ) const |
|
320 { |
|
321 HBufC* result = StringLoader::LoadL( R_GS_LANG_PLUGIN_CAPTION ); |
|
322 aCaption.Copy( *result ); |
|
323 delete result; |
|
324 } |
|
325 |
|
326 |
|
327 // ----------------------------------------------------------------------------- |
|
328 // CGSLangPlugin::PluginProviderCategory |
|
329 // |
|
330 // |
|
331 // ----------------------------------------------------------------------------- |
|
332 // |
|
333 TInt CGSLangPlugin::PluginProviderCategory() const |
|
334 { |
|
335 //This plugin is created by 3rd party. |
|
336 return KGSPluginProviderInternal; |
|
337 } |
|
338 |
|
339 // ========================= From CGSBaseView ================== |
|
340 |
|
341 |
|
342 // ----------------------------------------------------------------------------- |
|
343 // CGSLangPlugin::NewContainerL |
|
344 // |
|
345 // |
|
346 // ----------------------------------------------------------------------------- |
|
347 // |
|
348 void CGSLangPlugin::NewContainerL() |
|
349 { |
|
350 iContainer = new(ELeave) CGSLangContainer; |
|
351 } |
|
352 |
|
353 |
|
354 // ----------------------------------------------------------------------------- |
|
355 // CGSLangPlugin::HandleListBoxSelectionL |
|
356 // |
|
357 // |
|
358 // ----------------------------------------------------------------------------- |
|
359 // |
|
360 void CGSLangPlugin::HandleListBoxSelectionL() |
|
361 { |
|
362 const TInt currentFeatureId = Container()->CurrentFeatureId(); |
|
363 |
|
364 switch ( currentFeatureId ) |
|
365 { |
|
366 case EGSLangIdDTL: |
|
367 ShowLanguageSelectionSettingPageL(); |
|
368 break; |
|
369 case EGSLangIdITL: |
|
370 |
|
371 #ifdef RD_INTELLIGENT_TEXT_INPUT |
|
372 #ifdef FF_DUAL_LANGUAGE_SUPPORT |
|
373 TInt keyboardLayout = 0; |
|
374 RProperty::Get(KCRUidAvkon, KAknKeyBoardLayout, keyboardLayout); |
|
375 TPtiKeyboardType layout = (TPtiKeyboardType)keyboardLayout; |
|
376 // Currently dual language feature would work correctly for ITUT and Half Qwerty products |
|
377 // Hence the dual language settings should also be displayed only for ITUT and Halfqwerty products |
|
378 if(layout == EPtiKeyboard12Key || layout == EPtiKeyboardHalfQwerty ) |
|
379 { |
|
380 // Show Dual language selection setting list |
|
381 /* In Chinese/Japanese language variant,if there are more than one languages supporting dual language feature, |
|
382 display writing language setting view in which Primary and Secondary Languages can be selected from the list. |
|
383 |
|
384 In Chinese language variant,if there is only one language supporting dual language feature, |
|
385 no need to display the Writing language view which contains Primary and Secondary Language. |
|
386 Instead we can display the Writing language list directly to the user;from which the user can select the writing language*/ |
|
387 if ( FeatureManager::FeatureSupported( KFeatureIdJapanese ) || FeatureManager::FeatureSupported( KFeatureIdChinese ) ) |
|
388 { |
|
389 CPtiEngine* ptiEngine = CPtiEngine::NewL(); |
|
390 CleanupStack::PushL( ptiEngine ); |
|
391 CArrayFixFlat<TInt>* languages = new( ELeave )CArrayFixFlat<TInt>( 10 ); |
|
392 CleanupStack::PushL( languages ); |
|
393 ptiEngine->GetAvailableLanguagesL( languages ); |
|
394 |
|
395 TInt count = languages->Count(); |
|
396 TInt noLangSupportWesternPred = count; |
|
397 |
|
398 for (TInt index = 0; index < count; index++) |
|
399 { |
|
400 const TInt langCode = languages->At(index); |
|
401 if (langCode == ELangTaiwanChinese || |
|
402 langCode == ELangHongKongChinese || |
|
403 langCode == ELangPrcChinese || |
|
404 langCode == ELangJapanese || |
|
405 langCode == ELangKorean ) |
|
406 { |
|
407 noLangSupportWesternPred--; |
|
408 } |
|
409 } |
|
410 |
|
411 CleanupStack::PopAndDestroy(languages); |
|
412 CleanupStack::PopAndDestroy(ptiEngine); |
|
413 |
|
414 if( noLangSupportWesternPred > 1 ) |
|
415 { |
|
416 ShowDualInputLanguageSettingListL(); |
|
417 } |
|
418 else |
|
419 ShowInputSelectionSettingPageL(); |
|
420 } |
|
421 else |
|
422 ShowDualInputLanguageSettingListL(); |
|
423 } |
|
424 else |
|
425 ShowInputSelectionSettingPageL(); |
|
426 #else //FF_DUAL_LANGUAGE_SUPPORT |
|
427 ShowInputSelectionSettingPageL(); |
|
428 #endif //FF_DUAL_LANGUAGE_SUPPORT |
|
429 #else //RD_INTELLIGENT_TEXT_INPUT |
|
430 ShowInputSelectionSettingPageL(); |
|
431 #endif //RD_INTELLIGENT_TEXT_INPUT |
|
432 break; |
|
433 case EGSLangAHNumberMode: |
|
434 if( iElaf ) |
|
435 { |
|
436 ShowAHNumberModeSettingPageL(); |
|
437 } |
|
438 break; |
|
439 case EGSLangHindiNumberMode: |
|
440 ShowHindiNumberModeSettingPageL(); |
|
441 break; |
|
442 case EGSLangIdT9L: |
|
443 if ( !FeatureManager::FeatureSupported( KFeatureIdJapanese ) ) |
|
444 { |
|
445 #ifdef RD_INTELLIGENT_TEXT_INPUT |
|
446 // Launch Predictive mode setting page if >1 keyboards available on device |
|
447 // Otherwise just change the setting value for the only keyboard |
|
448 TInt keyboardLayout = 0; |
|
449 RProperty::Get(KCRUidAvkon, KAknKeyBoardLayout, keyboardLayout); |
|
450 TPtiKeyboardType layout = (TPtiKeyboardType)keyboardLayout; |
|
451 TBool isPredictionSupport = EFalse; |
|
452 switch(layout) |
|
453 { |
|
454 case EPtiKeyboardHalfQwerty: |
|
455 isPredictionSupport = Container()->Model()->CheckT9FromPtiLForPredictionL((TPtiEngineInputMode)EPtiEngineHalfQwertyPredictive); |
|
456 break; |
|
457 case EPtiKeyboardQwerty4x12: |
|
458 case EPtiKeyboardQwerty4x10: |
|
459 case EPtiKeyboardQwerty3x11: |
|
460 case EPtiKeyboardCustomQwerty: |
|
461 isPredictionSupport = Container()->Model()->CheckT9FromPtiLForPredictionL((TPtiEngineInputMode)EPtiEngineQwertyPredictive); |
|
462 break; |
|
463 case EPtiKeyboardNone: |
|
464 case EPtiKeyboard12Key: |
|
465 isPredictionSupport = Container()->Model()->CheckT9FromPtiLForPredictionL((TPtiEngineInputMode)EPtiEnginePredictive); |
|
466 break; |
|
467 default: |
|
468 isPredictionSupport = Container()->Model()->CheckT9FromPtiLForPredictionL((TPtiEngineInputMode)EPtiEnginePredictive); |
|
469 break; |
|
470 } |
|
471 if (isPredictionSupport) |
|
472 ShowITIMultiSettingPageL(EFalse); |
|
473 #else |
|
474 //change setting without opening the setting page |
|
475 Container()->Model()->ChangePredictiveOnOffSettingL( |
|
476 EFalse, |
|
477 CGSLangModel::EGSLangOther ); |
|
478 #endif |
|
479 } |
|
480 break; |
|
481 case EGSLangIdEPT: |
|
482 if ( FeatureManager::FeatureSupported( KFeatureIdJapanese ) ) |
|
483 { |
|
484 Container()->Model()->ChangePredictiveOnOffSettingL( |
|
485 EFalse, |
|
486 CGSLangModel::EGSLangOther ); |
|
487 } |
|
488 break; |
|
489 case EGSLangIdResetAtokDict: |
|
490 if ( FeatureManager::FeatureSupported( KFeatureIdJapanese ) ) |
|
491 { |
|
492 ResetATOKDictionaryL(); |
|
493 } |
|
494 break; |
|
495 case EGSLangIdJPT: |
|
496 if ( FeatureManager::FeatureSupported( KFeatureIdJapanese ) ) |
|
497 { |
|
498 Container()->Model()->ChangePredictiveOnOffSettingL( |
|
499 EFalse, |
|
500 CGSLangModel::EGSLangJapanese ); |
|
501 } |
|
502 break; |
|
503 case EGSLangIdKT: |
|
504 if ( FeatureManager::FeatureSupported( KFeatureIdJapanese ) ) |
|
505 { |
|
506 ShowKeypressTimeoutSettingPageL(); |
|
507 } |
|
508 break; |
|
509 case EGSLangIdJQC: |
|
510 if ( FeatureManager::FeatureSupported( KFeatureIdJapanese ) && |
|
511 FeatureManager::FeatureSupported( KFeatureIdQwertyInput ) ) |
|
512 { |
|
513 ChangeJapQwertySettingL( EGSJapQwertyFlagComma, |
|
514 currentFeatureId, EFalse ); |
|
515 } |
|
516 break; |
|
517 case EGSLangIdJQP: |
|
518 if ( FeatureManager::FeatureSupported( KFeatureIdJapanese ) && |
|
519 FeatureManager::FeatureSupported( KFeatureIdQwertyInput ) ) |
|
520 { |
|
521 ChangeJapQwertySettingL( EGSJapQwertyFlagPeriod, |
|
522 currentFeatureId, EFalse ); |
|
523 } |
|
524 break; |
|
525 case EGSLangIdJQWSP: |
|
526 if ( FeatureManager::FeatureSupported( KFeatureIdJapanese ) && |
|
527 FeatureManager::FeatureSupported( KFeatureIdQwertyInput ) ) |
|
528 { |
|
529 ChangeJapQwertySettingL( EGSJapQwertyFlagSpaceFullWidth, |
|
530 currentFeatureId, EFalse ); |
|
531 } |
|
532 break; |
|
533 case EGSLangIdDIM: |
|
534 if ( FeatureManager::FeatureSupported( KFeatureIdChinese ) ) |
|
535 { |
|
536 ShowDefaultInputMethodSettingPageL(); |
|
537 } |
|
538 break; |
|
539 case EGSLangIdCangJie: |
|
540 if ( FeatureManager::FeatureSupported( KFeatureIdChinese ) && |
|
541 Container()->Model()->DefaultInputMethodL() == ECangJie ) |
|
542 { |
|
543 ShowChiCangJieInputModeSettingPageL(); |
|
544 } |
|
545 break; |
|
546 case EGSLangIdPredictiveMode: |
|
547 #ifndef RD_INTELLIGENT_TEXT_INPUT |
|
548 if( Container()->Model()->CheckAutoWordCompletionSupportL() ) |
|
549 { |
|
550 ShowPredictiveModeSettingPageL( EFalse ); |
|
551 } |
|
552 #endif |
|
553 break; |
|
554 #ifdef RD_INTELLIGENT_TEXT_INPUT |
|
555 case EGSLangIdPredictiveOptions: |
|
556 // Show full ITI predictive settings list |
|
557 ShowPredictiveSettingListL(); |
|
558 break; |
|
559 #endif |
|
560 default: |
|
561 break; |
|
562 } |
|
563 } |
|
564 |
|
565 // ========================= New ====================================== |
|
566 |
|
567 |
|
568 // ----------------------------------------------------------------------------- |
|
569 // CGSLangPlugin::CGSLangPlugin |
|
570 // |
|
571 // |
|
572 // ----------------------------------------------------------------------------- |
|
573 // |
|
574 CGSLangContainer* CGSLangPlugin::Container() |
|
575 { |
|
576 CGSLangContainer* container = static_cast<CGSLangContainer*>( iContainer ); |
|
577 return container; |
|
578 } |
|
579 |
|
580 |
|
581 // ----------------------------------------------------------------------------- |
|
582 // CGSLangPlugin::ShowLanguageSelectionSettingPageL |
|
583 // |
|
584 // |
|
585 // ----------------------------------------------------------------------------- |
|
586 // |
|
587 void CGSLangPlugin::ShowLanguageSelectionSettingPageL() |
|
588 { |
|
589 // If the setting page has a list create array which contains all |
|
590 // the items of the list in the setting page: |
|
591 |
|
592 // Set up UI language arrays |
|
593 CArrayFixFlat<TInt>* systemEpocLanguageCodes = 0; |
|
594 // This creates the list itself |
|
595 User::LeaveIfError( SysLangUtil::GetInstalledLanguages( |
|
596 systemEpocLanguageCodes ) ); |
|
597 CleanupStack::PushL( systemEpocLanguageCodes ); |
|
598 |
|
599 CArrayFixFlat<TInt>* dtlanguages = new(ELeave)CArrayFixFlat<TInt>(4); |
|
600 CleanupStack::PushL( dtlanguages ); |
|
601 // Append "automatic" language into dtitems array |
|
602 dtlanguages->AppendL( 0 ); |
|
603 // and get text for automatic from resource... |
|
604 CDesCArrayFlat* dtitems = iCoeEnv->ReadDesC16ArrayResourceL( |
|
605 R_DISPLAY_TEXT_LANGUAGE_SETTING_PAGE_LBX ); |
|
606 CleanupStack::PushL( dtitems ); |
|
607 |
|
608 Container()->Model()->GetLanguagesFromPtiL( |
|
609 systemEpocLanguageCodes, |
|
610 dtlanguages, dtitems ); |
|
611 |
|
612 TInt count = dtlanguages->Count(); |
|
613 TInt currentItem = 0; // default value is Automatic |
|
614 |
|
615 //fetch the current value from model: |
|
616 TInt uiLanguage = Container()->Model()->LanguageL( CGSLangModel::EGSUiLanguage ); |
|
617 |
|
618 // find the match epoc language code and set to UI array |
|
619 TInt i=0; |
|
620 for ( ; i < count; i++ ) |
|
621 { |
|
622 if ( ( *dtlanguages )[i] == uiLanguage ) |
|
623 { |
|
624 currentItem = i; |
|
625 break; |
|
626 } |
|
627 } |
|
628 // create setting page: |
|
629 TInt oldItem = currentItem; |
|
630 CAknSettingPage* dlg = |
|
631 new( ELeave ) CAknRadioButtonSettingPage( |
|
632 R_DISPLAY_TEXT_LANGUAGE_SETTING_PAGE, |
|
633 currentItem, dtitems ); |
|
634 |
|
635 // Execute the setting page and check if the setting value was changed: |
|
636 if ( dlg->ExecuteLD( CAknSettingPage::EUpdateWhenChanged ) ) |
|
637 { |
|
638 if ( oldItem != currentItem ) |
|
639 { |
|
640 // Check if there is enough space in disk |
|
641 if ( Container()->Model()->CheckDiskSpaceL() ) |
|
642 { |
|
643 // Show information note |
|
644 HBufC* prompt = iCoeEnv->AllocReadResourceLC( R_GS_NOT_ENOUGH_MEMORY ); |
|
645 |
|
646 CAknInformationNote* note = |
|
647 new( ELeave ) CAknInformationNote( ETrue ); |
|
648 note->ExecuteLD( *prompt ); |
|
649 |
|
650 CleanupStack::PopAndDestroy( prompt ); |
|
651 } |
|
652 else |
|
653 { |
|
654 ConfirmRebootDTLL( ( *dtlanguages )[ currentItem ], |
|
655 ( *dtitems )[ currentItem ] ); |
|
656 } |
|
657 } |
|
658 } |
|
659 // Delete items: |
|
660 //dtitems, dtlanguages & systemEpocLanguageCodes |
|
661 CleanupStack::PopAndDestroy(3); |
|
662 |
|
663 } |
|
664 |
|
665 |
|
666 // ----------------------------------------------------------------------------- |
|
667 // CGSLangPlugin::ShowInputSelectionSettingPageL |
|
668 // |
|
669 // |
|
670 // ----------------------------------------------------------------------------- |
|
671 // |
|
672 void CGSLangPlugin::ShowInputSelectionSettingPageL() |
|
673 { |
|
674 // If the setting page has a list create array which contains all |
|
675 // the items of the list in the setting page: |
|
676 |
|
677 //some dummy size of 10 |
|
678 CArrayFixFlat<TInt>* languages = |
|
679 new( ELeave )CArrayFixFlat<TInt>(10); |
|
680 CleanupStack::PushL( languages ); |
|
681 |
|
682 //some dummy size of 10 |
|
683 CDesCArrayFlat* items = new( ELeave )CDesCArrayFlat(10); |
|
684 CleanupStack::PushL( items ); |
|
685 |
|
686 Container()->Model()->GetLanguagesFromPtiL( NULL, |
|
687 languages, items ); |
|
688 TInt i; |
|
689 TInt currentItem = 0; |
|
690 |
|
691 //fetch the current value from model: |
|
692 // current item is the decimal value of T9 language code from shared data |
|
693 TInt currentInputLanguage = |
|
694 Container()->Model()->LanguageL( CGSLangModel::EGSInputLanguage ); |
|
695 |
|
696 // total sum of available T9 dictionaries |
|
697 TInt count = languages->Count(); |
|
698 |
|
699 // compare sharedata languageCode with PtiLanguageCode array |
|
700 // Ptilanguage <-> listindex converter |
|
701 |
|
702 for ( i=0;i<count;i++ ) |
|
703 { |
|
704 if ((*languages)[i] == currentInputLanguage) |
|
705 { |
|
706 currentItem = i; |
|
707 break; |
|
708 } |
|
709 } |
|
710 // create setting page: |
|
711 CAknSettingPage* dlg = |
|
712 new( ELeave ) CAknRadioButtonSettingPage( |
|
713 R_INPUT_TEXT_LANGUAGE_SETTING_PAGE, |
|
714 currentItem, items ); |
|
715 TInt previous = Container()->Model()->LanguageL( CGSLangModel::EGSInputLanguage ); |
|
716 // Execute the setting page and check if the setting value was changed: |
|
717 if ( dlg->ExecuteLD(CAknSettingPage::EUpdateWhenChanged ) ) |
|
718 { |
|
719 //if the value was changed set the value to model |
|
720 Container()->Model()->SetLanguageL( CGSLangModel::EGSInputLanguage, |
|
721 ( *languages )[ currentItem ] ); |
|
722 //inform all other apps about language change. |
|
723 TWsEvent event; |
|
724 event.SetType( KEikInputLanguageChange ); |
|
725 iEikonEnv->WsSession().SendEventToAllWindowGroups( event ); |
|
726 |
|
727 //if updated |
|
728 if ( previous != |
|
729 Container()->Model()->LanguageL( CGSLangModel::EGSInputLanguage ) ) |
|
730 { |
|
731 //Update setting list: |
|
732 Container()->UpdateListBoxL( EGSLangIdITL ); |
|
733 Container()->UpdateListBoxL( EGSLangIdT9L ); |
|
734 Container()->UpdateListBoxL( EGSLangIdPredictiveMode ); |
|
735 } |
|
736 TInt current = Container()->Model()->LanguageL( CGSLangModel::EGSInputLanguage ); |
|
737 |
|
738 if ( ( (current == ELangPrcChinese || current == ELangHongKongChinese |
|
739 || current == ELangTaiwanChinese) && previous != current) |
|
740 || ( (current != ELangPrcChinese || current != ELangHongKongChinese ) |
|
741 && previous != current) ) |
|
742 { |
|
743 if (current == ELangPrcChinese ) |
|
744 { |
|
745 Container()->Model()->SetDefaultInputMethodL( EPinyin ); |
|
746 } |
|
747 else if ( current == ELangHongKongChinese ) |
|
748 { |
|
749 Container()->Model()->SetDefaultInputMethodL( EStroke ); |
|
750 } |
|
751 else if ( current == ELangTaiwanChinese ) |
|
752 { |
|
753 Container()->Model()->SetDefaultInputMethodL( EZhuyin ); |
|
754 } |
|
755 Container()->UpdateListBoxL( EGSLangIdDIM ); |
|
756 } |
|
757 } |
|
758 // Delete items: |
|
759 CleanupStack::PopAndDestroy(2); // items and languages |
|
760 } |
|
761 |
|
762 |
|
763 // ----------------------------------------------------------------------------- |
|
764 // CGSLangPlugin::ShowDefaultInputMethodSettingPageL |
|
765 // |
|
766 // |
|
767 // ----------------------------------------------------------------------------- |
|
768 // |
|
769 void CGSLangPlugin::ShowDefaultInputMethodSettingPageL() |
|
770 { |
|
771 // If the setting page has a list create array which contains all |
|
772 // the items of the list in the setting page: |
|
773 |
|
774 // Find correct Language resource among PRC, HK and TW. |
|
775 TInt resId = 0; |
|
776 TInt lang = Container()->Model()->LanguageL( CGSLangModel::EGSInputLanguage ); |
|
777 |
|
778 if ( FeatureManager::FeatureSupported( KFeatureIdQwertyInput ) |
|
779 || (FeatureManager::FeatureSupported(KFeatureIdVirtualKeyboardInput) && |
|
780 FeatureManager::FeatureSupported(KFeatureIdChinese))) |
|
781 { |
|
782 resId = R_DIM_QWERTY_SETTING_PAGE_LBX; |
|
783 } |
|
784 else |
|
785 { |
|
786 resId = R_DIM_SETTING_PAGE_LBX; |
|
787 } |
|
788 |
|
789 TInt keyboardLayout = 0; |
|
790 RProperty::Get(KCRUidAvkon, KAknKeyBoardLayout, keyboardLayout); |
|
791 TPtiKeyboardType layout = (TPtiKeyboardType)keyboardLayout; |
|
792 |
|
793 // Get the static items here |
|
794 CGSRadioButtonSettingPageItemTextArray* items = |
|
795 CGSRadioButtonSettingPageItemTextArray::NewL( resId, *iCoeEnv, NULL ); |
|
796 |
|
797 |
|
798 CleanupStack::PushL(items); |
|
799 |
|
800 TBool isCangjieSupported = EFalse; |
|
801 |
|
802 |
|
803 switch( lang ) |
|
804 { |
|
805 case ELangPrcChinese: |
|
806 if ( FeatureManager::FeatureSupported( KFeatureIdQwertyInput ) |
|
807 || FeatureManager::FeatureSupported(KFeatureIdVirtualKeyboardInput)) |
|
808 { |
|
809 items->SetItemVisibilityL( EGSLangSPIdQwPinyin, |
|
810 CGSListBoxItemTextArray::EVisible ); |
|
811 } |
|
812 else |
|
813 { |
|
814 items->SetItemVisibilityL( EGSLangSPIdPinyin, |
|
815 CGSListBoxItemTextArray::EVisible ); |
|
816 } |
|
817 break; |
|
818 case ELangHongKongChinese: |
|
819 if ( FeatureManager::FeatureSupported( KFeatureIdQwertyInput ) |
|
820 || FeatureManager::FeatureSupported(KFeatureIdVirtualKeyboardInput)) |
|
821 { |
|
822 if(!(layout == EPtiKeyboard12Key || layout == EPtiKeyboardHalfQwerty)) |
|
823 { |
|
824 isCangjieSupported = ETrue; |
|
825 } |
|
826 if ( Container()->Model()->CheckCangjieSupportL( ELangHongKongChinese ) && isCangjieSupported ) |
|
827 { |
|
828 |
|
829 //Cangjie input mode is only valid for QWERTY input and Virtual keyboard Input |
|
830 //Putting condition for 12 key and half QWERTY keyboard layout. |
|
831 |
|
832 items->SetItemVisibilityL( EGSLangSPIdQwCangJie, |
|
833 CGSListBoxItemTextArray::EVisible ); |
|
834 |
|
835 |
|
836 } |
|
837 } |
|
838 break; |
|
839 case ELangTaiwanChinese: |
|
840 if ( FeatureManager::FeatureSupported( KFeatureIdQwertyInput ) |
|
841 || FeatureManager::FeatureSupported(KFeatureIdVirtualKeyboardInput)) |
|
842 { |
|
843 items->SetItemVisibilityL( EGSLangSPIdQwZhuyin, |
|
844 CGSListBoxItemTextArray::EVisible ); |
|
845 } |
|
846 else |
|
847 { |
|
848 items->SetItemVisibilityL( EGSLangSPIdZhuyin, |
|
849 CGSListBoxItemTextArray::EVisible ); |
|
850 } |
|
851 break; |
|
852 default: |
|
853 break; |
|
854 } |
|
855 |
|
856 //fetch the current value from model: |
|
857 // current item is the Hexadecimal value of Input method code from CenRep |
|
858 TInt oldInputMethodCode = |
|
859 Container()->Model()->DefaultInputMethodL(); |
|
860 TInt currentItem = 0; |
|
861 |
|
862 // Construct a map for PRC,HK and TW for Input Method codes |
|
863 struct TMapArray { TInt iInputMethodCode; TInt index0, index1, index2; }; |
|
864 //Note: The values 0, 1, 2, 3 have been used to align with the setting page indices |
|
865 |
|
866 TMapArray qwertyMethodMap_Cangjie[] = { |
|
867 // PRC, HK, TW |
|
868 { EPinyin , 0, -1, -1 }, |
|
869 { EZhuyin ,-1, -1, 0 }, |
|
870 { EStroke , 1, 0, 1 }, |
|
871 { ECangJie ,-1, 1, -1 }, |
|
872 { ELatin , 2, 2, 2 } |
|
873 }; |
|
874 |
|
875 TMapArray qwertyMethodMap_NoCangjie[] = { |
|
876 // PRC, HK, TW |
|
877 { EPinyin , 0, -1, -1 }, |
|
878 { EZhuyin ,-1, -1, 0 }, |
|
879 { EStroke , 1, 0, 1 }, |
|
880 { ECangJie ,-1, -1, -1 }, |
|
881 { ELatin , 2, 1, 2 } |
|
882 }; |
|
883 |
|
884 TMapArray itutMethodMap[] = { |
|
885 // PRC, HK, TW |
|
886 { EPinyin , 0, -1, -1 }, |
|
887 { EZhuyin ,-1, -1, 0 }, |
|
888 { EStroke , 1, 0, 1 }, |
|
889 { ELatinText , 2, 1, 2 }, |
|
890 { ELatinUpper , 3, 2, 3 }, |
|
891 { ELatinLower , 4, 3, 4 } |
|
892 }; |
|
893 |
|
894 TMapArray halfQwertyMethodMap[] = { |
|
895 // PRC, HK, TW |
|
896 { EPinyin , 0, -1, -1 }, |
|
897 { EZhuyin ,-1, -1, 0 }, |
|
898 { EStroke , 1, 0, 1 }, |
|
899 { ECangJie ,-1, -1, -1 }, |
|
900 { ELatin , 2, 1, 2 } |
|
901 }; |
|
902 |
|
903 TInt itemsNum = KGSMapSize; |
|
904 TMapArray* methodMap = NULL; |
|
905 if ( layout == EPtiKeyboardHalfQwerty ) |
|
906 { |
|
907 methodMap = halfQwertyMethodMap; |
|
908 itemsNum = sizeof( halfQwertyMethodMap ) / sizeof( TMapArray ); |
|
909 } |
|
910 else if ( FeatureManager::FeatureSupported( KFeatureIdQwertyInput ) |
|
911 || (FeatureManager::FeatureSupported(KFeatureIdVirtualKeyboardInput) && |
|
912 FeatureManager::FeatureSupported(KFeatureIdChinese))) |
|
913 { |
|
914 if (isCangjieSupported) |
|
915 { |
|
916 methodMap = qwertyMethodMap_Cangjie; |
|
917 itemsNum = sizeof( qwertyMethodMap_Cangjie ) / sizeof( TMapArray ); |
|
918 } |
|
919 else |
|
920 { |
|
921 methodMap = qwertyMethodMap_NoCangjie; |
|
922 itemsNum = sizeof( qwertyMethodMap_NoCangjie ) / sizeof( TMapArray ); |
|
923 } |
|
924 } |
|
925 else |
|
926 { |
|
927 methodMap = itutMethodMap; |
|
928 itemsNum = sizeof( itutMethodMap ) / sizeof( TMapArray ); |
|
929 } |
|
930 for(TInt i = 0; i < itemsNum && i < KGSMapSize; i++) |
|
931 { |
|
932 if (oldInputMethodCode == methodMap[i].iInputMethodCode) |
|
933 { |
|
934 TInt val = 0; |
|
935 if ( lang == ELangPrcChinese ) { val = methodMap[i].index0; } |
|
936 if ( lang == ELangHongKongChinese ) { val = methodMap[i].index1; } |
|
937 if ( lang == ELangTaiwanChinese ) { val = methodMap[i].index2; } |
|
938 currentItem = val; |
|
939 break; |
|
940 } |
|
941 } |
|
942 if ( currentItem == -1 ) |
|
943 { |
|
944 currentItem = 0; |
|
945 } |
|
946 |
|
947 // create setting page: |
|
948 CAknSettingPage* dlg =new( ELeave ) CAknRadioButtonSettingPage( |
|
949 R_CH_DEFAULT_INPUT_METHOD_SETTING_PAGE, |
|
950 currentItem, |
|
951 items ); |
|
952 |
|
953 // Execute the setting page and check if the setting value was changed: |
|
954 if (dlg->ExecuteLD(CAknSettingPage::EUpdateWhenChanged)) |
|
955 { |
|
956 TInt newInputMethodCode=EPinyin; |
|
957 |
|
958 for (TInt j = 0; j < itemsNum && j < KGSMapSize; j++) |
|
959 { |
|
960 TInt val = 0; |
|
961 if ( lang == ELangPrcChinese ) { val = methodMap[j].index0; } |
|
962 if ( lang == ELangHongKongChinese ) { val = methodMap[j].index1; } |
|
963 if ( lang == ELangTaiwanChinese ) { val = methodMap[j].index2; } |
|
964 |
|
965 if ( currentItem == val ) |
|
966 { |
|
967 newInputMethodCode = methodMap[j].iInputMethodCode; |
|
968 break; |
|
969 } |
|
970 } |
|
971 //if the value was changed set the value to model |
|
972 Container()->Model()->SetDefaultInputMethodL( newInputMethodCode ); |
|
973 |
|
974 //Update setting list: |
|
975 Container()->UpdateListBoxL( EGSLangIdDIM ); |
|
976 // If CangJie input is selected, then make the CangJie input list |
|
977 // item visible in the UI. |
|
978 if ( newInputMethodCode == ECangJie ) |
|
979 { |
|
980 Container()->UpdateListBoxL( EGSLangIdCangJie ); |
|
981 } |
|
982 Container()->MakeListItemVisibleL( EGSLangIdCangJie, EGSLangIdDIM ); |
|
983 } |
|
984 // Delete items: |
|
985 CleanupStack::PopAndDestroy( items ); |
|
986 } |
|
987 |
|
988 |
|
989 // ----------------------------------------------------------------------------- |
|
990 // CGSLangPlugin::ShowAHNumberModeSettingPageL |
|
991 // |
|
992 // Show A&H number mode setting page |
|
993 // ----------------------------------------------------------------------------- |
|
994 // |
|
995 TBool CGSLangPlugin::ShowAHNumberModeSettingPageL() |
|
996 { |
|
997 // This updates also the iAHNumberModeItems which should be checked before |
|
998 // using them. |
|
999 Container()->UpdateListBoxL( EGSLangAHNumberMode ); |
|
1000 |
|
1001 TInt currentItem = |
|
1002 Container()->Model()->DefaultNumberMode( EGSNbrModeTypeArabic ); |
|
1003 |
|
1004 CAknRadioButtonSettingPage* dlg = new (ELeave) CAknRadioButtonSettingPage( |
|
1005 R_AH_NUMBER_MODE_SETTINGS_PAGE, |
|
1006 currentItem, |
|
1007 Container()->NumberModeItems( EGSNbrModeTypeArabic ) ); |
|
1008 |
|
1009 TBool ret = dlg->ExecuteLD( CAknSettingPage::EUpdateWhenChanged ); |
|
1010 |
|
1011 // Code to obtain the visual appearance of the date. |
|
1012 TAknVisualDateFormat visualDateFormat; |
|
1013 { |
|
1014 TLocale locale; |
|
1015 visualDateFormat = |
|
1016 AknDateFormatUtils::MapSymbianDateFormatToVisualDateFormat( |
|
1017 locale.DateFormat(), NULL ); |
|
1018 } |
|
1019 |
|
1020 const TInt uiLang = |
|
1021 Container()->Model()->LanguageL( CGSLangModel::EGSUiLanguage ); |
|
1022 if ( ( uiLang == ELangUrdu || User::Language() == ELangUrdu ) || |
|
1023 ( uiLang == ELangFarsi || User::Language() == ELangFarsi) ) |
|
1024 { |
|
1025 Container()->Model()->SetDefaultNumberMode( currentItem, |
|
1026 EGSNbrModeTypeEasternArabic ); |
|
1027 } |
|
1028 else |
|
1029 { |
|
1030 Container()->Model()->SetDefaultNumberMode( currentItem, |
|
1031 EGSNbrModeTypeArabic ); |
|
1032 } |
|
1033 |
|
1034 // Code to set ensure the visual appearance stays stable. |
|
1035 TLocale locale; |
|
1036 TDateFormat newFormat = |
|
1037 AknDateFormatUtils::MapVisualDateFormatToSymbianDateFormat( |
|
1038 visualDateFormat, NULL ); |
|
1039 if ( newFormat != locale.DateFormat()) |
|
1040 { |
|
1041 locale.SetDateFormat( newFormat ); |
|
1042 locale.Set(); |
|
1043 } |
|
1044 |
|
1045 TWsEvent event; |
|
1046 event.SetType( KEikInputLanguageChange ); |
|
1047 iEikonEnv->WsSession().SendEventToAllWindowGroups( event ); |
|
1048 |
|
1049 // value should really be being updated, so update listbox |
|
1050 Container()->UpdateListBoxL( EGSLangAHNumberMode ); |
|
1051 |
|
1052 return ret; |
|
1053 } |
|
1054 |
|
1055 |
|
1056 // ----------------------------------------------------------------------------- |
|
1057 // CGSLangPlugin::ShowHindiNumberModeSettingPageL |
|
1058 // |
|
1059 // Show Hindi number mode setting page |
|
1060 // ----------------------------------------------------------------------------- |
|
1061 // |
|
1062 TBool CGSLangPlugin::ShowHindiNumberModeSettingPageL() |
|
1063 { |
|
1064 // This updates also the iHindiNumberModeItems which should be checked before |
|
1065 // using them. |
|
1066 Container()->UpdateListBoxL( EGSLangHindiNumberMode ); |
|
1067 |
|
1068 TInt currentItem = |
|
1069 Container()->Model()->DefaultNumberMode( EGSNbrModeTypeIndic ); |
|
1070 |
|
1071 CAknRadioButtonSettingPage* dlg = new (ELeave) CAknRadioButtonSettingPage( |
|
1072 R_HI_NUMBER_MODE_SETTINGS_PAGE, |
|
1073 currentItem, |
|
1074 Container()->NumberModeItems( EGSNbrModeTypeIndic ) ); |
|
1075 |
|
1076 TBool ret = dlg->ExecuteLD( CAknSettingPage::EUpdateWhenChanged ); |
|
1077 |
|
1078 // Code to obtain the visual appearance of the date. |
|
1079 TAknVisualDateFormat visualDateFormat; |
|
1080 { |
|
1081 TLocale locale; |
|
1082 visualDateFormat = |
|
1083 AknDateFormatUtils::MapSymbianDateFormatToVisualDateFormat( |
|
1084 locale.DateFormat(), NULL ); |
|
1085 } |
|
1086 |
|
1087 Container()->Model()->SetDefaultNumberMode( currentItem, |
|
1088 EGSNbrModeTypeIndic ); |
|
1089 |
|
1090 // Code to set ensure the visual appearance stays stable. |
|
1091 TLocale locale; |
|
1092 TDateFormat newFormat = |
|
1093 AknDateFormatUtils::MapVisualDateFormatToSymbianDateFormat( |
|
1094 visualDateFormat, NULL ); |
|
1095 if ( newFormat != locale.DateFormat()) |
|
1096 { |
|
1097 locale.SetDateFormat( newFormat ); |
|
1098 locale.Set(); |
|
1099 } |
|
1100 |
|
1101 TWsEvent event; |
|
1102 event.SetType( KEikInputLanguageChange ); |
|
1103 iEikonEnv->WsSession().SendEventToAllWindowGroups( event ); |
|
1104 |
|
1105 // value should really be being updated, so update listbox |
|
1106 Container()->UpdateListBoxL( EGSLangHindiNumberMode ); |
|
1107 |
|
1108 return ret; |
|
1109 } |
|
1110 |
|
1111 |
|
1112 // ----------------------------------------------------------------------------- |
|
1113 // CGSLangPlugin::ConfirmRebootDTLL |
|
1114 // |
|
1115 // |
|
1116 // ----------------------------------------------------------------------------- |
|
1117 // |
|
1118 void CGSLangPlugin::ConfirmRebootDTLL( TInt aCurrentLanguage, |
|
1119 const TDesC& aLanguageName ) |
|
1120 { |
|
1121 //Get information of if there are open connections |
|
1122 TInt callState = CheckCallState(); |
|
1123 |
|
1124 // get information of whether there are open connections or not |
|
1125 if ( callState != EPSCTsyCallStateUninitialized && |
|
1126 callState != EPSCTsyCallStateNone ) |
|
1127 { |
|
1128 HBufC* prompt = iCoeEnv->AllocReadResourceLC( R_ACTIVE_CALLS ); |
|
1129 |
|
1130 CAknInformationNote* note = |
|
1131 new( ELeave ) CAknInformationNote( ETrue ); |
|
1132 |
|
1133 note->ExecuteLD( *prompt ); |
|
1134 |
|
1135 CleanupStack::PopAndDestroy( prompt ); |
|
1136 |
|
1137 return; |
|
1138 } |
|
1139 |
|
1140 // The activity starts here. |
|
1141 // First, show the confirmation query. |
|
1142 HBufC* buf = |
|
1143 StringLoader::LoadL(R_CONFIRM_DTL_STRING, aLanguageName, iEikonEnv ); |
|
1144 CleanupStack::PushL(buf); |
|
1145 |
|
1146 CAknQueryDialog* query = |
|
1147 new( ELeave ) CAknQueryDialog( CAknQueryDialog::ENoTone ); |
|
1148 query->PrepareLC( R_CONFIRM_DTL ); // pushes query to cleanupstack |
|
1149 query->SetPromptL( *buf ); |
|
1150 |
|
1151 TInt ret = query->RunLD(); // deletes query |
|
1152 |
|
1153 CleanupStack::PopAndDestroy( buf ); |
|
1154 |
|
1155 if ( ret ) |
|
1156 { |
|
1157 // Code to obtain the visual appearance of the date. |
|
1158 TAknVisualDateFormat visualDateFormat; |
|
1159 { |
|
1160 //This locale is scoped so that it does we get a totally new |
|
1161 //instance later on |
|
1162 TLocale locale; |
|
1163 visualDateFormat = |
|
1164 AknDateFormatUtils::MapSymbianDateFormatToVisualDateFormat( |
|
1165 locale.DateFormat(), NULL ); |
|
1166 } |
|
1167 // if the value was changed set the value to model |
|
1168 Container()->Model()->SetLanguageL( CGSLangModel::EGSUiLanguage, |
|
1169 aCurrentLanguage ); |
|
1170 |
|
1171 // Code to set ensure the visual appearance stays stable. |
|
1172 // Note that we force the language here because User::Language will |
|
1173 // not return the new language |
|
1174 TLocale locale; |
|
1175 TDateFormat newFormat = |
|
1176 AknDateFormatUtils::MapVisualDateFormatToSymbianDateFormat( |
|
1177 visualDateFormat, (TLanguage*)&aCurrentLanguage ); |
|
1178 if ( newFormat != locale.DateFormat() ) |
|
1179 { |
|
1180 locale.SetDateFormat( newFormat ); |
|
1181 locale.Set(); |
|
1182 } |
|
1183 // Update setting list: |
|
1184 Container()->UpdateListBoxL( EGSLangIdDTL ); |
|
1185 Container()->UpdateListBoxL( EGSLangIdITL ); |
|
1186 |
|
1187 //Updating default input method based on input text language |
|
1188 //Chinese specific feature |
|
1189 if ( aCurrentLanguage == ELangPrcChinese ) |
|
1190 { |
|
1191 Container()->Model()->SetDefaultInputMethodL( EPinyin ); |
|
1192 } |
|
1193 else if ( aCurrentLanguage == ELangHongKongChinese ) |
|
1194 { |
|
1195 Container()->Model()->SetDefaultInputMethodL( EStroke ); |
|
1196 } |
|
1197 else if ( aCurrentLanguage == ELangTaiwanChinese ) |
|
1198 { |
|
1199 Container()->Model()->SetDefaultInputMethodL( EZhuyin ); |
|
1200 } |
|
1201 |
|
1202 TInt satLanguageSelectionTime( 0 ); |
|
1203 RProperty::Get( KPSUidSatServer, |
|
1204 KSatLanguageSelectionTimeBeforeReboot, |
|
1205 satLanguageSelectionTime ); |
|
1206 |
|
1207 if ( 0 != satLanguageSelectionTime ) |
|
1208 { |
|
1209 User::After( satLanguageSelectionTime * 1000 ); |
|
1210 } |
|
1211 |
|
1212 // Reboot with Language Switch reason |
|
1213 #ifndef RD_STARTUP_CHANGE |
|
1214 SysStartup::ShutdownAndRestart( AppUi()->Application()->AppDllUid(), |
|
1215 ESWLangSwitch ); |
|
1216 #else |
|
1217 RStarterSession startSession; |
|
1218 if ( startSession.Connect() == KErrNone ) |
|
1219 { |
|
1220 startSession.Reset( RStarterSession::ELanguageSwitchReset ); |
|
1221 startSession.Close(); |
|
1222 } |
|
1223 #endif // RD_STARTUP_CHANGE |
|
1224 } |
|
1225 } |
|
1226 |
|
1227 |
|
1228 // ----------------------------------------------------------------------------- |
|
1229 // CGSLangPlugin::CheckCallState |
|
1230 // |
|
1231 // |
|
1232 // ----------------------------------------------------------------------------- |
|
1233 // |
|
1234 TInt CGSLangPlugin::CheckCallState() |
|
1235 { |
|
1236 TInt callState = KErrNone; |
|
1237 |
|
1238 //here are open connections or not |
|
1239 RProperty::Get( KPSUidCtsyCallInformation, |
|
1240 KCTsyCallState, |
|
1241 callState ); |
|
1242 return callState; |
|
1243 } |
|
1244 |
|
1245 |
|
1246 // ----------------------------------------------------------------------------- |
|
1247 // CGSLangPlugin::ResetATOKDictionaryL |
|
1248 // |
|
1249 // |
|
1250 // ----------------------------------------------------------------------------- |
|
1251 // |
|
1252 void CGSLangPlugin::ResetATOKDictionaryL() |
|
1253 { |
|
1254 HBufC* buf = StringLoader::LoadL( R_CONFIRM_RESET_ATOK_STRING, iEikonEnv ); |
|
1255 CleanupStack::PushL( buf ); |
|
1256 |
|
1257 CAknQueryDialog* query = |
|
1258 new( ELeave ) CAknQueryDialog( CAknQueryDialog::ENoTone ); |
|
1259 query->PrepareLC( R_CONFIRM_RESET_ATOK ); |
|
1260 query->SetPromptL( *buf ); |
|
1261 |
|
1262 TInt ret = query->RunLD(); // deletes query |
|
1263 CleanupStack::PopAndDestroy( buf ); |
|
1264 |
|
1265 if ( ret ) |
|
1266 { |
|
1267 CPtiEngine* ptiEngine = CPtiEngine::NewL(); |
|
1268 CleanupStack::PushL( ptiEngine ); |
|
1269 |
|
1270 ptiEngine->ActivateLanguageL( ELangJapanese, EPtiEngineHiraganaKanji ); |
|
1271 ptiEngine->HandleCommandL( EPtiCommandResetLearningInfo ); |
|
1272 |
|
1273 CleanupStack::PopAndDestroy( ptiEngine ); |
|
1274 } |
|
1275 } |
|
1276 |
|
1277 |
|
1278 // ----------------------------------------------------------------------------- |
|
1279 // CGSLangPlugin::ShowKeypressTimeoutSettingPageL() |
|
1280 // |
|
1281 // Create a Keypress timeout setting page |
|
1282 // ----------------------------------------------------------------------------- |
|
1283 // |
|
1284 void CGSLangPlugin::ShowKeypressTimeoutSettingPageL() |
|
1285 { |
|
1286 // Get current data |
|
1287 const TInt currentTime = Container()->Model()->KeypressTimeout(); |
|
1288 TInt currentIndex; |
|
1289 if ( currentTime == 0 ) |
|
1290 { |
|
1291 currentIndex = EGSKeypressTimeoutItemNone; |
|
1292 } |
|
1293 else if ( currentTime > KGSMultiTapTimerDefault ) |
|
1294 { |
|
1295 currentIndex = EGSKeypressTimeoutItemLong; |
|
1296 } |
|
1297 else if ( currentTime < KGSMultiTapTimerDefault ) |
|
1298 { |
|
1299 currentIndex = EGSKeypressTimeoutItemShort; |
|
1300 } |
|
1301 else |
|
1302 { |
|
1303 currentIndex = EGSKeypressTimeoutItemMedium; |
|
1304 } |
|
1305 |
|
1306 // and get text for automatic from resource... |
|
1307 CDesCArrayFlat* items = iCoeEnv->ReadDesC16ArrayResourceL( |
|
1308 R_KEYPRESS_TIMEOUT_SETTING_PAGE_LBX ); |
|
1309 CleanupStack::PushL( items ); |
|
1310 |
|
1311 // create setting page: |
|
1312 TInt oldIndex = currentIndex; |
|
1313 CAknSettingPage* dlg = new( ELeave ) CAknRadioButtonSettingPage |
|
1314 ( R_KEYPRESS_TIMEOUT_SETTING_PAGE, |
|
1315 currentIndex, items ); |
|
1316 |
|
1317 // Execute the setting page and check if the setting value was changed: |
|
1318 if ( dlg->ExecuteLD( CAknSettingPage::EUpdateWhenChanged ) ) |
|
1319 { |
|
1320 if ( oldIndex != currentIndex ) |
|
1321 { |
|
1322 TInt newTime = KGSMultiTapTimerDefault; |
|
1323 const TInt rate = 40; // rate is 40%. |
|
1324 switch ( currentIndex ) |
|
1325 { |
|
1326 case EGSKeypressTimeoutItemNone: |
|
1327 newTime = 0; |
|
1328 break; |
|
1329 case EGSKeypressTimeoutItemShort: |
|
1330 newTime = |
|
1331 KGSMultiTapTimerDefault - KGSMultiTapTimerDefault * rate / 100; |
|
1332 break; |
|
1333 case EGSKeypressTimeoutItemLong: |
|
1334 newTime = |
|
1335 KGSMultiTapTimerDefault + KGSMultiTapTimerDefault * rate / 100; |
|
1336 break; |
|
1337 case EGSKeypressTimeoutItemMedium: |
|
1338 default: |
|
1339 newTime = KGSMultiTapTimerDefault; |
|
1340 break; |
|
1341 } |
|
1342 Container()->Model()->SetKeypressTimeout( newTime ); |
|
1343 // value should really be being updated, so update listbox |
|
1344 Container()->UpdateListBoxL( EGSLangIdKT ); |
|
1345 } |
|
1346 } |
|
1347 // Delete items: |
|
1348 CleanupStack::PopAndDestroy( items ); |
|
1349 } |
|
1350 |
|
1351 |
|
1352 // ----------------------------------------------------------------------------- |
|
1353 // CGSLangPlugin::ChangeJapQwertySettingL |
|
1354 // Change Japanese Qwerty settings |
|
1355 // ----------------------------------------------------------------------------- |
|
1356 // |
|
1357 void CGSLangPlugin::ChangeJapQwertySettingL( const TGSJapQwertyFlags aFlag, |
|
1358 const TInt aItemId, |
|
1359 const TBool aShowSettingPage ) |
|
1360 { |
|
1361 TBool currentValue = Container()->Model()->JapanQwertyFlags( aFlag ); |
|
1362 TBool updateValue = ETrue; |
|
1363 |
|
1364 TInt settingPageResourceId = 0; |
|
1365 TInt itemArraryResourceId = 0; |
|
1366 switch ( aItemId ) |
|
1367 { |
|
1368 case EGSLangIdJQC: |
|
1369 settingPageResourceId = R_JAP_QWERTY_COMMA_SETTING_PAGE; |
|
1370 itemArraryResourceId = R_JAP_QWERTY_COMMA_SETTING_PAGE_LBX; |
|
1371 break; |
|
1372 case EGSLangIdJQP: |
|
1373 settingPageResourceId = R_JAP_QWERTY_PERIOD_SETTING_PAGE; |
|
1374 itemArraryResourceId = R_JAP_QWERTY_PERIOD_SETTING_PAGE_LBX; |
|
1375 break; |
|
1376 case EGSLangIdJQWSP: |
|
1377 settingPageResourceId = R_JAP_QWERTY_WIDTH_SPACE_SETTING_PAGE; |
|
1378 itemArraryResourceId = R_JAP_QWERTY_WIDTH_FULL_HALF_SETTING_PAGE_LBX; |
|
1379 break; |
|
1380 default: |
|
1381 break; |
|
1382 } |
|
1383 |
|
1384 // Following code potentially changes the value of currrent value |
|
1385 if ( aShowSettingPage ) |
|
1386 { |
|
1387 updateValue = ShowJapQwertySettingPageL( settingPageResourceId, |
|
1388 itemArraryResourceId, |
|
1389 currentValue ); |
|
1390 } |
|
1391 else |
|
1392 { |
|
1393 updateValue = !( currentValue ); |
|
1394 } |
|
1395 |
|
1396 if ( currentValue != updateValue ) |
|
1397 { |
|
1398 Container()->Model()->SetJapanQwertyFlags( aFlag, updateValue ); |
|
1399 // value should really be being updated, so update listbox |
|
1400 Container()->UpdateListBoxL( aItemId ); |
|
1401 } |
|
1402 } |
|
1403 |
|
1404 // ----------------------------------------------------------------------------- |
|
1405 // CGSLangPlugin::ShowJapQwertySettingPageL |
|
1406 // Display Japanese Qwerty ON/OFF setting page. |
|
1407 // ----------------------------------------------------------------------------- |
|
1408 // |
|
1409 TBool CGSLangPlugin::ShowJapQwertySettingPageL( |
|
1410 const TInt aSettingPageResourceId, |
|
1411 const TInt aItemArraryResourceId, |
|
1412 const TBool aCurrentValue ) |
|
1413 { |
|
1414 // Default is to act as if the user cancelled the setting page |
|
1415 TBool ret = EFalse; |
|
1416 |
|
1417 CDesCArrayFlat* items = iCoeEnv->ReadDesC16ArrayResourceL( |
|
1418 aItemArraryResourceId ); |
|
1419 CleanupStack::PushL( items ); |
|
1420 // If current value is ETrue, display index is 0. |
|
1421 TInt dispIndex = ( aCurrentValue )? 0 : 1; |
|
1422 |
|
1423 CAknRadioButtonSettingPage* dlg = new ( ELeave ) CAknRadioButtonSettingPage |
|
1424 ( aSettingPageResourceId, |
|
1425 dispIndex, items ); |
|
1426 ret = dlg->ExecuteLD( CAknSettingPage::EUpdateWhenChanged ); |
|
1427 if ( ret ) |
|
1428 { |
|
1429 ret = ( dispIndex )? EFalse : ETrue; |
|
1430 } |
|
1431 else |
|
1432 { |
|
1433 ret = aCurrentValue; |
|
1434 } |
|
1435 CleanupStack::PopAndDestroy( items ); |
|
1436 return ret; |
|
1437 } |
|
1438 |
|
1439 |
|
1440 // ----------------------------------------------------------------------------- |
|
1441 // CGSLangPlugin::ShowChiCangJieInputModeSettingPageL |
|
1442 // |
|
1443 // Display Chinese CangJie Input mode setting page. |
|
1444 // ----------------------------------------------------------------------------- |
|
1445 // |
|
1446 void CGSLangPlugin::ShowChiCangJieInputModeSettingPageL() |
|
1447 { |
|
1448 // Default is to act as if the user cancelled the setting page |
|
1449 TBool ret = EFalse; |
|
1450 |
|
1451 TInt selection = Container()->Model()->ChiCangJieInputL(); |
|
1452 CDesCArrayFlat* items = iCoeEnv->ReadDesC16ArrayResourceL( |
|
1453 R_CHI_CANGJIE_SETTING_PAGE_LBX ); |
|
1454 CleanupStack::PushL( items ); |
|
1455 |
|
1456 CAknRadioButtonSettingPage* dlg = new ( ELeave ) CAknRadioButtonSettingPage |
|
1457 ( R_CHI_CANGJIE_INPUT_MODE_SETTING_PAGE, selection, items ); |
|
1458 ret = dlg->ExecuteLD( CAknSettingPage::EUpdateWhenChanged ); |
|
1459 CleanupStack::PopAndDestroy( items ); |
|
1460 |
|
1461 if ( ret ) |
|
1462 { |
|
1463 //User has changed the value. Update the CenRep key and the UI |
|
1464 Container()->Model()->SetChiCangJieInputL( selection ); |
|
1465 Container()->UpdateListBoxL( EGSLangIdCangJie ); |
|
1466 } |
|
1467 } |
|
1468 |
|
1469 // ----------------------------------------------------------------------------- |
|
1470 // CGSLangPlugin::ShowPredictiveModeSettingPageL |
|
1471 // Word Autocompletion Requirement |
|
1472 // Display Predictive mode setting page. |
|
1473 // ----------------------------------------------------------------------------- |
|
1474 // |
|
1475 void CGSLangPlugin::ShowPredictiveModeSettingPageL( const TBool aShowSettingPage ) |
|
1476 { |
|
1477 TBool updateValue = ETrue; |
|
1478 TInt selection = Container()->Model()->PredictiveModeL(); |
|
1479 if ( aShowSettingPage ) |
|
1480 { |
|
1481 // Default is to act as if the user cancelled the setting page |
|
1482 CDesCArrayFlat* items = iCoeEnv->ReadDesC16ArrayResourceL( |
|
1483 R_PREDICTIVE_MODE_SETTING_PAGE_LBX ); |
|
1484 CleanupStack::PushL( items ); |
|
1485 CAknRadioButtonSettingPage* dlg = new ( ELeave ) CAknRadioButtonSettingPage |
|
1486 ( R_PREDICTIVE_MODE_SETTING_PAGE, selection, items ); |
|
1487 updateValue = dlg->ExecuteLD( CAknSettingPage::EUpdateWhenChanged ); |
|
1488 CleanupStack::PopAndDestroy( items ); |
|
1489 } |
|
1490 else // just switch the value |
|
1491 { |
|
1492 // 0 --> Normal |
|
1493 // 1 --> Autocompletion |
|
1494 if ( selection == EGSPredictiveModeNormal ) |
|
1495 { |
|
1496 selection = EGSPredictiveModeAutocompletion; |
|
1497 } |
|
1498 else if ( selection == EGSPredictiveModeAutocompletion ) |
|
1499 { |
|
1500 selection = EGSPredictiveModeNormal; |
|
1501 } |
|
1502 } |
|
1503 |
|
1504 if ( updateValue ) |
|
1505 { |
|
1506 //User has changed the value. Update the CenRep key and the UI |
|
1507 // Treat on and off separately for clarity |
|
1508 if ( selection ) |
|
1509 { |
|
1510 // See if it can do predictive text entry |
|
1511 TInt langCode = Container()->Model()->LanguageL |
|
1512 ( CGSLangModel::EGSInputLanguage ); |
|
1513 if( Container()->Model()->CheckDictionaryFromPtiL( langCode ) ) |
|
1514 { |
|
1515 Container()->Model()->SetPredictiveModeL( selection ); |
|
1516 } |
|
1517 else |
|
1518 { |
|
1519 CAknNoteDialog* dlg = new (ELeave) CAknNoteDialog( ); |
|
1520 dlg->ExecuteDlgLD( |
|
1521 CAknNoteDialog::EShortTimeout, |
|
1522 CAknNoteDialog::ENoTone, |
|
1523 R_AVKON_T9_NOTE_NO_AVAILABLE ); |
|
1524 } |
|
1525 } |
|
1526 else |
|
1527 { |
|
1528 // We are always able to turn T9 off: |
|
1529 Container()->Model()->SetPredictiveModeL( selection ); |
|
1530 } |
|
1531 Container()->UpdateListBoxL( EGSLangIdPredictiveMode ); |
|
1532 } |
|
1533 } |
|
1534 |
|
1535 #ifdef RD_INTELLIGENT_TEXT_INPUT |
|
1536 #ifdef FF_DUAL_LANGUAGE_SUPPORT |
|
1537 // ---------------------------------------------------------------------------- |
|
1538 // CGSLangPlugin::ShowDualInputLanguageSettingListL() |
|
1539 // |
|
1540 // Display the dynamic menu |
|
1541 // ---------------------------------------------------------------------------- |
|
1542 void CGSLangPlugin::ShowDualInputLanguageSettingListL() |
|
1543 { |
|
1544 CAknAppUi* appUi = static_cast<CAknAppUi*>(iCoeEnv->AppUi()); |
|
1545 |
|
1546 CAknTitlePane* titlePane = static_cast<CAknTitlePane*>( appUi->StatusPane()->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) ); |
|
1547 |
|
1548 const TDesC* appTitle = titlePane->Text(); |
|
1549 HBufC* oldTitle = appTitle->AllocL(); |
|
1550 CleanupStack::PushL(oldTitle); |
|
1551 HBufC* title = StringLoader::LoadLC( R_INPUT_LANGUAGE_SETTINGS_TITLE, iCoeEnv); |
|
1552 titlePane->SetTextL( *title ); |
|
1553 CleanupStack::PopAndDestroy(title); |
|
1554 |
|
1555 CGSDualLanguageDialog* dlg = CGSDualLanguageDialog::NewL(R_GS_MENUBAR_CHANGE_EXIT, Container()->Model()); |
|
1556 dlg->ExecuteLD(R_INPUTLANGUAGE_DIALOG); |
|
1557 |
|
1558 titlePane->SetTextL( *oldTitle ); |
|
1559 CleanupStack::PopAndDestroy(oldTitle); |
|
1560 } |
|
1561 |
|
1562 #endif //FF_DUAL_LANGUAGE_SUPPORT |
|
1563 |
|
1564 void DestroySelectionItemList(TAny* aPtr) |
|
1565 { |
|
1566 CSelectionItemList* list = static_cast<CSelectionItemList*>(aPtr); |
|
1567 list->ResetAndDestroy(); |
|
1568 delete list; |
|
1569 } |
|
1570 |
|
1571 // ---------------------------------------------------------------------------- |
|
1572 // CGSLangPlugin::ShowITIMultiSettingPageL(TBool aShowOnOffSettingPage) |
|
1573 // |
|
1574 // Display the dynamic menu |
|
1575 // ---------------------------------------------------------------------------- |
|
1576 void CGSLangPlugin::ShowITIMultiSettingPageL(TBool aShowOnOffSettingPage) |
|
1577 { |
|
1578 if( Container()->Model()->DeviceHasMultipleKeyboardsL() ) |
|
1579 { |
|
1580 CSelectionItemList* selection = new (ELeave) CSelectionItemList(2); |
|
1581 CleanupStack::PushL(TCleanupItem(DestroySelectionItemList, selection)); |
|
1582 TInt physicalKeyboards = Container()->Model()->PhysicalKeyboardsL(); |
|
1583 TInt predictionBitmask = Container()->Model()->PredictionBitMaskL(); |
|
1584 TBool settingActive = EFalse; |
|
1585 HBufC* selectionText = 0; |
|
1586 TInt count = 0; |
|
1587 TInt itutIndex = 0; |
|
1588 TInt halfQwertyIndex = 0; |
|
1589 TInt qwertyIndex = 0; |
|
1590 for(TUint i = 0x01; i <= 0xF0; i = i << 1) |
|
1591 { |
|
1592 if(physicalKeyboards & i) |
|
1593 { |
|
1594 switch(i) |
|
1595 { |
|
1596 case 0x01: // itut |
|
1597 settingActive = ( predictionBitmask & EKeyboardStyle12Key ? 1 : 0 ); |
|
1598 selectionText = iCoeEnv->AllocReadResourceLC(R_AKNFEP_PRED_SETTING_ITUT); |
|
1599 itutIndex = count; |
|
1600 break; |
|
1601 case 0x10: // half |
|
1602 settingActive = ( predictionBitmask & EKeyboardStyleHalfQwerty ? 1 : 0 ); |
|
1603 selectionText = iCoeEnv->AllocReadResourceLC(R_AKNFEP_PRED_SETTING_HALF_QWERTY); |
|
1604 halfQwertyIndex = count; |
|
1605 break; |
|
1606 case 0x02: // 4x12 |
|
1607 case 0x04: // 4x10 |
|
1608 case 0x08: // 3x11 |
|
1609 case 0x20: // custom |
|
1610 settingActive = ( predictionBitmask & EKeyboardStyleQwerty ? 1: 0); |
|
1611 selectionText = iCoeEnv->AllocReadResourceLC(R_AKNFEP_PRED_SETTING_QWERTY); |
|
1612 qwertyIndex = count; |
|
1613 i = 0x20; // Skip rest of qwerty checks |
|
1614 break; |
|
1615 default: |
|
1616 break; |
|
1617 } |
|
1618 count++; |
|
1619 CSelectableItem* item = new (ELeave) CSelectableItem( *selectionText, settingActive ); |
|
1620 item->ConstructL(); |
|
1621 selection->AppendL(item); |
|
1622 CleanupStack::PopAndDestroy(); //selectionText |
|
1623 } |
|
1624 } |
|
1625 |
|
1626 CAknCheckBoxSettingPage* settingPage = |
|
1627 new( ELeave) CAknCheckBoxSettingPage( R_PREDICTIVE_TEXT_MULTI_SETTING_PAGE, selection); |
|
1628 |
|
1629 if( settingPage->ExecuteLD(CAknSettingPage::EUpdateWhenAccepted)) |
|
1630 { |
|
1631 for(TUint i = 0x01; i <= 0xF0; i = i << 1) |
|
1632 { |
|
1633 if(physicalKeyboards & i) |
|
1634 { |
|
1635 switch(i) |
|
1636 { |
|
1637 case 0x01: // itut |
|
1638 if( (selection->At(itutIndex))->SelectionStatus() ) |
|
1639 { |
|
1640 predictionBitmask = predictionBitmask | EKeyboardStyle12Key ; |
|
1641 } |
|
1642 else |
|
1643 { |
|
1644 predictionBitmask = predictionBitmask & ~EKeyboardStyle12Key ; |
|
1645 } |
|
1646 break; |
|
1647 case 0x10: // half |
|
1648 if( (selection->At(halfQwertyIndex))->SelectionStatus() ) |
|
1649 { |
|
1650 predictionBitmask = predictionBitmask | EKeyboardStyleHalfQwerty ; |
|
1651 } |
|
1652 else |
|
1653 { |
|
1654 predictionBitmask = predictionBitmask & ~EKeyboardStyleHalfQwerty ; |
|
1655 } |
|
1656 break; |
|
1657 case 0x02: // 4x12 |
|
1658 case 0x04: // 4x10 |
|
1659 case 0x08: // 3x11 |
|
1660 case 0x20: // custom |
|
1661 if( (selection->At(qwertyIndex))->SelectionStatus() ) |
|
1662 { |
|
1663 predictionBitmask = predictionBitmask | EKeyboardStyleQwerty ; |
|
1664 } |
|
1665 else |
|
1666 { |
|
1667 predictionBitmask = predictionBitmask & ~EKeyboardStyleQwerty ; |
|
1668 } |
|
1669 i = 0x20; // Skip rest of qwerty checks |
|
1670 break; |
|
1671 default: |
|
1672 break; |
|
1673 } |
|
1674 } |
|
1675 } |
|
1676 Container()->Model()->SetPredictionBitMaskL(predictionBitmask); |
|
1677 } |
|
1678 CleanupStack::PopAndDestroy(); // selection |
|
1679 } |
|
1680 else |
|
1681 { |
|
1682 Container()->Model()->ChangePredictiveOnOffSettingL( |
|
1683 aShowOnOffSettingPage, |
|
1684 CGSLangModel::EGSLangOther ); |
|
1685 } |
|
1686 } |
|
1687 |
|
1688 // ---------------------------------------------------------------------------- |
|
1689 // CGSLangPlugin::ShowPredictiveSettingListL() |
|
1690 // |
|
1691 // Display the dynamic menu |
|
1692 // ---------------------------------------------------------------------------- |
|
1693 void CGSLangPlugin::ShowPredictiveSettingListL() |
|
1694 { |
|
1695 if (iCascadeOptionsOpen) |
|
1696 { |
|
1697 // Return if already open |
|
1698 return; |
|
1699 } |
|
1700 |
|
1701 CAknAppUi* appUi = static_cast<CAknAppUi*>(iCoeEnv->AppUi()); |
|
1702 |
|
1703 CAknTitlePane* titlePane = static_cast<CAknTitlePane*>( appUi->StatusPane()->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) ); |
|
1704 |
|
1705 const TDesC* appTitle = titlePane->Text(); |
|
1706 HBufC* oldTitle = appTitle->AllocL(); |
|
1707 CleanupStack::PushL(oldTitle); |
|
1708 HBufC* title = StringLoader::LoadLC( R_AKNFEP_PRED_INPUT_SETTINGS_TITLE, iCoeEnv); |
|
1709 titlePane->SetTextL( *title ); |
|
1710 CleanupStack::PopAndDestroy(title); |
|
1711 |
|
1712 CGSPredictiveSettingDialog* dlg = CGSPredictiveSettingDialog::NewL(R_PREDICTIVESETTINGDIALOG_MENUBAR, R_PREDICTIVETEXTOFF_CONFIRMATION_QUERY); |
|
1713 iDialog = dlg; |
|
1714 iCascadeOptionsOpen = ETrue; |
|
1715 dlg->ExecuteLD(R_PREDICTIVESETTING_DIALOG); |
|
1716 iCascadeOptionsOpen = EFalse; |
|
1717 iDialog = NULL; |
|
1718 titlePane->SetTextL( *oldTitle ); |
|
1719 CleanupStack::PopAndDestroy(oldTitle); |
|
1720 } |
|
1721 #endif |
|
1722 |
|
1723 // ---------------------------------------------------------------------------- |
|
1724 // CGSLangPlugin::DynInitMenuPaneL() |
|
1725 // |
|
1726 // Display the dynamic menu |
|
1727 // ---------------------------------------------------------------------------- |
|
1728 void CGSLangPlugin::DynInitMenuPaneL( TInt aResourceId, |
|
1729 CEikMenuPane* aMenuPane ) |
|
1730 { |
|
1731 // show or hide the 'help' menu item when supported |
|
1732 if( aResourceId == R_GS_MENU_ITEM_HELP ) |
|
1733 { |
|
1734 User::LeaveIfNull( aMenuPane ); |
|
1735 |
|
1736 if ( FeatureManager::FeatureSupported( KFeatureIdHelp ) ) |
|
1737 { |
|
1738 aMenuPane->SetItemDimmed( EAknCmdHelp, EFalse ); |
|
1739 } |
|
1740 else |
|
1741 { |
|
1742 aMenuPane->SetItemDimmed( EAknCmdHelp, ETrue ); |
|
1743 } |
|
1744 } |
|
1745 #ifdef RD_INTELLIGENT_TEXT_INPUT |
|
1746 // show or hide the change menu option when supported |
|
1747 if(aResourceId == R_GS_MENU_ITEM_CHANGE) |
|
1748 { |
|
1749 User::LeaveIfNull( aMenuPane ); |
|
1750 TInt keyboardLayout = 0; |
|
1751 RProperty::Get(KCRUidAvkon, KAknKeyBoardLayout, keyboardLayout); |
|
1752 TPtiKeyboardType layout = (TPtiKeyboardType)keyboardLayout; |
|
1753 TBool isPredictionSupport = EFalse; |
|
1754 switch(layout) |
|
1755 { |
|
1756 case EPtiKeyboardHalfQwerty: |
|
1757 isPredictionSupport = Container()->Model()->CheckT9FromPtiLForPredictionL((TPtiEngineInputMode)EPtiEngineHalfQwertyPredictive); |
|
1758 break; |
|
1759 case EPtiKeyboardQwerty4x12: |
|
1760 case EPtiKeyboardQwerty4x10: |
|
1761 case EPtiKeyboardQwerty3x11: |
|
1762 case EPtiKeyboardCustomQwerty: |
|
1763 isPredictionSupport = Container()->Model()->CheckT9FromPtiLForPredictionL((TPtiEngineInputMode)EPtiEngineQwertyPredictive); |
|
1764 break; |
|
1765 case EPtiKeyboardNone: |
|
1766 case EPtiKeyboard12Key: |
|
1767 isPredictionSupport = Container()->Model()->CheckT9FromPtiLForPredictionL((TPtiEngineInputMode)EPtiEnginePredictive); |
|
1768 break; |
|
1769 default: |
|
1770 isPredictionSupport = Container()->Model()->CheckT9FromPtiLForPredictionL((TPtiEngineInputMode)EPtiEnginePredictive); |
|
1771 break; |
|
1772 } |
|
1773 if (isPredictionSupport == EFalse) |
|
1774 { |
|
1775 aMenuPane->SetItemDimmed(EGSCmdAppChange, ETrue ); |
|
1776 } |
|
1777 } |
|
1778 #endif |
|
1779 |
|
1780 } |
|
1781 // ----------------------------------------------------------------------------- |
|
1782 // CGSLangPlugin::CreateIconL() |
|
1783 // |
|
1784 // |
|
1785 // ----------------------------------------------------------------------------- |
|
1786 // |
|
1787 CGulIcon* CGSLangPlugin::CreateIconL( const TUid aIconType ) |
|
1788 { |
|
1789 //EMbm<Mbm_file_name><Bitmap_name> |
|
1790 CGulIcon* icon; |
|
1791 |
|
1792 if( aIconType == KGSIconTypeLbxItem ) |
|
1793 { |
|
1794 icon = AknsUtils::CreateGulIconL( |
|
1795 AknsUtils::SkinInstance(), |
|
1796 KAknsIIDQgnPropCpPersoLang, |
|
1797 KGSDefaultLangIconFileName, |
|
1798 EMbmGslangpluginQgn_prop_cp_perso_lang, |
|
1799 EMbmGslangpluginQgn_prop_cp_perso_lang_mask ); |
|
1800 } |
|
1801 else |
|
1802 { |
|
1803 icon = CGSPluginInterface::CreateIconL( aIconType ); |
|
1804 } |
|
1805 |
|
1806 return icon; |
|
1807 } |
|
1808 |
|
1809 #ifdef RD_INTELLIGENT_TEXT_INPUT |
|
1810 #ifdef __ITI_VIRTUAL_TOUCH_FIRST_GENERATION_SUPPORT__ |
|
1811 TInt CGSLangPlugin::HandleKeyboardLayoutChangeNotification(TAny* aObj) |
|
1812 { |
|
1813 if (aObj) |
|
1814 { |
|
1815 static_cast<CGSLangPlugin*>(aObj)->HandleKeyboardLayoutChange(); |
|
1816 return KErrNone; |
|
1817 } |
|
1818 else |
|
1819 { |
|
1820 return KErrArgument; |
|
1821 } |
|
1822 } |
|
1823 |
|
1824 void CGSLangPlugin::HandleKeyboardLayoutChange() |
|
1825 { |
|
1826 if(iDialog) |
|
1827 { |
|
1828 iDialog->HandleResourceChange(KEikDynamicLayoutVariantSwitch); |
|
1829 } |
|
1830 if(iContainer) |
|
1831 { |
|
1832 Container()->HandleResourceChange(KEikDynamicLayoutVariantSwitch); |
|
1833 } |
|
1834 } |
|
1835 |
|
1836 CGSLangPlugin::CSubscriber::CSubscriber(TCallBack aCallBack, RProperty& aProperty) |
|
1837 : |
|
1838 CActive(EPriorityNormal), iCallBack(aCallBack), iProperty(aProperty) |
|
1839 { |
|
1840 CActiveScheduler::Add(this); |
|
1841 } |
|
1842 |
|
1843 CGSLangPlugin::CSubscriber::~CSubscriber() |
|
1844 { |
|
1845 Cancel(); |
|
1846 } |
|
1847 |
|
1848 void CGSLangPlugin::CSubscriber::SubscribeL() |
|
1849 { |
|
1850 if (!IsActive()) |
|
1851 { |
|
1852 iProperty.Subscribe(iStatus); |
|
1853 SetActive(); |
|
1854 } |
|
1855 } |
|
1856 |
|
1857 void CGSLangPlugin::CSubscriber::StopSubscribe() |
|
1858 { |
|
1859 Cancel(); |
|
1860 } |
|
1861 |
|
1862 void CGSLangPlugin::CSubscriber::RunL() |
|
1863 { |
|
1864 if (iStatus.Int() == KErrNone) |
|
1865 { |
|
1866 iCallBack.CallBack(); |
|
1867 SubscribeL(); |
|
1868 } |
|
1869 } |
|
1870 |
|
1871 void CGSLangPlugin::CSubscriber::DoCancel() |
|
1872 { |
|
1873 iProperty.Cancel(); |
|
1874 } |
|
1875 |
|
1876 #endif //__ITI_VIRTUAL_TOUCH_FIRST_GENERATION_SUPPORT__ |
|
1877 #endif |
|
1878 // End of File |