author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Wed, 13 Oct 2010 14:55:58 +0300 | |
branch | RCL_3 |
changeset 56 | 8152b1f1763a |
parent 50 | 5a1685599b76 |
permissions | -rw-r--r-- |
44 | 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: generic 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 <peninputcommonlayoutglobalenum.h> |
|
27 |
#include <coemain.h> |
|
28 |
#include <peninputlayoutbubblectrl.h> |
|
29 |
#include <peninputlayoutmultilineicf.h> |
|
30 |
#include <peninputscrollablelist.h> |
|
31 |
#include <s32mem.h> |
|
32 |
||
33 |
// User includes |
|
34 |
#include "peninputgenericvkb.hrh" |
|
35 |
#include "peninputuistatemgrinterface.h" |
|
36 |
#include "peninputgenericvkblayout.h" |
|
37 |
#include "peninputgenericvkbwindow.h" |
|
38 |
#include "peninputgenericvkbdatamgr.h" |
|
39 |
#include "peninputgenericvkbuistatestandby.h" |
|
40 |
#include "peninputgenericvkbuistatepopup.h" |
|
41 |
#include "peninputdataconverter.h" |
|
42 |
||
43 |
const TInt KPeriodicTimerIntervalSec(2500000); |
|
44 |
// ======== MEMBER FUNCTIONS ======== |
|
45 |
const TInt KNumberOfDottedChar = 16; |
|
46 |
const TUint16 thaiUnicodeOri[KNumberOfDottedChar] = {0x0E31,0x0E33,0x0E34,0x0E35,0x0E36,0x0E37,0x0E38,0x0E39, |
|
47 |
0x0E3A,0x0E47,0x0E48,0x0E49,0x0E4A,0x0E4B,0x0E4C,0x0E4D}; |
|
48 |
const TUint16 thaiUnicodeNew[KNumberOfDottedChar] = {0xF731,0xF733,0xF734,0xF735,0xF736,0xF737,0xF738,0xF739, |
|
49 |
0xF73A,0xF747,0xF748,0xF749,0xF74A,0xF74B,0xF74C,0xF74D}; |
|
50 |
||
51 |
const TInt KNumberOfMirrorChar = 6; |
|
52 |
const TUint16 mirrorUnicode[KNumberOfMirrorChar] = {0x0029,0x005D,0x003E,0x003C,0x005B,0x0028}; |
|
53 |
||
54 |
_LIT(KDisplaySpace, "\x0020"); |
|
55 |
_LIT(KEmptyString, ""); |
|
56 |
||
57 |
// --------------------------------------------------------------------------- |
|
58 |
// CPeninputGenericVkbLayoutImp::NewL |
|
59 |
// (other items were commented in a header) |
|
60 |
// --------------------------------------------------------------------------- |
|
61 |
// |
|
62 |
CPeninputGenericVkbLayoutImp* CPeninputGenericVkbLayoutImp::NewL( |
|
63 |
TAny* /*aInitParams*/ ) |
|
64 |
{ |
|
65 |
CPeninputGenericVkbLayoutImp* self = new ( ELeave ) |
|
66 |
CPeninputGenericVkbLayoutImp(); |
|
67 |
CleanupStack::PushL( self ); |
|
68 |
self->Construct( EFalse ); |
|
69 |
CleanupStack::Pop( self ); |
|
70 |
||
71 |
return self; |
|
72 |
} |
|
73 |
||
74 |
// --------------------------------------------------------------------------- |
|
75 |
// CPeninputGenericVkbLayoutImp::NewFsqL |
|
76 |
// Entry point for landscape FSQ. |
|
77 |
// --------------------------------------------------------------------------- |
|
78 |
// |
|
79 |
CPeninputGenericVkbLayoutImp* CPeninputGenericVkbLayoutImp::NewFsqL( |
|
80 |
TAny* /*aInitParams*/ ) |
|
81 |
{ |
|
82 |
CPeninputGenericVkbLayoutImp* self = new ( ELeave ) |
|
83 |
CPeninputGenericVkbLayoutImp(); |
|
84 |
CleanupStack::PushL( self ); |
|
85 |
self->Construct( ETrue ); |
|
86 |
CleanupStack::Pop( self ); |
|
87 |
||
88 |
return self; |
|
89 |
} |
|
90 |
||
91 |
// --------------------------------------------------------------------------- |
|
92 |
// CPeninputGenericVkbLayoutImp::NewPrtFsqL |
|
93 |
// Entry point for portrait FSQ. |
|
94 |
// --------------------------------------------------------------------------- |
|
95 |
// |
|
96 |
CPeninputGenericVkbLayoutImp* CPeninputGenericVkbLayoutImp::NewPrtFsqL( |
|
97 |
TAny* /*aInitParams*/ ) |
|
98 |
{ |
|
99 |
CPeninputGenericVkbLayoutImp* self = new ( ELeave ) |
|
100 |
CPeninputGenericVkbLayoutImp(); |
|
101 |
CleanupStack::PushL( self ); |
|
102 |
self->Construct( ETrue ); |
|
103 |
CleanupStack::Pop( self ); |
|
104 |
||
105 |
return self; |
|
106 |
} |
|
107 |
||
108 |
// --------------------------------------------------------------------------- |
|
109 |
// CPeninputGenericVkbLayoutImp::~CPeninputGenericVkbLayoutImp |
|
110 |
// (other items were commented in a header) |
|
111 |
// --------------------------------------------------------------------------- |
|
112 |
// |
|
113 |
CPeninputGenericVkbLayoutImp::~CPeninputGenericVkbLayoutImp() |
|
114 |
{ |
|
115 |
} |
|
116 |
||
117 |
// --------------------------------------------------------------------------- |
|
118 |
// CPeninputGenericVkbLayoutImp::CPeninputGenericVkbLayoutImp |
|
119 |
// (other items were commented in a header) |
|
120 |
// --------------------------------------------------------------------------- |
|
121 |
// |
|
122 |
CPeninputGenericVkbLayoutImp::CPeninputGenericVkbLayoutImp() |
|
123 |
{ |
|
124 |
} |
|
125 |
||
126 |
// --------------------------------------------------------------------------- |
|
127 |
// CPeninputGenericVkbLayoutImp::ConstructL |
|
128 |
// (other items were commented in a header) |
|
129 |
// --------------------------------------------------------------------------- |
|
130 |
// |
|
131 |
void CPeninputGenericVkbLayoutImp::Construct( TBool aIsFsq ) |
|
132 |
{ |
|
133 |
iIsFsq = aIsFsq; |
|
134 |
} |
|
135 |
||
136 |
// --------------------------------------------------------------------------- |
|
137 |
// CPeninputGenericVkbLayoutImp::CreateFepUiLayoutL |
|
138 |
// (other items were commented in a header) |
|
139 |
// --------------------------------------------------------------------------- |
|
140 |
// |
|
141 |
CFepUiLayout* CPeninputGenericVkbLayoutImp::CreateFepUiLayoutL( |
|
142 |
MLayoutOwner* aLayoutOwner, const TAny* aData ) |
|
143 |
{ |
|
144 |
CPeninputGenericVkbLayout* uiLayout = |
|
145 |
CPeninputGenericVkbLayout::NewL( aLayoutOwner, aData, iIsFsq ); |
|
146 |
||
147 |
return uiLayout; |
|
148 |
} |
|
149 |
||
150 |
// --------------------------------------------------------------------------- |
|
151 |
// CPeninputGenericVkbLayout::NewL |
|
152 |
// (other items were commented in a header) |
|
153 |
// --------------------------------------------------------------------------- |
|
154 |
// |
|
155 |
CPeninputGenericVkbLayout* CPeninputGenericVkbLayout::NewL( |
|
156 |
MLayoutOwner* aLayoutOwner, const TAny* aInitData, TBool aIsFsq ) |
|
157 |
{ |
|
158 |
CPeninputGenericVkbLayout* self = |
|
159 |
new (ELeave) CPeninputGenericVkbLayout( aLayoutOwner ); |
|
160 |
CleanupStack::PushL( self ); |
|
161 |
self->ConstructL( aInitData, aIsFsq ); |
|
162 |
CleanupStack::Pop( self ); |
|
163 |
||
164 |
return self; |
|
165 |
} |
|
166 |
||
167 |
// --------------------------------------------------------------------------- |
|
168 |
// CPeninputGenericVkbLayout::CPeninputGenericVkbLayout |
|
169 |
// (other items were commented in a header) |
|
170 |
// --------------------------------------------------------------------------- |
|
171 |
// |
|
172 |
CPeninputGenericVkbLayout::CPeninputGenericVkbLayout( MLayoutOwner* aLayoutOwner ) |
|
173 |
: CPeninputCommonLayoutExt( aLayoutOwner ), iLayoutType( EPluginInputModeVkb ) |
|
174 |
{ |
|
175 |
iInEditWordQueryDlg = EFalse; |
|
176 |
} |
|
177 |
||
178 |
// --------------------------------------------------------------------------- |
|
179 |
// CPeninputGenericVkbLayout::~CPeninputGenericVkbLayout |
|
180 |
// (other items were commented in a header) |
|
181 |
// --------------------------------------------------------------------------- |
|
182 |
// |
|
183 |
CPeninputGenericVkbLayout::~CPeninputGenericVkbLayout() |
|
184 |
{ |
|
185 |
if (iInfoTimer) |
|
186 |
{ |
|
187 |
iInfoTimer->Cancel(); |
|
188 |
} |
|
189 |
delete iInfoTimer; |
|
190 |
} |
|
191 |
||
192 |
// --------------------------------------------------------------------------- |
|
193 |
// CPeninputGenericVkbLayout::ConstructL |
|
194 |
// (other items were commented in a header) |
|
195 |
// --------------------------------------------------------------------------- |
|
196 |
// |
|
197 |
void CPeninputGenericVkbLayout::ConstructL( const TAny* aInitData, TBool aIsFsq ) |
|
198 |
{ |
|
199 |
// must set layout type first |
|
200 |
iLayoutType = aIsFsq ? EPluginInputModeFSQ : EPluginInputModeVkb; |
|
201 |
||
202 |
CPeninputCommonLayoutExt::ConstructL( aInitData ); |
|
203 |
||
204 |
CPeninputUiStateBase* initialState = |
|
205 |
CPeninputUiStateBase::NewL( UiStateMgr(), this ); |
|
206 |
CPeninputUiStateVkbStandby* standbyState = |
|
207 |
CPeninputUiStateVkbStandby::NewL( UiStateMgr(), this ); |
|
208 |
CPeninputUiStateVkbPopup* popupState = |
|
209 |
CPeninputUiStateVkbPopup::NewL( UiStateMgr(), this ); |
|
210 |
||
211 |
UiStateMgr()->AddUiState( initialState, EPeninputVkbUiStateNone ); |
|
212 |
UiStateMgr()->AddUiState( standbyState, EPeninputVkbUiStateStandby ); |
|
213 |
UiStateMgr()->AddUiState( popupState, EPeninputVkbUiStatePopup ); |
|
214 |
UiStateMgr()->SetCurrentUiState( initialState ); |
|
215 |
iInfoTimer = CPeriodic::NewL(CActive::EPriorityStandard); |
|
216 |
} |
|
217 |
||
218 |
// --------------------------------------------------------------------------- |
|
219 |
// CPeninputGenericVkbLayout::HandleCommand |
|
220 |
// (other items were commented in a header) |
|
221 |
// --------------------------------------------------------------------------- |
|
222 |
// |
|
223 |
TInt CPeninputGenericVkbLayout::HandleCommand( TInt aCmd, TUint8* aData ) |
|
224 |
{ |
|
225 |
CPeninputCommonLayoutExt::HandleCommand( aCmd, aData ); |
|
226 |
CPeninputGenericVkbWindow* vkbWindow = |
|
227 |
static_cast<CPeninputGenericVkbWindow*>(iLayoutWindow); |
|
228 |
switch ( aCmd ) |
|
229 |
{ |
|
230 |
case ECmdPenInputWindowOpen: |
|
231 |
{ |
|
232 |
UiStateMgr()->SetCurrentUiState( EPeninputVkbUiStateStandby ); |
|
233 |
} |
|
234 |
break; |
|
235 |
case ECmdPenInputWindowClose: |
|
236 |
{ |
|
237 |
vkbWindow->UnLatchDeadKey(); |
|
238 |
UiStateMgr()->SetCurrentUiState( EPeninputVkbUiStateNone ); |
|
239 |
||
240 |
// For Addition of ITI features on FSQ |
|
241 |
// Close tooltip and candidate list |
|
242 |
vkbWindow->HideTooltip(); |
|
243 |
vkbWindow->HideCandidateList(); |
|
244 |
} |
|
245 |
break; |
|
246 |
case ECmdPenInputLanguage: |
|
247 |
{ |
|
248 |
iDataMgr->SetData( EPeninputDataTypeInputLanguage, aData ); |
|
249 |
vkbWindow->SetSwitchlistLanguage(*aData); |
|
250 |
vkbWindow->SetDeadKey(); |
|
251 |
if ( iLayoutType == EPluginInputModeFSQ ) |
|
252 |
{ |
|
253 |
TRAP_IGNORE(vkbWindow->ConstructFSQAccentListL( *aData )); |
|
254 |
TRAP_IGNORE(vkbWindow->ConstructRangeLabelListL( *aData )); |
|
255 |
} |
|
256 |
else |
|
257 |
{ |
|
258 |
TRAP_IGNORE(vkbWindow->ConstructAccentListL(*aData)); |
|
259 |
} |
|
260 |
} |
|
261 |
break; |
|
262 |
case ECmdPenInputRange: |
|
263 |
{ |
|
264 |
if ( iLayoutType == EPluginInputModeFSQ ) |
|
265 |
{ |
|
266 |
TRAP_IGNORE( vkbWindow->UpdateRangeCtrlsL()); |
|
267 |
} |
|
268 |
} |
|
269 |
break; |
|
270 |
case ECmdPenInputIsSecretText: |
|
271 |
{ |
|
272 |
vkbWindow->SetSwitchlistSecretFlag(*aData); |
|
273 |
} |
|
274 |
break; |
|
275 |
case ECmdPenInputDimArrowKeys: |
|
276 |
{ |
|
277 |
TBool IsDimArrowKeys = *aData; |
|
278 |
vkbWindow->DimArrowKeys( IsDimArrowKeys ); |
|
279 |
} |
|
280 |
break; |
|
56
8152b1f1763a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
50
diff
changeset
|
281 |
case ECmdPeninputVietSyncToneMarker: |
8152b1f1763a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
50
diff
changeset
|
282 |
{ |
8152b1f1763a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
50
diff
changeset
|
283 |
TBool bDimToneMarker = *aData; |
8152b1f1763a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
50
diff
changeset
|
284 |
vkbWindow->EnableToneMarker(bDimToneMarker); |
8152b1f1763a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
50
diff
changeset
|
285 |
} |
8152b1f1763a
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
50
diff
changeset
|
286 |
break; |
44 | 287 |
case ECmdPenInputDimEnterKey: |
288 |
{ |
|
289 |
TBool isDimEnterKey = *((TUint16*)( aData )); |
|
290 |
vkbWindow->DimEnterKey( isDimEnterKey ); |
|
291 |
} |
|
292 |
break; |
|
293 |
case ECmdPenInputSetPromptText: |
|
294 |
{ |
|
295 |
if ( iLayoutType == EPluginInputModeFSQ ) |
|
296 |
TRAP_IGNORE(vkbWindow->SetPromptTextL(aData)); |
|
297 |
} |
|
298 |
break; |
|
299 |
case ECmdPenInputCharacterPreview: |
|
300 |
{ |
|
301 |
vkbWindow->ShowBubble(*aData); |
|
302 |
} |
|
303 |
break; |
|
304 |
case ECmdPenInputInEditWordQueryDlg: |
|
305 |
{ |
|
306 |
iInEditWordQueryDlg = *aData; |
|
307 |
} |
|
308 |
break; |
|
309 |
case ECmdPenInputPopupTooltip: |
|
310 |
{ |
|
311 |
TRAP_IGNORE( HandleShowTooltipCmdL( aData ) ); |
|
312 |
} |
|
313 |
break; |
|
314 |
case ECmdPenInputHideTooltip: |
|
315 |
{ |
|
316 |
vkbWindow->HideTooltip(); |
|
317 |
} |
|
318 |
break; |
|
319 |
case ECmdPenInputPopupCandidateList: |
|
320 |
{ |
|
321 |
TRAP_IGNORE( HandleShowCandidateListCmdL( aData ) ); |
|
322 |
} |
|
323 |
break; |
|
324 |
case ECmdPenInputHideCandidateList: |
|
325 |
{ |
|
326 |
vkbWindow->HideCandidateList(); |
|
327 |
} |
|
328 |
break; |
|
329 |
case ECmdPeninputITIStatus: |
|
330 |
{ |
|
331 |
// Set the flag to indicate if FSQ with ITI feature is opened |
|
332 |
iITIEnabled = CPeninputDataConverter::AnyToInt( aData ); |
|
333 |
} |
|
334 |
break; |
|
335 |
case ECmdPenInputFingerMatchIndicator: |
|
336 |
{ |
|
337 |
if ( iLayoutType == EPluginInputModeFSQ ) |
|
338 |
{ |
|
339 |
TRAP_IGNORE( vkbWindow->UpdateIndiBubbleL( aData )); |
|
340 |
} |
|
341 |
} |
|
342 |
break; |
|
343 |
default: |
|
344 |
{ |
|
345 |
} |
|
346 |
break; |
|
347 |
} |
|
348 |
||
349 |
return KErrNone; |
|
350 |
} |
|
351 |
||
352 |
||
353 |
// --------------------------------------------------------------------------- |
|
354 |
// CPeninputGenericVkbLayout::HandleControlEvent |
|
355 |
// (other items were commented in a header) |
|
356 |
// --------------------------------------------------------------------------- |
|
357 |
// |
|
358 |
void CPeninputGenericVkbLayout::HandleControlEvent( |
|
359 |
TInt aEventType, CFepUiBaseCtrl* aCtrl, const TDesC& aEventData ) |
|
360 |
{ |
|
361 |
switch ( aEventType ) |
|
362 |
{ |
|
363 |
case EEventVirtualKeyUp: |
|
364 |
{ |
|
365 |
TRAP_IGNORE(HandleVirtualKeyUpL(aEventType, aCtrl, aEventData)); |
|
366 |
} |
|
367 |
break; |
|
368 |
case EEventTooltipPointerUp: |
|
369 |
{ |
|
370 |
// Signal to FEP to accept tooltip data |
|
371 |
SignalOwner( ESignalAcceptTooltip ); |
|
372 |
} |
|
373 |
break; |
|
374 |
case EEventPointerDownOnInline: |
|
375 |
{ |
|
376 |
// add by jiawenjuan |
|
377 |
// show candidate list when tap on active words |
|
378 |
SignalOwner(ESignalShowCandidate ); |
|
379 |
} |
|
380 |
break; |
|
381 |
case EEventInsertSpace: |
|
382 |
{ |
|
383 |
SignalOwner(ESignalKeyEvent, KDisplaySpace); |
|
384 |
} |
|
385 |
break; |
|
386 |
default: |
|
387 |
{ |
|
388 |
CPeninputCommonLayoutExt::HandleControlEvent(aEventType, aCtrl, aEventData); |
|
389 |
} |
|
390 |
break; |
|
391 |
} |
|
392 |
} |
|
393 |
||
394 |
// --------------------------------------------------------------------------- |
|
395 |
// CPeninputGenericVkbLayout::CreateLayoutWindowL |
|
396 |
// (other items were commented in a header) |
|
397 |
// --------------------------------------------------------------------------- |
|
398 |
// |
|
399 |
void CPeninputGenericVkbLayout::CreateLayoutWindowL() |
|
400 |
{ |
|
401 |
iLayoutWindow = CPeninputGenericVkbWindow::NewL( this, this, UiStateMgr() ); |
|
402 |
} |
|
403 |
||
404 |
// --------------------------------------------------------------------------- |
|
405 |
// CPeninputGenericVkbLayout::CreateDataMgrL |
|
406 |
// (other items were commented in a header) |
|
407 |
// --------------------------------------------------------------------------- |
|
408 |
// |
|
409 |
void CPeninputGenericVkbLayout::CreateDataMgrL( const TAny* /*aInitData*/ ) |
|
410 |
{ |
|
411 |
iDataMgr = CPeninputGenericVkbDataMgr::NewL( this ); |
|
412 |
} |
|
413 |
||
414 |
// --------------------------------------------------------------------------- |
|
415 |
// CPeninputGenericVkbLayout::LayoutType |
|
416 |
// (other items were commented in a header) |
|
417 |
// --------------------------------------------------------------------------- |
|
418 |
// |
|
419 |
TInt CPeninputGenericVkbLayout::LayoutType() |
|
420 |
{ |
|
421 |
return iLayoutType; |
|
422 |
} |
|
423 |
TInt CPeninputGenericVkbLayout::SizeChanged( const TAny* aData ) |
|
424 |
{ |
|
425 |
//(( CPeninputGenericVkbWindow*)iLayoutWindow)->UpdateLafData(); |
|
426 |
return CPeninputCommonLayoutExt::SizeChanged( aData ); |
|
427 |
} |
|
428 |
void CPeninputGenericVkbLayout::HandleAppInfoChange(const TDesC& aInfo, |
|
429 |
TPeninputAppInfo aType) |
|
430 |
{ |
|
431 |
if ( LayoutWindow() ) |
|
432 |
{ |
|
433 |
CFepLayoutMultiLineIcf* icf = static_cast<CFepLayoutMultiLineIcf*> |
|
434 |
(LayoutWindow()->Control(EPeninputWindowCtrlIdMultiLineICF)) ; |
|
435 |
||
436 |
if ( icf && ( aType == EAppIndicatorMsg ) && (iLayoutType == EPluginInputModeFSQ) ) |
|
437 |
{ |
|
438 |
if ( aInfo.Length() > 0 && !iInEditWordQueryDlg) |
|
439 |
{ |
|
440 |
//icf->HideBubble(); |
|
441 |
CPeninputGenericVkbWindow* vkbWindow = |
|
442 |
static_cast<CPeninputGenericVkbWindow*>(iLayoutWindow); |
|
443 |
vkbWindow->SetIndiWithTextFlag( ETrue ); |
|
444 |
vkbWindow->IndiBubbleWithText(); |
|
445 |
icf->ShowBubble(aInfo,icf->MsgBubbleCtrl()->Rect()); |
|
446 |
} |
|
447 |
else |
|
448 |
{ |
|
449 |
//icf->HideBubble(); |
|
450 |
CPeninputGenericVkbWindow* vkbWindow = |
|
451 |
static_cast<CPeninputGenericVkbWindow*>(iLayoutWindow); |
|
452 |
vkbWindow->SetIndiWithTextFlag( EFalse ); |
|
453 |
vkbWindow->IndiBubbleWithoutText(); |
|
454 |
icf->ShowBubble(KEmptyString, icf->MsgBubbleCtrl()->Rect()); |
|
455 |
} |
|
456 |
} |
|
457 |
else |
|
458 |
{ |
|
459 |
if ( icf && ( aType == EAppByteWarningMsg ) && (iLayoutType == EPluginInputModeFSQ) ) |
|
460 |
{ |
|
461 |
if (!iInfoTimer->IsActive()) |
|
462 |
{ |
|
463 |
iInfoTimer->Start(KPeriodicTimerIntervalSec, |
|
464 |
KPeriodicTimerIntervalSec, |
|
465 |
TCallBack(CPeninputGenericVkbLayout::HideByteWarningBubble, this)); |
|
466 |
} |
|
467 |
icf->ShowByteWarningBubble(aInfo); |
|
468 |
} |
|
469 |
else |
|
470 |
{ |
|
471 |
if ( icf && ( aType == EAppMessageTypeChangeMsg ) && (iLayoutType == EPluginInputModeFSQ) ) |
|
472 |
{ |
|
473 |
if (!iInfoTimer->IsActive()) |
|
474 |
{ |
|
475 |
if ( aInfo.Length() > 0 && !iInEditWordQueryDlg) |
|
476 |
{ |
|
477 |
icf->ShowBubble(aInfo,icf->MsgBubbleCtrl()->Rect()); |
|
478 |
} |
|
479 |
iInfoTimer->Start(KPeriodicTimerIntervalSec, |
|
480 |
KPeriodicTimerIntervalSec, |
|
481 |
TCallBack(CPeninputGenericVkbLayout::HideByteWarningBubble, this)); |
|
482 |
} |
|
483 |
icf->ShowByteWarningBubble(aInfo); |
|
484 |
} |
|
485 |
} |
|
486 |
} |
|
487 |
} |
|
488 |
} |
|
489 |
||
490 |
// --------------------------------------------------------------------------- |
|
491 |
// CPeninputGenericVkbLayout::SemiTransparencyRequired |
|
492 |
// . |
|
493 |
// --------------------------------------------------------------------------- |
|
494 |
// |
|
495 |
TBool CPeninputGenericVkbLayout::SemiTransparencyRequired() |
|
496 |
{ |
|
497 |
return ETrue; |
|
498 |
} |
|
499 |
||
500 |
void CPeninputGenericVkbLayout::HandleVirtualKeyUpL(TInt aEventType, |
|
501 |
CFepUiBaseCtrl* aCtrl, |
|
502 |
const TDesC& aEventData) |
|
503 |
{ |
|
504 |
TBool flag; |
|
505 |
flag = static_cast<CPeninputGenericVkbWindow*> |
|
506 |
(iLayoutWindow)->HandleVirtualKeyUpEvent( aEventType, aCtrl, aEventData ); |
|
507 |
if(!flag) |
|
508 |
{ |
|
509 |
HBufC* number = HBufC::NewL( 1 ); |
|
510 |
TPtrC eventDataPtr = aEventData; |
|
511 |
TInt len = aEventData.Length(); |
|
512 |
if ( len > 1) |
|
513 |
{ |
|
514 |
TVirtualKeyEventData* data = (TVirtualKeyEventData* ) aEventData.Ptr(); |
|
515 |
TUint16 inputCode = data->iKeyEvent.iCode; |
|
516 |
TUint16 outputCode = inputCode; |
|
517 |
TBool isDottedChar = EFalse; |
|
518 |
for (TInt i = 0; i < KNumberOfDottedChar; i++) |
|
519 |
{ |
|
520 |
if (thaiUnicodeNew[i] == inputCode) |
|
521 |
{ |
|
522 |
outputCode = thaiUnicodeOri[i]; |
|
523 |
isDottedChar = ETrue; |
|
524 |
break; |
|
525 |
} |
|
526 |
} |
|
527 |
TBool bIsMirror = EFalse; |
|
528 |
bIsMirror = TranslateMirrorUnicode( inputCode, outputCode ); |
|
529 |
||
530 |
if ( isDottedChar || bIsMirror ) |
|
531 |
{ |
|
532 |
number->Des().Append( outputCode ); |
|
533 |
data->iKeyData.Set(*number); |
|
534 |
eventDataPtr.Set(reinterpret_cast<TUint16*>(data),sizeof(*data)/sizeof(TUint16)); |
|
535 |
} |
|
536 |
} |
|
537 |
CPeninputCommonLayoutExt::HandleControlEvent(aEventType, aCtrl, eventDataPtr); |
|
538 |
delete number; |
|
539 |
} |
|
540 |
} |
|
541 |
||
542 |
TBool CPeninputGenericVkbLayout::TranslateMirrorUnicode( TUint16 aInputCode, TUint16& aOutputCode ) |
|
543 |
{ |
|
544 |
TBool isMirrorChar = EFalse; |
|
545 |
TInt langCode = *( ( TInt* )(iDataMgr->RequestData( EPeninputDataTypeInputLanguage ))); |
|
546 |
if (( langCode != ELangArabic ) && |
|
547 |
( langCode != ELangHebrew ) && |
|
548 |
( langCode != ELangFarsi ) && |
|
549 |
( langCode != ELangUrdu )) |
|
550 |
{ |
|
551 |
return isMirrorChar; |
|
552 |
} |
|
553 |
for (TInt i = 0; i < KNumberOfMirrorChar; i++) |
|
554 |
{ |
|
555 |
if (mirrorUnicode[i] == aInputCode) |
|
556 |
{ |
|
557 |
aOutputCode = mirrorUnicode[KNumberOfMirrorChar - i - 1]; |
|
558 |
isMirrorChar = ETrue; |
|
559 |
break; |
|
560 |
} |
|
561 |
} |
|
562 |
return isMirrorChar; |
|
563 |
} |
|
564 |
||
565 |
// --------------------------------------------------------------------------- |
|
566 |
// Handle show tooltip command. |
|
567 |
// --------------------------------------------------------------------------- |
|
568 |
// |
|
569 |
void CPeninputGenericVkbLayout::HandleShowTooltipCmdL( TUint8* aData ) |
|
570 |
{ |
|
571 |
CPeninputGenericVkbWindow* vkbWindow = |
|
572 |
static_cast<CPeninputGenericVkbWindow*>(iLayoutWindow); |
|
573 |
if (!vkbWindow) |
|
574 |
{ |
|
575 |
return; |
|
576 |
} |
|
577 |
||
578 |
TPtr8 buf8(aData, sizeof(TInt32), sizeof(TInt32)); |
|
579 |
RDesReadStream readStream; |
|
580 |
readStream.Open(buf8); |
|
581 |
CleanupClosePushL(readStream); |
|
582 |
TInt dataSize = readStream.ReadInt32L(); |
|
583 |
CleanupStack::PopAndDestroy(&readStream); |
|
584 |
if (dataSize > 0) |
|
585 |
{ |
|
586 |
TUint16* dataAddress = (TUint16*)( aData + sizeof(TInt32)); |
|
587 |
HBufC* tooltipText = ReadTextInfoHBufCL(dataAddress, (dataSize + 1) / 2); |
|
588 |
if (tooltipText) |
|
589 |
{ |
|
590 |
CleanupStack::PushL(tooltipText); |
|
591 |
vkbWindow->ShowTooltipL(*tooltipText, *( ( TInt* )(iDataMgr->RequestData( EPeninputDataTypeInputLanguage )))); |
|
592 |
CleanupStack::PopAndDestroy(tooltipText); |
|
593 |
} |
|
594 |
} |
|
595 |
} |
|
596 |
||
597 |
// --------------------------------------------------------------------------- |
|
598 |
// Handle show candidate list command. |
|
599 |
// --------------------------------------------------------------------------- |
|
600 |
// |
|
601 |
void CPeninputGenericVkbLayout::HandleShowCandidateListCmdL( TUint8* aData ) |
|
602 |
{ |
|
603 |
CPeninputGenericVkbWindow* vkbWindow |
|
604 |
= static_cast<CPeninputGenericVkbWindow*>(iLayoutWindow); |
|
605 |
if ( !vkbWindow || !IsEnableITIOnFSQ() ) |
|
606 |
{ |
|
607 |
return; |
|
608 |
} |
|
609 |
||
610 |
// Read candidate data from a block of memory staring from aData |
|
611 |
// The format is activeIndex | count of candiates | |
|
612 |
// length 1 | text 1 | length 2 | text 2 |... |
|
613 |
TPtr8 buf8( aData, sizeof( TInt32 )* 3, sizeof( TInt32 )* 3 ); |
|
614 |
RDesReadStream readStream; |
|
615 |
readStream.Open( buf8 ); |
|
616 |
CleanupClosePushL( readStream ); |
|
617 |
// Get activeIndex |
|
618 |
TInt activeIndex = readStream.ReadInt32L(); |
|
619 |
// Get coutn of candidates |
|
620 |
TInt count = readStream.ReadInt32L(); |
|
621 |
TInt langCode = readStream.ReadInt32L(); |
|
622 |
TInt align = TBidiText::ScriptDirectionality((TLanguage)langCode); |
|
623 |
if(align != TBidiText::ELeftToRight) |
|
624 |
align = CGraphicsContext::ERight; |
|
625 |
else |
|
626 |
align = CGraphicsContext::ELeft; |
|
627 |
CleanupStack::PopAndDestroy( &readStream ); |
|
628 |
||
629 |
CDesCArray* itemArray = NULL; |
|
630 |
if ( count > 0 ) |
|
631 |
{ |
|
632 |
TUint8* curPointer = aData + sizeof(TInt) * 3; |
|
633 |
itemArray = new (ELeave) CDesCArrayFlat( count ); |
|
634 |
CleanupStack::PushL( itemArray ); |
|
635 |
for ( TInt i = 0; i < count; i++ ) |
|
636 |
{ |
|
637 |
// Get length |
|
638 |
buf8.Set( curPointer, sizeof( TInt32 ), sizeof( TInt32 ) ); |
|
639 |
readStream.Open( buf8 ); |
|
640 |
CleanupClosePushL( readStream ); |
|
641 |
TInt32 textSize = 0; |
|
642 |
textSize = readStream.ReadInt32L(); |
|
643 |
CleanupStack::PopAndDestroy( &readStream ); |
|
644 |
if ( textSize > 0 ) |
|
645 |
{ |
|
646 |
// Get text |
|
647 |
curPointer += sizeof( TInt32 ); |
|
648 |
HBufC* itemText = ReadTextInfoHBufCL |
|
649 |
( (TUint16*)curPointer, |
|
650 |
( textSize + 1 )/ 2 ); |
|
651 |
if ( itemText ) |
|
652 |
{ |
|
653 |
CleanupStack::PushL( itemText ); |
|
654 |
itemArray->AppendL( *itemText ); |
|
655 |
CleanupStack::PopAndDestroy( itemText ); |
|
656 |
} |
|
657 |
curPointer += textSize; |
|
658 |
} |
|
659 |
} |
|
660 |
vkbWindow->ShowCandidateListL( align, itemArray, activeIndex ); |
|
661 |
CleanupStack::PopAndDestroy( itemArray ); |
|
662 |
} |
|
663 |
else |
|
664 |
{ |
|
665 |
// Open empty candidate list. |
|
666 |
vkbWindow->ShowCandidateListL( align, NULL, activeIndex ); |
|
667 |
} |
|
668 |
} |
|
669 |
||
670 |
||
671 |
// --------------------------------------------------------------------------- |
|
672 |
// Handle show candidate list command. |
|
673 |
// --------------------------------------------------------------------------- |
|
674 |
// |
|
675 |
HBufC* CPeninputGenericVkbLayout::ReadTextInfoHBufCL( TUint16* aStartPtr, |
|
676 |
TInt aLength ) |
|
677 |
{ |
|
678 |
HBufC* itemText = NULL; |
|
679 |
if ( aLength > 0 ) |
|
680 |
{ |
|
681 |
itemText = HBufC::NewLC( aLength ); |
|
682 |
TPtr itemTextPtr = itemText->Des(); |
|
683 |
itemTextPtr.Copy( aStartPtr, aLength ); |
|
684 |
CleanupStack::Pop( itemText ); |
|
685 |
} |
|
686 |
return itemText; |
|
687 |
} |
|
688 |
||
689 |
TInt CPeninputGenericVkbLayout::HideByteWarningBubble(TAny* aPointer) |
|
690 |
{ |
|
691 |
CPeninputGenericVkbLayout* layout = static_cast<CPeninputGenericVkbLayout*>(aPointer); |
|
692 |
layout->HideByteWarningBubble(); |
|
693 |
return KErrNone; |
|
694 |
} |
|
695 |
void CPeninputGenericVkbLayout::HideByteWarningBubble() |
|
696 |
{ |
|
697 |
if (!iInfoTimer) |
|
698 |
{ |
|
699 |
return; |
|
700 |
} |
|
701 |
CFepLayoutMultiLineIcf* icf = static_cast<CFepLayoutMultiLineIcf*> |
|
702 |
(LayoutWindow()->Control(EPeninputWindowCtrlIdMultiLineICF)); |
|
703 |
if (iInfoTimer->IsActive()) |
|
704 |
{ |
|
705 |
iInfoTimer->Cancel(); |
|
706 |
icf->HideInfoBubble(); |
|
707 |
} |
|
708 |
} |
|
709 |
// End Of File |