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;
|
|
281 |
case ECmdPenInputDimEnterKey:
|
|
282 |
{
|
|
283 |
TBool isDimEnterKey = *((TUint16*)( aData ));
|
|
284 |
vkbWindow->DimEnterKey( isDimEnterKey );
|
|
285 |
}
|
|
286 |
break;
|
|
287 |
case ECmdPenInputSetPromptText:
|
|
288 |
{
|
|
289 |
if ( iLayoutType == EPluginInputModeFSQ )
|
|
290 |
TRAP_IGNORE(vkbWindow->SetPromptTextL(aData));
|
|
291 |
}
|
|
292 |
break;
|
|
293 |
case ECmdPenInputCharacterPreview:
|
|
294 |
{
|
|
295 |
vkbWindow->ShowBubble(*aData);
|
|
296 |
}
|
|
297 |
break;
|
|
298 |
case ECmdPenInputInEditWordQueryDlg:
|
|
299 |
{
|
|
300 |
iInEditWordQueryDlg = *aData;
|
|
301 |
}
|
|
302 |
break;
|
|
303 |
case ECmdPenInputPopupTooltip:
|
|
304 |
{
|
|
305 |
TRAP_IGNORE( HandleShowTooltipCmdL( aData ) );
|
|
306 |
}
|
|
307 |
break;
|
|
308 |
case ECmdPenInputHideTooltip:
|
|
309 |
{
|
|
310 |
vkbWindow->HideTooltip();
|
|
311 |
}
|
|
312 |
break;
|
|
313 |
case ECmdPenInputPopupCandidateList:
|
|
314 |
{
|
|
315 |
TRAP_IGNORE( HandleShowCandidateListCmdL( aData ) );
|
|
316 |
}
|
|
317 |
break;
|
|
318 |
case ECmdPenInputHideCandidateList:
|
|
319 |
{
|
|
320 |
vkbWindow->HideCandidateList();
|
|
321 |
}
|
|
322 |
break;
|
|
323 |
case ECmdPeninputITIStatus:
|
|
324 |
{
|
|
325 |
// Set the flag to indicate if FSQ with ITI feature is opened
|
|
326 |
iITIEnabled = CPeninputDataConverter::AnyToInt( aData );
|
|
327 |
}
|
|
328 |
break;
|
|
329 |
case ECmdPenInputFingerMatchIndicator:
|
|
330 |
{
|
|
331 |
if ( iLayoutType == EPluginInputModeFSQ )
|
|
332 |
{
|
|
333 |
TRAP_IGNORE( vkbWindow->UpdateIndiBubbleL( aData ));
|
|
334 |
}
|
|
335 |
}
|
|
336 |
break;
|
|
337 |
default:
|
|
338 |
{
|
|
339 |
}
|
|
340 |
break;
|
|
341 |
}
|
|
342 |
|
|
343 |
return KErrNone;
|
|
344 |
}
|
|
345 |
|
|
346 |
|
|
347 |
// ---------------------------------------------------------------------------
|
|
348 |
// CPeninputGenericVkbLayout::HandleControlEvent
|
|
349 |
// (other items were commented in a header)
|
|
350 |
// ---------------------------------------------------------------------------
|
|
351 |
//
|
|
352 |
void CPeninputGenericVkbLayout::HandleControlEvent(
|
|
353 |
TInt aEventType, CFepUiBaseCtrl* aCtrl, const TDesC& aEventData )
|
|
354 |
{
|
|
355 |
switch ( aEventType )
|
|
356 |
{
|
|
357 |
case EEventVirtualKeyUp:
|
|
358 |
{
|
|
359 |
TRAP_IGNORE(HandleVirtualKeyUpL(aEventType, aCtrl, aEventData));
|
|
360 |
}
|
|
361 |
break;
|
|
362 |
case EEventTooltipPointerUp:
|
|
363 |
{
|
|
364 |
// Signal to FEP to accept tooltip data
|
|
365 |
SignalOwner( ESignalAcceptTooltip );
|
|
366 |
}
|
|
367 |
break;
|
|
368 |
case EEventPointerDownOnInline:
|
|
369 |
{
|
|
370 |
// add by jiawenjuan
|
|
371 |
// show candidate list when tap on active words
|
|
372 |
SignalOwner(ESignalShowCandidate );
|
|
373 |
}
|
|
374 |
break;
|
|
375 |
case EEventInsertSpace:
|
|
376 |
{
|
|
377 |
SignalOwner(ESignalKeyEvent, KDisplaySpace);
|
|
378 |
}
|
|
379 |
break;
|
|
380 |
default:
|
|
381 |
{
|
|
382 |
CPeninputCommonLayoutExt::HandleControlEvent(aEventType, aCtrl, aEventData);
|
|
383 |
}
|
|
384 |
break;
|
|
385 |
}
|
|
386 |
}
|
|
387 |
|
|
388 |
// ---------------------------------------------------------------------------
|
|
389 |
// CPeninputGenericVkbLayout::CreateLayoutWindowL
|
|
390 |
// (other items were commented in a header)
|
|
391 |
// ---------------------------------------------------------------------------
|
|
392 |
//
|
|
393 |
void CPeninputGenericVkbLayout::CreateLayoutWindowL()
|
|
394 |
{
|
|
395 |
iLayoutWindow = CPeninputGenericVkbWindow::NewL( this, this, UiStateMgr() );
|
|
396 |
}
|
|
397 |
|
|
398 |
// ---------------------------------------------------------------------------
|
|
399 |
// CPeninputGenericVkbLayout::CreateDataMgrL
|
|
400 |
// (other items were commented in a header)
|
|
401 |
// ---------------------------------------------------------------------------
|
|
402 |
//
|
|
403 |
void CPeninputGenericVkbLayout::CreateDataMgrL( const TAny* /*aInitData*/ )
|
|
404 |
{
|
|
405 |
iDataMgr = CPeninputGenericVkbDataMgr::NewL( this );
|
|
406 |
}
|
|
407 |
|
|
408 |
// ---------------------------------------------------------------------------
|
|
409 |
// CPeninputGenericVkbLayout::LayoutType
|
|
410 |
// (other items were commented in a header)
|
|
411 |
// ---------------------------------------------------------------------------
|
|
412 |
//
|
|
413 |
TInt CPeninputGenericVkbLayout::LayoutType()
|
|
414 |
{
|
|
415 |
return iLayoutType;
|
|
416 |
}
|
|
417 |
TInt CPeninputGenericVkbLayout::SizeChanged( const TAny* aData )
|
|
418 |
{
|
|
419 |
//(( CPeninputGenericVkbWindow*)iLayoutWindow)->UpdateLafData();
|
|
420 |
return CPeninputCommonLayoutExt::SizeChanged( aData );
|
|
421 |
}
|
|
422 |
void CPeninputGenericVkbLayout::HandleAppInfoChange(const TDesC& aInfo,
|
|
423 |
TPeninputAppInfo aType)
|
|
424 |
{
|
|
425 |
if ( LayoutWindow() )
|
|
426 |
{
|
|
427 |
CFepLayoutMultiLineIcf* icf = static_cast<CFepLayoutMultiLineIcf*>
|
|
428 |
(LayoutWindow()->Control(EPeninputWindowCtrlIdMultiLineICF)) ;
|
|
429 |
|
|
430 |
if ( icf && ( aType == EAppIndicatorMsg ) && (iLayoutType == EPluginInputModeFSQ) )
|
|
431 |
{
|
|
432 |
if ( aInfo.Length() > 0 && !iInEditWordQueryDlg)
|
|
433 |
{
|
|
434 |
//icf->HideBubble();
|
|
435 |
CPeninputGenericVkbWindow* vkbWindow =
|
|
436 |
static_cast<CPeninputGenericVkbWindow*>(iLayoutWindow);
|
|
437 |
vkbWindow->SetIndiWithTextFlag( ETrue );
|
|
438 |
vkbWindow->IndiBubbleWithText();
|
|
439 |
icf->ShowBubble(aInfo,icf->MsgBubbleCtrl()->Rect());
|
|
440 |
}
|
|
441 |
else
|
|
442 |
{
|
|
443 |
//icf->HideBubble();
|
|
444 |
CPeninputGenericVkbWindow* vkbWindow =
|
|
445 |
static_cast<CPeninputGenericVkbWindow*>(iLayoutWindow);
|
|
446 |
vkbWindow->SetIndiWithTextFlag( EFalse );
|
|
447 |
vkbWindow->IndiBubbleWithoutText();
|
|
448 |
icf->ShowBubble(KEmptyString, icf->MsgBubbleCtrl()->Rect());
|
|
449 |
}
|
|
450 |
}
|
|
451 |
else
|
|
452 |
{
|
|
453 |
if ( icf && ( aType == EAppByteWarningMsg ) && (iLayoutType == EPluginInputModeFSQ) )
|
|
454 |
{
|
|
455 |
if (!iInfoTimer->IsActive())
|
|
456 |
{
|
|
457 |
iInfoTimer->Start(KPeriodicTimerIntervalSec,
|
|
458 |
KPeriodicTimerIntervalSec,
|
|
459 |
TCallBack(CPeninputGenericVkbLayout::HideByteWarningBubble, this));
|
|
460 |
}
|
|
461 |
icf->ShowByteWarningBubble(aInfo);
|
|
462 |
}
|
|
463 |
else
|
|
464 |
{
|
|
465 |
if ( icf && ( aType == EAppMessageTypeChangeMsg ) && (iLayoutType == EPluginInputModeFSQ) )
|
|
466 |
{
|
|
467 |
if (!iInfoTimer->IsActive())
|
|
468 |
{
|
|
469 |
if ( aInfo.Length() > 0 && !iInEditWordQueryDlg)
|
|
470 |
{
|
|
471 |
icf->ShowBubble(aInfo,icf->MsgBubbleCtrl()->Rect());
|
|
472 |
}
|
|
473 |
iInfoTimer->Start(KPeriodicTimerIntervalSec,
|
|
474 |
KPeriodicTimerIntervalSec,
|
|
475 |
TCallBack(CPeninputGenericVkbLayout::HideByteWarningBubble, this));
|
|
476 |
}
|
|
477 |
icf->ShowByteWarningBubble(aInfo);
|
|
478 |
}
|
|
479 |
}
|
|
480 |
}
|
|
481 |
}
|
|
482 |
}
|
|
483 |
|
|
484 |
// ---------------------------------------------------------------------------
|
|
485 |
// CPeninputGenericVkbLayout::SemiTransparencyRequired
|
|
486 |
// .
|
|
487 |
// ---------------------------------------------------------------------------
|
|
488 |
//
|
|
489 |
TBool CPeninputGenericVkbLayout::SemiTransparencyRequired()
|
|
490 |
{
|
|
491 |
return ETrue;
|
|
492 |
}
|
|
493 |
|
|
494 |
void CPeninputGenericVkbLayout::HandleVirtualKeyUpL(TInt aEventType,
|
|
495 |
CFepUiBaseCtrl* aCtrl,
|
|
496 |
const TDesC& aEventData)
|
|
497 |
{
|
|
498 |
TBool flag;
|
|
499 |
flag = static_cast<CPeninputGenericVkbWindow*>
|
|
500 |
(iLayoutWindow)->HandleVirtualKeyUpEvent( aEventType, aCtrl, aEventData );
|
|
501 |
if(!flag)
|
|
502 |
{
|
|
503 |
HBufC* number = HBufC::NewL( 1 );
|
|
504 |
TPtrC eventDataPtr = aEventData;
|
|
505 |
TInt len = aEventData.Length();
|
|
506 |
if ( len > 1)
|
|
507 |
{
|
|
508 |
TVirtualKeyEventData* data = (TVirtualKeyEventData* ) aEventData.Ptr();
|
|
509 |
TUint16 inputCode = data->iKeyEvent.iCode;
|
|
510 |
TUint16 outputCode = inputCode;
|
|
511 |
TBool isDottedChar = EFalse;
|
|
512 |
for (TInt i = 0; i < KNumberOfDottedChar; i++)
|
|
513 |
{
|
|
514 |
if (thaiUnicodeNew[i] == inputCode)
|
|
515 |
{
|
|
516 |
outputCode = thaiUnicodeOri[i];
|
|
517 |
isDottedChar = ETrue;
|
|
518 |
break;
|
|
519 |
}
|
|
520 |
}
|
|
521 |
TBool bIsMirror = EFalse;
|
|
522 |
bIsMirror = TranslateMirrorUnicode( inputCode, outputCode );
|
|
523 |
|
|
524 |
if ( isDottedChar || bIsMirror )
|
|
525 |
{
|
|
526 |
number->Des().Append( outputCode );
|
|
527 |
data->iKeyData.Set(*number);
|
|
528 |
eventDataPtr.Set(reinterpret_cast<TUint16*>(data),sizeof(*data)/sizeof(TUint16));
|
|
529 |
}
|
|
530 |
}
|
|
531 |
CPeninputCommonLayoutExt::HandleControlEvent(aEventType, aCtrl, eventDataPtr);
|
|
532 |
delete number;
|
|
533 |
}
|
|
534 |
}
|
|
535 |
|
|
536 |
TBool CPeninputGenericVkbLayout::TranslateMirrorUnicode( TUint16 aInputCode, TUint16& aOutputCode )
|
|
537 |
{
|
|
538 |
TBool isMirrorChar = EFalse;
|
|
539 |
TInt langCode = *( ( TInt* )(iDataMgr->RequestData( EPeninputDataTypeInputLanguage )));
|
|
540 |
if (( langCode != ELangArabic ) &&
|
|
541 |
( langCode != ELangHebrew ) &&
|
|
542 |
( langCode != ELangFarsi ) &&
|
|
543 |
( langCode != ELangUrdu ))
|
|
544 |
{
|
|
545 |
return isMirrorChar;
|
|
546 |
}
|
|
547 |
for (TInt i = 0; i < KNumberOfMirrorChar; i++)
|
|
548 |
{
|
|
549 |
if (mirrorUnicode[i] == aInputCode)
|
|
550 |
{
|
|
551 |
aOutputCode = mirrorUnicode[KNumberOfMirrorChar - i - 1];
|
|
552 |
isMirrorChar = ETrue;
|
|
553 |
break;
|
|
554 |
}
|
|
555 |
}
|
|
556 |
return isMirrorChar;
|
|
557 |
}
|
|
558 |
|
|
559 |
// ---------------------------------------------------------------------------
|
|
560 |
// Handle show tooltip command.
|
|
561 |
// ---------------------------------------------------------------------------
|
|
562 |
//
|
|
563 |
void CPeninputGenericVkbLayout::HandleShowTooltipCmdL( TUint8* aData )
|
|
564 |
{
|
|
565 |
CPeninputGenericVkbWindow* vkbWindow =
|
|
566 |
static_cast<CPeninputGenericVkbWindow*>(iLayoutWindow);
|
|
567 |
if (!vkbWindow)
|
|
568 |
{
|
|
569 |
return;
|
|
570 |
}
|
|
571 |
|
|
572 |
TPtr8 buf8(aData, sizeof(TInt32), sizeof(TInt32));
|
|
573 |
RDesReadStream readStream;
|
|
574 |
readStream.Open(buf8);
|
|
575 |
CleanupClosePushL(readStream);
|
|
576 |
TInt dataSize = readStream.ReadInt32L();
|
|
577 |
CleanupStack::PopAndDestroy(&readStream);
|
|
578 |
if (dataSize > 0)
|
|
579 |
{
|
|
580 |
TUint16* dataAddress = (TUint16*)( aData + sizeof(TInt32));
|
|
581 |
HBufC* tooltipText = ReadTextInfoHBufCL(dataAddress, (dataSize + 1) / 2);
|
|
582 |
if (tooltipText)
|
|
583 |
{
|
|
584 |
CleanupStack::PushL(tooltipText);
|
|
585 |
vkbWindow->ShowTooltipL(*tooltipText, *( ( TInt* )(iDataMgr->RequestData( EPeninputDataTypeInputLanguage ))));
|
|
586 |
CleanupStack::PopAndDestroy(tooltipText);
|
|
587 |
}
|
|
588 |
}
|
|
589 |
}
|
|
590 |
|
|
591 |
// ---------------------------------------------------------------------------
|
|
592 |
// Handle show candidate list command.
|
|
593 |
// ---------------------------------------------------------------------------
|
|
594 |
//
|
|
595 |
void CPeninputGenericVkbLayout::HandleShowCandidateListCmdL( TUint8* aData )
|
|
596 |
{
|
|
597 |
CPeninputGenericVkbWindow* vkbWindow
|
|
598 |
= static_cast<CPeninputGenericVkbWindow*>(iLayoutWindow);
|
|
599 |
if ( !vkbWindow || !IsEnableITIOnFSQ() )
|
|
600 |
{
|
|
601 |
return;
|
|
602 |
}
|
|
603 |
|
|
604 |
// Read candidate data from a block of memory staring from aData
|
|
605 |
// The format is activeIndex | count of candiates |
|
|
606 |
// length 1 | text 1 | length 2 | text 2 |...
|
|
607 |
TPtr8 buf8( aData, sizeof( TInt32 )* 3, sizeof( TInt32 )* 3 );
|
|
608 |
RDesReadStream readStream;
|
|
609 |
readStream.Open( buf8 );
|
|
610 |
CleanupClosePushL( readStream );
|
|
611 |
// Get activeIndex
|
|
612 |
TInt activeIndex = readStream.ReadInt32L();
|
|
613 |
// Get coutn of candidates
|
|
614 |
TInt count = readStream.ReadInt32L();
|
|
615 |
TInt langCode = readStream.ReadInt32L();
|
|
616 |
TInt align = TBidiText::ScriptDirectionality((TLanguage)langCode);
|
|
617 |
if(align != TBidiText::ELeftToRight)
|
|
618 |
align = CGraphicsContext::ERight;
|
|
619 |
else
|
|
620 |
align = CGraphicsContext::ELeft;
|
|
621 |
CleanupStack::PopAndDestroy( &readStream );
|
|
622 |
|
|
623 |
CDesCArray* itemArray = NULL;
|
|
624 |
if ( count > 0 )
|
|
625 |
{
|
|
626 |
TUint8* curPointer = aData + sizeof(TInt) * 3;
|
|
627 |
itemArray = new (ELeave) CDesCArrayFlat( count );
|
|
628 |
CleanupStack::PushL( itemArray );
|
|
629 |
for ( TInt i = 0; i < count; i++ )
|
|
630 |
{
|
|
631 |
// Get length
|
|
632 |
buf8.Set( curPointer, sizeof( TInt32 ), sizeof( TInt32 ) );
|
|
633 |
readStream.Open( buf8 );
|
|
634 |
CleanupClosePushL( readStream );
|
|
635 |
TInt32 textSize = 0;
|
|
636 |
textSize = readStream.ReadInt32L();
|
|
637 |
CleanupStack::PopAndDestroy( &readStream );
|
|
638 |
if ( textSize > 0 )
|
|
639 |
{
|
|
640 |
// Get text
|
|
641 |
curPointer += sizeof( TInt32 );
|
|
642 |
HBufC* itemText = ReadTextInfoHBufCL
|
|
643 |
( (TUint16*)curPointer,
|
|
644 |
( textSize + 1 )/ 2 );
|
|
645 |
if ( itemText )
|
|
646 |
{
|
|
647 |
CleanupStack::PushL( itemText );
|
|
648 |
itemArray->AppendL( *itemText );
|
|
649 |
CleanupStack::PopAndDestroy( itemText );
|
|
650 |
}
|
|
651 |
curPointer += textSize;
|
|
652 |
}
|
|
653 |
}
|
|
654 |
vkbWindow->ShowCandidateListL( align, itemArray, activeIndex );
|
|
655 |
CleanupStack::PopAndDestroy( itemArray );
|
|
656 |
}
|
|
657 |
else
|
|
658 |
{
|
|
659 |
// Open empty candidate list.
|
|
660 |
vkbWindow->ShowCandidateListL( align, NULL, activeIndex );
|
|
661 |
}
|
|
662 |
}
|
|
663 |
|
|
664 |
|
|
665 |
// ---------------------------------------------------------------------------
|
|
666 |
// Handle show candidate list command.
|
|
667 |
// ---------------------------------------------------------------------------
|
|
668 |
//
|
|
669 |
HBufC* CPeninputGenericVkbLayout::ReadTextInfoHBufCL( TUint16* aStartPtr,
|
|
670 |
TInt aLength )
|
|
671 |
{
|
|
672 |
HBufC* itemText = NULL;
|
|
673 |
if ( aLength > 0 )
|
|
674 |
{
|
|
675 |
itemText = HBufC::NewLC( aLength );
|
|
676 |
TPtr itemTextPtr = itemText->Des();
|
|
677 |
itemTextPtr.Copy( aStartPtr, aLength );
|
|
678 |
CleanupStack::Pop( itemText );
|
|
679 |
}
|
|
680 |
return itemText;
|
|
681 |
}
|
|
682 |
|
|
683 |
TInt CPeninputGenericVkbLayout::HideByteWarningBubble(TAny* aPointer)
|
|
684 |
{
|
|
685 |
CPeninputGenericVkbLayout* layout = static_cast<CPeninputGenericVkbLayout*>(aPointer);
|
|
686 |
layout->HideByteWarningBubble();
|
|
687 |
return KErrNone;
|
|
688 |
}
|
|
689 |
void CPeninputGenericVkbLayout::HideByteWarningBubble()
|
|
690 |
{
|
|
691 |
if (!iInfoTimer)
|
|
692 |
{
|
|
693 |
return;
|
|
694 |
}
|
|
695 |
CFepLayoutMultiLineIcf* icf = static_cast<CFepLayoutMultiLineIcf*>
|
|
696 |
(LayoutWindow()->Control(EPeninputWindowCtrlIdMultiLineICF));
|
|
697 |
if (iInfoTimer->IsActive())
|
|
698 |
{
|
|
699 |
iInfoTimer->Cancel();
|
|
700 |
icf->HideInfoBubble();
|
|
701 |
}
|
|
702 |
}
|
|
703 |
// End Of File
|