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