21
|
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: split qwerty 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 |
#include <peninputrangebar.h>
|
|
34 |
|
|
35 |
// User includes
|
|
36 |
#include "peninputsplitqwerty.hrh"
|
|
37 |
#include "peninputuistatemgrinterface.h"
|
|
38 |
#include "peninputsplitqwertylayout.h"
|
|
39 |
#include "peninputsplitqwertywindow.h"
|
|
40 |
#include "peninputsplitqwertydatamgr.h"
|
|
41 |
#include "peninputsplitqwertyuistatestandby.h"
|
|
42 |
#include "peninputsplitqwertyuistatepopup.h"
|
|
43 |
#include "peninputdataconverter.h"
|
|
44 |
|
|
45 |
// ======== MEMBER FUNCTIONS ========
|
|
46 |
const TInt KNumberOfDottedChar = 16;
|
|
47 |
|
|
48 |
const TUint16 thaiUnicodeOri[KNumberOfDottedChar] =
|
|
49 |
{
|
|
50 |
0x0E31,0x0E33,0x0E34,0x0E35,0x0E36,0x0E37,0x0E38,0x0E39,
|
|
51 |
0x0E3A,0x0E47,0x0E48,0x0E49,0x0E4A,0x0E4B,0x0E4C,0x0E4D
|
|
52 |
};
|
|
53 |
|
|
54 |
const TUint16 thaiUnicodeNew[KNumberOfDottedChar] =
|
|
55 |
{
|
|
56 |
0xF731,0xF733,0xF734,0xF735,0xF736,0xF737,0xF738,0xF739,
|
|
57 |
0xF73A,0xF747,0xF748,0xF749,0xF74A,0xF74B,0xF74C,0xF74D
|
|
58 |
};
|
|
59 |
|
|
60 |
// ---------------------------------------------------------------------------
|
|
61 |
// Symbian constructor
|
|
62 |
// ---------------------------------------------------------------------------
|
|
63 |
//
|
|
64 |
CPeninputSplitQwertyLayoutImp* CPeninputSplitQwertyLayoutImp::NewL( TAny* /*aInitParams*/ )
|
|
65 |
{
|
|
66 |
CPeninputSplitQwertyLayoutImp*
|
|
67 |
self = new ( ELeave ) CPeninputSplitQwertyLayoutImp();
|
|
68 |
|
|
69 |
CleanupStack::PushL( self );
|
|
70 |
self->ConstructL();
|
|
71 |
CleanupStack::Pop( self );
|
|
72 |
return self;
|
|
73 |
}
|
|
74 |
|
|
75 |
// ---------------------------------------------------------------------------
|
|
76 |
// C++ destructor
|
|
77 |
// ---------------------------------------------------------------------------
|
|
78 |
//
|
|
79 |
CPeninputSplitQwertyLayoutImp::~CPeninputSplitQwertyLayoutImp()
|
|
80 |
{
|
|
81 |
}
|
|
82 |
|
|
83 |
// ---------------------------------------------------------------------------
|
|
84 |
// Create fep ui layout
|
|
85 |
// ---------------------------------------------------------------------------
|
|
86 |
//
|
|
87 |
CFepUiLayout* CPeninputSplitQwertyLayoutImp::CreateFepUiLayoutL(
|
|
88 |
MLayoutOwner* aLayoutOwner,
|
|
89 |
const TAny* aData )
|
|
90 |
{
|
|
91 |
CPeninputSplitQwertyLayout*
|
|
92 |
uiLayout = CPeninputSplitQwertyLayout::NewL( aLayoutOwner, aData );
|
|
93 |
|
|
94 |
return uiLayout;
|
|
95 |
}
|
|
96 |
|
|
97 |
// ---------------------------------------------------------------------------
|
|
98 |
// C++ constructor
|
|
99 |
// ---------------------------------------------------------------------------
|
|
100 |
//
|
|
101 |
CPeninputSplitQwertyLayoutImp::CPeninputSplitQwertyLayoutImp()
|
|
102 |
{
|
|
103 |
}
|
|
104 |
|
|
105 |
// ---------------------------------------------------------------------------
|
|
106 |
// Symbian constructor
|
|
107 |
// ---------------------------------------------------------------------------
|
|
108 |
//
|
|
109 |
void CPeninputSplitQwertyLayoutImp::ConstructL()
|
|
110 |
{
|
|
111 |
}
|
|
112 |
|
|
113 |
|
|
114 |
// ---------------------------------------------------------------------------
|
|
115 |
// Symbian constructor
|
|
116 |
// ---------------------------------------------------------------------------
|
|
117 |
//
|
|
118 |
CPeninputSplitQwertyLayout* CPeninputSplitQwertyLayout::NewL(
|
|
119 |
MLayoutOwner* aLayoutOwner, const TAny* aInitData )
|
|
120 |
{
|
|
121 |
CPeninputSplitQwertyLayout* self =
|
|
122 |
new (ELeave) CPeninputSplitQwertyLayout( aLayoutOwner );
|
|
123 |
|
|
124 |
CleanupStack::PushL( self );
|
|
125 |
self->ConstructL( aInitData );
|
|
126 |
CleanupStack::Pop( self );
|
|
127 |
|
|
128 |
return self;
|
|
129 |
}
|
|
130 |
|
|
131 |
// ---------------------------------------------------------------------------
|
|
132 |
// C++ destructor
|
|
133 |
// ---------------------------------------------------------------------------
|
|
134 |
//
|
|
135 |
CPeninputSplitQwertyLayout::~CPeninputSplitQwertyLayout()
|
|
136 |
{
|
|
137 |
}
|
|
138 |
|
|
139 |
// ---------------------------------------------------------------------------
|
|
140 |
// Handle layout command event
|
|
141 |
// ---------------------------------------------------------------------------
|
|
142 |
//
|
|
143 |
TInt CPeninputSplitQwertyLayout::HandleCommand( TInt aCmd, TUint8* aData )
|
|
144 |
{
|
|
145 |
CPeninputCommonLayoutExt::HandleCommand( aCmd, aData );
|
|
146 |
CPeninputSplitQwertyWindow*
|
|
147 |
vkbWindow = static_cast<CPeninputSplitQwertyWindow*>(iLayoutWindow);
|
|
148 |
|
|
149 |
switch ( aCmd )
|
|
150 |
{
|
|
151 |
case ECmdPenInputWindowOpen:
|
|
152 |
{
|
|
153 |
UiStateMgr()->SetCurrentUiState( EPeninputVkbUiStateStandby );
|
|
154 |
}
|
|
155 |
break;
|
|
156 |
case ECmdPenInputWindowClose:
|
|
157 |
{
|
|
158 |
vkbWindow->UnLatchDeadKey();
|
|
159 |
UiStateMgr()->SetCurrentUiState( EPeninputVkbUiStateNone );
|
|
160 |
}
|
|
161 |
break;
|
|
162 |
case ECmdPenInputLanguage:
|
|
163 |
{
|
|
164 |
vkbWindow->SetSwitchlistLanguage( *aData );
|
|
165 |
vkbWindow->SetDeadKey();
|
|
166 |
TRAP_IGNORE(
|
|
167 |
vkbWindow->ConstructAccentListL( *aData );
|
|
168 |
vkbWindow->ConstructRangeLabelListL( *aData )
|
|
169 |
);
|
|
170 |
}
|
|
171 |
break;
|
|
172 |
case ECmdPenInputRange:
|
|
173 |
{
|
|
174 |
TRAP_IGNORE( vkbWindow->UpdateRangeCtrlsL() );
|
|
175 |
}
|
|
176 |
break;
|
|
177 |
case ECmdPenInputIsSecretText:
|
|
178 |
{
|
|
179 |
vkbWindow->SetSwitchlistSecretFlag( *aData );
|
|
180 |
}
|
|
181 |
break;
|
|
182 |
case ECmdPenInputDimArrowKeys:
|
|
183 |
{
|
|
184 |
TBool IsDimArrowKeys = *aData;
|
|
185 |
vkbWindow->DimArrowKeys( IsDimArrowKeys );
|
|
186 |
}
|
|
187 |
break;
|
|
188 |
case ECmdPenInputSetPromptText:
|
|
189 |
break;
|
|
190 |
case ECmdPenInputCharacterPreview:
|
|
191 |
{
|
|
192 |
vkbWindow->ShowBubble( *aData );
|
|
193 |
}
|
|
194 |
break;
|
|
195 |
case ECmdPenInputInEditWordQueryDlg:
|
|
196 |
{
|
|
197 |
iInEditWordQueryDlg = *aData;
|
|
198 |
}
|
|
199 |
break;
|
|
200 |
case ECmdPeninputITIStatus:
|
|
201 |
{
|
|
202 |
// Set the flag to indicate if FSQ with ITI feature is opened
|
|
203 |
iITIEnabled = CPeninputDataConverter::AnyToInt( aData );
|
|
204 |
}
|
|
205 |
break;
|
|
206 |
default:
|
|
207 |
{
|
|
208 |
}
|
|
209 |
break;
|
|
210 |
}
|
|
211 |
|
|
212 |
return KErrNone;
|
|
213 |
}
|
|
214 |
|
|
215 |
// ---------------------------------------------------------------------------
|
|
216 |
// Handle control event
|
|
217 |
// ---------------------------------------------------------------------------
|
|
218 |
//
|
|
219 |
void CPeninputSplitQwertyLayout::HandleControlEvent( TInt aEventType,
|
|
220 |
CFepUiBaseCtrl* aCtrl,
|
|
221 |
const TDesC& aEventData )
|
|
222 |
{
|
|
223 |
switch ( aEventType )
|
|
224 |
{
|
|
225 |
case EEventVirtualKeyUp:
|
|
226 |
{
|
|
227 |
TRAP_IGNORE( HandleVirtualKeyUpL( aEventType, aCtrl, aEventData ) );
|
|
228 |
}
|
|
229 |
break;
|
|
230 |
default:
|
|
231 |
{
|
|
232 |
CPeninputCommonLayoutExt::HandleControlEvent( aEventType,
|
|
233 |
aCtrl, aEventData );
|
|
234 |
}
|
|
235 |
break;
|
|
236 |
}
|
|
237 |
}
|
|
238 |
|
|
239 |
// ---------------------------------------------------------------------------
|
|
240 |
// Handle editor text coming
|
|
241 |
// ---------------------------------------------------------------------------
|
|
242 |
//
|
|
243 |
TInt CPeninputSplitQwertyLayout::OnAppEditorTextComing(
|
|
244 |
const TFepInputContextFieldData& aData )
|
|
245 |
{
|
|
246 |
CPeninputSplitQwertyWindow*
|
|
247 |
win = static_cast<CPeninputSplitQwertyWindow*>(iLayoutWindow);
|
|
248 |
|
|
249 |
//Suppress ICF related actions
|
|
250 |
if ( win )
|
|
251 |
{
|
|
252 |
return KErrNone;
|
|
253 |
}
|
|
254 |
|
|
255 |
return CPeninputCommonLayoutExt::OnAppEditorTextComing( aData );
|
|
256 |
}
|
|
257 |
|
|
258 |
// ---------------------------------------------------------------------------
|
|
259 |
// Inform layout the size changing event
|
|
260 |
// ---------------------------------------------------------------------------
|
|
261 |
//
|
|
262 |
TInt CPeninputSplitQwertyLayout::SizeChanged( const TAny* aData )
|
|
263 |
{
|
|
264 |
CPeninputSplitQwertyWindow*
|
|
265 |
win = static_cast<CPeninputSplitQwertyWindow*>( iLayoutWindow );
|
|
266 |
|
|
267 |
if ( win )
|
|
268 |
{
|
|
269 |
win->UpdateLafData();
|
|
270 |
|
|
271 |
win->UpdateLayoutPosAndSize();
|
|
272 |
}
|
|
273 |
|
|
274 |
return CPeninputCommonLayoutExt::SizeChanged( aData );
|
|
275 |
}
|
|
276 |
|
|
277 |
// ---------------------------------------------------------------------------
|
|
278 |
// Inform UI that application infomation changed
|
|
279 |
// ---------------------------------------------------------------------------
|
|
280 |
//
|
|
281 |
void CPeninputSplitQwertyLayout::HandleAppInfoChange( const TDesC& /*aInfo*/,
|
|
282 |
TPeninputAppInfo /*aType*/ )
|
|
283 |
{
|
|
284 |
//Suppress ICF related actions
|
|
285 |
}
|
|
286 |
|
|
287 |
// ---------------------------------------------------------------------------
|
|
288 |
// Called by owner when the layout is going to be active
|
|
289 |
// ---------------------------------------------------------------------------
|
|
290 |
//
|
|
291 |
void CPeninputSplitQwertyLayout::OnActivate()
|
|
292 |
{
|
|
293 |
CPeninputCommonLayoutExt::OnActivate();
|
|
294 |
|
|
295 |
CPeninputSplitQwertyWindow*
|
|
296 |
win = static_cast<CPeninputSplitQwertyWindow*>( iLayoutWindow );
|
|
297 |
|
|
298 |
if( win )
|
|
299 |
{
|
|
300 |
win->UpdateLayoutPosAndSize();
|
|
301 |
}
|
|
302 |
}
|
|
303 |
|
|
304 |
// ---------------------------------------------------------------------------
|
|
305 |
// Tell whether this layout require transparency.
|
|
306 |
// ---------------------------------------------------------------------------
|
|
307 |
//
|
|
308 |
TBool CPeninputSplitQwertyLayout::SemiTransparencyRequired()
|
|
309 |
{
|
|
310 |
return ETrue;
|
|
311 |
}
|
|
312 |
|
|
313 |
// ---------------------------------------------------------------------------
|
|
314 |
// C++ constructor
|
|
315 |
// ---------------------------------------------------------------------------
|
|
316 |
//
|
|
317 |
CPeninputSplitQwertyLayout::CPeninputSplitQwertyLayout( MLayoutOwner* aLayoutOwner )
|
|
318 |
: CPeninputCommonLayoutExt( aLayoutOwner )
|
|
319 |
, iLayoutType( EPluginInputModeFSQ )
|
|
320 |
{
|
|
321 |
iInEditWordQueryDlg = EFalse;
|
|
322 |
}
|
|
323 |
|
|
324 |
// ---------------------------------------------------------------------------
|
|
325 |
// Symbian constructor
|
|
326 |
// ---------------------------------------------------------------------------
|
|
327 |
//
|
|
328 |
void CPeninputSplitQwertyLayout::ConstructL( const TAny* aInitData )
|
|
329 |
{
|
|
330 |
// must set layout type first
|
|
331 |
iLayoutType = EPluginInputModeFSQ;
|
|
332 |
|
|
333 |
CPeninputCommonLayoutExt::ConstructL( aInitData );
|
|
334 |
|
|
335 |
CPeninputUiStateBase* state = NULL;
|
|
336 |
CPeninputUiStateBase* initialState = NULL;
|
|
337 |
|
|
338 |
//init state
|
|
339 |
state = CPeninputUiStateBase::NewL( UiStateMgr(), this );
|
|
340 |
UiStateMgr()->AddUiState( state, EPeninputVkbUiStateNone );
|
|
341 |
initialState = state;
|
|
342 |
|
|
343 |
//standby state
|
|
344 |
state= CPeninputSplitQwertyUiStateStandby::NewL( UiStateMgr(), this );
|
|
345 |
UiStateMgr()->AddUiState( state, EPeninputVkbUiStateStandby );
|
|
346 |
|
|
347 |
//popup state
|
|
348 |
state = CPeninputSplitQwertyUiStatePopup::NewL( UiStateMgr(), this );
|
|
349 |
UiStateMgr()->AddUiState( state, EPeninputVkbUiStatePopup );
|
|
350 |
|
|
351 |
UiStateMgr()->SetCurrentUiState( initialState );
|
|
352 |
}
|
|
353 |
|
|
354 |
// ---------------------------------------------------------------------------
|
|
355 |
// Factory method for creation of layout window
|
|
356 |
// ---------------------------------------------------------------------------
|
|
357 |
//
|
|
358 |
void CPeninputSplitQwertyLayout::CreateLayoutWindowL()
|
|
359 |
{
|
|
360 |
iLayoutWindow = CPeninputSplitQwertyWindow::NewL( this, this, UiStateMgr() );
|
|
361 |
}
|
|
362 |
|
|
363 |
// ---------------------------------------------------------------------------
|
|
364 |
// Factory method for creation resource config
|
|
365 |
// ---------------------------------------------------------------------------
|
|
366 |
//
|
|
367 |
void CPeninputSplitQwertyLayout::CreateDataMgrL( const TAny* /*aInitData*/ )
|
|
368 |
{
|
|
369 |
iDataMgr = CPeninputSplitQwertyDataMgr::NewL( this );
|
|
370 |
}
|
|
371 |
|
|
372 |
// ---------------------------------------------------------------------------
|
|
373 |
// Get the layout type
|
|
374 |
// ---------------------------------------------------------------------------
|
|
375 |
//
|
|
376 |
TInt CPeninputSplitQwertyLayout::LayoutType()
|
|
377 |
{
|
|
378 |
return iLayoutType;
|
|
379 |
}
|
|
380 |
|
|
381 |
// ---------------------------------------------------------------------------
|
|
382 |
// Handle virtual key event
|
|
383 |
// ---------------------------------------------------------------------------
|
|
384 |
//
|
|
385 |
void CPeninputSplitQwertyLayout::HandleVirtualKeyUpL( TInt aEventType,
|
|
386 |
CFepUiBaseCtrl* aCtrl,
|
|
387 |
const TDesC& aEventData )
|
|
388 |
{
|
|
389 |
CPeninputSplitQwertyWindow*
|
|
390 |
win = static_cast<CPeninputSplitQwertyWindow*>( iLayoutWindow );
|
|
391 |
|
|
392 |
TBool flag = win->HandleVirtualKeyUpEvent( aEventType, aCtrl, aEventData );
|
|
393 |
if( !flag )
|
|
394 |
{
|
|
395 |
HBufC* number = HBufC::NewL( 1 );
|
|
396 |
TPtrC eventDataPtr = aEventData;
|
|
397 |
TInt len = aEventData.Length();
|
|
398 |
if ( len > 1 )
|
|
399 |
{
|
|
400 |
TVirtualKeyEventData* data = (TVirtualKeyEventData*) aEventData.Ptr();
|
|
401 |
TUint16 inputCode = data->iKeyEvent.iCode;
|
|
402 |
TUint16 outputCode = inputCode;
|
|
403 |
TBool isDottedChar = EFalse;
|
|
404 |
for ( TInt i = 0; i < KNumberOfDottedChar; i++ )
|
|
405 |
{
|
|
406 |
if ( thaiUnicodeNew[i] == inputCode )
|
|
407 |
{
|
|
408 |
outputCode = thaiUnicodeOri[i];
|
|
409 |
isDottedChar = ETrue;
|
|
410 |
break;
|
|
411 |
}
|
|
412 |
}
|
|
413 |
if ( isDottedChar )
|
|
414 |
{
|
|
415 |
number->Des().Append( outputCode );
|
|
416 |
data->iKeyData.Set( *number );
|
|
417 |
eventDataPtr.Set( reinterpret_cast<TUint16*>(data),
|
|
418 |
sizeof(*data)/sizeof(TUint16) );
|
|
419 |
}
|
|
420 |
}
|
|
421 |
|
|
422 |
CPeninputCommonLayoutExt::HandleControlEvent( aEventType, aCtrl,
|
|
423 |
eventDataPtr );
|
|
424 |
delete number;
|
|
425 |
}
|
|
426 |
}
|
|
427 |
|
|
428 |
// End Of File
|