|
1 /* |
|
2 * Copyright (c) 2002-2005 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0"" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: dialog for gspeninputimple |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <e32base.h> |
|
20 #include <aknsettingitemlist.h> |
|
21 #include <AknColourSelectionGrid.h> |
|
22 #include <aknradiobuttonsettingpage.h> |
|
23 #include <gdi.h> |
|
24 #include <AknUtils.h> |
|
25 #include <avkon.rsg> |
|
26 #include <avkon.hrh> |
|
27 #include <gspeninputpluginrsc.rsg> |
|
28 #include <StringLoader.h> |
|
29 #include <gscommon.hrh> |
|
30 #include <aknlayoutscalable_avkon.cdl.h> |
|
31 #include <avkon.mbg> |
|
32 #include <AknsDrawUtils.h> |
|
33 #include <AknsFrameBackgroundControlContext.h> |
|
34 #include <skinlayout.cdl.h> |
|
35 #include <aknconsts.h> |
|
36 #include <aknslider.h> |
|
37 #include <settingsinternalcrkeys.h> |
|
38 #include <AknFepInternalCRKeys.h> |
|
39 #include <aknappui.h> |
|
40 #include <hlplch.h> // HlpLauncher |
|
41 #include <peninputpluginutils.h> |
|
42 //#include <csxhelp\cp.hlp.hrh> |
|
43 #include <gsfwviewuids.h> |
|
44 #include <AknNullService.h> |
|
45 |
|
46 using namespace SkinLayout; |
|
47 |
|
48 #include "gspeninputplugin.hrh" |
|
49 #include "gssettingdialog.h" |
|
50 #include "gspeninputimple.h" |
|
51 #include "gspeninputmodel.h" |
|
52 |
|
53 _LIT(KSingleSpaceText, " "); |
|
54 |
|
55 const TUid KUidCalibrationApp = { 0x102828BC }; |
|
56 |
|
57 |
|
58 // ======== MEMBER FUNCTIONS ======== |
|
59 |
|
60 // --------------------------------------------------------- |
|
61 // Constructor |
|
62 // --------------------------------------------------------- |
|
63 // |
|
64 CGSColorSettingItem::CGSColorSettingItem(const TInt aIdentifier, |
|
65 CGSPenInputImple* aImple) |
|
66 :CAknSettingItem(aIdentifier), iImple(aImple) |
|
67 { |
|
68 } |
|
69 |
|
70 // --------------------------------------------------------- |
|
71 // Destructor |
|
72 // --------------------------------------------------------- |
|
73 // |
|
74 CGSColorSettingItem::~CGSColorSettingItem() |
|
75 { |
|
76 } |
|
77 |
|
78 // --------------------------------------------------------- |
|
79 // This launches the setting page |
|
80 // --------------------------------------------------------- |
|
81 // |
|
82 void CGSColorSettingItem::EditItemL(TBool /*aCalledFromMenu*/) |
|
83 { |
|
84 if (iImple->ShowTrailColourPageL()) |
|
85 { |
|
86 UpdateListBoxTextL(); |
|
87 } |
|
88 } |
|
89 |
|
90 // --------------------------------------------------------- |
|
91 // This method obtains the current value's setting text |
|
92 // --------------------------------------------------------- |
|
93 // |
|
94 const TDesC& CGSColorSettingItem::SettingTextL() |
|
95 { |
|
96 return KSingleSpaceText; |
|
97 } |
|
98 |
|
99 // --------------------------------------------------------- |
|
100 // Method to obtain a new bitmap for the setting content |
|
101 // --------------------------------------------------------- |
|
102 // |
|
103 CFbsBitmap* CGSColorSettingItem::CreateBitmapL() |
|
104 { |
|
105 TRect origin; |
|
106 |
|
107 AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, origin); |
|
108 |
|
109 TAknLayoutRect layoutRect; |
|
110 |
|
111 layoutRect.LayoutRect(origin, |
|
112 AknLayoutScalable_Avkon::listscroll_gen_pane(0)); |
|
113 layoutRect.LayoutRect(layoutRect.Rect(), |
|
114 AknLayoutScalable_Avkon::list_gen_pane(0)); |
|
115 layoutRect.LayoutRect(layoutRect.Rect(), |
|
116 AknLayoutScalable_Avkon::list_setting_number_pane(0)); |
|
117 layoutRect.LayoutRect(layoutRect.Rect(), |
|
118 AknLayoutScalable_Avkon::set_value_pane(0)); |
|
119 |
|
120 TRect mainRect(layoutRect.Rect()); |
|
121 |
|
122 // Move to 0,0 |
|
123 mainRect.Move(-mainRect.iTl.iX, -mainRect.iTl.iY); |
|
124 |
|
125 CFbsBitmap* bitmap = new (ELeave) CFbsBitmap; |
|
126 CleanupStack::PushL(bitmap); |
|
127 |
|
128 bitmap->Create(mainRect.Size(), CCoeEnv::Static()->ScreenDevice()->DisplayMode()); |
|
129 |
|
130 CFbsBitGc* fbsBitGc = CFbsBitGc::NewL(); |
|
131 CleanupStack::PushL(fbsBitGc); |
|
132 |
|
133 CFbsBitmapDevice* bmpDevice = CFbsBitmapDevice::NewL(bitmap); |
|
134 CleanupStack::PushL(bmpDevice); |
|
135 |
|
136 fbsBitGc->Activate(bmpDevice); |
|
137 |
|
138 TRect outerRect; |
|
139 TRect innerRect; |
|
140 TAknLayoutRect backGrandRect; |
|
141 |
|
142 backGrandRect.LayoutRect(origin, |
|
143 AknLayoutScalable_Avkon::listscroll_gen_pane(0)); |
|
144 backGrandRect.LayoutRect(backGrandRect.Rect(), |
|
145 AknLayoutScalable_Avkon::list_gen_pane(0)); |
|
146 backGrandRect.LayoutRect(backGrandRect.Rect(), |
|
147 AknLayoutScalable_Avkon::list_setting_number_pane(0)); |
|
148 |
|
149 TRect listSettingPaneRect(backGrandRect.Rect()); |
|
150 |
|
151 // Background skinning |
|
152 TAknLayoutRect topLeft; |
|
153 TAknLayoutRect bottomRight; |
|
154 |
|
155 topLeft.LayoutRect(listSettingPaneRect, |
|
156 Setting_list_item_skin_elements__value_background__Line_2()); |
|
157 bottomRight.LayoutRect(listSettingPaneRect, |
|
158 Setting_list_item_skin_elements__value_background__Line_5()); |
|
159 |
|
160 // Move to 0,0 |
|
161 TRect topLeftRect = topLeft.Rect(); |
|
162 TRect bottomRightRect = bottomRight.Rect(); |
|
163 |
|
164 TPoint skinOffset(-topLeftRect.iTl.iX, -topLeftRect.iTl.iY); |
|
165 bottomRightRect.Move(skinOffset); |
|
166 topLeftRect.Move(skinOffset); |
|
167 |
|
168 outerRect = TRect(topLeftRect.iTl, bottomRightRect.iBr); |
|
169 innerRect = TRect(topLeftRect.iBr, bottomRightRect.iTl); |
|
170 |
|
171 // Frame IID for qsn_fr_set_opt_foc_xxxxx |
|
172 const TAknsItemID *frameId = &KAknsIIDQsnFrSetOptFoc; |
|
173 |
|
174 // Make a control context: |
|
175 CAknsFrameBackgroundControlContext* cc = CAknsFrameBackgroundControlContext::NewL( |
|
176 *frameId, outerRect, innerRect, EFalse); |
|
177 CleanupStack::PushL(cc); |
|
178 |
|
179 TPoint dstPos(0, 0); |
|
180 |
|
181 AknsDrawUtils::DrawBackground(AknsUtils::SkinInstance(), |
|
182 cc, NULL, *fbsBitGc, dstPos, |
|
183 outerRect, KAknsDrawParamDefault); |
|
184 |
|
185 fbsBitGc->SetPenColor(TRgb(iImple->Model()->TrailColour())); |
|
186 fbsBitGc->SetPenStyle(CGraphicsContext::ESolidPen); |
|
187 fbsBitGc->SetBrushColor(iImple->Model()->TrailColour()); |
|
188 fbsBitGc->SetBrushStyle(CGraphicsContext::ESolidBrush); |
|
189 |
|
190 const TInt clolorWidth = outerRect.Width() / 3; |
|
191 const TInt clolorHight = (outerRect.Height() * 2) / 3; |
|
192 |
|
193 dstPos.iX = (outerRect.Width() / 2) - (clolorWidth / 2); |
|
194 dstPos.iY = (outerRect.Height() / 2) - (clolorHight / 2); |
|
195 |
|
196 fbsBitGc->DrawRect(TRect(dstPos.iX, |
|
197 dstPos.iY, |
|
198 dstPos.iX + clolorWidth, |
|
199 dstPos.iY + clolorHight)); |
|
200 |
|
201 CleanupStack::PopAndDestroy(cc); |
|
202 CleanupStack::PopAndDestroy(bmpDevice); |
|
203 CleanupStack::PopAndDestroy(fbsBitGc); |
|
204 CleanupStack::Pop(bitmap); |
|
205 |
|
206 CreateMaskL(); |
|
207 |
|
208 return bitmap; |
|
209 } |
|
210 |
|
211 // --------------------------------------------------------- |
|
212 // Create a mask for item mask |
|
213 // --------------------------------------------------------- |
|
214 // |
|
215 void CGSColorSettingItem::CreateMaskL() |
|
216 { |
|
217 TRect origin; |
|
218 AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, origin); |
|
219 |
|
220 TAknLayoutRect layoutRect; |
|
221 layoutRect.LayoutRect(origin, |
|
222 AknLayoutScalable_Avkon::listscroll_gen_pane(0)); |
|
223 layoutRect.LayoutRect(layoutRect.Rect(), |
|
224 AknLayoutScalable_Avkon::list_gen_pane(0)); |
|
225 layoutRect.LayoutRect(layoutRect.Rect(), |
|
226 AknLayoutScalable_Avkon::list_setting_number_pane(0)); |
|
227 layoutRect.LayoutRect(layoutRect.Rect(), |
|
228 AknLayoutScalable_Avkon::set_value_pane(0)); |
|
229 TRect mainRect(layoutRect.Rect()); |
|
230 |
|
231 // Move to 0,0 |
|
232 mainRect.Move(-mainRect.iTl.iX,-mainRect.iTl.iY); |
|
233 |
|
234 TRect outerRect; |
|
235 TRect innerRect; |
|
236 |
|
237 TAknLayoutRect backGrandRect; |
|
238 backGrandRect.LayoutRect(origin, |
|
239 AknLayoutScalable_Avkon::listscroll_gen_pane(0)); |
|
240 backGrandRect.LayoutRect(backGrandRect.Rect(), |
|
241 AknLayoutScalable_Avkon::list_gen_pane(0)); |
|
242 backGrandRect.LayoutRect(backGrandRect.Rect(), |
|
243 AknLayoutScalable_Avkon::list_setting_number_pane(0)); |
|
244 TRect listSettingPaneRect(backGrandRect.Rect()); |
|
245 |
|
246 |
|
247 TAknLayoutRect topLeft; |
|
248 TAknLayoutRect bottomRight; |
|
249 |
|
250 topLeft.LayoutRect(listSettingPaneRect, |
|
251 Setting_list_item_skin_elements__value_background__Line_2()); |
|
252 bottomRight.LayoutRect(listSettingPaneRect, |
|
253 Setting_list_item_skin_elements__value_background__Line_5()); |
|
254 |
|
255 // Move to 0,0 |
|
256 TRect topLeftRect = topLeft.Rect(); |
|
257 TRect bottomRightRect = bottomRight.Rect(); |
|
258 |
|
259 TPoint skinOffset(-topLeftRect.iTl.iX, -topLeftRect.iTl.iY); |
|
260 bottomRightRect.Move(skinOffset); |
|
261 topLeftRect.Move(skinOffset); |
|
262 |
|
263 outerRect = TRect(topLeftRect.iTl, bottomRightRect.iBr); |
|
264 innerRect = TRect(topLeftRect.iBr, bottomRightRect.iTl); |
|
265 |
|
266 CFbsBitmap* mask = new (ELeave) CFbsBitmap; |
|
267 CleanupStack::PushL(mask); |
|
268 |
|
269 mask->Create(mainRect.Size(), EGray256); |
|
270 CFbsBitGc* fbsBitGc = CFbsBitGc::NewL(); |
|
271 CleanupStack::PushL(fbsBitGc); |
|
272 CFbsBitmapDevice* bmpDevice = CFbsBitmapDevice::NewL(mask); |
|
273 CleanupStack::PushL(bmpDevice); |
|
274 fbsBitGc->Activate(bmpDevice); |
|
275 fbsBitGc->SetPenStyle(CGraphicsContext::ENullPen); |
|
276 fbsBitGc->SetBrushStyle(CGraphicsContext::ESolidBrush); |
|
277 fbsBitGc->SetBrushColor(KRgbWhite); |
|
278 fbsBitGc->DrawRect(TRect(mainRect.Size())); |
|
279 |
|
280 AknsDrawUtils::DrawFrame(AknsUtils::SkinInstance(), *fbsBitGc, outerRect, |
|
281 innerRect, KAknsIIDQsnFrSetOptFoc, |
|
282 KAknsIIDQsnFrSetOptFocCenter, KAknsSDMAlphaOnly); |
|
283 |
|
284 CleanupStack::PopAndDestroy(bmpDevice); |
|
285 CleanupStack::PopAndDestroy(fbsBitGc); |
|
286 |
|
287 if (SetIconMask(mask)) |
|
288 { |
|
289 CleanupStack::Pop(mask); |
|
290 } |
|
291 else |
|
292 { |
|
293 CleanupStack::PopAndDestroy(mask); |
|
294 } |
|
295 } |
|
296 |
|
297 // --------------------------------------------------------- |
|
298 // Constructor |
|
299 // --------------------------------------------------------- |
|
300 // |
|
301 CGSTextSettingItem::CGSTextSettingItem(TInt aItemResourceId, |
|
302 TDes &aText, |
|
303 CGSPenInputImple* aImple, |
|
304 CGSSettingItemList* aParent) |
|
305 :CAknTextSettingItem(aItemResourceId, aText), |
|
306 iImple(aImple), |
|
307 iItemId(aItemResourceId), |
|
308 iSettingList(aParent) |
|
309 { |
|
310 } |
|
311 |
|
312 // --------------------------------------------------------- |
|
313 // Destructor |
|
314 // --------------------------------------------------------- |
|
315 // |
|
316 CGSTextSettingItem::~CGSTextSettingItem() |
|
317 { |
|
318 iInputChineseFindMethod.Close(); |
|
319 } |
|
320 |
|
321 // --------------------------------------------------------- |
|
322 // This method obtains the current value's setting text |
|
323 // --------------------------------------------------------- |
|
324 // |
|
325 const TDesC& CGSTextSettingItem::SettingTextL() |
|
326 { |
|
327 switch ( iItemId ) |
|
328 { |
|
329 /*case EGSInputpenIdHwrTraining: |
|
330 { |
|
331 TBuf<10> buf; |
|
332 buf.Append(_L("trui")); |
|
333 return buf; |
|
334 }*/ |
|
335 case EGSInputpenIdInputLanguage: |
|
336 { |
|
337 iImple->Model()->InputLanguage(iInputLanguage); |
|
338 return iInputLanguage; |
|
339 } |
|
340 case EGSDefaultChineseOnscreenKeyboard: |
|
341 { |
|
342 iImple->InputModeL(iInputMode); |
|
343 return iInputMode; |
|
344 } |
|
345 case EGSInputpenIdWritingSpeed: |
|
346 { |
|
347 iImple->WritingSpeed(iWritingSpeed); |
|
348 return iWritingSpeed; |
|
349 } |
|
350 case EGSInputpenIdGuidLine: |
|
351 { |
|
352 iImple->GuideLine(iGuideLine); |
|
353 return iGuideLine; |
|
354 } |
|
355 case EGSInputpenIdRecognitionWithDictionary: |
|
356 { |
|
357 iImple->RecognitionWithDictionary(iRecognitionWithDictionary); |
|
358 return iRecognitionWithDictionary; |
|
359 } |
|
360 case EGSInputpenIdPenTrailWidth: |
|
361 { |
|
362 iImple->TrailWidth(iTrailWidth); |
|
363 return iTrailWidth; |
|
364 } |
|
365 case EGSInputpenIdInputMethodForFind: |
|
366 { |
|
367 iImple->InputMethodForFind(iInputMethodForFind); |
|
368 return iInputMethodForFind; |
|
369 } |
|
370 case EGSInputpenIdChineseFindMethod: |
|
371 { |
|
372 if ( !iInputChineseFindMethod.MaxLength() ) |
|
373 { |
|
374 iInputChineseFindMethod.CreateL( KItemTextSize ); |
|
375 } |
|
376 iImple->GetCurrentChineseFineMethodItem(iInputChineseFindMethod); |
|
377 return iInputChineseFindMethod; |
|
378 } |
|
379 } |
|
380 |
|
381 return KSingleSpaceText; |
|
382 } |
|
383 |
|
384 // --------------------------------------------------------- |
|
385 // This launches the setting page |
|
386 // --------------------------------------------------------- |
|
387 // |
|
388 void CGSTextSettingItem::EditItemL(TBool /*aCalledFromMenu*/) |
|
389 { |
|
390 switch(iItemId) |
|
391 { |
|
392 case EGSInputpenIdInputLanguage: |
|
393 { |
|
394 if (iImple->ShowInputLanguageSettingPageL()) |
|
395 { |
|
396 //iSettingList->ResetSettingListL(); |
|
397 UpdateListBoxTextL(); |
|
398 } |
|
399 } |
|
400 break; |
|
401 case EGSDefaultChineseOnscreenKeyboard: |
|
402 { |
|
403 if (iImple->ShowInputModePageL()) |
|
404 { |
|
405 UpdateListBoxTextL(); |
|
406 } |
|
407 } |
|
408 break; |
|
409 case EGSInputpenIdWritingSpeed: |
|
410 { |
|
411 if (iImple->ShowWritingSpeedPageL()) |
|
412 { |
|
413 UpdateListBoxTextL(); |
|
414 } |
|
415 } |
|
416 break; |
|
417 case EGSInputpenIdGuidLine: |
|
418 { |
|
419 if (iImple->ShowGuideLinePageL()) |
|
420 { |
|
421 UpdateListBoxTextL(); |
|
422 } |
|
423 } |
|
424 break; |
|
425 case EGSInputpenIdRecognitionWithDictionary: |
|
426 { |
|
427 if (iImple->ShowRecognitionWithDictionaryL()) |
|
428 { |
|
429 UpdateListBoxTextL(); |
|
430 } |
|
431 } |
|
432 break; |
|
433 case EGSInputpenIdPenTrailWidth: |
|
434 { |
|
435 if (iImple->ShowTrailWidthPageL()) |
|
436 { |
|
437 UpdateListBoxTextL(); |
|
438 } |
|
439 } |
|
440 break; |
|
441 case EGSInputpenIdInputMethodForFind: |
|
442 { |
|
443 if (iImple->ShowInputMethodForFindPageL()) |
|
444 { |
|
445 UpdateListBoxTextL(); |
|
446 } |
|
447 } |
|
448 break; |
|
449 case EGSInputpenIdChineseFindMethod: |
|
450 { |
|
451 if (iImple->ShowChineseFindMethodPageL()) |
|
452 { |
|
453 UpdateListBoxTextL(); |
|
454 } |
|
455 } |
|
456 break; |
|
457 default: |
|
458 break; |
|
459 } |
|
460 } |
|
461 |
|
462 // --------------------------------------------------------- |
|
463 // Constructor |
|
464 // --------------------------------------------------------- |
|
465 // |
|
466 CGSSettingItemList::CGSSettingItemList(CGSPenInputImple* aImple) |
|
467 :CAknSettingItemList(), iImple(aImple) |
|
468 { |
|
469 } |
|
470 |
|
471 // --------------------------------------------------------- |
|
472 // Destructor |
|
473 // --------------------------------------------------------- |
|
474 // |
|
475 CGSSettingItemList::~CGSSettingItemList() |
|
476 { |
|
477 iInputChineseFindMethod.Close(); |
|
478 } |
|
479 |
|
480 // --------------------------------------------------------- |
|
481 // Reset Setting List |
|
482 // --------------------------------------------------------- |
|
483 // |
|
484 void CGSSettingItemList::ResetSettingListL() |
|
485 { |
|
486 CAknSettingItemArray* listArray = SettingItemArray(); |
|
487 for( TInt i = EGSInputpenIdHwrTraining; i <= EGSInputpenIdTouchScrCalib; ++i ) |
|
488 { |
|
489 CAknSettingItem* item = listArray->At(i); |
|
490 item->SetHidden(!(iImple->Model()->IsSettingItemAvailable(i) )); |
|
491 } |
|
492 ListBox()->SetCurrentItemIndex(0); |
|
493 //HandleChangeInItemArrayOrVisibilityL(); |
|
494 } |
|
495 |
|
496 // --------------------------------------------------------- |
|
497 // Handle listbox events |
|
498 // --------------------------------------------------------- |
|
499 // |
|
500 void CGSSettingItemList::HandleListBoxEventL( CEikListBox* aListBox, TListBoxEvent aEventType ) |
|
501 { |
|
502 |
|
503 if ( aEventType == EEventEnterKeyPressed || |
|
504 aEventType == EEventItemDoubleClicked ) |
|
505 { |
|
506 |
|
507 TInt index = aListBox->CurrentItemIndex(); |
|
508 TInt itemID = SettingItemArray()->ItemIndexFromVisibleIndex(index); |
|
509 switch ( itemID ) |
|
510 { |
|
511 case EGSInputpenIdTouchScrCalib: |
|
512 { |
|
513 iImple->StartTouchScreenCalibL(); |
|
514 return; |
|
515 } |
|
516 case EGSInputpenIdHwrTraining: |
|
517 { |
|
518 _LIT(KPeninputHwrTrainingUI, "z:\\sys\\bin\\trui.exe" ); |
|
519 AknPenInputUtils::StartAppL( KPeninputHwrTrainingUI ); |
|
520 return; |
|
521 } |
|
522 } |
|
523 } |
|
524 |
|
525 CAknSettingItemList::HandleListBoxEventL( aListBox, aEventType ); |
|
526 } |
|
527 |
|
528 // --------------------------------------------------------- |
|
529 // Framework method to create a setting item based upon the user id aSettingId |
|
530 // --------------------------------------------------------- |
|
531 // |
|
532 CAknSettingItem* CGSSettingItemList::CreateSettingItemL(TInt identifier) |
|
533 { |
|
534 CAknSettingItem* settingItem = NULL; |
|
535 |
|
536 switch (identifier) |
|
537 { |
|
538 case EGSInputpenIdHwrTraining: |
|
539 { |
|
540 settingItem = new (ELeave) CAknBigSettingItemBase( EGSInputpenIdHwrTraining); |
|
541 } |
|
542 break; |
|
543 case EGSInputpenIdInputLanguage: |
|
544 { |
|
545 iImple->Model()->InputLanguage(iInputLanguage); |
|
546 settingItem = new (ELeave) CGSTextSettingItem(EGSInputpenIdInputLanguage, |
|
547 iInputLanguage, |
|
548 iImple, |
|
549 this); |
|
550 } |
|
551 break; |
|
552 case EGSDefaultChineseOnscreenKeyboard: |
|
553 { |
|
554 iImple->InputModeL(iInputMode); |
|
555 settingItem = new (ELeave) CGSTextSettingItem( |
|
556 EGSDefaultChineseOnscreenKeyboard, |
|
557 iInputMode, iImple, this); |
|
558 } |
|
559 break; |
|
560 case EGSInputpenIdWritingSpeed: |
|
561 { |
|
562 iImple->WritingSpeed(iWritingSpeed); |
|
563 settingItem = new (ELeave) CGSTextSettingItem(EGSInputpenIdWritingSpeed, |
|
564 iWritingSpeed, |
|
565 iImple, |
|
566 this); |
|
567 } |
|
568 break; |
|
569 case EGSInputpenIdGuidLine: |
|
570 { |
|
571 iImple->GuideLine(iGuideLine); |
|
572 settingItem = new (ELeave) CGSTextSettingItem(EGSInputpenIdGuidLine, |
|
573 iGuideLine, |
|
574 iImple, |
|
575 this); |
|
576 } |
|
577 break; |
|
578 case EGSInputpenIdRecognitionWithDictionary: |
|
579 { |
|
580 iImple->RecognitionWithDictionary(iRecognitionWithDictionary); |
|
581 settingItem = new (ELeave) CGSTextSettingItem(EGSInputpenIdRecognitionWithDictionary, |
|
582 iRecognitionWithDictionary, |
|
583 iImple, |
|
584 this); |
|
585 } |
|
586 break; |
|
587 case EGSInputpenIdPenTrailWidth: |
|
588 { |
|
589 iImple->TrailWidth(iTrailWidth); |
|
590 settingItem = new (ELeave) CGSTextSettingItem(EGSInputpenIdPenTrailWidth, |
|
591 iTrailWidth, |
|
592 iImple, |
|
593 this); |
|
594 } |
|
595 break; |
|
596 case EGSInputpenIdPenTrailColour: |
|
597 { |
|
598 settingItem = new (ELeave) CGSColorSettingItem(EGSInputpenIdPenTrailColour, |
|
599 iImple); |
|
600 } |
|
601 break; |
|
602 case EGSInputpenIdInputMethodForFind: |
|
603 { |
|
604 iImple->InputMethodForFind(iInputMethodForFind); |
|
605 settingItem = new (ELeave) CGSTextSettingItem(EGSInputpenIdInputMethodForFind, |
|
606 iInputMethodForFind, |
|
607 iImple, |
|
608 this); |
|
609 } |
|
610 break; |
|
611 case EGSInputpenIdChineseFindMethod: |
|
612 { |
|
613 iImple->LoadChineseFindMethodItemsL(); |
|
614 if ( !iInputChineseFindMethod.MaxLength() ) |
|
615 { |
|
616 iInputChineseFindMethod.CreateL( KItemTextSize ); |
|
617 } |
|
618 iImple->GetCurrentChineseFineMethodItem( iInputChineseFindMethod ); |
|
619 iInputChineseFindMethod.Copy( KNullDesC ); |
|
620 settingItem = new (ELeave) CGSTextSettingItem(EGSInputpenIdChineseFindMethod, |
|
621 iInputChineseFindMethod, |
|
622 iImple, |
|
623 this); |
|
624 } |
|
625 break; |
|
626 case EGSInputpenIdTouchScrCalib: |
|
627 { |
|
628 settingItem = new (ELeave) CAknBigSettingItemBase( EGSInputpenIdTouchScrCalib ); |
|
629 } |
|
630 default: |
|
631 break; |
|
632 } |
|
633 |
|
634 if( settingItem ) |
|
635 { |
|
636 settingItem->SetHidden( |
|
637 !(iImple->Model()->IsSettingItemAvailable(identifier) )); |
|
638 } |
|
639 |
|
640 return settingItem; |
|
641 } |
|
642 |
|
643 // --------------------------------------------------------- |
|
644 // Constructor |
|
645 // --------------------------------------------------------- |
|
646 // |
|
647 CGSSettingDialog::CGSSettingDialog(CGSPenInputImple* aImple) |
|
648 : iImple(aImple) |
|
649 { |
|
650 } |
|
651 |
|
652 // --------------------------------------------------------- |
|
653 // Destructor |
|
654 // --------------------------------------------------------- |
|
655 // |
|
656 CGSSettingDialog::~CGSSettingDialog() |
|
657 { |
|
658 } |
|
659 |
|
660 // --------------------------------------------------------- |
|
661 // Framework method to create a control based upon control type |
|
662 // --------------------------------------------------------- |
|
663 // |
|
664 SEikControlInfo CGSSettingDialog::CreateCustomControlL(TInt aControlType) |
|
665 { |
|
666 SEikControlInfo controlInfo; |
|
667 |
|
668 controlInfo.iControl = NULL; |
|
669 controlInfo.iTrailerTextId = 0; |
|
670 controlInfo.iFlags = 0; |
|
671 |
|
672 switch (aControlType) |
|
673 { |
|
674 case EGSSettingItemListBox: |
|
675 { |
|
676 iSettingList = new (ELeave) CGSSettingItemList(iImple); |
|
677 controlInfo.iControl = iSettingList; |
|
678 } |
|
679 break; |
|
680 default: |
|
681 break; |
|
682 } |
|
683 |
|
684 return controlInfo; |
|
685 } |
|
686 |
|
687 // --------------------------------------------------------- |
|
688 // This callback method is used to notify the client about |
|
689 // key changing |
|
690 // --------------------------------------------------------- |
|
691 // |
|
692 void CGSSettingDialog::HandleNotifyInt(TUint32 aId, TInt /*aNewValue*/) |
|
693 { |
|
694 CAknSettingItemArray* itemsArray = iSettingList->SettingItemArray(); |
|
695 TInt index = 0; |
|
696 switch (aId) |
|
697 { |
|
698 case KAknFepInputTxtLang: |
|
699 { |
|
700 TRAP_IGNORE(itemsArray->At(EGSInputpenIdInputLanguage)->UpdateListBoxTextL()); |
|
701 //TRAP_IGNORE(iSettingList->ResetSettingListL()); |
|
702 index = EGSDefaultChineseOnscreenKeyboard; |
|
703 if (iImple->Model()->ChineseLanguage()) |
|
704 { |
|
705 TRAP_IGNORE(itemsArray->At(index)->UpdateListBoxTextL()); |
|
706 } |
|
707 TRAP_IGNORE( iSettingList->HandleChangeInItemArrayOrVisibilityL() ); |
|
708 } |
|
709 break; |
|
710 case KSettingsWritingSpeed: |
|
711 { |
|
712 index = EGSInputpenIdWritingSpeed; |
|
713 TRAP_IGNORE(itemsArray->At(index)->UpdateListBoxTextL()); |
|
714 } |
|
715 break; |
|
716 case KSettingsPenInputGuideLine: |
|
717 { |
|
718 index = EGSInputpenIdGuidLine; |
|
719 TRAP_IGNORE(itemsArray->At(index)->UpdateListBoxTextL()); |
|
720 } |
|
721 break; |
|
722 case KSettingRecognitionwithdictionary: |
|
723 { |
|
724 TRAP_IGNORE(iSettingList->ResetSettingListL()); |
|
725 index = EGSInputpenIdRecognitionWithDictionary; |
|
726 TRAP_IGNORE(itemsArray->At(index)->UpdateListBoxTextL()); |
|
727 } |
|
728 break; |
|
729 case KSettingsPenWidth: |
|
730 { |
|
731 TRAP_IGNORE(itemsArray->At(EGSInputpenIdPenTrailWidth)->UpdateListBoxTextL()); |
|
732 } |
|
733 break; |
|
734 case KSettingsPenColor: |
|
735 { |
|
736 index = EGSInputpenIdPenTrailColour; |
|
737 TRAP_IGNORE(itemsArray->At(index)->UpdateListBoxTextL()); |
|
738 } |
|
739 break; |
|
740 case KSettingsDefaultVkbPrc: |
|
741 case KSettingsDefaultVkbTw: |
|
742 case KSettingsDefaultVkbHk: |
|
743 { |
|
744 index = EGSDefaultChineseOnscreenKeyboard; |
|
745 if (iImple->Model()->ChineseLanguage()) |
|
746 { |
|
747 TRAP_IGNORE(itemsArray->At(index)->UpdateListBoxTextL()); |
|
748 } |
|
749 } |
|
750 break; |
|
751 default: |
|
752 break; |
|
753 } |
|
754 |
|
755 TRAP_IGNORE(iSettingList->HandleChangeInItemArrayOrVisibilityL()); |
|
756 } |
|
757 |
|
758 // --------------------------------------------------------- |
|
759 // This callback method is used to notify the client about |
|
760 // key changing |
|
761 // --------------------------------------------------------- |
|
762 // |
|
763 void CGSSettingDialog::HandleNotifyInt |
|
764 (TUid aRepositoryUid, TUint32 aId, TInt aNewValue) |
|
765 { |
|
766 TRAP_IGNORE |
|
767 ( |
|
768 if ( aRepositoryUid == KCRUidPersonalizationSettings ) |
|
769 { |
|
770 HandleNotifyIntFromPersonalizationL( aId, aNewValue ); |
|
771 } |
|
772 else if ( aRepositoryUid == KCRUidAknFep ) |
|
773 { |
|
774 HandleNotifyIntFromAknFepL( aId, aNewValue ); |
|
775 } |
|
776 else if ( aRepositoryUid == KCRUidAvkon ) |
|
777 { |
|
778 HandleNotifyIntFromAvkonL( aId, aNewValue ); |
|
779 } |
|
780 iSettingList->HandleChangeInItemArrayOrVisibilityL(); |
|
781 ) |
|
782 } |
|
783 |
|
784 // --------------------------------------------------------- |
|
785 // Handle notifier from KCRUidPersonalizationSettings |
|
786 // in CRepository |
|
787 // --------------------------------------------------------- |
|
788 // |
|
789 void CGSSettingDialog::HandleNotifyIntFromPersonalizationL |
|
790 ( TUint32 aId, TInt /*aNewValue*/ ) |
|
791 { |
|
792 CAknSettingItemArray* itemsArray = iSettingList->SettingItemArray(); |
|
793 TInt index = 0; |
|
794 switch ( aId ) |
|
795 { |
|
796 case KSettingsWritingSpeed: |
|
797 { |
|
798 index = EGSInputpenIdWritingSpeed; |
|
799 itemsArray->At(index)->UpdateListBoxTextL(); |
|
800 break; |
|
801 } |
|
802 case KSettingsPenInputGuideLine: |
|
803 { |
|
804 index = EGSInputpenIdGuidLine; |
|
805 itemsArray->At(index)->UpdateListBoxTextL(); |
|
806 break; |
|
807 } |
|
808 case KSettingsPenWidth: |
|
809 { |
|
810 itemsArray->At(EGSInputpenIdPenTrailWidth)->UpdateListBoxTextL(); |
|
811 break; |
|
812 } |
|
813 case KSettingsPenColor: |
|
814 { |
|
815 index = EGSInputpenIdPenTrailColour; |
|
816 itemsArray->At(index)->UpdateListBoxTextL(); |
|
817 break; |
|
818 } |
|
819 case KSettingsDefaultVkbPrc: |
|
820 case KSettingsDefaultVkbHk: |
|
821 case KSettingsDefaultVkbTw: |
|
822 { |
|
823 index = EGSDefaultChineseOnscreenKeyboard; |
|
824 if (iImple->Model()->ChineseLanguage()) |
|
825 { |
|
826 itemsArray->At(index)->UpdateListBoxTextL(); |
|
827 } |
|
828 break; |
|
829 } |
|
830 case KSettingRecognitionwithdictionary: |
|
831 { |
|
832 index = EGSInputpenIdRecognitionWithDictionary; |
|
833 itemsArray->At(index)->UpdateListBoxTextL(); |
|
834 break; |
|
835 } |
|
836 default: |
|
837 break; |
|
838 } |
|
839 } |
|
840 |
|
841 // --------------------------------------------------------- |
|
842 // Handle notifier from KCRUidAknFep in CRepository |
|
843 // --------------------------------------------------------- |
|
844 // |
|
845 void CGSSettingDialog::HandleNotifyIntFromAknFepL |
|
846 ( TUint32 aId, TInt /*aNewValue*/ ) |
|
847 { |
|
848 CAknSettingItemArray* itemsArray = iSettingList->SettingItemArray(); |
|
849 TInt index = 0; |
|
850 switch ( aId ) |
|
851 { |
|
852 case KAknFepInputTxtLang: |
|
853 { |
|
854 itemsArray->At(EGSInputpenIdInputLanguage)->UpdateListBoxTextL(); |
|
855 iSettingList->ResetSettingListL(); |
|
856 if (iImple->Model()->ChineseLanguage()) |
|
857 { |
|
858 // Reload default on-screen vkb |
|
859 iImple->LoadDefaultOnScreenVkbItemsL(); |
|
860 index = EGSDefaultChineseOnscreenKeyboard; |
|
861 itemsArray->At(index)->UpdateListBoxTextL(); |
|
862 // Reload chinese find items because language changed |
|
863 iImple->LoadChineseFindMethodItemsL(); |
|
864 index = EGSInputpenIdChineseFindMethod; |
|
865 itemsArray->At(index)->UpdateListBoxTextL(); |
|
866 } |
|
867 break; |
|
868 } |
|
869 default: |
|
870 break; |
|
871 } |
|
872 } |
|
873 |
|
874 // --------------------------------------------------------- |
|
875 // Handle notifier from KCRUidAvkon in CRepository |
|
876 // --------------------------------------------------------- |
|
877 // |
|
878 void CGSSettingDialog::HandleNotifyIntFromAvkonL |
|
879 ( TUint32 aId, TInt /*aNewValue*/ ) |
|
880 { |
|
881 CAknSettingItemArray* itemsArray = iSettingList->SettingItemArray(); |
|
882 TInt index = 0; |
|
883 switch ( aId ) |
|
884 { |
|
885 case KAknAvkonAdaptiveSearchEnabled: |
|
886 { |
|
887 index = EGSInputpenIdInputMethodForFind; |
|
888 itemsArray->At(index)->UpdateListBoxTextL(); |
|
889 break; |
|
890 } |
|
891 case KAknAdaptiveSearchChinesePRC: |
|
892 case KAknAdaptiveSearchChineseTW: |
|
893 case KAknAdaptiveSearchChineseHongkong: |
|
894 { |
|
895 index = EGSInputpenIdChineseFindMethod; |
|
896 itemsArray->At(index)->UpdateListBoxTextL(); |
|
897 break; |
|
898 } |
|
899 default: |
|
900 break; |
|
901 } |
|
902 } |
|
903 |
|
904 // --------------------------------------------------------- |
|
905 // Launch other application; |
|
906 // --------------------------------------------------------- |
|
907 // |
|
908 void CGSSettingDialog::LaunchAppL( TUid aAppUid ) |
|
909 { |
|
910 // Find the task with uid |
|
911 TApaTaskList taskList( iEikonEnv->WsSession() ); |
|
912 TApaTask task = taskList.FindApp( aAppUid ); |
|
913 |
|
914 if ( task.Exists() ) |
|
915 { |
|
916 task.BringToForeground(); |
|
917 } |
|
918 else |
|
919 { |
|
920 if ( iNullService ) |
|
921 { |
|
922 delete iNullService; |
|
923 iNullService = NULL; |
|
924 } |
|
925 iNullService = CAknNullService::NewL( aAppUid, NULL ); |
|
926 } |
|
927 } |
|
928 |
|
929 // --------------------------------------------------------- |
|
930 // Process menu selection event |
|
931 // --------------------------------------------------------- |
|
932 // |
|
933 void CGSSettingDialog::ProcessCommandL(TInt aCommandId) |
|
934 { |
|
935 HideMenu(); |
|
936 |
|
937 switch (aCommandId) |
|
938 { |
|
939 case EGSCmdAppChange: |
|
940 { |
|
941 ShowSettingPageL(); |
|
942 } |
|
943 break; |
|
944 case EAknCmdExit: |
|
945 { |
|
946 TryExitL(EAknCmdExit); |
|
947 } |
|
948 break; |
|
949 case EAknCmdHelp: |
|
950 { |
|
951 TCoeHelpContext context; |
|
952 context.iMajor = KUidGS; |
|
953 context.iContext = HLP_GS_PEN_INPUT;// temp fix for helps integration build break; |
|
954 CArrayFixFlat<TCoeHelpContext>* array |
|
955 = new (ELeave) CArrayFixFlat |
|
956 <TCoeHelpContext>( 1 ); |
|
957 CleanupStack::PushL( array ); |
|
958 array->AppendL( context ); |
|
959 CleanupStack::Pop( array ); |
|
960 HlpLauncher::LaunchHelpApplicationL( |
|
961 iEikonEnv->WsSession(), array ); |
|
962 } |
|
963 break; |
|
964 default: |
|
965 break; |
|
966 } |
|
967 } |
|
968 |
|
969 // --------------------------------------------------------- |
|
970 // Process button pressed event |
|
971 // --------------------------------------------------------- |
|
972 // |
|
973 TBool CGSSettingDialog::OkToExitL(TInt aButtonId) |
|
974 { |
|
975 TInt ret = EFalse; |
|
976 switch (aButtonId) |
|
977 { |
|
978 case EGSMSKCmdAppChange: |
|
979 { |
|
980 ShowSettingPageL(); |
|
981 } |
|
982 break; |
|
983 case EAknCmdExit: |
|
984 case EAknSoftkeyBack: |
|
985 { |
|
986 // Add to restore status pane before closing dialog |
|
987 if ( iImple ) |
|
988 { |
|
989 iImple->RestoreStatusPaneVisibility(); |
|
990 } |
|
991 ret = ETrue; |
|
992 } |
|
993 break; |
|
994 case EAknSoftkeyOptions: |
|
995 { |
|
996 DisplayMenuL(); |
|
997 } |
|
998 default: |
|
999 break; |
|
1000 } |
|
1001 |
|
1002 return ret; |
|
1003 } |
|
1004 |
|
1005 // --------------------------------------------------------- |
|
1006 // Show setting page when user select item in listbox |
|
1007 // --------------------------------------------------------- |
|
1008 // |
|
1009 void CGSSettingDialog::ShowSettingPageL() |
|
1010 { |
|
1011 CEikFormattedCellListBox* listbox = iSettingList->ListBox(); |
|
1012 const TInt index = listbox->CurrentItemIndex(); |
|
1013 |
|
1014 TInt itemID = iSettingList->SettingItemArray()->ItemIndexFromVisibleIndex(index); |
|
1015 |
|
1016 switch (itemID) |
|
1017 { |
|
1018 case EGSInputpenIdHwrTraining: |
|
1019 { |
|
1020 _LIT(KPeninputHwrTrainingUI, "z:\\sys\\bin\\trui.exe" ); |
|
1021 AknPenInputUtils::StartAppL( KPeninputHwrTrainingUI ); |
|
1022 } |
|
1023 break; |
|
1024 case EGSInputpenIdInputLanguage: |
|
1025 { |
|
1026 iImple->ShowInputLanguagePageL(); |
|
1027 CAknSettingItemArray* itemsArray = iSettingList->SettingItemArray(); |
|
1028 itemsArray->At(itemID)->UpdateListBoxTextL(); |
|
1029 //iSettingList->ResetSettingListL(); |
|
1030 //itemsArray->At(itemID + 1 )->UpdateListBoxTextL(); |
|
1031 } |
|
1032 break; |
|
1033 case EGSDefaultChineseOnscreenKeyboard: |
|
1034 { |
|
1035 iImple->ShowInputModePageL(); |
|
1036 CAknSettingItemArray* itemsArray = iSettingList->SettingItemArray(); |
|
1037 itemsArray->At(itemID)->UpdateListBoxTextL(); |
|
1038 } |
|
1039 break; |
|
1040 case EGSInputpenIdWritingSpeed: |
|
1041 { |
|
1042 iImple->ShowWritingSpeedPageL(); |
|
1043 CAknSettingItemArray* itemsArray = iSettingList->SettingItemArray(); |
|
1044 itemsArray->At(itemID)->UpdateListBoxTextL(); |
|
1045 } |
|
1046 break; |
|
1047 case EGSInputpenIdGuidLine: |
|
1048 { |
|
1049 iImple->ShowGuideLinePageL(); |
|
1050 CAknSettingItemArray* itemsArray = iSettingList->SettingItemArray(); |
|
1051 itemsArray->At(itemID)->UpdateListBoxTextL(); |
|
1052 } |
|
1053 break; |
|
1054 case EGSInputpenIdRecognitionWithDictionary: |
|
1055 { |
|
1056 iImple->ShowRecognitionWithDictionaryL(); |
|
1057 CAknSettingItemArray* itemsArray = iSettingList->SettingItemArray(); |
|
1058 itemsArray->At(itemID)->UpdateListBoxTextL(); |
|
1059 } |
|
1060 break; |
|
1061 case EGSInputpenIdPenTrailWidth: |
|
1062 { |
|
1063 iImple->ShowTrailWidthPageL(); |
|
1064 CAknSettingItemArray* itemsArray = iSettingList->SettingItemArray(); |
|
1065 itemsArray->At(itemID)->UpdateListBoxTextL(); |
|
1066 } |
|
1067 break; |
|
1068 case EGSInputpenIdPenTrailColour: |
|
1069 { |
|
1070 iImple->ShowTrailColourPageL(); |
|
1071 CAknSettingItemArray* itemsArray = iSettingList->SettingItemArray(); |
|
1072 itemsArray->At(itemID)->UpdateListBoxTextL(); |
|
1073 } |
|
1074 break; |
|
1075 case EGSInputpenIdInputMethodForFind: |
|
1076 { |
|
1077 iImple->ShowInputMethodForFindPageL(); |
|
1078 CAknSettingItemArray* itemsArray = iSettingList->SettingItemArray(); |
|
1079 itemsArray->At(itemID)->UpdateListBoxTextL(); |
|
1080 } |
|
1081 break; |
|
1082 case EGSInputpenIdChineseFindMethod: |
|
1083 { |
|
1084 iImple->ShowChineseFindMethodPageL(); |
|
1085 CAknSettingItemArray* itemsArray = iSettingList->SettingItemArray(); |
|
1086 itemsArray->At(itemID)->UpdateListBoxTextL(); |
|
1087 } |
|
1088 break; |
|
1089 case EGSInputpenIdTouchScrCalib: |
|
1090 { |
|
1091 LaunchAppL( KUidCalibrationApp ); |
|
1092 } |
|
1093 break; |
|
1094 default: |
|
1095 break; |
|
1096 } |
|
1097 } |
|
1098 |
|
1099 void CGSSettingDialog::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane *aMenuPane) |
|
1100 { |
|
1101 if ( aResourceId != R_GS_INPUT_ITEM_CHANGE ) |
|
1102 { |
|
1103 return; |
|
1104 } |
|
1105 |
|
1106 CEikFormattedCellListBox* listbox = iSettingList->ListBox(); |
|
1107 const TInt index = listbox->CurrentItemIndex(); |
|
1108 TInt itemID = iSettingList->SettingItemArray()->ItemIndexFromVisibleIndex(index); |
|
1109 |
|
1110 if ( itemID == EGSInputpenIdHwrTraining || itemID == EGSInputpenIdTouchScrCalib ) |
|
1111 { |
|
1112 aMenuPane->SetItemTextL( EGSCmdAppChange, R_GS_INPUT_ITEM_TXT_OPEN ); |
|
1113 } |
|
1114 else |
|
1115 { |
|
1116 aMenuPane->SetItemTextL( EGSCmdAppChange, R_GS_INPUT_ITEM_TXT_CHANGE ); |
|
1117 } |
|
1118 } |
|
1119 // End Of File |