1 /* |
|
2 * Copyright (c) 2009 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 /* |
|
28 * ============================================================================ |
|
29 * Name : CAknFepPredictiveSettingList from AknFepPredictiveSettingList |
|
30 * ============================================================================ |
|
31 */ |
|
32 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS |
|
33 #include <uikon/eikctrlstatus.h> |
|
34 #endif |
|
35 #include <centralrepository.h> |
|
36 #include <AknQueryDialog.h> |
|
37 #include <AknFepInternalCRKeys.h> |
|
38 #include <PtiDefs.h> |
|
39 #include <e32property.h> |
|
40 #include <AvkonInternalCRKeys.h> |
|
41 #include <AknFepGlobalEnums.h> |
|
42 #include "AknFepPredictiveSettingDialog.h" |
|
43 #include <aknnotewrappers.h> |
|
44 #include <aknfep.rsg> |
|
45 #include <hlplch.h> |
|
46 //#include <csxhelp/cp.hlp.hrh> |
|
47 #include <akntitle.h> //CAknTitlePane |
|
48 #include <StringLoader.h> |
|
49 #include <aknnavide.h> |
|
50 |
|
51 _LIT(KFEPIMPLPREDINPUT_HLP_INPUT, "PREDINPUT_HLP_INPUT"); // |
|
52 |
|
53 CAknFepPredictiveSettingDialog *CAknFepPredictiveSettingDialog::NewL(TInt aMenuResId, TInt aConfirmationQueryResId, TInt aTitlePaneResId) |
|
54 { |
|
55 CAknFepPredictiveSettingDialog* self = CAknFepPredictiveSettingDialog::NewLC(aMenuResId, aConfirmationQueryResId, aTitlePaneResId); |
|
56 CleanupStack::Pop(self); |
|
57 return self; |
|
58 } |
|
59 |
|
60 CAknFepPredictiveSettingDialog *CAknFepPredictiveSettingDialog::NewLC(TInt aMenuResId, TInt aConfirmationQueryResId, TInt aTitlePaneResId) |
|
61 { |
|
62 CAknFepPredictiveSettingDialog* self = new (ELeave) CAknFepPredictiveSettingDialog(aConfirmationQueryResId, aTitlePaneResId); |
|
63 CleanupStack::PushL(self); |
|
64 self->ConstructL(aMenuResId); |
|
65 return self; |
|
66 } |
|
67 |
|
68 void CAknFepPredictiveSettingDialog::ConstructL( TInt aMenuTitleResourceId ) |
|
69 { |
|
70 CAknDialog::ConstructL(aMenuTitleResourceId); |
|
71 PrepareStatusPaneL(); |
|
72 iItemCloseEventCheck = CIdle::NewL(CActive::EPriorityStandard); |
|
73 } |
|
74 |
|
75 CAknFepPredictiveSettingDialog ::CAknFepPredictiveSettingDialog(TInt aConfirmationQueryResId, TInt aTitlePaneResId): |
|
76 iConfirmationQueryResId(aConfirmationQueryResId), |
|
77 iPredictiveSettingOffQueryNotShown(ETrue), |
|
78 iTitlePane(NULL), |
|
79 iNaviPane(NULL), |
|
80 iNaviDecoratedTabGroup(NULL), |
|
81 iLastTitle(NULL), |
|
82 iStatusTitle(NULL), |
|
83 iTitlePaneResId(aTitlePaneResId), |
|
84 iSettingItemInEditingState(EFalse) |
|
85 { |
|
86 #ifdef __ITI_VIRTUAL_TOUCH_FIRST_GENERATION_SUPPORT__ |
|
87 RProperty::Get(KCRUidAvkon, KAknKeyBoardLayout, iOriginalKeyboardLayout); |
|
88 #endif //__ITI_VIRTUAL_TOUCH_FIRST_GENERATION_SUPPORT__ |
|
89 } |
|
90 |
|
91 CAknFepPredictiveSettingDialog::~CAknFepPredictiveSettingDialog() |
|
92 { |
|
93 TRAP_IGNORE(RestoreStatusPaneL()); |
|
94 delete iSettingsData; |
|
95 |
|
96 delete iItemCloseEventCheck; |
|
97 iItemCloseEventCheck = NULL; |
|
98 if (iAknFepRepository) |
|
99 delete iAknFepRepository; |
|
100 |
|
101 delete iLastTitle; |
|
102 delete iStatusTitle; |
|
103 } |
|
104 |
|
105 |
|
106 SEikControlInfo CAknFepPredictiveSettingDialog::CreateCustomControlL(TInt /*aControlType*/) |
|
107 { |
|
108 |
|
109 // construct the data object the settings list will use |
|
110 iSettingsData = CAknFepPredictiveSettingData::NewL(); |
|
111 iAknFepRepository = CRepository::NewL(KCRUidAknFep); |
|
112 ReadSettingsDataL(); |
|
113 |
|
114 iSettingsList = CAknFepPredictiveSettingList::NewL(*iSettingsData, *this); |
|
115 |
|
116 SEikControlInfo controlInfo; |
|
117 controlInfo.iFlags = EEikControlHasEars; |
|
118 controlInfo.iTrailerTextId = 0; |
|
119 controlInfo.iControl = iSettingsList; |
|
120 STATIC_CAST(CAknFepPredictiveSettingList*, controlInfo.iControl)->SetContainerWindowL(*this); |
|
121 |
|
122 return controlInfo; |
|
123 } |
|
124 |
|
125 |
|
126 CAknFepPredictiveSettingDialog::TFormControlTypes CAknFepPredictiveSettingDialog::ConvertCustomControlTypeToBaseControlType(TInt /*aControlType*/) const |
|
127 { |
|
128 return EPopfieldDerived; |
|
129 } |
|
130 |
|
131 |
|
132 TBool CAknFepPredictiveSettingDialog::OkToExitL(TInt aButtonId) |
|
133 { |
|
134 TBool retValue = EFalse; |
|
135 switch(aButtonId) |
|
136 { |
|
137 case EAknSoftkeyBack: |
|
138 iSettingsList->StoreSettingsL(); |
|
139 SaveSettingsDataL(); |
|
140 retValue = ETrue; |
|
141 break; |
|
142 |
|
143 case EAknSoftkeyOptions: |
|
144 DisplayMenuL(); |
|
145 break; |
|
146 |
|
147 case EAknSoftkeyChange: |
|
148 EditItemL(EFalse); |
|
149 break; |
|
150 } |
|
151 return retValue; |
|
152 } |
|
153 |
|
154 void CAknFepPredictiveSettingDialog::ProcessCommandL(TInt aCommandId) |
|
155 { |
|
156 if(iSettingItemInEditingState && aCommandId == EAknCmdExit) |
|
157 { |
|
158 // If we are currently editing the settings item then generate a cancel event |
|
159 RWsSession& wsSession = CEikonEnv::Static()->WsSession(); |
|
160 TKeyEvent escapeEvent = {EKeyEscape, EStdKeyEscape, 0, 0}; |
|
161 TRAP_IGNORE(CEikonEnv::Static()->SimulateKeyEventL(escapeEvent, EEventKey)); |
|
162 wsSession.Flush(); |
|
163 // After generating cancel event, start the callback function so the settings |
|
164 // page is dismissed. |
|
165 iItemCloseEventCheck->Start( TCallBack(EventCheckCallback, this) ); |
|
166 return; |
|
167 } |
|
168 |
|
169 // This is TSW eror fixing. |
|
170 // This function is called by dialog framework, whenever menu item is |
|
171 // selected. we should have to hide existing display menu first to maitain the |
|
172 // control stack . |
|
173 // If user try to stop displaying menu after creating any control |
|
174 // In that situation whenever application goes to background framework remove the |
|
175 // control from the stack when try to remove the menubar from control stack. |
|
176 CAknDialog::ProcessCommandL(aCommandId); |
|
177 |
|
178 switch(aCommandId) |
|
179 { |
|
180 case EAknFepCmdPredSettingChange: |
|
181 EditItemL(ETrue); |
|
182 break; |
|
183 case EAknCmdHelp: |
|
184 { |
|
185 |
|
186 const TInt KArrayGranularity = 3; |
|
187 CArrayFix<TCoeHelpContext>* contexts = |
|
188 new (ELeave) CArrayFixFlat<TCoeHelpContext>( KArrayGranularity ); |
|
189 CleanupStack::PushL ( contexts ); |
|
190 TUid appuid = { 0x100058EC }; |
|
191 contexts->AppendL( TCoeHelpContext( appuid, KFEPIMPLPREDINPUT_HLP_INPUT ) ); |
|
192 CleanupStack::Pop( contexts ); |
|
193 HlpLauncher::LaunchHelpApplicationL( CEikonEnv::Static()->WsSession(), contexts ); |
|
194 } |
|
195 break; |
|
196 case EAknCmdExit: |
|
197 // Save the setting and exit application. |
|
198 iSettingsList->StoreSettingsL(); |
|
199 SaveSettingsDataL(); |
|
200 // Pass the EAknCmdExit command to Avkon |
|
201 // Framework |
|
202 iAvkonAppUi->ProcessCommandL(aCommandId); |
|
203 break; |
|
204 } |
|
205 } |
|
206 |
|
207 void CAknFepPredictiveSettingDialog::ReadSettingsDataL() |
|
208 { |
|
209 TInt autoWordCompl = 0; |
|
210 TInt typingCorrection = 0; |
|
211 TInt numberCandidates = 0; |
|
212 TInt primaryCandidate = 0; |
|
213 TInt physicalKeyboards = 0; |
|
214 // Read CenRep |
|
215 if( iAknFepRepository ) |
|
216 { |
|
217 iAknFepRepository->Get(KAknFepPredTxtFlagExtension, iPredictiveTextFlag); |
|
218 iAknFepRepository->Get(KAknFepAutoCompleteFlag, autoWordCompl); |
|
219 iAknFepRepository->Get(KAknFepTypingCorrectionLevel, typingCorrection); |
|
220 iAknFepRepository->Get(KAknFepNumberCandidateFlag, numberCandidates); |
|
221 iAknFepRepository->Get(KAknFepPrimaryCandidateFlag, primaryCandidate); |
|
222 iAknFepRepository->Get(KAknFepPhysicalKeyboards, physicalKeyboards); |
|
223 } |
|
224 |
|
225 // Parse keyboard dependent settings for current keyboard from bitmask |
|
226 TInt keyboardLayout = 0; |
|
227 RProperty::Get(KCRUidAvkon, KAknKeyBoardLayout, keyboardLayout); |
|
228 TPtiKeyboardType layout = (TPtiKeyboardType)keyboardLayout; |
|
229 TInt autoTmp = autoWordCompl; |
|
230 |
|
231 // This part of code for error fixing: |
|
232 // IF ITI is off for QWERTY/ITU-T iPredictiveTextFlag = 0 |
|
233 // IF ITI is on for ITU-T iPredictiveTextFlag = 1 |
|
234 // IF ITI is on for QWERTY iPredictiveTextFlag = 2 |
|
235 |
|
236 switch(layout) |
|
237 { |
|
238 case EPtiKeyboardNone: |
|
239 break; |
|
240 case EPtiKeyboard12Key: |
|
241 autoTmp &= EKeyboardStyle12Key; |
|
242 iPredictiveTextFlag &= EKeyboardStyle12Key; |
|
243 break; |
|
244 case EPtiKeyboardHalfQwerty: |
|
245 autoTmp &= EKeyboardStyleHalfQwerty; |
|
246 iPredictiveTextFlag &= EKeyboardStyleHalfQwerty; |
|
247 break; |
|
248 case EPtiKeyboardQwerty4x12: |
|
249 case EPtiKeyboardQwerty4x10: |
|
250 case EPtiKeyboardQwerty3x11: |
|
251 case EPtiKeyboardCustomQwerty: |
|
252 autoTmp &= EKeyboardStyleQwerty; |
|
253 iPredictiveTextFlag &= EKeyboardStyleQwerty; |
|
254 break; |
|
255 default: |
|
256 break; |
|
257 } |
|
258 |
|
259 //load setting data |
|
260 iSettingsData->LoadL(( autoTmp ? 1 : 0), typingCorrection, numberCandidates, |
|
261 primaryCandidate, physicalKeyboards, autoWordCompl); |
|
262 |
|
263 } |
|
264 |
|
265 |
|
266 void CAknFepPredictiveSettingDialog::SaveSettingsDataL() const |
|
267 { |
|
268 // Read setting data and fill CenRep. |
|
269 if( iAknFepRepository ) |
|
270 { |
|
271 TInt autoFlag = 0; |
|
272 iAknFepRepository->Get(KAknFepAutoCompleteFlag, autoFlag); |
|
273 TInt predFlag = 0; |
|
274 iAknFepRepository->Get(KAknFepPredTxtFlagExtension, predFlag); |
|
275 |
|
276 // Parse keyboard dependent settings for current keyboard from bitmask |
|
277 TInt keyboardLayout = 0; |
|
278 RProperty::Get(KCRUidAvkon, KAknKeyBoardLayout, keyboardLayout); |
|
279 TPtiKeyboardType layout = (TPtiKeyboardType)keyboardLayout; |
|
280 switch(layout) |
|
281 { |
|
282 case EPtiKeyboardNone: |
|
283 break; |
|
284 case EPtiKeyboard12Key: |
|
285 if (iSettingsData->AutoWordCompl()) |
|
286 { |
|
287 autoFlag |= EKeyboardStyle12Key; |
|
288 } |
|
289 else |
|
290 { |
|
291 autoFlag &= ~EKeyboardStyle12Key; |
|
292 } |
|
293 break; |
|
294 case EPtiKeyboardHalfQwerty: |
|
295 if (iSettingsData->AutoWordCompl()) |
|
296 { |
|
297 autoFlag |= EKeyboardStyleHalfQwerty; |
|
298 } |
|
299 else |
|
300 { |
|
301 autoFlag &= ~EKeyboardStyleHalfQwerty; |
|
302 } |
|
303 case EPtiKeyboardQwerty4x12: |
|
304 case EPtiKeyboardQwerty4x10: |
|
305 case EPtiKeyboardQwerty3x11: |
|
306 |
|
307 case EPtiKeyboardCustomQwerty: |
|
308 if (iSettingsData->AutoWordCompl()) |
|
309 { |
|
310 autoFlag |= EKeyboardStyleQwerty; |
|
311 } |
|
312 else |
|
313 { |
|
314 autoFlag &= ~EKeyboardStyleQwerty; |
|
315 } |
|
316 break; |
|
317 default: |
|
318 break; |
|
319 } |
|
320 |
|
321 if(iSettingsList->DeviceHasMultipleKeyboards()) |
|
322 { |
|
323 iAknFepRepository->Set(KAknFepAutoCompleteFlag, iSettingsData->AWCBitmask()); |
|
324 } |
|
325 else |
|
326 { |
|
327 iAknFepRepository->Set(KAknFepAutoCompleteFlag, autoFlag); |
|
328 } |
|
329 iAknFepRepository->Set(KAknFepTypingCorrectionLevel, iSettingsData->TypingCorrection()); |
|
330 iAknFepRepository->Set(KAknFepNumberCandidateFlag, iSettingsData->NumberCandidates()); |
|
331 iAknFepRepository->Set(KAknFepPrimaryCandidateFlag, iSettingsData->PrimaryCandidate()); |
|
332 } |
|
333 } |
|
334 |
|
335 void CAknFepPredictiveSettingDialog::SaveCurrentSettingsDataL() const |
|
336 { |
|
337 // Read setting data and fill CenRep. |
|
338 if(iAknFepRepository) |
|
339 { |
|
340 if(EAutoWordCompletion == iSettingsList->ListBox()->CurrentItemIndex()) |
|
341 { |
|
342 TInt autoFlag = 0; |
|
343 iAknFepRepository->Get(KAknFepAutoCompleteFlag, autoFlag); |
|
344 TInt predFlag = 0; |
|
345 iAknFepRepository->Get(KAknFepPredTxtFlagExtension, predFlag); |
|
346 |
|
347 // Parse keyboard dependent settings for current keyboard from bitmask |
|
348 TInt keyboardLayout = 0; |
|
349 RProperty::Get(KCRUidAvkon, KAknKeyBoardLayout, keyboardLayout); |
|
350 TPtiKeyboardType layout = (TPtiKeyboardType)keyboardLayout; |
|
351 switch(layout) |
|
352 { |
|
353 case EPtiKeyboardNone: |
|
354 break; |
|
355 case EPtiKeyboard12Key: |
|
356 if (iSettingsData->AutoWordCompl()) |
|
357 { |
|
358 autoFlag |= EKeyboardStyle12Key; |
|
359 } |
|
360 else |
|
361 { |
|
362 autoFlag &= ~EKeyboardStyle12Key; |
|
363 } |
|
364 break; |
|
365 case EPtiKeyboardHalfQwerty: |
|
366 if (iSettingsData->AutoWordCompl()) |
|
367 { |
|
368 autoFlag |= EKeyboardStyleHalfQwerty; |
|
369 } |
|
370 else |
|
371 { |
|
372 autoFlag &= ~EKeyboardStyleHalfQwerty; |
|
373 } |
|
374 break; |
|
375 case EPtiKeyboardQwerty4x12: |
|
376 case EPtiKeyboardQwerty4x10: |
|
377 case EPtiKeyboardQwerty3x11: |
|
378 case EPtiKeyboardCustomQwerty: |
|
379 if (iSettingsData->AutoWordCompl()) |
|
380 { |
|
381 autoFlag |= EKeyboardStyleQwerty; |
|
382 } |
|
383 else |
|
384 { |
|
385 autoFlag &= ~EKeyboardStyleQwerty; |
|
386 } |
|
387 break; |
|
388 default: |
|
389 break; |
|
390 } |
|
391 |
|
392 if(iSettingsList->DeviceHasMultipleKeyboards()) |
|
393 { |
|
394 iAknFepRepository->Set(KAknFepAutoCompleteFlag, iSettingsData->AWCBitmask()); |
|
395 } |
|
396 else |
|
397 { |
|
398 iAknFepRepository->Set(KAknFepAutoCompleteFlag, autoFlag); |
|
399 } |
|
400 } |
|
401 else if(ETypingCorrectionLevel == iSettingsList->ListBox()->CurrentItemIndex()) |
|
402 { |
|
403 iAknFepRepository->Set(KAknFepTypingCorrectionLevel, iSettingsData->TypingCorrection()); |
|
404 } |
|
405 else if(ENumberCandidate == iSettingsList->ListBox()->CurrentItemIndex()) |
|
406 { |
|
407 iAknFepRepository->Set(KAknFepNumberCandidateFlag, iSettingsData->NumberCandidates()); |
|
408 } |
|
409 else if(EPrimaryCandidate == iSettingsList->ListBox()->CurrentItemIndex()) |
|
410 { |
|
411 iAknFepRepository->Set(KAknFepPrimaryCandidateFlag, iSettingsData->PrimaryCandidate()); |
|
412 } |
|
413 } |
|
414 } |
|
415 |
|
416 |
|
417 void CAknFepPredictiveSettingDialog::EditItemL(TBool aCalledFromMenu) |
|
418 { |
|
419 TInt prevSettings = CurrentSettings(); |
|
420 |
|
421 // Set the flag as we are currently editing the settings item |
|
422 iSettingItemInEditingState = ETrue; |
|
423 |
|
424 iSettingsList->EditCurrentItemL(aCalledFromMenu); |
|
425 if(iSettingItemInEditingState == EFalse) |
|
426 { |
|
427 User::Leave(KErrNone); |
|
428 } |
|
429 LaunchPredictiveSettingOffQueryIfNecessaryL(prevSettings); |
|
430 SaveCurrentSettingsDataL(); |
|
431 |
|
432 //Reset the flag as the current item edit is over |
|
433 iSettingItemInEditingState = EFalse; |
|
434 } |
|
435 |
|
436 void CAknFepPredictiveSettingDialog::LaunchPredictiveSettingOffQueryIfNecessaryL(TInt prevSettings) |
|
437 { |
|
438 if(iPredictiveSettingOffQueryNotShown) |
|
439 { |
|
440 if(iAknFepRepository) |
|
441 { |
|
442 iAknFepRepository->Get(KAknFepPredTxtFlagExtension,iPredictiveTextFlag); |
|
443 } |
|
444 TInt keyboardLayout = 0; |
|
445 RProperty::Get(KCRUidAvkon, KAknKeyBoardLayout, keyboardLayout); |
|
446 TPtiKeyboardType layout = (TPtiKeyboardType)keyboardLayout; |
|
447 TBool QueryNeeded = EFalse; |
|
448 if(iSettingsList->DeviceHasMultipleKeyboards()) |
|
449 { |
|
450 TInt activateITIForKbd = 0; |
|
451 if(EAutoWordCompletion == iSettingsList->ListBox()->CurrentItemIndex() && |
|
452 iSettingsData->AWCBitmask() != prevSettings & 0xF) |
|
453 { |
|
454 // if AWC is ON and Prev.Settings of AWC is not ON and ITI is OFF |
|
455 if((iSettingsData->AWCBitmask() & EKeyboardStyle12Key) && |
|
456 ((prevSettings & 0xF) & EKeyboardStyle12Key)!=1 && |
|
457 (iPredictiveTextFlag & EKeyboardStyle12Key) == 0) |
|
458 { |
|
459 QueryNeeded = ETrue; |
|
460 activateITIForKbd |= EKeyboardStyle12Key ; |
|
461 if(layout == EPtiKeyboard12Key) |
|
462 iPredictiveSettingOffQueryNotShown = EFalse; |
|
463 } |
|
464 // if AWC is ON and Prev.Settings of AWC is not ON and ITI is OFF |
|
465 if((iSettingsData->AWCBitmask() & EKeyboardStyleQwerty) && |
|
466 ((prevSettings & 0xF) & EKeyboardStyleQwerty)!=2 && |
|
467 (iPredictiveTextFlag & EKeyboardStyleQwerty) == 0) |
|
468 { |
|
469 QueryNeeded = ETrue; |
|
470 activateITIForKbd |= EKeyboardStyleQwerty ; |
|
471 if(layout == EKeyboardStyleQwerty) |
|
472 iPredictiveSettingOffQueryNotShown = EFalse; |
|
473 } |
|
474 if((iSettingsData->AWCBitmask() & EKeyboardStyleHalfQwerty) && |
|
475 ((prevSettings & 0xF) & EKeyboardStyleHalfQwerty)!=4 && |
|
476 (iPredictiveTextFlag & EKeyboardStyleHalfQwerty) == 0) |
|
477 { |
|
478 QueryNeeded = ETrue; |
|
479 activateITIForKbd |= EKeyboardStyleHalfQwerty ; |
|
480 if(layout == EKeyboardStyleHalfQwerty) |
|
481 iPredictiveSettingOffQueryNotShown = EFalse; |
|
482 } |
|
483 } |
|
484 // if Prev.Setting of TypingCorrection != Curr.Settng of TypingCorrection and |
|
485 // Current TypingCorrection != OFF and ITI is OFF |
|
486 else if(iSettingsData->iTypingCorrection != ((prevSettings >> 4)&0xF) && |
|
487 ETypingCorrectionLevel == iSettingsList->ListBox()->CurrentItemIndex() && |
|
488 0 != iSettingsData->TypingCorrection() && |
|
489 (iPredictiveTextFlag & EKeyboardStyleQwerty) == 0) |
|
490 { |
|
491 QueryNeeded = ETrue; |
|
492 iPredictiveSettingOffQueryNotShown = EFalse; |
|
493 activateITIForKbd |= EKeyboardStyleQwerty ; |
|
494 } |
|
495 // if Prev.Setting of NumberCandidate != Curr.Settng of NumberCandidate and |
|
496 // Current NumberCandidate is ON and ITI is OFF |
|
497 else if(iSettingsData->iNumberCandidates != ((prevSettings >> 8)&0xF) && |
|
498 ENumberCandidate == iSettingsList->ListBox()->CurrentItemIndex() && |
|
499 1 == iSettingsData->NumberCandidates() && |
|
500 (iPredictiveTextFlag & EKeyboardStyleQwerty) == 0) |
|
501 { |
|
502 QueryNeeded = ETrue; |
|
503 iPredictiveSettingOffQueryNotShown = EFalse; |
|
504 activateITIForKbd |= EKeyboardStyleQwerty ; |
|
505 } |
|
506 |
|
507 if(QueryNeeded) |
|
508 { |
|
509 CAknQueryDialog* dlg = CAknQueryDialog::NewL(); |
|
510 if(dlg->ExecuteLD(iConfirmationQueryResId)) |
|
511 { |
|
512 if(activateITIForKbd & EKeyboardStyle12Key) |
|
513 { |
|
514 iPredictiveTextFlag |= EKeyboardStyle12Key; |
|
515 } |
|
516 |
|
517 if(activateITIForKbd & EKeyboardStyleQwerty) |
|
518 { |
|
519 iPredictiveTextFlag |= EKeyboardStyleQwerty; |
|
520 } |
|
521 if(activateITIForKbd & EKeyboardStyleHalfQwerty) |
|
522 { |
|
523 iPredictiveTextFlag |= EKeyboardStyleHalfQwerty; |
|
524 } |
|
525 } |
|
526 } |
|
527 } |
|
528 else |
|
529 { |
|
530 TInt predFlag = 0; |
|
531 iAknFepRepository->Get(KAknFepPredTxtFlagExtension, predFlag); |
|
532 TInt autoFlag = 0; |
|
533 iAknFepRepository->Get(KAknFepAutoCompleteFlag, autoFlag); |
|
534 |
|
535 switch(layout) |
|
536 { |
|
537 case EPtiKeyboardNone: |
|
538 break; |
|
539 case EPtiKeyboard12Key: |
|
540 autoFlag = ((autoFlag & EPtiKeyboard12Key)!=0); |
|
541 // if ITI is ON for QWERTY then iPredictiveTextFlag = 2; In that case we have to find out the ITI state for ITU-T |
|
542 if (!( iPredictiveTextFlag & EKeyboardStyle12Key )) |
|
543 { |
|
544 predFlag |= EKeyboardStyle12Key; |
|
545 } |
|
546 |
|
547 break; |
|
548 case EPtiKeyboardHalfQwerty: |
|
549 autoFlag = ((autoFlag & EKeyboardStyleHalfQwerty)!=0); |
|
550 if (!(iPredictiveTextFlag & EKeyboardStyleHalfQwerty )) |
|
551 { |
|
552 predFlag |= EKeyboardStyleHalfQwerty; |
|
553 } |
|
554 break; |
|
555 case EPtiKeyboardQwerty4x12: |
|
556 case EPtiKeyboardQwerty4x10: |
|
557 case EPtiKeyboardQwerty3x11: |
|
558 case EPtiKeyboardCustomQwerty: |
|
559 autoFlag = ((autoFlag & EKeyboardStyleQwerty)!=0); |
|
560 // if ITI is ON for ITU-T then iPredictiveTextFlag = 1; In that case we have to find out the ITI state for QWERTY |
|
561 if (!(iPredictiveTextFlag & EKeyboardStyleQwerty )) |
|
562 { |
|
563 predFlag |= EKeyboardStyleQwerty; |
|
564 } |
|
565 break; |
|
566 default: |
|
567 break; |
|
568 } |
|
569 |
|
570 |
|
571 if (predFlag != iPredictiveTextFlag) |
|
572 { |
|
573 switch(iSettingsList->ListBox()->CurrentItemIndex()) |
|
574 { |
|
575 case EAutoWordCompletion: |
|
576 if(iSettingsData->iAutoWordCompl != autoFlag && |
|
577 1 == iSettingsData->AutoWordCompl()) |
|
578 { |
|
579 QueryNeeded = ETrue; |
|
580 } |
|
581 break; |
|
582 case ETypingCorrectionLevel: |
|
583 if(iSettingsData->iTypingCorrection != ((prevSettings >> 4)&0xF) && |
|
584 0 != iSettingsData->TypingCorrection()) |
|
585 { |
|
586 QueryNeeded = ETrue; |
|
587 } |
|
588 break; |
|
589 case ENumberCandidate: |
|
590 if(iSettingsData->iNumberCandidates != ((prevSettings >> 8)&0xF) && |
|
591 0 != iSettingsData->NumberCandidates()) |
|
592 { |
|
593 QueryNeeded = ETrue; |
|
594 } |
|
595 break; |
|
596 } |
|
597 |
|
598 if(QueryNeeded) |
|
599 { |
|
600 CAknQueryDialog* dlg = CAknQueryDialog::NewL(); |
|
601 if(dlg->ExecuteLD(iConfirmationQueryResId)) |
|
602 iPredictiveTextFlag = predFlag; |
|
603 |
|
604 iPredictiveSettingOffQueryNotShown = EFalse; |
|
605 } |
|
606 } |
|
607 } |
|
608 if(iAknFepRepository && QueryNeeded) |
|
609 { |
|
610 iAknFepRepository->Set(KAknFepPredTxtFlagExtension,iPredictiveTextFlag); |
|
611 iAknFepRepository->Set(KAknFepPredTxtFlag, iPredictiveTextFlag != 0); // For backwards compatibility |
|
612 } |
|
613 } |
|
614 } |
|
615 TInt CAknFepPredictiveSettingDialog::CurrentSettings() |
|
616 { |
|
617 TInt settings = 0; |
|
618 //settings are the values of first 16 bits |
|
619 // settings & 0xF = iAWCBitmask |
|
620 // (settings >> 4) & 0xF = iNumberCandidates |
|
621 // (settings >> 8) & 0xF = iTypingCorrection |
|
622 // (settings >> 12) & 0xF = iPrimaryCandidate |
|
623 settings = (iSettingsData->iPrimaryCandidate << 12) | |
|
624 (iSettingsData->iNumberCandidates << 8) | |
|
625 (iSettingsData->iTypingCorrection << 4) | |
|
626 (iSettingsData->AWCBitmask()); |
|
627 return settings; |
|
628 } |
|
629 |
|
630 // This part of code for error fixing multiple layout. |
|
631 void CAknFepPredictiveSettingDialog::HandleResourceChange(TInt aType) |
|
632 { |
|
633 |
|
634 CAknDialog::HandleResourceChange(aType); |
|
635 |
|
636 // Check for keyboard layout change |
|
637 // If layout is changed, load the setting information based on |
|
638 // Layout. |
|
639 if(aType==KEikDynamicLayoutVariantSwitch) |
|
640 { |
|
641 |
|
642 // Read the Predictive setting |
|
643 if(iAknFepRepository) |
|
644 { |
|
645 iAknFepRepository->Get(KAknFepPredTxtFlagExtension, iPredictiveTextFlag); |
|
646 } |
|
647 |
|
648 // Adjust predictive flag after layout switch |
|
649 TInt keyboardLayout = EPtiKeyboardNone; |
|
650 RProperty::Get(KCRUidAvkon, KAknKeyBoardLayout, keyboardLayout); |
|
651 //settings page not to be retained on change of keyboard layout for Touch Input. |
|
652 #ifdef __ITI_VIRTUAL_TOUCH_FIRST_GENERATION_SUPPORT__ |
|
653 if (iOriginalKeyboardLayout != keyboardLayout) |
|
654 { |
|
655 if(iSettingItemInEditingState) |
|
656 { |
|
657 // If we are currently editing the settings item then generate a cancel event |
|
658 // and start the scheduler so as to close the settings page |
|
659 // when the blocking call completes. |
|
660 RWsSession& wsSession = CEikonEnv::Static()->WsSession(); |
|
661 TKeyEvent escapeEvent = {EKeyEscape, EStdKeyEscape, 0, 0}; |
|
662 TRAP_IGNORE(CEikonEnv::Static()->SimulateKeyEventL(escapeEvent, EEventKey)); |
|
663 wsSession.Flush(); |
|
664 iItemCloseEventCheck->Start( TCallBack(EventCheckCallback, this) ); |
|
665 } |
|
666 else |
|
667 { |
|
668 // In case the current settings item is not in editing state then directly |
|
669 // close the settings page. |
|
670 TRAP_IGNORE(TryExitL(EAknSoftkeyBack)); |
|
671 } |
|
672 return; |
|
673 } |
|
674 #endif //__ITI_VIRTUAL_TOUCH_FIRST_GENERATION_SUPPORT__ |
|
675 switch(keyboardLayout) |
|
676 { |
|
677 case EPtiKeyboard12Key: |
|
678 // Dictionary is ON for ITU-T |
|
679 iPredictiveTextFlag &= EKeyboardStyle12Key; |
|
680 break; |
|
681 case EPtiKeyboardQwerty4x12: |
|
682 case EPtiKeyboardQwerty4x10: |
|
683 case EPtiKeyboardQwerty3x11: |
|
684 case EPtiKeyboardHalfQwerty: |
|
685 case EPtiKeyboardCustomQwerty: |
|
686 // // Dictionary is ON for QWERTY |
|
687 iPredictiveTextFlag &= EKeyboardStyleQwerty; |
|
688 case EPtiKeyboardNone: |
|
689 default: |
|
690 break; |
|
691 } |
|
692 TRAP_IGNORE(SetTitlePaneL()); |
|
693 } |
|
694 } |
|
695 |
|
696 TInt CAknFepPredictiveSettingDialog::EventCheckCallback(TAny* aObj) |
|
697 { |
|
698 TRAP_IGNORE(static_cast<CAknFepPredictiveSettingDialog*>(aObj)->AttemptToExitL()); |
|
699 return KErrNone; |
|
700 } |
|
701 |
|
702 void CAknFepPredictiveSettingDialog::AttemptToExitL() |
|
703 { |
|
704 if(iItemCloseEventCheck->IsActive()) |
|
705 { |
|
706 iItemCloseEventCheck->Cancel(); |
|
707 } |
|
708 // iSettingItemInEditingState sets before the blocking call of editing item state and |
|
709 // gets reset after the blocking call. |
|
710 if (!iSettingItemInEditingState) |
|
711 { |
|
712 // In case we are here, then we need to close the settings item because of layout change |
|
713 TRAP_IGNORE(TryExitL(EAknSoftkeyBack)); |
|
714 } |
|
715 else |
|
716 { |
|
717 // Because of priority we hit the scheduler first and then the blocking call gets |
|
718 // executed. To handle such a scenario, restart the scheduler. |
|
719 iItemCloseEventCheck->Start( TCallBack(EventCheckCallback, this) ); |
|
720 } |
|
721 } |
|
722 |
|
723 void CAknFepPredictiveSettingDialog::PrepareStatusPaneL() |
|
724 { |
|
725 CCoeEnv* coeEnv = CCoeEnv::Static(); |
|
726 CAknAppUi* appUi = static_cast<CAknAppUi*>(coeEnv->AppUi()); |
|
727 CEikStatusPane* statusPane = appUi->StatusPane(); |
|
728 |
|
729 iTitlePane = static_cast<CAknTitlePane*>( statusPane->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) ); |
|
730 |
|
731 const TDesC* appTitle = iTitlePane->Text(); |
|
732 iLastTitle = appTitle->AllocL(); |
|
733 CleanupStack::PushL(iLastTitle); |
|
734 |
|
735 iStatusTitle = StringLoader::LoadLC( iTitlePaneResId,coeEnv); |
|
736 SetTitlePaneL(); |
|
737 CleanupStack::Pop(iStatusTitle); |
|
738 CleanupStack::Pop(iLastTitle); |
|
739 |
|
740 iNaviPane = static_cast<CAknNavigationControlContainer*>(statusPane->ControlL( TUid::Uid( EEikStatusPaneUidNavi ) ) ); |
|
741 |
|
742 if(iNaviPane) |
|
743 { |
|
744 // Create a new tab Groub for Settings Page and push it on the Navigation Pane |
|
745 // This is done so as to avoid previous page Tab Group to be used |
|
746 iNaviDecoratedTabGroup = iNaviPane->CreateTabGroupL(); |
|
747 if(iNaviDecoratedTabGroup) |
|
748 { |
|
749 // Tab Group visibility is set to false |
|
750 iNaviDecoratedTabGroup->MakeVisible(EFalse); |
|
751 iNaviPane->PushL(*iNaviDecoratedTabGroup); |
|
752 } |
|
753 } |
|
754 } |
|
755 |
|
756 void CAknFepPredictiveSettingDialog::SetTitlePaneL() |
|
757 { |
|
758 iTitlePane->SetTextL( *iStatusTitle ); |
|
759 } |
|
760 |
|
761 void CAknFepPredictiveSettingDialog::RestoreStatusPaneL() |
|
762 { |
|
763 iTitlePane->SetTextL( *iLastTitle ); |
|
764 |
|
765 if(iNaviPane && iNaviDecoratedTabGroup) |
|
766 { |
|
767 // Pop the Tab Group created for the Settings page |
|
768 iNaviPane->Pop(); |
|
769 delete iNaviDecoratedTabGroup; |
|
770 iNaviDecoratedTabGroup = NULL; |
|
771 } |
|
772 } |
|
773 |
|
774 void CAknFepPredictiveSettingDialog::HandlePointerEventL(const TPointerEvent& aPointerEvent) |
|
775 { |
|
776 if ( aPointerEvent.iType == TPointerEvent::EDrag ) |
|
777 { |
|
778 iSettingsList->HandlePointerEventL(aPointerEvent); |
|
779 } |
|
780 else |
|
781 { |
|
782 CAknDialog::HandlePointerEventL(aPointerEvent); |
|
783 } |
|
784 } |
|
785 |
|
786 /** |
|
787 *From MEikCommandObserver |
|
788 */ |
|
789 void CAknFepPredictiveSettingDialog::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane) |
|
790 { |
|
791 if ( iAvkonAppUi->IsSingleClickCompatible() ) |
|
792 { |
|
793 if ( R_PREDICTIVESETTINGDIALOG_MENU == aResourceId ) |
|
794 { |
|
795 aMenuPane->SetItemDimmed(EAknFepCmdPredSettingChange, ETrue); |
|
796 } |
|
797 } |
|
798 } |
|