|
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: Implementation of the vkb layout |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // system includes |
|
20 #include <aknfeppeninputenums.h> //command from fep or IME to plugin |
|
21 #include <AknFepGlobalEnums.h> //define EPluginInputModeHwr |
|
22 #include <peninputcmd.h> // use global signal |
|
23 #include <peninputlayoutchoicelist.h> |
|
24 #include <peninputlayoutbutton.h> |
|
25 #include <peninputdragbutton.h> |
|
26 #include <coemain.h> |
|
27 #include <PtiEngine.h> |
|
28 #include <PtiUserDicEntry.h> |
|
29 #include <peninputpluginutils.h> |
|
30 #include <bautils.h> |
|
31 #include <peninputmultimodebutton.h> // add by jiawenjuan |
|
32 #include <peninputlayoutmultilineicf.h> |
|
33 #include <peninputlayoutbubblectrl.h> |
|
34 #include <s32mem.h> |
|
35 |
|
36 // user includes |
|
37 #include "peninputvkblayout.h" |
|
38 #include "peninputvkbevent.h" // use event |
|
39 #include "peninputvkb.hrh" // control ID and range defination |
|
40 #include "peninputvkbwindow.h" // use vkb window, which derived from base window |
|
41 #include "peninputvkbuistate.h" // use ui state |
|
42 #include "peninputvkbuistatemgr.h" // use ui state mgr |
|
43 #include "peninputvkbdatamgr.h" // use data mgr |
|
44 #include "peninputvkbclientarea.h" |
|
45 |
|
46 // constant definition |
|
47 _LIT(KResourceFile, "z:\\resource\\peninputvkbcn.rsc"); |
|
48 |
|
49 const TInt KIntSizeToInt16 = 2; |
|
50 |
|
51 // ======== MEMBER FUNCTIONS ======== |
|
52 |
|
53 // --------------------------------------------------------------------------- |
|
54 // CAknFepVkbLayoutImp::NewL |
|
55 // (other items were commented in a header). |
|
56 // --------------------------------------------------------------------------- |
|
57 // |
|
58 CAknFepVkbLayoutImp* CAknFepVkbLayoutImp::NewL( TAny* /*aInitParams*/ ) |
|
59 { |
|
60 CAknFepVkbLayoutImp* self = new(ELeave) CAknFepVkbLayoutImp(); |
|
61 CleanupStack::PushL(self); |
|
62 self->ConstructL( EFalse ); |
|
63 CleanupStack::Pop(); |
|
64 |
|
65 return self; |
|
66 } |
|
67 |
|
68 CAknFepVkbLayoutImp* CAknFepVkbLayoutImp::NewFsqL( TAny* /*aInitParams*/ ) |
|
69 { |
|
70 CAknFepVkbLayoutImp* self = new ( ELeave ) CAknFepVkbLayoutImp(); |
|
71 CleanupStack::PushL( self ); |
|
72 self->ConstructL( ETrue ); |
|
73 CleanupStack::Pop( self ); |
|
74 |
|
75 return self; |
|
76 } |
|
77 |
|
78 // --------------------------------------------------------------------------- |
|
79 // CAknFepVkbLayoutImp::~CAknFepVkbLayoutImp |
|
80 // (other items were commented in a header). |
|
81 // --------------------------------------------------------------------------- |
|
82 // |
|
83 CAknFepVkbLayoutImp::~CAknFepVkbLayoutImp() |
|
84 { |
|
85 } |
|
86 |
|
87 // --------------------------------------------------------------------------- |
|
88 // CAknFepVkbLayoutImp::CAknFepVkbLayoutImp |
|
89 // (other items were commented in a header). |
|
90 // --------------------------------------------------------------------------- |
|
91 // |
|
92 CAknFepVkbLayoutImp::CAknFepVkbLayoutImp() |
|
93 { |
|
94 // See ConstructL() for initialisation completion. |
|
95 } |
|
96 |
|
97 // --------------------------------------------------------------------------- |
|
98 // CAknFepVkbLayoutImp::ConstructL |
|
99 // (other items were commented in a header). |
|
100 // --------------------------------------------------------------------------- |
|
101 // |
|
102 void CAknFepVkbLayoutImp::ConstructL(TBool aIsFsq) |
|
103 { |
|
104 iIsFsq = aIsFsq; |
|
105 } |
|
106 |
|
107 // --------------------------------------------------------------------------- |
|
108 // CAknFepVkbLayoutImp::CreateFepUiLayoutL |
|
109 // (other items were commented in a header). |
|
110 // --------------------------------------------------------------------------- |
|
111 // |
|
112 CFepUiLayout* CAknFepVkbLayoutImp::CreateFepUiLayoutL(MLayoutOwner* aLayoutOwner,const TAny* aData) |
|
113 { |
|
114 CAknFepVkbLayout* uiLayout = CAknFepVkbLayout::NewL( aLayoutOwner, aData, iIsFsq ); |
|
115 |
|
116 return uiLayout; |
|
117 } |
|
118 |
|
119 // --------------------------------------------------------------------------- |
|
120 // CAknFepVkbLayout::NewL |
|
121 // (other items were commented in a header). |
|
122 // --------------------------------------------------------------------------- |
|
123 // |
|
124 CAknFepVkbLayout* CAknFepVkbLayout::NewL(MLayoutOwner* aLayoutOwner, |
|
125 const TAny* aInitData, TBool aIsFsq ) |
|
126 { |
|
127 CAknFepVkbLayout* self = new (ELeave) CAknFepVkbLayout(aLayoutOwner); |
|
128 |
|
129 CleanupStack::PushL(self); |
|
130 self->ConstructL(aInitData, aIsFsq); |
|
131 CleanupStack::Pop(); |
|
132 |
|
133 return self; |
|
134 } |
|
135 |
|
136 // --------------------------------------------------------------------------- |
|
137 // CAknFepVkbLayout::CAknFepVkbLayout |
|
138 // (other items were commented in a header). |
|
139 // --------------------------------------------------------------------------- |
|
140 // |
|
141 CAknFepVkbLayout::CAknFepVkbLayout(MLayoutOwner* aLayoutOwner) |
|
142 : CFepUiLayout(aLayoutOwner), iNeedDealFocusGained(ETrue) |
|
143 { |
|
144 } |
|
145 |
|
146 // --------------------------------------------------------------------------- |
|
147 // CAknFepVkbLayout::ConstructL |
|
148 // (other items were commented in a header). |
|
149 // --------------------------------------------------------------------------- |
|
150 // |
|
151 void CAknFepVkbLayout::ConstructL(const TAny* aInitData, TBool aIsFsq) |
|
152 { |
|
153 iLayoutType = aIsFsq ? EPluginInputModeFSQ : EPluginInputModeVkb; |
|
154 BaseConstructL(); |
|
155 |
|
156 CCoeEnv* coeEnv = CCoeEnv::Static(); |
|
157 TPixelsTwipsAndRotation ptSize; |
|
158 |
|
159 TFileName resFileName( KResourceFile ); |
|
160 BaflUtils::NearestLanguageFile(coeEnv->FsSession(), resFileName ); |
|
161 |
|
162 coeEnv->ScreenDevice()->GetDefaultScreenSizeAndRotation(ptSize); |
|
163 iResId = coeEnv->AddResourceFileL( resFileName ); |
|
164 TPeninputLayoutData* layoutData = (TPeninputLayoutData*)aInitData; |
|
165 iPtiEngine = (*layoutData).iPtiEngine; |
|
166 |
|
167 //create date manager |
|
168 iDataMgr = CAknFepVkbDataMgr::NewL(this, iPtiEngine); |
|
169 |
|
170 // Store screen mode, and get new window position |
|
171 iDataMgr->SetScreenMode(ptSize); |
|
172 |
|
173 //Create ui state manager |
|
174 iUiStateMgr = CAknFepVkbUiStateMgr::NewL(this); |
|
175 |
|
176 //create vkb window |
|
177 iVkbWindow = CAknFepVkbWindow::NewL(this, |
|
178 EAknFepVkbCtrlIdVkbWindow, |
|
179 iDataMgr, |
|
180 iUiStateMgr); |
|
181 iVkbWindow->Hide(ETrue); |
|
182 AddControlL(iVkbWindow); |
|
183 |
|
184 //config layout self using the whole screen |
|
185 //set proper size |
|
186 SetScreenSize(ptSize.iPixelSize); |
|
187 |
|
188 // When layout is initianized, we should make the entire window visible |
|
189 } |
|
190 |
|
191 // --------------------------------------------------------------------------- |
|
192 // CAknFepVkbLayout::~CAknFepVkbLayout |
|
193 // (other items were commented in a header). |
|
194 // --------------------------------------------------------------------------- |
|
195 // |
|
196 CAknFepVkbLayout::~CAknFepVkbLayout() |
|
197 { |
|
198 delete iDataMgr; |
|
199 CCoeEnv::Static()->DeleteResourceFile(iResId); |
|
200 delete iUiStateMgr; |
|
201 } |
|
202 |
|
203 // --------------------------------------------------------------------------- |
|
204 // CAknFepVkbLayout::HandleCommand |
|
205 // (other items were commented in a header). |
|
206 // --------------------------------------------------------------------------- |
|
207 // |
|
208 TInt CAknFepVkbLayout::HandleCommand(TInt aCmd, TUint8* aData) |
|
209 { |
|
210 // Handle command from fep or IME to this layout |
|
211 TUint* data = (TUint*) aData; |
|
212 TBuf<KIntSizeToInt16> bufStyle; |
|
213 TInt style; |
|
214 TInt ret = KErrNone; |
|
215 |
|
216 switch ( aCmd ) |
|
217 { |
|
218 case ECmdPenInputPermittedRange: |
|
219 iDataMgr->SetPermittedRange(*data); |
|
220 break; |
|
221 case ECmdPenInputEditorNumericKeyMap: |
|
222 iDataMgr->SetEditorNumericKeymap(*data); |
|
223 break; |
|
224 case ECmdPenInputCase: |
|
225 DoCaseChange(*data); |
|
226 break; |
|
227 case ECmdPenInputPermittedCase: |
|
228 iDataMgr->SetPermittedCase(*data); |
|
229 break; |
|
230 case ECmdPenInputLanguage: |
|
231 { |
|
232 ChangeInputLanguage(*data); |
|
233 iVkbWindow->SetSwitchlistLanguage(*data); |
|
234 } |
|
235 break; |
|
236 // When data query need to change position |
|
237 case ECmdPenInputSetWindowPos: |
|
238 iDataMgr->SetDataQueryRect(*((TRect*)aData)); |
|
239 |
|
240 style = EVkbPositionChangeDataQuery; |
|
241 bufStyle = ( TUint16* )&style; |
|
242 SendEventToVkbControl(EVkbEventPositionChanged, NULL, bufStyle); |
|
243 break; |
|
244 case ECmdPenInputWindowOpen: |
|
245 if ( *data == EPenInputOpenManually ) |
|
246 { |
|
247 style = EVkbPositionChangeBrJustify; |
|
248 bufStyle = ( TUint16* )&style; |
|
249 SendEventToVkbControl(EVkbEventPositionChanged, NULL, bufStyle ); |
|
250 } |
|
251 iVkbWindow->Hide(EFalse); |
|
252 LayoutOwner()->Hide(EFalse); |
|
253 break; |
|
254 case ECmdPenInputWindowClose: |
|
255 iVkbWindow->Hide(ETrue); |
|
256 LayoutOwner()->Hide(ETrue); |
|
257 break; |
|
258 case ECmdPenInputRange: |
|
259 SetCurrentRange(*data); |
|
260 break; |
|
261 case ECmdPenInputEditorCustomNumericKeyMap: |
|
262 { |
|
263 iDataMgr->SetData(EAknFepDataTypeUseDefinedResource, (TInt) aData); |
|
264 } |
|
265 break; |
|
266 case ECmdPenInputEnableSettingBtn: |
|
267 { |
|
268 iVkbWindow->SetEnableSettingBtn(*data); |
|
269 } |
|
270 break; |
|
271 case ECmdPenInputIsSecretText: |
|
272 { |
|
273 iVkbWindow->SetSwitchlistSecretFlag(*data); |
|
274 |
|
275 iVkbWindow->SetTextIsSecret( *aData ); |
|
276 } |
|
277 break; |
|
278 case ECmdPenInputDimArrowKeys: |
|
279 { |
|
280 TBool IsDimArrowKeys = *aData; |
|
281 iVkbWindow->DimArrowKeys( IsDimArrowKeys ); |
|
282 } |
|
283 break; |
|
284 case ECmdPenInputSetPromptText: |
|
285 { |
|
286 if( iLayoutType == EPluginInputModeFSQ ) |
|
287 TRAP_IGNORE(iVkbWindow->SetPromptTextL(aData)); |
|
288 } |
|
289 break; |
|
290 case ECmdPenInputCharacterPreview: |
|
291 { |
|
292 iVkbWindow->ShowBubble(*aData); |
|
293 } |
|
294 break; |
|
295 case ECmdPenInputSetTextAlignment: |
|
296 { |
|
297 TRAP_IGNORE(iVkbWindow->SetTextAlignmentL( *aData )); |
|
298 } |
|
299 break; |
|
300 case ECmdPenInputPopupTooltip: |
|
301 { |
|
302 TRAP_IGNORE( HandleShowTooltipOnFSQCmdL( aData ) ); |
|
303 } |
|
304 break; |
|
305 case ECmdPenInputHideTooltip: |
|
306 { |
|
307 iVkbWindow->HideTooltipOnFSQ(); |
|
308 } |
|
309 break; |
|
310 case ECmdPenInputPopupCandidateList: |
|
311 { |
|
312 TRAP_IGNORE( HandleShowCandidateListOnFSQCmdL( aData ) ); |
|
313 } |
|
314 break; |
|
315 case ECmdPenInputHideCandidateList: |
|
316 { |
|
317 iVkbWindow->HideCandidateListOnFSQ(); |
|
318 } |
|
319 break; |
|
320 case ECmdPeninputITIStatus: |
|
321 { |
|
322 // Set the flag to indicate if FSQ with ITI feature is opened |
|
323 iITIEnabled = *aData ; |
|
324 } |
|
325 break; |
|
326 default: |
|
327 { |
|
328 ret = CFepUiLayout::HandleCommand( aCmd, aData ); |
|
329 } |
|
330 break; |
|
331 } |
|
332 |
|
333 return ret; |
|
334 } |
|
335 |
|
336 // --------------------------------------------------------------------------- |
|
337 // CAknFepVkbLayout::SizeChanged |
|
338 // (other items were commented in a header). |
|
339 // --------------------------------------------------------------------------- |
|
340 // |
|
341 TInt CAknFepVkbLayout::SizeChanged(const TAny* /*pData*/) |
|
342 { |
|
343 // Handle size changed event |
|
344 TPixelsTwipsAndRotation size; |
|
345 |
|
346 CCoeEnv::Static()->ScreenDevice()->GetDefaultScreenSizeAndRotation(size); |
|
347 |
|
348 // Store screen mode, and get new window position |
|
349 iDataMgr->SetScreenMode(size); |
|
350 |
|
351 iDataMgr->SetSizeChanging(ETrue); |
|
352 // The following need to implement |
|
353 iVkbWindow->SizeChanged(ETrue); |
|
354 iDataMgr->SetSizeChanging(EFalse); |
|
355 |
|
356 // When layout size is changed, we should make the entire window visible |
|
357 TInt style = EVkbPositionChangeBrJustify; |
|
358 TBuf<KIntSizeToInt16> bufStyle; |
|
359 bufStyle = ( TUint16* )&style; |
|
360 SendEventToVkbControl(EVkbEventPositionChanged, NULL, bufStyle); |
|
361 |
|
362 return KErrNone; |
|
363 } |
|
364 |
|
365 // --------------------------------------------------------------------------- |
|
366 // CAknFepVkbLayout::OnAppEditorTextComing |
|
367 // (other items were commented in a header). |
|
368 // --------------------------------------------------------------------------- |
|
369 // |
|
370 TInt CAknFepVkbLayout::OnAppEditorTextComing(const TFepInputContextFieldData& aData) |
|
371 { |
|
372 // Handle edit text coming |
|
373 if (iVkbWindow) |
|
374 { |
|
375 TRAPD(err, iVkbWindow->SetEditorTextL(aData)); |
|
376 return err; |
|
377 } |
|
378 |
|
379 return KErrNone; |
|
380 } |
|
381 |
|
382 // --------------------------------------------------------------------------- |
|
383 // CAknFepVkbLayout::HandleControlEvent |
|
384 // (other items were commented in a header). |
|
385 // --------------------------------------------------------------------------- |
|
386 // |
|
387 void CAknFepVkbLayout::HandleControlEvent(TInt aEventType, CFepUiBaseCtrl* aCtrl, |
|
388 const TDesC& aEventData) |
|
389 { |
|
390 // Handle event from control |
|
391 TInt* data = (TInt*)aEventData.Ptr(); |
|
392 |
|
393 //static TInt COUNT = 1; |
|
394 |
|
395 //deal with the event from all controls in layout |
|
396 switch (aEventType) |
|
397 { |
|
398 case EVkbEventWindowClose: |
|
399 iVkbWindow->ClientArea()->HandleControlEvent( aEventType, aCtrl, aEventData ); |
|
400 SignalOwner(ESignalLayoutClosed); |
|
401 break; |
|
402 case EVkbEventTouchInputOption: |
|
403 case EPeninputLayoutEventOption: |
|
404 SignalOwner(ESignalLaunchOptionMenu); |
|
405 break; |
|
406 case EVkbEventInputLangSwitch: |
|
407 SignalOwner(ESignalLaunchLanguageMenu); |
|
408 break; |
|
409 |
|
410 //When drag end, store the data |
|
411 case EEventDraggingEnd: |
|
412 { |
|
413 TInt x = 0; |
|
414 TInt y = 0; |
|
415 x = 0x0000FFFF & ( Position().iX + Rect().Width()); |
|
416 y = 0xFFFF0000 & ( (Position().iY + Rect().Height() ) << 16 ); |
|
417 if ( x|y ) |
|
418 { |
|
419 iDataMgr->SetWindowPosition(x | y); |
|
420 } |
|
421 } |
|
422 break; |
|
423 |
|
424 case EVkbEventPositionChanged: |
|
425 SendEventToVkbControl(EVkbEventPositionChanged,NULL); |
|
426 break; |
|
427 |
|
428 case EVkbEventHwr: |
|
429 { |
|
430 TRAP_IGNORE( iVkbWindow->UpdateICFTextL() ); |
|
431 iVkbWindow->PopupSwitchWindow(); |
|
432 } |
|
433 break; |
|
434 |
|
435 case EVkbEventSetRange: |
|
436 if ( *data == ERangeAccent ) |
|
437 { |
|
438 iVkbWindow->PopupAccentWindow(); |
|
439 } |
|
440 else |
|
441 { |
|
442 // When change range mannually, we should make the entire window visible |
|
443 //iVkbWindow->Hide(ETrue); |
|
444 SetCurrentRange(*data,ETrue,ETrue); |
|
445 //iVkbWindow->Hide(EFalse); |
|
446 |
|
447 //singal server |
|
448 TInt range = *data; |
|
449 TBuf<4> buf; |
|
450 buf.Append(reinterpret_cast<TText*>(&range), 4); |
|
451 SignalOwner(ESignalRange, buf); |
|
452 } |
|
453 break; |
|
454 |
|
455 case EEventChoiceSelected: |
|
456 { |
|
457 CFepLayoutChoiceList::SEvent* event = (CFepLayoutChoiceList::SEvent*)aEventData.Ptr(); |
|
458 if( event->iIndex != -1 ) |
|
459 { |
|
460 if (aCtrl->ControlId() == EAknFepVkbPopupWindow) |
|
461 { |
|
462 TInt currentRange = iDataMgr->CurrentRange(); |
|
463 TInt currentAccent = iDataMgr->CurrentAccent(); |
|
464 if ( (currentRange == ERangeAccent) && ( currentAccent == event->iCommand ) ) |
|
465 { |
|
466 return; |
|
467 } |
|
468 else |
|
469 { |
|
470 iDataMgr->SetCurrentAccent(event->iCommand); |
|
471 // When change range mannually, we should make the entire window visible |
|
472 SetCurrentRange(ERangeAccent,EFalse, ETrue); |
|
473 |
|
474 TInt style = EVkbPositionChangeBrJustify; |
|
475 TBuf<KIntSizeToInt16> bufStyle; |
|
476 bufStyle = ( TUint16* )&style; |
|
477 SendEventToVkbControl(EVkbEventPositionChanged, NULL, bufStyle); |
|
478 |
|
479 //singal server |
|
480 TInt range = ERangeAccent; |
|
481 TBuf<4> buf; |
|
482 buf.Append(reinterpret_cast<TText*>(&range), 4); |
|
483 SignalOwner(ESignalRange, buf); |
|
484 } |
|
485 |
|
486 } |
|
487 else if (aCtrl->ControlId() == EPeninutWindowCtrlIdSwitcherPopupWindow) |
|
488 { |
|
489 if (iLayoutType != event->iCommand) |
|
490 { |
|
491 TBool switchByMode = ETrue; |
|
492 TInt mode = event->iCommand; |
|
493 |
|
494 TBuf<8> buf; |
|
495 buf.Append(reinterpret_cast<TText*>(&switchByMode), |
|
496 sizeof(TBool)/sizeof(TText)); |
|
497 buf.Append(reinterpret_cast<TText*>(&mode), |
|
498 sizeof(TInt)/sizeof(TText)); |
|
499 SignalOwner(ESignalLayoutUIChanged,buf); |
|
500 } |
|
501 } |
|
502 else if ( aCtrl->ControlId() == EPentinputHwrCandidateList ) |
|
503 { |
|
504 TRAP_IGNORE( iVkbWindow->HandleCandidateListSelectedOnFSQL( aCtrl, aEventData ) ); |
|
505 } |
|
506 } |
|
507 else |
|
508 { |
|
509 iVkbWindow->ResetAccentButton(); |
|
510 } |
|
511 } |
|
512 |
|
513 break; |
|
514 case EVkbEventCompFieldAnalysisReq: |
|
515 //Send the data to engine to recognize |
|
516 TRAP_IGNORE(iDataMgr->GetCandidatesL(aEventData,EFalse)); |
|
517 break; |
|
518 |
|
519 case EVkbEventCompFieldSubmit: |
|
520 { |
|
521 SignalOwner(ESignalKeyEvent,aEventData); |
|
522 iUiStateMgr->SetCurrentUiState(iUiStateMgr->UiStateStandbycn()); |
|
523 ForceEditGainFocus(EInputContextFieldGetFocus); |
|
524 |
|
525 // predictive char is selected |
|
526 TRAP_IGNORE(iDataMgr->GetCandidatesL(aEventData,ETrue)); |
|
527 |
|
528 // create new word if needed |
|
529 if ((iVkbWindow->NeedCreateWord()) && (aEventData.Length() > 0)) |
|
530 { |
|
531 |
|
532 // only bind spell sequence in zhuyin or pinyin mode |
|
533 if ( iDataMgr->RequestData( EAknFepDataTypeIMLayout ) == EAknFepVkbImCnZhuyin |
|
534 || iDataMgr->RequestData( EAknFepDataTypeIMLayout ) == EAknFepVkbImCnPinyin ) |
|
535 { |
|
536 TPtrC buf = iVkbWindow->GetCreatedWordSpell(); |
|
537 TPtiUserDictionaryEntry newUdbEntry(buf); |
|
538 iPtiEngine->AddUserDictionaryEntry(newUdbEntry); |
|
539 } |
|
540 else |
|
541 { |
|
542 TPtiUserDictionaryEntry newUdbEntry(aEventData); |
|
543 iPtiEngine->AddUserDictionaryEntry(newUdbEntry); |
|
544 } |
|
545 } |
|
546 } |
|
547 break; |
|
548 |
|
549 case EVkbEventCandidateSelected: |
|
550 if ( !iVkbWindow->CompositionFieldStringLength() ) |
|
551 { |
|
552 //First send it to fep |
|
553 TBuf<32> buf = aEventData; |
|
554 buf.SetLength(buf.Length()-1); |
|
555 SignalOwner(ESignalKeyEvent,buf); |
|
556 |
|
557 // predictive char is selected |
|
558 TRAP_IGNORE(iDataMgr->GetCandidatesL(buf,ETrue)); |
|
559 ForceEditGainFocus(EInputContextFieldGetFocus); |
|
560 } |
|
561 else |
|
562 { |
|
563 // candidate char is selected |
|
564 SendEventToVkbControl(EVkbEventCandidateSelected,aCtrl,aEventData); |
|
565 } |
|
566 break; |
|
567 case EVkbEventQueryCandidateExisted: |
|
568 { |
|
569 if (iDataMgr->Candidates().Count() >= KMaxPredictCandCnt) |
|
570 { |
|
571 iVkbWindow->ClientArea()->SetNextCandidateExistFlag(EFalse); |
|
572 } |
|
573 else |
|
574 { |
|
575 iVkbWindow->ClientArea()->SetNextCandidateExistFlag |
|
576 (iDataMgr->NextCandidateExist()); |
|
577 } |
|
578 } |
|
579 break; |
|
580 case EVkbEventGetNextPageCandidate: |
|
581 { |
|
582 TRAP_IGNORE(iDataMgr->GetCandidatesL(KNullDesC, EFalse, ETrue)); |
|
583 } |
|
584 break; |
|
585 case EVkbEventGetPreviousPageCandidate: |
|
586 // actually, 'get previous page candidate' do nothing here |
|
587 // the branch here just to avoid it is handled by 'default' branch |
|
588 break; |
|
589 case EVkbEventStandby2Composition: |
|
590 case EVkbEventComposition2Standby: |
|
591 SendEventToVkbControl(aEventType, aCtrl, aEventData); |
|
592 break; |
|
593 |
|
594 case EVkbEventCompFieldDataFlush: |
|
595 SendEventToVkbControl(aEventType,aCtrl,aEventData); |
|
596 iUiStateMgr->SetCurrentUiState(iUiStateMgr->UiStateStandbycn()); |
|
597 ForceEditGainFocus(EInputContextFieldGetFocus); |
|
598 break; |
|
599 |
|
600 case EVkbEventCompFieldNoChars: |
|
601 SendEventToVkbControl(EVkbEventComposition2Standby,NULL); |
|
602 case EVkbEventClearContent: |
|
603 SendEventToVkbControl(aEventType,aCtrl,aEventData); |
|
604 break; |
|
605 |
|
606 case EEventControlFocusGained: |
|
607 HandleFocusGained(aCtrl,aEventData); |
|
608 break; |
|
609 |
|
610 case EEventButtonUp: |
|
611 { |
|
612 // check current range |
|
613 TInt curRange = iDataMgr->CurrentRange(); |
|
614 if( aCtrl->ControlId() == EAknFepVkbCtrlIdShiftBtn) |
|
615 { |
|
616 if( (curRange == ERangeNative) || (curRange == ERangeEnglish) || |
|
617 (curRange == ERangeAccent)) |
|
618 { |
|
619 CAknFepCtrlMultiModeButton* button = |
|
620 static_cast<CAknFepCtrlMultiModeButton*>( aCtrl ); |
|
621 TInt realCase = button->GetRealCaseByMode( button->CurrentMode() ); |
|
622 HandleMergedBtnClicked( realCase ); |
|
623 } |
|
624 else |
|
625 { |
|
626 iVkbWindow->LoopVkbLayout(EVkbBoth, ETrue); |
|
627 TInt shiftStatus = iDataMgr->RequestData(EAknFepDataTypeShfitDown); |
|
628 iVkbWindow->ChangeMergedButtonStatus( shiftStatus, 0 ); |
|
629 } |
|
630 } |
|
631 |
|
632 } |
|
633 break; |
|
634 case EEventButtonDown: |
|
635 //Set length when pen down on backspace button |
|
636 iDataMgr->SetData(EAknFepDataTypeLengthWhenButtondownOnBack, |
|
637 iVkbWindow->CompositionFieldStringLength()); |
|
638 break; |
|
639 |
|
640 case EPeninputLayoutEventBack: |
|
641 case EVkbEventKeyEnter: |
|
642 case EVkbEventKeySpace: |
|
643 case EEventVirtualKeyUp: |
|
644 case EVkbEventLeftArrow: |
|
645 case EVkbEventRightArrow: |
|
646 case EVkbEventUpArrow: |
|
647 case EVkbEventDownArrow: |
|
648 if ( ! iUiStateMgr->CurrentUiState()->HandleControlEvent(aEventType,aEventData) ) |
|
649 { |
|
650 SendEventToVkbControl(aEventType,aCtrl,aEventData); |
|
651 } |
|
652 break; |
|
653 |
|
654 //case EVkbEventCandidatesChanged: // the event will be sent to control directly |
|
655 //case EEventControlFocusLost: // the event will be sent to control directly |
|
656 //case EVkbEventCompFieldAnalysisResponse: // the event will be sent to control directly |
|
657 //case EVkbEventCompFieldCursorChange: // no action |
|
658 // break; |
|
659 case EEventIcfPointerUpEvent: |
|
660 if(iDataMgr->RequestData( EAknFepDataTypeIMLayout ) != EAknFepVkbImNumber && |
|
661 iDataMgr->RequestData( EAknFepDataTypeIMLayout ) != EAknFepVkbImLatin) |
|
662 { |
|
663 // Clear trigger string when changing cursor position |
|
664 iDataMgr->ClearTriggerString(); |
|
665 } |
|
666 break; |
|
667 case EEventSetAppCursorSelection: |
|
668 iUiStateMgr->CurrentUiState()->HandleControlEvent(aEventType,aEventData); |
|
669 break; |
|
670 case EEventTooltipPointerUp: |
|
671 { |
|
672 // Signal to FEP to accept tooltip data |
|
673 SignalOwner( ESignalAcceptTooltip ); |
|
674 } |
|
675 break; |
|
676 case EEventPointerDownOnInline: |
|
677 { |
|
678 // show candidate list when tap on active words |
|
679 SignalOwner( ESignalShowCandidate ); |
|
680 } |
|
681 break; |
|
682 default: |
|
683 break; |
|
684 } |
|
685 } |
|
686 |
|
687 // --------------------------------------------------------------------------- |
|
688 // CAknFepVkbLayout::HandleShiftBtnClicked |
|
689 // (other items were commented in a header) |
|
690 // --------------------------------------------------------------------------- |
|
691 // |
|
692 void CAknFepVkbLayout::HandleMergedBtnClicked( TInt aCase ) |
|
693 { |
|
694 switch( aCase ) |
|
695 { |
|
696 case ECaseLower: |
|
697 { |
|
698 iVkbWindow->LoopVkbLayout(EVkbCapslock, ETrue); |
|
699 } |
|
700 break; |
|
701 case ECaseUpper: |
|
702 { |
|
703 iVkbWindow->LoopVkbLayout(EVkbShift, ETrue); |
|
704 } |
|
705 break; |
|
706 case ECaseText: |
|
707 // case ECaseInverseText: |
|
708 { |
|
709 // Current case is Text, equals shift button |
|
710 iVkbWindow->LoopVkbLayout(EVkbBoth, ETrue); |
|
711 } |
|
712 break; |
|
713 default: |
|
714 break; |
|
715 } |
|
716 |
|
717 } |
|
718 |
|
719 // --------------------------------------------------------------------------- |
|
720 // CAknFepVkbLayout::HandleRawKeyEventL |
|
721 // (other items were commented in a header). |
|
722 // --------------------------------------------------------------------------- |
|
723 // |
|
724 TBool CAknFepVkbLayout::HandleRawKeyEventL(const TRawEvent& aKeyEvent) |
|
725 { |
|
726 iVkbWindow->CloseAccentWindow(); |
|
727 return iUiStateMgr->CurrentUiState()->HandleKeyEventL(aKeyEvent); |
|
728 } |
|
729 |
|
730 // --------------------------------------------------------------------------- |
|
731 // CAknFepVkbLayout::SendEventToVkbControl |
|
732 // (other items were commented in a header). |
|
733 // --------------------------------------------------------------------------- |
|
734 // |
|
735 void CAknFepVkbLayout::SendEventToVkbControl(TInt aEventType, CFepUiBaseCtrl* aCtrl, |
|
736 const TDesC& aEventData) |
|
737 { |
|
738 iVkbWindow->HandleControlEvent(aEventType,aCtrl,aEventData); |
|
739 } |
|
740 |
|
741 // --------------------------------------------------------------------------- |
|
742 // CAknFepVkbLayout::Sendkey |
|
743 // (other items were commented in a header). |
|
744 // --------------------------------------------------------------------------- |
|
745 // |
|
746 void CAknFepVkbLayout::Sendkey(TInt aEventType,const TDesC& aEventData) |
|
747 { |
|
748 SignalOwner(aEventType,aEventData); |
|
749 } |
|
750 |
|
751 // --------------------------------------------------------------------------- |
|
752 // CAknFepVkbLayout::RequestData |
|
753 // (other items were commented in a header). |
|
754 // --------------------------------------------------------------------------- |
|
755 // |
|
756 TInt CAknFepVkbLayout::RequestData(TAknFepDataType aDataType) |
|
757 { |
|
758 return iDataMgr->RequestData(aDataType); |
|
759 } |
|
760 |
|
761 // --------------------------------------------------------------------------- |
|
762 // CAknFepVkbLayout::Reset |
|
763 // (other items were commented in a header). |
|
764 // --------------------------------------------------------------------------- |
|
765 // |
|
766 void CAknFepVkbLayout::Reset() |
|
767 { |
|
768 iDataMgr->Reset(); |
|
769 |
|
770 ForceEditGainFocus(EInputContextFieldGetFocus); |
|
771 |
|
772 SendEventToVkbControl(EVkbEventClearContent,iVkbWindow,KNullDesC16); |
|
773 |
|
774 SendEventToVkbControl(EVkbEventResetShiftCapslock,iVkbWindow,KNullDesC16); |
|
775 |
|
776 iNeedDealFocusGained = ETrue; |
|
777 |
|
778 } |
|
779 |
|
780 // --------------------------------------------------------------------------- |
|
781 // CAknFepVkbLayout::SetData |
|
782 // (other items were commented in a header). |
|
783 // --------------------------------------------------------------------------- |
|
784 // |
|
785 void CAknFepVkbLayout::SetData(TAknFepDataType aDataType,TInt aData) |
|
786 { |
|
787 iDataMgr->SetData(aDataType,aData); |
|
788 } |
|
789 |
|
790 // --------------------------------------------------------------------------- |
|
791 // CAknFepVkbLayout::SetData |
|
792 // (other items were commented in a header). |
|
793 // --------------------------------------------------------------------------- |
|
794 // |
|
795 TBool CAknFepVkbLayout::IsValidDestination(const TRect& aRect, |
|
796 CDragBar* aDragBar, |
|
797 TBool& aVInfo,TBool& aHInfo, |
|
798 TBool aFlag) |
|
799 { |
|
800 // Validate move button destination |
|
801 if (!aDragBar) |
|
802 { |
|
803 return EFalse; |
|
804 } |
|
805 TRect rect = aRect; |
|
806 |
|
807 if( aFlag ) |
|
808 {//layout is moving |
|
809 aHInfo = aVInfo = EFalse; |
|
810 TRect dragbarRect(aRect.iTl, aDragBar->Rect().Size()); |
|
811 |
|
812 if( dragbarRect.iTl.iX >=0 && dragbarRect.iBr.iX < ScreenSize().iWidth ) |
|
813 { |
|
814 aHInfo = ETrue; |
|
815 } |
|
816 |
|
817 if( dragbarRect.iTl.iY >=0 && dragbarRect.iBr.iY < ScreenSize().iHeight) |
|
818 { |
|
819 aVInfo = ETrue; |
|
820 } |
|
821 |
|
822 return aHInfo && aVInfo; |
|
823 } |
|
824 else |
|
825 { |
|
826 if (aDragBar) |
|
827 { |
|
828 rect.SetSize(aDragBar->Rect().Size()); |
|
829 } |
|
830 TBool tlInvalid = !Rect().Contains(rect.iTl); |
|
831 TBool brInvalid = !Rect().Contains(rect.iBr); |
|
832 |
|
833 if (tlInvalid && !brInvalid) |
|
834 { |
|
835 if (rect.iTl.iX >= Rect().iTl.iX && rect.iTl.iX <= Rect().iBr.iX) |
|
836 { |
|
837 aHInfo = ETrue; |
|
838 } |
|
839 else if (rect.iTl.iY >= Rect().iTl.iY && rect.iTl.iY <= Rect().iBr.iY) |
|
840 { |
|
841 aVInfo = ETrue; |
|
842 } |
|
843 } |
|
844 else if (!tlInvalid && brInvalid) |
|
845 { |
|
846 if (rect.iBr.iX >= Rect().iTl.iX && rect.iBr.iX <= Rect().iBr.iX) |
|
847 { |
|
848 aHInfo = ETrue; |
|
849 } |
|
850 else if (rect.iBr.iY >= Rect().iTl.iY && rect.iBr.iY <= Rect().iBr.iY) |
|
851 |
|
852 { |
|
853 aVInfo = ETrue; |
|
854 } |
|
855 } |
|
856 |
|
857 return !(tlInvalid || brInvalid); |
|
858 } |
|
859 } |
|
860 |
|
861 // --------------------------------------------------------------------------- |
|
862 // CAknFepVkbLayout::ChangeInputLanguage |
|
863 // (other items were commented in a header). |
|
864 // --------------------------------------------------------------------------- |
|
865 // |
|
866 void CAknFepVkbLayout::ChangeInputLanguage(TInt aLangID) |
|
867 { |
|
868 //1.Notify engine the language need to change |
|
869 //const TDesC& showText = iDataMgr->SetInputLanguage(aLangID); |
|
870 TInt switchDisplayLang = iDataMgr->SetInputLanguage(aLangID); |
|
871 TBuf<10> showText; |
|
872 AknPenInputUtils::GetISOLanguageCode(TLanguage(switchDisplayLang), showText); |
|
873 |
|
874 SendEventToVkbControl(EVkbEventLanguageChanged,NULL,showText); |
|
875 } |
|
876 |
|
877 // --------------------------------------------------------------------------- |
|
878 // CAknFepVkbLayout::SetCurrentRange |
|
879 // (other items were commented in a header). |
|
880 // --------------------------------------------------------------------------- |
|
881 // |
|
882 void CAknFepVkbLayout::SetCurrentRange(TInt aRange, TBool aNeedSave, TBool aNotify) |
|
883 { |
|
884 if ( aNeedSave && ( iDataMgr->PermittedRange() & ERangeEnglish ) |
|
885 && ( (aRange & ERangeNative) || (aRange & ERangeEnglish) ) ) |
|
886 { |
|
887 //save to CenRep |
|
888 iDataMgr->WriteLastUsedRange(aRange); |
|
889 } |
|
890 |
|
891 Reset(); |
|
892 |
|
893 iDataMgr->SetCurrentRange(aRange); |
|
894 iVkbWindow->ChangeImLayout(iDataMgr->IMLayout()); |
|
895 |
|
896 //iVkbWindow->SizeChanged(ETrue); |
|
897 if ( aRange == ERangeNative ) |
|
898 { |
|
899 iUiStateMgr->SetCurrentUiState(iUiStateMgr->UiStateStandbycn()); |
|
900 } |
|
901 else |
|
902 { |
|
903 iUiStateMgr->SetCurrentUiState(iUiStateMgr->UiStateStandby()); |
|
904 } |
|
905 |
|
906 if ( aNotify ) |
|
907 { |
|
908 TInt style = EVkbPositionChangeBrJustify; |
|
909 TBuf<KIntSizeToInt16> bufStyle; |
|
910 bufStyle = ( TUint16* )&style; |
|
911 |
|
912 SendEventToVkbControl(EVkbEventPositionChanged, NULL, bufStyle); |
|
913 } |
|
914 } |
|
915 |
|
916 // --------------------------------------------------------------------------- |
|
917 // CAknFepVkbLayout::HandleFocusGained |
|
918 // (other items were commented in a header). |
|
919 // --------------------------------------------------------------------------- |
|
920 // |
|
921 void CAknFepVkbLayout::HandleFocusGained(CFepUiBaseCtrl* aCtrl, const TDesC& aEventData) |
|
922 { |
|
923 if ( !iNeedDealFocusGained || !iVkbWindow ) |
|
924 { |
|
925 return; |
|
926 } |
|
927 |
|
928 SendEventToVkbControl(EEventControlFocusGained,aCtrl,aEventData); |
|
929 |
|
930 // Change current state machine |
|
931 if ( iDataMgr->CurrentRange() == ERangeNative ) |
|
932 { |
|
933 if ( iVkbWindow->FocusedControlID() == EPeninputWindowCtrlIdMultiLineICF ) |
|
934 { |
|
935 if ( iVkbWindow->CompositionFieldStringLength() ) |
|
936 { |
|
937 iUiStateMgr->SetCurrentUiState(iUiStateMgr->UiStateStandbycnWithChars()); |
|
938 } |
|
939 else |
|
940 { |
|
941 iUiStateMgr->SetCurrentUiState(iUiStateMgr->UiStateStandbycn()); |
|
942 } |
|
943 } |
|
944 else if ( iVkbWindow->FocusedControlID() == EAknFepVkbCtrlIdCompositionField ) |
|
945 { |
|
946 if ( iVkbWindow->CompositionFieldStringLength() ) |
|
947 { |
|
948 iUiStateMgr->SetCurrentUiState(iUiStateMgr->UiStateCompositionWithChars()); |
|
949 } |
|
950 else |
|
951 { |
|
952 iUiStateMgr->SetCurrentUiState(iUiStateMgr->UiStateCompositionNoChars()); |
|
953 } |
|
954 } |
|
955 } |
|
956 } |
|
957 |
|
958 // --------------------------------------------------------------------------- |
|
959 // CAknFepVkbLayout::ForceEditGainFocus |
|
960 // (other items were commented in a header). |
|
961 // --------------------------------------------------------------------------- |
|
962 // |
|
963 void CAknFepVkbLayout::ForceEditGainFocus(TInt aWhichEdit) |
|
964 { |
|
965 TBuf<KIntSizeToInt16> data; |
|
966 iNeedDealFocusGained = EFalse;//to avoid focus gain loop |
|
967 data = (TUint16*) &aWhichEdit; |
|
968 SendEventToVkbControl(EEventControlFocusGained,NULL,data); |
|
969 iNeedDealFocusGained = ETrue; //reset the flag |
|
970 } |
|
971 |
|
972 // --------------------------------------------------------------------------- |
|
973 // CAknFepVkbLayout::CompositionFieldStringLength |
|
974 // (other items were commented in a header). |
|
975 // --------------------------------------------------------------------------- |
|
976 // |
|
977 TInt CAknFepVkbLayout::CompositionFieldStringLength() |
|
978 { |
|
979 return iVkbWindow->CompositionFieldStringLength(); |
|
980 } |
|
981 |
|
982 // --------------------------------------------------------------------------- |
|
983 // CAknFepVkbLayout::GetCandidatesL |
|
984 // (other items were commented in a header). |
|
985 // --------------------------------------------------------------------------- |
|
986 // |
|
987 TInt CAknFepVkbLayout::GetCandidatesL(const TDesC& aInputString, |
|
988 const TBool aIsPredictive, |
|
989 TBool aForNextPage) |
|
990 { |
|
991 return iDataMgr->GetCandidatesL(aInputString, aIsPredictive, aForNextPage); |
|
992 } |
|
993 |
|
994 // --------------------------------------------------------------------------- |
|
995 // CAknFepVkbLayout::ClearTriggerString |
|
996 // (other items were commented in a header). |
|
997 // --------------------------------------------------------------------------- |
|
998 // |
|
999 void CAknFepVkbLayout::ClearTriggerString() |
|
1000 { |
|
1001 iDataMgr->ClearTriggerString(); |
|
1002 } |
|
1003 |
|
1004 // --------------------------------------------------------------------------- |
|
1005 // CAknFepVkbLayout::DoCaseChange |
|
1006 // (other items were commented in a header). |
|
1007 // --------------------------------------------------------------------------- |
|
1008 // |
|
1009 void CAknFepVkbLayout::DoCaseChange(TInt aCase) |
|
1010 { |
|
1011 TInt curCase = iDataMgr->Case(); |
|
1012 |
|
1013 if ( curCase == aCase ) |
|
1014 { |
|
1015 return; |
|
1016 } |
|
1017 |
|
1018 iDataMgr->SetCase(aCase); |
|
1019 |
|
1020 if ( ( iDataMgr->CurrentRange() == ERangeEnglish ) || |
|
1021 ( iDataMgr->CurrentRange() == ERangeAccent ) ) |
|
1022 { |
|
1023 switch (aCase) |
|
1024 { |
|
1025 case ECaseUpper: |
|
1026 iDataMgr->SetShiftDown(EFalse); |
|
1027 iDataMgr->SetCapslockDown(ETrue); |
|
1028 break; |
|
1029 case ECaseLower: |
|
1030 iDataMgr->SetShiftDown(EFalse); |
|
1031 iDataMgr->SetCapslockDown(EFalse); |
|
1032 break; |
|
1033 case ECaseText: |
|
1034 iDataMgr->SetShiftDown(ETrue); |
|
1035 iDataMgr->SetCapslockDown(EFalse); |
|
1036 break; |
|
1037 case ECaseInverseText: |
|
1038 iDataMgr->SetShiftDown(ETrue); |
|
1039 iDataMgr->SetCapslockDown(ETrue); |
|
1040 break; |
|
1041 default: |
|
1042 return; |
|
1043 } |
|
1044 |
|
1045 iVkbWindow->LoopVkbLayout(EVkbNone, EFalse); |
|
1046 } |
|
1047 else |
|
1048 { |
|
1049 iDataMgr->SetCase(ECaseInvalide); |
|
1050 } |
|
1051 } |
|
1052 |
|
1053 // --------------------------------------------------------------------------- |
|
1054 // CAknFepVkbLayout::PenInputUiType |
|
1055 // return current input UI type |
|
1056 // (other items were commented in a header). |
|
1057 // --------------------------------------------------------------------------- |
|
1058 // |
|
1059 TInt CAknFepVkbLayout::PenInputType() |
|
1060 { |
|
1061 return iLayoutType; |
|
1062 } |
|
1063 |
|
1064 void CAknFepVkbLayout::SetPositionFromOutside(const TPoint& aNewPos) |
|
1065 { |
|
1066 SetLayoutPos(aNewPos); |
|
1067 TInt x = 0x0000FFFF & aNewPos.iX; |
|
1068 TInt y = 0xFFFF0000 & ( aNewPos.iY << 16 ); |
|
1069 |
|
1070 return SetData( EAknFepDataTypeWindowPosition, x | y ); |
|
1071 } |
|
1072 |
|
1073 // --------------------------------------------------------------------------- |
|
1074 // CAknFepVkbLayout::Window |
|
1075 // return window |
|
1076 // (other items were commented in a header). |
|
1077 // --------------------------------------------------------------------------- |
|
1078 // |
|
1079 CAknFepVkbWindow* CAknFepVkbLayout::Window() const |
|
1080 { |
|
1081 return iVkbWindow; |
|
1082 } |
|
1083 |
|
1084 // --------------------------------------------------------------------------- |
|
1085 // CPeninputGenericVkbLayout::SemiTransparencyRequired |
|
1086 // . |
|
1087 // --------------------------------------------------------------------------- |
|
1088 // |
|
1089 TBool CAknFepVkbLayout::SemiTransparencyRequired() |
|
1090 { |
|
1091 return ETrue; |
|
1092 } |
|
1093 |
|
1094 // --------------------------------------------------------------------------- |
|
1095 // CAknFepVkbLayout::HandleAppInfoChange |
|
1096 // . |
|
1097 // --------------------------------------------------------------------------- |
|
1098 // |
|
1099 void CAknFepVkbLayout::HandleAppInfoChange(const TDesC& aInfo, |
|
1100 TPeninputAppInfo aType) |
|
1101 { |
|
1102 if ( iVkbWindow ) |
|
1103 { |
|
1104 CFepLayoutMultiLineIcf* icf = static_cast<CFepLayoutMultiLineIcf*> |
|
1105 (iVkbWindow->Control(EPeninputWindowCtrlIdMultiLineICF)) ; |
|
1106 |
|
1107 if ( icf && ( aType == EAppIndicatorMsg ) && (iLayoutType == EPluginInputModeFSQ) ) |
|
1108 { |
|
1109 if ( aInfo.Length() > 0 ) |
|
1110 { |
|
1111 icf->ShowBubble(aInfo,icf->MsgBubbleCtrl()->Rect()); |
|
1112 } |
|
1113 else |
|
1114 { |
|
1115 icf->HideBubble(); |
|
1116 } |
|
1117 } |
|
1118 } |
|
1119 } |
|
1120 |
|
1121 // --------------------------------------------------------------------------- |
|
1122 // Handle show tooltip command. |
|
1123 // --------------------------------------------------------------------------- |
|
1124 // |
|
1125 void CAknFepVkbLayout::HandleShowTooltipOnFSQCmdL( TUint8* aData ) |
|
1126 { |
|
1127 if ( !iITIEnabled || iLayoutType != EPluginInputModeFSQ ) |
|
1128 { |
|
1129 return; |
|
1130 } |
|
1131 |
|
1132 TPtr8 buf8( aData, sizeof(TInt32), sizeof(TInt32) ); |
|
1133 RDesReadStream readStream; |
|
1134 readStream.Open( buf8 ); |
|
1135 CleanupClosePushL( readStream ); |
|
1136 TInt dataSize = readStream.ReadInt32L(); |
|
1137 CleanupStack::PopAndDestroy( &readStream ); |
|
1138 if ( dataSize > 0 ) |
|
1139 { |
|
1140 TUint16* dataAddress = (TUint16*)( aData + sizeof(TInt32) ); |
|
1141 HBufC* tooltipText = ReadTextInfoHBufCL( dataAddress, |
|
1142 ( dataSize + 1 )/ 2 ); |
|
1143 if ( tooltipText ) |
|
1144 { |
|
1145 CleanupStack::PushL( tooltipText ); |
|
1146 iVkbWindow->ShowTooltipOnFSQL( *tooltipText ); |
|
1147 CleanupStack::PopAndDestroy( tooltipText ); |
|
1148 } |
|
1149 } |
|
1150 } |
|
1151 |
|
1152 // --------------------------------------------------------------------------- |
|
1153 // Handle show candidate list command. |
|
1154 // --------------------------------------------------------------------------- |
|
1155 // |
|
1156 void CAknFepVkbLayout::HandleShowCandidateListOnFSQCmdL( TUint8* aData ) |
|
1157 { |
|
1158 if ( !iITIEnabled || iLayoutType != EPluginInputModeFSQ ) |
|
1159 { |
|
1160 return; |
|
1161 } |
|
1162 |
|
1163 // Read candidate data from a block of memory staring from aData |
|
1164 // The format is activeIndex | count of candiates | |
|
1165 // length 1 | text 1 | length 2 | text 2 |... |
|
1166 TPtr8 buf8( aData, sizeof( TInt32 )*2, sizeof( TInt32 )*2 ); |
|
1167 RDesReadStream readStream; |
|
1168 readStream.Open( buf8 ); |
|
1169 CleanupClosePushL( readStream ); |
|
1170 // Get activeIndex |
|
1171 TInt activeIndex = readStream.ReadInt32L(); |
|
1172 // Get count of candidates |
|
1173 TInt count = readStream.ReadInt32L(); |
|
1174 CleanupStack::PopAndDestroy( &readStream ); |
|
1175 |
|
1176 CDesCArray* itemArray = NULL; |
|
1177 if ( count > 0 ) |
|
1178 { |
|
1179 TUint8* curPointer = aData + sizeof(TInt) * 2; |
|
1180 itemArray = new (ELeave) CDesCArrayFlat( count ); |
|
1181 CleanupStack::PushL( itemArray ); |
|
1182 for ( TInt i = 0; i < count; i++ ) |
|
1183 { |
|
1184 // Get length |
|
1185 buf8.Set( curPointer, sizeof( TInt32 ), sizeof( TInt32 ) ); |
|
1186 readStream.Open( buf8 ); |
|
1187 CleanupClosePushL( readStream ); |
|
1188 TInt32 textSize = 0; |
|
1189 textSize = readStream.ReadInt32L(); |
|
1190 CleanupStack::PopAndDestroy( &readStream ); |
|
1191 if ( textSize > 0 ) |
|
1192 { |
|
1193 // Get text |
|
1194 curPointer += sizeof( TInt32 ); |
|
1195 HBufC* itemText = ReadTextInfoHBufCL |
|
1196 ( (TUint16*)curPointer, |
|
1197 ( textSize + 1 )/ 2 ); |
|
1198 if ( itemText ) |
|
1199 { |
|
1200 CleanupStack::PushL( itemText ); |
|
1201 itemArray->AppendL( *itemText ); |
|
1202 CleanupStack::PopAndDestroy( itemText ); |
|
1203 } |
|
1204 curPointer += textSize; |
|
1205 } |
|
1206 } |
|
1207 |
|
1208 iVkbWindow->ShowCandidateListOnFSQL( itemArray, activeIndex ); |
|
1209 CleanupStack::PopAndDestroy( itemArray ); |
|
1210 } |
|
1211 } |
|
1212 |
|
1213 // --------------------------------------------------------------------------- |
|
1214 // Handle show candidate list command. |
|
1215 // --------------------------------------------------------------------------- |
|
1216 // |
|
1217 HBufC* CAknFepVkbLayout::ReadTextInfoHBufCL( const TUint16* aStartPtr, |
|
1218 TInt aLength ) |
|
1219 { |
|
1220 HBufC* itemText = NULL; |
|
1221 if ( aLength > 0 ) |
|
1222 { |
|
1223 itemText = HBufC::NewLC( aLength ); |
|
1224 TPtr itemTextPtr = itemText->Des(); |
|
1225 itemTextPtr.Copy( aStartPtr, aLength ); |
|
1226 CleanupStack::Pop( itemText ); |
|
1227 } |
|
1228 return itemText; |
|
1229 } |
|
1230 // End Of File |