author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Wed, 15 Sep 2010 12:34:44 +0300 | |
branch | RCL_3 |
changeset 50 | 5a1685599b76 |
parent 44 | ecbabf52600f |
child 56 | 8152b1f1763a |
permissions | -rw-r--r-- |
44 | 1 |
/* |
2 |
* Copyright (c) 2008 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: |
|
15 |
* Provides the TAknFepInputStateStrokePhraseCreationBase definition. |
|
16 |
* |
|
17 |
*/ |
|
18 |
||
19 |
||
20 |
||
21 |
||
22 |
||
23 |
||
24 |
||
25 |
||
26 |
||
27 |
||
28 |
||
29 |
||
30 |
||
31 |
// System includes |
|
32 |
#include <e32cmn.h> |
|
33 |
#include <PtiEngine.h> |
|
34 |
#include <PtiDefs.h> |
|
35 |
#include <avkon.rsg> |
|
36 |
#include <aknfep.rsg> |
|
37 |
#include <PtiUserDicEntry.h> |
|
38 |
#include <aknnotewrappers.h> //CAknWarningNote |
|
39 |
||
40 |
// User includes |
|
41 |
#include "AknFepUIManagerStateInterface.h" |
|
42 |
#include "AknFepUICtrlInputPane.h" |
|
43 |
#include "aknfepuictrleditpane.h" //Stroke phrase creation |
|
44 |
#include "AknFepUICtrlCandidatePane.h" |
|
45 |
#include "AknFepManager.h" |
|
46 |
#include "aknfepuiinputminiqwertystrokephrasebase.h" |
|
47 |
||
48 |
// CONSTANTS |
|
49 |
||
50 |
const TInt KMaxPhraseCount = 50; |
|
51 |
const TInt KMaxPhraseCreationCount = 7; |
|
52 |
const TInt KMaxKeystrokeCount = 31; |
|
53 |
const TInt16 KStrokeDelimiter = 0x2022; |
|
54 |
const TInt16 KStrokeUnicode = 0x2461; |
|
55 |
const TInt16 KKey1 = 0x31; |
|
56 |
const TInt16 KKey6 = 0x36; |
|
57 |
||
50
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
58 |
const TUid KPtiSogouCoreUid = { 0x20031DD6 }; |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
59 |
|
44 | 60 |
_LIT( KMaxPhraseNote,"\x8BCD\x7EC4\x6700\x957F\x4E3A\x4E03\x5B57" ); |
61 |
||
62 |
// --------------------------------------------------------------------------- |
|
63 |
// TAknFepInputStateStrokePhraseCreationBase::TAknFepInputStateStrokePhraseCreationBase |
|
64 |
// C++ default constructor |
|
65 |
// --------------------------------------------------------------------------- |
|
66 |
// |
|
67 |
TAknFepInputMiniQwertyStrokePhraseBase::TAknFepInputMiniQwertyStrokePhraseBase( |
|
68 |
MAknFepUIManagerStateInterface* aOwner, |
|
69 |
MAknFepUICtrlContainerChinese* aUIContainer) |
|
70 |
:TAknFepInputStateCandidateQwertyBaseChinesePhrase(aOwner, aUIContainer) |
|
71 |
{ |
|
72 |
iOwner->PtiEngine()->SetInputMode(EPtiEngineStrokePhraseQwerty); |
|
73 |
iOwner->PtiEngine()->SetCase(EPtiCaseLower); |
|
74 |
iOwner->PtiEngine()->SetCandidatePageLength( KMaxPhraseCount ); |
|
75 |
MAknFepUICtrlContainerChinese* uiContainer = UIContainer(); |
|
76 |
||
77 |
MAknFepUICtrlCandidatePane* candidatePane = uiContainer->CandidatePane(); |
|
78 |
TBool multiplePages = !(candidatePane->IsLastPage() && |
|
79 |
candidatePane->IsFirstPage()); |
|
80 |
uiContainer->ShowVerticalScrollArrows(multiplePages); |
|
81 |
} |
|
82 |
||
83 |
// --------------------------------------------------------------------------- |
|
84 |
// TAknFepInputMiniQwertyStrokePhraseBase::HandleKeyL |
|
85 |
// Handle system key press event. |
|
86 |
// --------------------------------------------------------------------------- |
|
87 |
// |
|
88 |
TBool TAknFepInputMiniQwertyStrokePhraseBase::HandleKeyL( |
|
89 |
TInt aKey, |
|
90 |
TKeyPressLength aLength ) |
|
91 |
{ |
|
92 |
TBool ret = ETrue; |
|
93 |
const TPtiKeyboardType keyboardType = iOwner->PtiEngine()->KeyboardType(); |
|
94 |
||
95 |
switch( aKey ) |
|
96 |
{ |
|
97 |
case EKeyLeftShift: |
|
98 |
case EKeyLeftCtrl: |
|
99 |
case EKeyRightCtrl: |
|
100 |
case EStdKeyLeftFunc: |
|
101 |
{ |
|
102 |
iOwner->FepMan()->TryCloseUiL(); |
|
103 |
ret = EFalse; |
|
104 |
break; |
|
105 |
} |
|
106 |
case EStdKeyDevice1:// CBA2 |
|
107 |
{ |
|
108 |
iOwner->FepMan()->TryCloseUiL(); |
|
109 |
break; |
|
110 |
} |
|
111 |
case EStdKeyUpArrow: |
|
112 |
case EStdKeyDownArrow: |
|
113 |
case EKeyRightFunc: |
|
114 |
case EStdKeyEnter: |
|
115 |
{ |
|
116 |
iOwner->FepMan()->PlaySound(EAvkonSIDErrorTone); |
|
117 |
break; |
|
118 |
} |
|
119 |
case EStdKeyBackspace: |
|
120 |
{ |
|
121 |
HandleKeyBackspaceL( aLength ); |
|
122 |
break; |
|
123 |
} |
|
124 |
case EStdKeyDevice0:// CBA1 |
|
125 |
case EStdKeyDevice3:// CBASelect |
|
126 |
{ |
|
127 |
HandleCommitL( aLength ); |
|
128 |
break; |
|
129 |
} |
|
130 |
case EStdKeyLeftArrow: |
|
131 |
{ |
|
132 |
if ( !MoveCursorLeft() ) |
|
133 |
{ |
|
134 |
iOwner->FepMan()->PlaySound( EAvkonSIDErrorTone ); |
|
135 |
} |
|
136 |
break; |
|
137 |
} |
|
138 |
case EStdKeyRightArrow: |
|
139 |
{ |
|
140 |
if ( !MoveCursorRight() ) |
|
141 |
{ |
|
142 |
iOwner->FepMan()->PlaySound( EAvkonSIDErrorTone ); |
|
143 |
} |
|
144 |
break; |
|
145 |
} |
|
146 |
default: |
|
147 |
{ |
|
148 |
ret = HandleDefaultL( aKey, aLength ); |
|
149 |
break; |
|
150 |
} |
|
151 |
} |
|
152 |
||
153 |
return ret; |
|
154 |
} |
|
155 |
||
156 |
// --------------------------------------------------------------------------- |
|
157 |
// TAknFepInputMiniQwertyStrokePhraseBase::RefreshUI |
|
158 |
// Update input window. |
|
159 |
// --------------------------------------------------------------------------- |
|
160 |
// |
|
161 |
void TAknFepInputMiniQwertyStrokePhraseBase::RefreshUI() |
|
162 |
{ |
|
163 |
MAknFepUICtrlContainerChinese* uiContainer = UIContainer(); |
|
164 |
// get cursor position |
|
165 |
if ( ( uiContainer->EditPaneWindow()->KeystrokeArray()->Count() == 0 ) && |
|
166 |
( uiContainer->EditPaneWindow()->PhraseArray()->Count() == 0 ) ) |
|
167 |
{ |
|
168 |
TPoint baseLine; |
|
169 |
TInt height(0); |
|
170 |
TInt ascent(0); |
|
171 |
TRAPD(ret,iOwner->FepMan()->GetScreenCoordinatesL(baseLine,height,ascent)); |
|
172 |
if (ret == KErrNone) |
|
173 |
{ |
|
174 |
uiContainer->SetContainerPosition(baseLine, height); |
|
175 |
} |
|
176 |
} |
|
177 |
if ( ( uiContainer->EditPaneWindow()->KeystrokeArray()->Count() > 0 ) || |
|
178 |
( uiContainer->EditPaneWindow()->PhraseArray()->Count() > 0 ) ) |
|
179 |
{ |
|
180 |
ShowInfoOnEEPPane(); |
|
181 |
SetWarningColor(); |
|
182 |
ShowInfoOnCandidatePane(); |
|
183 |
UpdateIndicator(); |
|
184 |
TRAP_IGNORE( ChangeCbaL() ); |
|
185 |
} |
|
186 |
} |
|
187 |
||
188 |
// --------------------------------------------------------------------------- |
|
189 |
// TAknFepInputMiniQwertyStrokePhraseBase::CheckFirstGroupStroke |
|
190 |
// check the first group stroke of keystroke. |
|
191 |
// --------------------------------------------------------------------------- |
|
192 |
// |
|
193 |
TBool TAknFepInputMiniQwertyStrokePhraseBase::CheckFirstGroupStroke() |
|
194 |
{ |
|
195 |
CPtiEngine* ptiengine = iOwner->PtiEngine(); |
|
196 |
MAknFepUICtrlContainerChinese* uiContainer = UIContainer(); |
|
197 |
MAknFepUICtrlEditPane* editPane = uiContainer->EditPaneWindow(); |
|
198 |
CDesCArrayFlat* keystroke = editPane->KeystrokeArray(); |
|
199 |
RArray<TInt>* keycodeArray = editPane->KeycodeArray(); |
|
200 |
TInt stringBeforeLength = 0; |
|
201 |
TInt stringAfterLength = 0; |
|
202 |
TInt keyCode = 0; |
|
203 |
TInt pos = 0; |
|
204 |
TBuf<1> delimiter; |
|
205 |
||
206 |
if ( 0 == keystroke->Count() ) |
|
207 |
{ |
|
208 |
return EFalse; |
|
209 |
} |
|
210 |
||
211 |
delimiter.Append( KStrokeDelimiter ); |
|
212 |
||
213 |
//the keystroke is not delimiter the all keystroke is first group keystroke. |
|
214 |
if ( 0 != keystroke->Find( delimiter, pos ) ) |
|
215 |
{ |
|
216 |
pos = keystroke->Count(); |
|
217 |
} |
|
218 |
//first keystroke is delimiter then first group keystroke is invalid. |
|
219 |
if ( 0 == pos ) |
|
220 |
{ |
|
221 |
return EFalse; |
|
222 |
} |
|
223 |
||
224 |
ClearPtiEngineKeystroke(); |
|
225 |
||
226 |
for ( TInt i = 0; i < pos; ++i ) |
|
227 |
{ |
|
228 |
//GetKeystrokeCode( keyCode, keystroke->MdcaPoint( i ) ); |
|
229 |
keyCode = (*keycodeArray)[i]; |
|
230 |
stringBeforeLength = |
|
231 |
ptiengine->GetPhoneticSpelling(1).Length(); |
|
232 |
stringAfterLength = |
|
233 |
ptiengine->AppendKeyPress((TPtiKey)keyCode).Length(); |
|
50
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
234 |
stringAfterLength = ptiengine->GetPhoneticSpelling(1).Length(); |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
235 |
|
44 | 236 |
//the keystroke is invalid. |
237 |
if ( stringBeforeLength == stringAfterLength ) |
|
238 |
{ |
|
239 |
return EFalse; |
|
240 |
} |
|
241 |
} |
|
242 |
return ETrue; |
|
243 |
} |
|
244 |
||
245 |
// --------------------------------------------------------------------------- |
|
246 |
// TAknFepInputMiniQwertyStrokePhraseBase::HandleCommitL |
|
247 |
// Handle CBA1 or select event. |
|
248 |
// --------------------------------------------------------------------------- |
|
249 |
// |
|
250 |
void TAknFepInputMiniQwertyStrokePhraseBase::HandleCommitL( |
|
251 |
TKeyPressLength aLength ) |
|
252 |
{ |
|
253 |
MAknFepUICtrlContainerChinese* uiContainer = UIContainer(); |
|
254 |
MAknFepUICtrlEditPane* editPane = uiContainer->EditPaneWindow(); |
|
255 |
TInt keyCount = editPane->KeystrokeArray()->Count(); |
|
256 |
CDesCArrayFlat* phrase = editPane->PhraseArray(); |
|
257 |
TInt cdtCount = uiContainer->CandidatePane()->CandidateArray()->Count(); |
|
258 |
MAknFepManagerUIInterface* fepMan = iOwner->FepMan(); |
|
259 |
||
260 |
if ( !CheckKeyNeedRepeat( aLength ) ) |
|
261 |
{ |
|
262 |
iOwner->FepMan()->PlaySound( EAvkonSIDErrorTone ); |
|
263 |
return; |
|
264 |
} |
|
265 |
||
266 |
if ( EMiniQwertyEdit == iState ) |
|
267 |
{ |
|
268 |
if ( cdtCount > 0 ) |
|
269 |
{ |
|
270 |
UIContainer()->EditPaneWindow()->SetChangeState( ETrue ); |
|
50
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
271 |
iOwner->ChangeState( EEntry ); |
44 | 272 |
return; |
273 |
} |
|
274 |
||
275 |
if ( keyCount > 0 ) |
|
276 |
{ |
|
277 |
fepMan->PlaySound( EAvkonSIDErrorTone ); |
|
278 |
return; |
|
279 |
} |
|
280 |
} |
|
281 |
||
282 |
if ( phrase->Count( ) <= 1 ) |
|
283 |
{ |
|
284 |
fepMan->PlaySound( EAvkonSIDErrorTone ); |
|
285 |
return; |
|
286 |
} |
|
287 |
||
288 |
TBuf<KMaxPhraseCreationCount> phraseCreated; |
|
289 |
for (TInt i = 0; i < phrase->Count( ); ++i ) |
|
290 |
{ |
|
291 |
phraseCreated.Append( phrase->MdcaPoint( i ) ); |
|
292 |
} |
|
293 |
fepMan->NewTextL( phraseCreated ); |
|
294 |
fepMan->CommitInlineEditL( ); |
|
295 |
AddPhraseToDB( phraseCreated ); |
|
296 |
fepMan->TryCloseUiL( ); |
|
297 |
} |
|
298 |
||
299 |
// --------------------------------------------------------------------------- |
|
300 |
// TAknFepInputMiniQwertyStrokePhraseBase::HandleAutoChangeState |
|
301 |
// Auto change state. |
|
302 |
// --------------------------------------------------------------------------- |
|
303 |
// |
|
304 |
TBool TAknFepInputMiniQwertyStrokePhraseBase::HandleAutoChangeState() |
|
305 |
{ |
|
306 |
MAknFepUICtrlContainerChinese* uiContainer = UIContainer(); |
|
307 |
MAknFepUICtrlEditPane* editPane = uiContainer->EditPaneWindow(); |
|
308 |
TInt index = editPane->GetCursorIndexOfKeystroke(); |
|
309 |
TBool FirstStrokeValid = CheckFirstGroupStroke(); |
|
310 |
//Auto change from EMiniQwertyEdit state to EEntry state. |
|
311 |
if ( EMiniQwertyEdit == iState ) |
|
312 |
{ |
|
313 |
if ( FirstStrokeValid ) |
|
314 |
{ |
|
315 |
if ( EAutoChangeStateFromInput == editPane->GetAutoChangeStateFlag() ) |
|
316 |
{ |
|
317 |
editPane->SetChangeState( EFalse ); |
|
318 |
iOwner->ChangeState( EEntry ); |
|
319 |
return ETrue; |
|
320 |
} |
|
321 |
else if ( EAutoChangeStateFromCandidate == editPane->GetAutoChangeStateFlag() ) |
|
322 |
{ |
|
323 |
editPane->SetChangeState( ETrue ); |
|
324 |
iOwner->ChangeState( ECandidate ); |
|
325 |
return ETrue; |
|
326 |
} |
|
327 |
} |
|
328 |
} |
|
329 |
||
330 |
//Auto change from EEntry state to EMiniQwertyEdit state. |
|
331 |
if ( EEntry == iState ) |
|
332 |
{ |
|
333 |
if ( ( 0 <= index ) && ( !FirstStrokeValid ) ) |
|
334 |
{ |
|
335 |
editPane->SetChangeState( EFalse ); |
|
336 |
editPane->SetAutoChangeStateFlag( EAutoChangeStateFromInput ); |
|
337 |
iOwner->ChangeState( EMiniQwertyEdit ); |
|
338 |
return ETrue; |
|
339 |
} |
|
340 |
} |
|
341 |
return EFalse; |
|
342 |
} |
|
343 |
||
344 |
// --------------------------------------------------------------------------- |
|
345 |
// TAknFepInputMiniQwertyStrokePhraseBase::HandleKeyBackspaceL |
|
346 |
// Handle KeyBackspace event. |
|
347 |
// --------------------------------------------------------------------------- |
|
348 |
// |
|
349 |
void TAknFepInputMiniQwertyStrokePhraseBase::HandleKeyBackspaceL( |
|
350 |
TKeyPressLength aLength ) |
|
351 |
{ |
|
352 |
MAknFepUICtrlContainerChinese* uiContainer = UIContainer(); |
|
353 |
MAknFepUICtrlEditPane* editPane = uiContainer->EditPaneWindow(); |
|
354 |
TInt index = editPane->GetCursorIndexOfKeystroke(); |
|
355 |
CDesCArrayFlat* keystroke = editPane->KeystrokeArray(); |
|
356 |
TInt phraseCount = editPane->PhraseArray()->Count(); |
|
357 |
||
358 |
if ( !CheckKeyNeedRepeat( aLength ) ) |
|
359 |
{ |
|
360 |
iOwner->FepMan()->PlaySound( EAvkonSIDErrorTone ); |
|
361 |
return; |
|
362 |
} |
|
363 |
||
364 |
if ( ( 0 == index ) && ( phraseCount != 0 ) ) |
|
365 |
{ |
|
366 |
RevertPhraseToKeystrokeL(); |
|
367 |
} |
|
368 |
else if ( ( 0 == index ) && ( keystroke->Count() > 0 ) ) |
|
369 |
{ |
|
370 |
iOwner->FepMan()->PlaySound( EAvkonSIDErrorTone ); |
|
371 |
return; |
|
372 |
} |
|
373 |
else |
|
374 |
{ |
|
375 |
if ( !DeleteKeystroke() ) |
|
376 |
{ |
|
377 |
iOwner->FepMan()->PlaySound( EAvkonSIDErrorTone ); |
|
378 |
return; |
|
379 |
} |
|
380 |
} |
|
381 |
||
382 |
//if the keystroke is null and phrase is null then close input window. |
|
383 |
if ( ( 0 == phraseCount ) && ( keystroke->Count() == 0 ) ) |
|
384 |
{ |
|
385 |
iOwner->FepMan()->TryCloseUiL(); //no more keys, close the UI. |
|
386 |
if ( aLength == ELongKeyPress ) |
|
387 |
{ |
|
388 |
iOwner->FepMan()->SetLongClearAfterCloseUI( ETrue ); |
|
389 |
} |
|
390 |
return; |
|
391 |
} |
|
392 |
||
393 |
if ( !HandleAutoChangeState() ) |
|
394 |
{ |
|
395 |
RefreshUI(); |
|
396 |
} |
|
397 |
} |
|
398 |
||
399 |
// --------------------------------------------------------------------------- |
|
400 |
// TAknFepInputMiniQwertyStrokePhraseBase::HandleDefaultL |
|
401 |
// Handle default event. |
|
402 |
// --------------------------------------------------------------------------- |
|
403 |
// |
|
404 |
TBool TAknFepInputMiniQwertyStrokePhraseBase::HandleDefaultL( |
|
405 |
TInt aKey, |
|
406 |
TKeyPressLength aLength ) |
|
407 |
{ |
|
408 |
TBool ret = ETrue; |
|
409 |
if( CAknFepFnKeyManager::EFnKeyNext == iOwner->FepMan()->FnKeyState() || |
|
410 |
CAknFepFnKeyManager::EFnKeyLock == iOwner->FepMan()->FnKeyState() || |
|
411 |
( CAknFepFnKeyManager::EFnKeyDown == iOwner->FepMan()->FnKeyState() && iState != ECandidate )) |
|
412 |
{ |
|
413 |
iOwner->FepMan()->PlaySound(EAvkonSIDErrorTone); |
|
414 |
} |
|
415 |
else if (iOwner->FepMan()->IsFlagSet(CAknFepManager::EFlagShiftKeyDepressed) || |
|
416 |
iOwner->FepMan()->IsFlagSet(CAknFepManager::EFlagQwertyChrKeyDepressed)) |
|
417 |
{ |
|
418 |
iOwner->FepMan()->TryCloseUiL(); |
|
419 |
ret = EFalse; |
|
420 |
} |
|
421 |
else if ( ( EShortKeyPress == aLength ) && |
|
422 |
( iOwner->IsValidChineseInputKeyQwerty( aKey ) ) ) |
|
423 |
{ |
|
424 |
if ( iState == ECandidate ) |
|
425 |
{ |
|
426 |
HandleKeyFromCandidateL( aKey, aLength ); |
|
427 |
} |
|
428 |
else |
|
429 |
{ |
|
430 |
HandleDefaultKeyL( aKey ); |
|
431 |
} |
|
432 |
} |
|
433 |
else |
|
434 |
{ |
|
435 |
iOwner->FepMan()->PlaySound(EAvkonSIDErrorTone); |
|
436 |
} |
|
437 |
||
438 |
return ret; |
|
439 |
} |
|
440 |
||
441 |
// --------------------------------------------------------------------------- |
|
442 |
// TAknFepInputMiniQwertyStrokePhraseBase::HandleDefaultKeyL |
|
443 |
// Handle default key press event. |
|
444 |
// --------------------------------------------------------------------------- |
|
445 |
// |
|
446 |
void TAknFepInputMiniQwertyStrokePhraseBase::HandleDefaultKeyL( TInt aKey ) |
|
447 |
{ |
|
448 |
if ( !AddKeystrokeL( aKey ) ) |
|
449 |
{ |
|
450 |
iOwner->FepMan()->PlaySound(EAvkonSIDErrorTone); |
|
451 |
return; |
|
452 |
} |
|
453 |
||
454 |
if ( !HandleAutoChangeState() ) |
|
455 |
{ |
|
456 |
RefreshUI(); |
|
457 |
} |
|
458 |
} |
|
459 |
||
460 |
// --------------------------------------------------------------------------- |
|
461 |
// TAknFepInputMiniQwertyStrokePhraseBase::ShowInfoOnEEP |
|
462 |
// Show the showinfo on the EEP ctrl. |
|
463 |
// --------------------------------------------------------------------------- |
|
464 |
// |
|
465 |
void TAknFepInputMiniQwertyStrokePhraseBase::ShowInfoOnEEPPane() |
|
466 |
{ |
|
467 |
MAknFepUICtrlContainerChinese* uiContainer = UIContainer(); |
|
468 |
MAknFepUICtrlEditPane* editPane = uiContainer->EditPaneWindow(); |
|
469 |
CDesCArrayFlat* keystroke = editPane->KeystrokeArray(); |
|
470 |
CDesCArrayFlat* phrase = editPane->PhraseArray(); |
|
471 |
TInt index = editPane->GetCursorIndexOfKeystroke(); |
|
472 |
TBuf<KMaxKeystrokeCount> showInfo; |
|
473 |
||
50
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
474 |
// Get the current core id |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
475 |
TInt coreID = 0; |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
476 |
TRAP_IGNORE( coreID = iOwner->PtiEngine()->HandleCommandL( EPtiCommandGetCoreID )); |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
477 |
TInt phraseCount = 0; |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
478 |
|
44 | 479 |
for ( TInt i = 0; i < phrase->Count(); ++i ) |
480 |
{ |
|
50
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
481 |
// If this method is called in construction of the state machine, |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
482 |
// the plugin is not set. If sogou core is in use now, we should append |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
483 |
// each characters to showInfo. |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
484 |
// For Sogou core, maybe one element of PhraseArray() contains two or more characters. |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
485 |
if ( TUid::Uid( coreID ) == KPtiSogouCoreUid ) |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
486 |
{ |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
487 |
for ( TInt k = 0; k < phrase->MdcaPoint(i).Length(); k++ ) |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
488 |
{ |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
489 |
showInfo.Append( phrase->MdcaPoint(i)[k] ); |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
490 |
} |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
491 |
phraseCount += phrase->MdcaPoint(i).Length(); |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
492 |
} |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
493 |
else |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
494 |
{ |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
495 |
// If cpicore is in use, just append the element of phrase |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
496 |
showInfo.Append(phrase->MdcaPoint(i) ); |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
497 |
} |
44 | 498 |
} |
499 |
||
500 |
for ( TInt ii = 0; ii < keystroke->Count(); ++ii ) |
|
501 |
{ |
|
502 |
showInfo.Append( keystroke->MdcaPoint( ii ) ); |
|
503 |
} |
|
50
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
504 |
|
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
505 |
// If this method is called in construction of the state machine, |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
506 |
// the plugin is not set. If sogou core is in use now, the phraseCount |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
507 |
// should be the same as the phrase characters count. |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
508 |
// For Sogou core, maybe one element of PhraseArray() contains two or more characters. |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
509 |
if ( TUid::Uid( coreID ) == KPtiSogouCoreUid ) |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
510 |
{ |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
511 |
editPane->SetText( showInfo, index + phraseCount ); |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
512 |
} |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
513 |
else |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
514 |
{ |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
515 |
// If cpicore is in use, phraseCount is the same as phrase->Count() |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
516 |
editPane->SetText( showInfo, index + phrase->Count() ); |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
517 |
} |
44 | 518 |
|
519 |
switch ( iState ) |
|
520 |
{ |
|
521 |
case ECandidate: |
|
522 |
editPane->DisableCursor(); |
|
523 |
break; |
|
524 |
case EEntry: |
|
525 |
editPane->EnableCursor(); |
|
526 |
editPane->DeactiveCursor(); |
|
527 |
break; |
|
528 |
case EMiniQwertyEdit: |
|
529 |
editPane->EnableCursor(); |
|
530 |
editPane->ActiveCursor(); |
|
531 |
break; |
|
532 |
default: |
|
533 |
break; |
|
534 |
} |
|
535 |
} |
|
536 |
||
537 |
// --------------------------------------------------------------------------- |
|
538 |
// TAknFepInputMiniQwertyStrokePhraseBase::ShowInfoOnEEP |
|
539 |
// Show the showinfo on the EEP ctrl. |
|
540 |
// --------------------------------------------------------------------------- |
|
541 |
// |
|
542 |
void TAknFepInputMiniQwertyStrokePhraseBase::ShowInfoOnCandidatePane() |
|
543 |
{ |
|
544 |
MAknFepUICtrlContainerChinese* uiContainer = UIContainer(); |
|
545 |
CDesCArrayFlat* phrase = uiContainer->CandidatePane()->CandidateArray(); |
|
546 |
MAknFepUICtrlEditPane* editPane = uiContainer->EditPaneWindow(); |
|
547 |
if ( KMaxPhraseCreationCount == editPane->PhraseArray()->Count() ) |
|
548 |
{ |
|
549 |
phrase->Reset(); |
|
550 |
TRAP_IGNORE( phrase->AppendL( KMaxPhraseNote ) ); |
|
551 |
uiContainer->CandidatePane()->SplitPhraseCandidatesIntoPages(); |
|
552 |
uiContainer->CandidatePane()->SetCandidateBuffer(); |
|
553 |
uiContainer->Enable( ETrue ); |
|
554 |
uiContainer->ShowHorizontalScrollArrows( EFalse ); |
|
555 |
uiContainer->ShowVerticalScrollArrows( EFalse ); |
|
556 |
} |
|
557 |
||
558 |
TRAP_IGNORE( GetCandidateL() ); |
|
559 |
if ( phrase->Count() > 0 ) |
|
560 |
{ |
|
561 |
// layout candidate and fill candidate buffer for first display page |
|
562 |
uiContainer->CandidatePane()->SplitPhraseCandidatesIntoPages(); |
|
563 |
uiContainer->CandidatePane()->SetCandidateBuffer(); |
|
564 |
uiContainer->Enable( ETrue ); |
|
565 |
TBool multiplePages = !(uiContainer->CandidatePane()->IsLastPage() && |
|
566 |
uiContainer->CandidatePane()->IsFirstPage()); |
|
567 |
uiContainer->ShowVerticalScrollArrows( multiplePages ); |
|
568 |
if ( iState == EMiniQwertyEdit ) |
|
569 |
{ |
|
570 |
UIContainer()->FocusCandidatePane( EFalse ); |
|
571 |
} |
|
572 |
else |
|
573 |
{ |
|
574 |
UIContainer()->FocusCandidatePane( ETrue ); |
|
575 |
UIContainer()->CandidatePane()->SelectFirstPhrase(); |
|
576 |
} |
|
577 |
} |
|
578 |
else |
|
579 |
{ |
|
580 |
uiContainer->CandidatePane()->SplitPhraseCandidatesIntoPages(); |
|
581 |
uiContainer->CandidatePane()->SetCandidateBuffer(); |
|
582 |
uiContainer->Enable( ETrue ); |
|
583 |
uiContainer->ShowHorizontalScrollArrows( EFalse ); |
|
584 |
uiContainer->ShowVerticalScrollArrows( EFalse ); |
|
585 |
uiContainer->SetControlInVisible( EFalse ); |
|
586 |
} |
|
587 |
} |
|
588 |
||
589 |
// --------------------------------------------------------------------------- |
|
590 |
// TAknFepInputMiniQwertyStrokePhraseBase::HandleHorizontalNavigation |
|
591 |
//Handle horizontal navigation. |
|
592 |
// --------------------------------------------------------------------------- |
|
593 |
// |
|
594 |
TBool TAknFepInputMiniQwertyStrokePhraseBase::HandleHorizontalNavigation( |
|
595 |
TInt aKey ) |
|
596 |
{ |
|
597 |
MAknFepUICtrlCandidatePane* candidatePane = UIContainer()->CandidatePane(); |
|
598 |
TBool response = EFalse; |
|
599 |
||
600 |
// Do navigation... |
|
601 |
if ( aKey == EStdKeyLeftArrow ) |
|
602 |
{ |
|
603 |
if(!candidatePane->SelectPrev()) |
|
604 |
{ |
|
605 |
candidatePane->SetCandidateBuffer(); |
|
606 |
candidatePane->SelectLastPhrase(); |
|
607 |
} |
|
608 |
response = ETrue; |
|
609 |
} |
|
610 |
else if ( aKey == EStdKeyRightArrow ) |
|
611 |
{ |
|
612 |
if(!candidatePane->SelectNext()) |
|
613 |
{ |
|
614 |
candidatePane->SetCandidateBuffer(); |
|
615 |
candidatePane->SelectFirstPhrase(); |
|
616 |
} |
|
617 |
response = ETrue; |
|
618 |
} |
|
619 |
||
620 |
if (response) |
|
621 |
{ |
|
622 |
UpdateIndicator(); |
|
623 |
} |
|
624 |
||
625 |
return response; |
|
626 |
} |
|
627 |
||
628 |
// --------------------------------------------------------- |
|
629 |
// TAknFepInputMiniQwertyStrokePhraseBase::UpdateIndicator |
|
630 |
// Update Indicator. |
|
631 |
// --------------------------------------------------------- |
|
632 |
// |
|
633 |
void TAknFepInputMiniQwertyStrokePhraseBase::UpdateIndicator() |
|
634 |
{ |
|
635 |
MAknFepUICtrlContainerChinese* uiContainer = UIContainer(); |
|
636 |
MAknFepUICtrlCandidatePane* candidatePane = uiContainer->CandidatePane(); |
|
637 |
||
638 |
if (candidatePane->IsFirstPage()) |
|
639 |
{ |
|
640 |
uiContainer->CandidatePane()->ShowUpScrollArrows(EFalse); |
|
641 |
} |
|
642 |
else |
|
643 |
{ |
|
644 |
uiContainer->CandidatePane()->ShowUpScrollArrows(ETrue); |
|
645 |
} |
|
646 |
||
647 |
if (candidatePane->IsLastPage()) |
|
648 |
{ |
|
649 |
uiContainer->CandidatePane()->ShowDownScrollArrows(EFalse); |
|
650 |
} |
|
651 |
else |
|
652 |
{ |
|
653 |
uiContainer->CandidatePane()->ShowDownScrollArrows(ETrue); |
|
654 |
} |
|
655 |
#ifdef RD_INTELLIGENT_TEXT_INPUT |
|
656 |
if (iOwner->FepMan()->KeyboardLayout() == EPtiKeyboardQwerty4x10) |
|
657 |
{ |
|
658 |
if (candidatePane->VisibleCandidateCount()==1) |
|
659 |
{ |
|
660 |
uiContainer->CandidatePane()->ShowLeftScrollArrows(EFalse); |
|
661 |
uiContainer->CandidatePane()->ShowRightScrollArrows(EFalse); |
|
662 |
} |
|
663 |
else |
|
664 |
{ |
|
665 |
uiContainer->CandidatePane()->ShowLeftScrollArrows(ETrue); |
|
666 |
uiContainer->CandidatePane()->ShowRightScrollArrows(ETrue); |
|
667 |
} |
|
668 |
} |
|
669 |
else |
|
670 |
{ |
|
671 |
#endif |
|
672 |
if (candidatePane->SelectedIndex() == 0 |
|
673 |
&& candidatePane->IsFirstPage() ) |
|
674 |
{ |
|
675 |
uiContainer->CandidatePane()->ShowLeftScrollArrows(EFalse); |
|
676 |
} |
|
677 |
else |
|
678 |
{ |
|
679 |
uiContainer->CandidatePane()->ShowLeftScrollArrows(ETrue); |
|
680 |
} |
|
681 |
||
682 |
if (candidatePane->IsLastPage() && (candidatePane->SelectedIndex() |
|
683 |
== candidatePane->VisibleCandidateCount() - 1)) |
|
684 |
{ |
|
685 |
uiContainer->CandidatePane()->ShowRightScrollArrows(EFalse); |
|
686 |
} |
|
687 |
else |
|
688 |
{ |
|
689 |
uiContainer->CandidatePane()->ShowRightScrollArrows(ETrue); |
|
690 |
} |
|
691 |
} |
|
692 |
#ifdef RD_INTELLIGENT_TEXT_INPUT |
|
693 |
} |
|
694 |
#endif |
|
695 |
||
696 |
// --------------------------------------------------------- |
|
697 |
// TAknFepInputMiniQwertyStrokePhraseBase::DeleteKeystroke |
|
698 |
// Delete current keystroke. |
|
699 |
// --------------------------------------------------------- |
|
700 |
// |
|
701 |
TBool TAknFepInputMiniQwertyStrokePhraseBase::DeleteKeystroke() |
|
702 |
{ |
|
703 |
MAknFepUICtrlContainerChinese* uiContainer = UIContainer(); |
|
704 |
MAknFepUICtrlEditPane* editPane = uiContainer->EditPaneWindow(); |
|
705 |
CDesCArrayFlat* keystroke = editPane->KeystrokeArray(); |
|
706 |
RArray<TInt>* keycodeArray = editPane->KeycodeArray(); |
|
707 |
TInt index = editPane->GetCursorIndexOfKeystroke(); |
|
708 |
||
709 |
if ( ( 0 == index ) || ( keystroke->Count() == 0 ) ) |
|
710 |
{ |
|
711 |
return EFalse; |
|
712 |
} |
|
713 |
||
714 |
if ( 1 == index ) |
|
715 |
{ |
|
716 |
editPane->Reset(); |
|
717 |
} |
|
718 |
||
719 |
if ( index >= keystroke->Count() ) |
|
720 |
{ |
|
721 |
keystroke->Delete( keystroke->Count() - 1 ); |
|
722 |
keycodeArray->Remove( keycodeArray->Count() - 1 ); |
|
723 |
editPane->SetCursorIndexOfKeystroke( keystroke->Count() ); |
|
724 |
} |
|
725 |
else |
|
726 |
{ |
|
727 |
keystroke->Delete( index - 1 ); |
|
728 |
keycodeArray->Remove( index - 1 ); |
|
729 |
editPane->SetCursorIndexOfKeystroke( index - 1 ); |
|
730 |
} |
|
731 |
return ETrue; |
|
732 |
} |
|
733 |
||
734 |
// --------------------------------------------------------- |
|
735 |
// TAknFepInputMiniQwertyStrokePhraseBase::AddPhraseToDB |
|
736 |
// Add phrase to DB. |
|
737 |
// --------------------------------------------------------- |
|
738 |
// |
|
739 |
void TAknFepInputMiniQwertyStrokePhraseBase::AddPhraseToDB( |
|
740 |
const TDesC& aPhraseAdd ) |
|
741 |
{ |
|
50
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
742 |
// If sogou core is actived, use the plugin. |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
743 |
if ( iStrokePlugin.IsEnable()) |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
744 |
{ |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
745 |
iStrokePlugin.AddPhrasePinyinToPti(); |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
746 |
return; |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
747 |
} |
44 | 748 |
TPtiUserDictionaryEntry addUdbEntry( aPhraseAdd ); |
749 |
//Add the phrase to the DB by PTI Engine |
|
750 |
iOwner->PtiEngine()->AddUserDictionaryEntry( addUdbEntry ); |
|
751 |
} |
|
752 |
||
753 |
// --------------------------------------------------------------------------- |
|
754 |
// TAknFepInputMiniQwertyStrokePhraseBase::RefreshCandidate |
|
755 |
// Refresh candidate |
|
756 |
// --------------------------------------------------------------------------- |
|
757 |
// |
|
758 |
void TAknFepInputMiniQwertyStrokePhraseBase::RefreshCandidate() |
|
759 |
{ |
|
760 |
MAknFepUICtrlContainerChinese* uiContainer = UIContainer(); |
|
761 |
uiContainer->CandidatePane()->SetCandidateBuffer(); |
|
762 |
uiContainer->Enable( ETrue ); |
|
763 |
||
764 |
TBool multiplePages = !(uiContainer->CandidatePane()->IsLastPage() && |
|
765 |
uiContainer->CandidatePane()->IsFirstPage()); |
|
766 |
uiContainer->ShowVerticalScrollArrows( multiplePages ); |
|
767 |
||
768 |
uiContainer->CandidatePane()->SelectFirstPhrase(); |
|
769 |
UpdateIndicator(); |
|
770 |
} |
|
771 |
||
772 |
// --------------------------------------------------------------------------- |
|
773 |
// TAknFepInputMiniQwertyStrokePhraseBase::CheckKeyNeedRepeat |
|
774 |
// Check key whether need repeat. |
|
775 |
// --------------------------------------------------------------------------- |
|
776 |
// |
|
777 |
TBool TAknFepInputMiniQwertyStrokePhraseBase::CheckKeyNeedRepeat( TKeyPressLength aLength ) |
|
778 |
{ |
|
779 |
MAknFepUICtrlEditPane* editPane = UIContainer()->EditPaneWindow(); |
|
780 |
if ( editPane->IsChangeState() && aLength == ELongKeyPress ) |
|
781 |
{ |
|
782 |
return EFalse; |
|
783 |
} |
|
784 |
else |
|
785 |
{ |
|
786 |
editPane->SetChangeState( EFalse ); |
|
787 |
} |
|
788 |
return ETrue; |
|
789 |
} |
|
790 |
||
791 |
// --------------------------------------------------------------------------- |
|
792 |
// TAknFepInputMiniQwertyStrokePhraseBase::CommitInlineEEPL |
|
793 |
// Commint text to EEP or editor |
|
794 |
// --------------------------------------------------------------------------- |
|
795 |
// |
|
796 |
TBool TAknFepInputMiniQwertyStrokePhraseBase::CommitInlineEEPL( const TDesC& aDes ) |
|
797 |
{ |
|
50
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
798 |
// If sogou core is actived, use the plugin. |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
799 |
if ( iStrokePlugin.IsEnable()) |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
800 |
{ |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
801 |
return iStrokePlugin.CommitInlineEEPL( aDes ); |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
802 |
} |
44 | 803 |
TInt charCount = aDes.Length(); |
804 |
MAknFepManagerUIInterface* fepMan = iOwner->FepMan(); |
|
805 |
MAknFepUICtrlEditPane* editpane = UIContainer()->EditPaneWindow(); |
|
806 |
CDesCArrayFlat* keyStoke = editpane->KeystrokeArray(); |
|
807 |
RArray<TInt>* keycode = editpane->KeycodeArray(); |
|
808 |
CDesCArrayFlat* phraseArray = editpane->PhraseArray(); |
|
809 |
CDesCArrayFlat* phraseShowKeyStroke = editpane->PhraseShowKeyStrokeArray(); |
|
810 |
RArray<TInt>* phraseKeycode = editpane->PhraseKeycodeArray(); |
|
811 |
TBuf<KMaxKeystrokeCount> buf; |
|
812 |
TBuf<1> strokeDLT; |
|
813 |
strokeDLT.Append( KStrokeDelimiter ); |
|
814 |
||
815 |
phraseArray->AppendL( aDes ); |
|
816 |
||
817 |
TInt phraseCount = phraseArray->Count(); |
|
818 |
TInt index = 0; |
|
819 |
TInt isFound = keyStoke->Find( strokeDLT, index ); |
|
820 |
||
821 |
//phrase creation state |
|
822 |
if ( phraseCount > 1 || ( 0 == isFound && charCount <= 1 )) |
|
823 |
{ |
|
824 |
editpane->SetPhraseCreationFlag( ETrue ); |
|
825 |
if ( 0 == isFound && phraseCount < 7 && index < keyStoke->Count() - 1 ) |
|
826 |
{ |
|
827 |
for ( TInt i = 0; i <= index; i++ ) |
|
828 |
{ |
|
829 |
TPtrC ptr = keyStoke->MdcaPoint( 0 ); |
|
830 |
buf.Append( ptr ); |
|
831 |
keyStoke->Delete( 0); |
|
832 |
phraseKeycode->AppendL( (*keycode)[0]); |
|
833 |
keycode->Remove( 0 ); |
|
834 |
} |
|
835 |
phraseShowKeyStroke->AppendL( buf ); |
|
836 |
editpane->SetCursorIndexOfKeystroke( 0 ); |
|
837 |
editpane->DisableCursor(); |
|
838 |
return ETrue; |
|
839 |
} |
|
840 |
else |
|
841 |
{ |
|
842 |
TBuf<KMaxPhraseCreationCount> phraseCreated; |
|
843 |
for ( TInt ii = 0; ii < phraseCount; ++ii ) |
|
844 |
{ |
|
845 |
phraseCreated.Append( phraseArray->MdcaPoint(ii) ); |
|
846 |
} |
|
847 |
if ( 0 != isFound || ( 0 == isFound && index == keyStoke->Count() - 1 ) ) |
|
848 |
{ |
|
849 |
editpane->ResetAllArray(); |
|
850 |
} |
|
851 |
fepMan->NewTextL( phraseCreated ); |
|
852 |
fepMan->CommitInlineEditL(); |
|
853 |
AddPhraseToDB( phraseCreated ); |
|
854 |
return EFalse; |
|
855 |
} |
|
856 |
} |
|
857 |
else |
|
858 |
{ |
|
859 |
TBuf<KMaxPhraseCreationCount> phraseCreated; |
|
860 |
for ( TInt ii = 0; ii < phraseCount; ++ii ) |
|
861 |
{ |
|
862 |
phraseCreated.Append( phraseArray->MdcaPoint( ii ) ); |
|
863 |
} |
|
864 |
editpane->ResetAllArray(); |
|
865 |
editpane->SetPhraseCreationFlag( EFalse ); |
|
866 |
fepMan->NewTextL( phraseCreated ); |
|
867 |
fepMan->CommitInlineEditL(); |
|
868 |
iOwner->PtiEngine()->SetPredictiveChineseChar( phraseCreated ); |
|
869 |
return EFalse; |
|
870 |
} |
|
871 |
} |
|
872 |
||
873 |
// --------------------------------------------------------- |
|
874 |
// TAknFepInputMiniQwertyStrokePhraseBase::ClearPtiEngineKeystroke |
|
875 |
// clear the ptiengine keystroke; |
|
876 |
// --------------------------------------------------------- |
|
877 |
// |
|
878 |
void TAknFepInputMiniQwertyStrokePhraseBase::ClearPtiEngineKeystroke() |
|
879 |
{ |
|
880 |
iOwner->PtiEngine()->ClearCurrentWord(); |
|
881 |
} |
|
882 |
||
883 |
// --------------------------------------------------------- |
|
884 |
// TAknFepInputMiniQwertyStrokePhraseBase::AddKeystrokeL |
|
885 |
// Add keystroke. |
|
886 |
// --------------------------------------------------------- |
|
887 |
// |
|
888 |
TBool TAknFepInputMiniQwertyStrokePhraseBase::AddKeystrokeL( TInt aKey ) |
|
889 |
{ |
|
890 |
MAknFepUICtrlContainerChinese* uiContainer = UIContainer(); |
|
891 |
MAknFepUICtrlEditPane* editPane = uiContainer->EditPaneWindow(); |
|
892 |
CDesCArrayFlat* keystrokeArray = editPane->KeystrokeArray(); |
|
893 |
RArray<TInt>* keycodeArray = editPane->KeycodeArray(); |
|
894 |
TInt phraseCount = editPane->PhraseArray()->Count(); |
|
895 |
TInt keystrokeCount = keystrokeArray->Count(); |
|
896 |
TInt index = editPane->GetCursorIndexOfKeystroke(); |
|
50
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
897 |
|
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
898 |
// Get the current core id |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
899 |
TInt coreID = 0; |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
900 |
TRAP_IGNORE( coreID = iOwner->PtiEngine()->HandleCommandL( EPtiCommandGetCoreID )); |
44 | 901 |
|
50
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
902 |
if ( TUid::Uid( coreID ) == KPtiSogouCoreUid ) |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
903 |
{ |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
904 |
CDesCArrayFlat* phrase = editPane->PhraseArray(); |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
905 |
phraseCount = 0; |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
906 |
for ( TInt j = 0; j < phrase->Count(); j++ ) |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
907 |
{ |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
908 |
phraseCount += phrase->MdcaPoint(j).Length();; |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
909 |
} |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
910 |
} |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
911 |
|
44 | 912 |
if ( phraseCount + keystrokeCount >= KMaxKeystrokeCount ) |
913 |
{ |
|
914 |
return EFalse; |
|
915 |
} |
|
916 |
||
917 |
||
918 |
TBuf<1> keystroke; |
|
919 |
GetShowKeystroke( aKey, keystroke ); |
|
920 |
if ( index >= keystrokeCount ) |
|
921 |
{ |
|
922 |
keystrokeArray->AppendL( keystroke ); |
|
923 |
keycodeArray->AppendL( aKey ); |
|
924 |
editPane->SetCursorIndexOfKeystroke( keystrokeCount + 1 ); |
|
925 |
} |
|
926 |
else |
|
927 |
{ |
|
928 |
keystrokeArray->InsertL( index, keystroke ); |
|
929 |
keycodeArray->InsertL( aKey, index ); |
|
930 |
editPane->SetCursorIndexOfKeystroke( index + 1 ); |
|
931 |
} |
|
932 |
||
933 |
return ETrue; |
|
934 |
} |
|
935 |
||
936 |
// --------------------------------------------------------- |
|
937 |
// TAknFepInputMiniQwertyStrokePhraseBase::GetCandidateL |
|
938 |
// Get the candidate info. |
|
939 |
// --------------------------------------------------------- |
|
940 |
// |
|
941 |
void TAknFepInputMiniQwertyStrokePhraseBase::GetCandidateL() |
|
942 |
{ |
|
943 |
CPtiEngine* ptiengine = iOwner->PtiEngine(); |
|
944 |
MAknFepUICtrlContainerChinese* uiContainer = UIContainer(); |
|
945 |
MAknFepUICtrlEditPane* editPane = uiContainer->EditPaneWindow(); |
|
946 |
CDesCArrayFlat* phraseCandidates = |
|
947 |
uiContainer->CandidatePane()->CandidateArray(); |
|
948 |
CDesCArrayFlat* keystrokeArray = editPane->KeystrokeArray(); |
|
949 |
TInt phraseCount = editPane->PhraseArray()->Count(); |
|
950 |
phraseCandidates->Reset(); |
|
951 |
||
952 |
if ( keystrokeArray->Count() == 0 ) |
|
953 |
{ |
|
954 |
return; |
|
955 |
} |
|
956 |
||
957 |
if ( ( 0 == phraseCount ) && editPane->GetAllValidFlag() ) |
|
958 |
{ |
|
959 |
ptiengine->GetChinesePhraseCandidatesL( *phraseCandidates ); |
|
960 |
return; |
|
961 |
} |
|
962 |
||
963 |
if ( !CheckFirstGroupStroke() ) |
|
964 |
{ |
|
965 |
return; |
|
966 |
} |
|
967 |
||
968 |
ptiengine->GetChinesePhraseCandidatesL( *phraseCandidates ); |
|
969 |
} |
|
970 |
||
971 |
// --------------------------------------------------------------------------- |
|
972 |
// TAknFepInputMiniQwertyStrokePhraseBase::GetShowKeystroke |
|
973 |
// get the show keystroke. |
|
974 |
// --------------------------------------------------------------------------- |
|
975 |
// |
|
976 |
void TAknFepInputMiniQwertyStrokePhraseBase::GetShowKeystroke( |
|
977 |
TInt aKey, |
|
978 |
TDes& aKeystroke |
|
979 |
) |
|
980 |
{ |
|
981 |
CPtiEngine* ptiEngine = iOwner->PtiEngine(); |
|
50
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
982 |
TBuf<KMaxName> lowerdata; |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
983 |
|
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
984 |
// If the key is EPtiKeyQwertySpace, just append a KStrokeDelimiter. |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
985 |
if ( aKey == EPtiKeyQwertySpace ) |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
986 |
{ |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
987 |
TBuf<1> strokeDLT; |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
988 |
strokeDLT.Append( KStrokeDelimiter ); |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
989 |
aKeystroke.Copy( strokeDLT ); |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
990 |
return; |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
991 |
} |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
992 |
|
44 | 993 |
ptiEngine->MappingDataForKey((TPtiKey)aKey, lowerdata, EPtiCaseLower); |
994 |
TInt StrokeUnicodePosition =0; |
|
995 |
||
996 |
if(lowerdata.Length()>0) |
|
997 |
{ |
|
998 |
for(TInt i=0;i<lowerdata.Length()-1;i++) |
|
999 |
{ |
|
1000 |
if(lowerdata[i]==KStrokeUnicode) |
|
1001 |
{ |
|
1002 |
StrokeUnicodePosition = i+1; |
|
1003 |
break; |
|
1004 |
} |
|
1005 |
} |
|
1006 |
if ( StrokeUnicodePosition < lowerdata.Length() ) |
|
1007 |
{ |
|
1008 |
aKeystroke.Copy( lowerdata.Mid( StrokeUnicodePosition, 1 ) ); |
|
1009 |
} |
|
1010 |
} |
|
1011 |
||
1012 |
} |
|
1013 |
||
1014 |
// --------------------------------------------------------- |
|
1015 |
// TAknFepInputMiniQwertyStrokePhraseBase::RevertPhraseToKeystrokeL |
|
1016 |
// Revert the phrase to keystroke. |
|
1017 |
// --------------------------------------------------------- |
|
1018 |
// |
|
1019 |
void TAknFepInputMiniQwertyStrokePhraseBase::RevertPhraseToKeystrokeL() |
|
1020 |
{ |
|
1021 |
MAknFepUICtrlContainerChinese* uiContainer = UIContainer(); |
|
1022 |
MAknFepUICtrlEditPane* editPane = uiContainer->EditPaneWindow(); |
|
1023 |
CDesCArrayFlat* keystrokeArray = editPane->KeystrokeArray(); |
|
1024 |
RArray<TInt>* keycodeArray = editPane->KeycodeArray(); |
|
1025 |
RArray<TInt>* phraseKeycodeArray = editPane->PhraseKeycodeArray(); |
|
1026 |
CDesCArrayFlat* phrase = editPane->PhraseArray(); |
|
1027 |
CDesCArrayFlat* phraseStroke = editPane->PhraseShowKeyStrokeArray(); |
|
1028 |
||
1029 |
TBuf<KMaxKeystrokeCount> buf; |
|
1030 |
||
1031 |
if ( ( phrase->Count() == 0 ) || ( phraseStroke->Count() == 0 ) ) |
|
1032 |
{ |
|
1033 |
return; |
|
1034 |
} |
|
1035 |
||
1036 |
buf.Append( phraseStroke->MdcaPoint( phraseStroke->Count() - 1 ) ); |
|
1037 |
||
1038 |
for ( TInt i = buf.Length() - 1; i >= 0; --i ) |
|
1039 |
{ |
|
1040 |
keystrokeArray->InsertL( 0, buf.Mid( i, 1 ) ); |
|
1041 |
keycodeArray->Insert( (*phraseKeycodeArray)[phraseKeycodeArray->Count()-1], 0 ); |
|
1042 |
phraseKeycodeArray->Remove( phraseKeycodeArray->Count()-1 ); |
|
1043 |
} |
|
1044 |
phrase->Delete( phrase->Count() - 1 ); |
|
1045 |
phraseStroke->Delete( phraseStroke->Count() - 1 ); |
|
1046 |
||
1047 |
TInt leng = phrase->Count() + keystrokeArray->Count(); |
|
1048 |
if ( leng > KMaxKeystrokeCount ) |
|
1049 |
{ |
|
1050 |
for ( TInt i = 0; i < leng - KMaxKeystrokeCount; ++i ) |
|
1051 |
{ |
|
1052 |
if ( keystrokeArray->Count() == 0 ) |
|
1053 |
{ |
|
1054 |
break; |
|
1055 |
} |
|
1056 |
keystrokeArray->Delete( keystrokeArray->Count() - 1 ); |
|
1057 |
keycodeArray->Remove( keycodeArray->Count() - 1 ); |
|
1058 |
} |
|
1059 |
} |
|
1060 |
||
1061 |
editPane->SetCursorIndexOfKeystroke( buf.Length() ); |
|
1062 |
keystrokeArray->Compress(); |
|
1063 |
phrase->Compress(); |
|
1064 |
phraseStroke->Compress(); |
|
50
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
1065 |
|
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
1066 |
TInt coreID = iOwner->PtiEngine()->HandleCommandL( EPtiCommandGetCoreID ); |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
1067 |
if ( TUid::Uid( coreID ) == KPtiSogouCoreUid ) |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
1068 |
{ |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
1069 |
// Notify sogoucore that last phrase is cancelled |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
1070 |
iOwner->PtiEngine()->HandleCommandL( EPtiCommandCancelSelectElement ); |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
1071 |
} |
44 | 1072 |
} |
1073 |
||
1074 |
// --------------------------------------------------------- |
|
1075 |
// TAknFepInputMiniQwertyStrokePhraseBase::SetWarningColor |
|
1076 |
// Set warning color. |
|
1077 |
// --------------------------------------------------------- |
|
1078 |
// |
|
1079 |
void TAknFepInputMiniQwertyStrokePhraseBase::SetWarningColor() |
|
1080 |
{ |
|
1081 |
CPtiEngine* ptiengine = iOwner->PtiEngine(); |
|
1082 |
MAknFepUICtrlEditPane* editPane = UIContainer()->EditPaneWindow(); |
|
1083 |
CDesCArrayFlat* keystrokeArray = editPane->KeystrokeArray(); |
|
1084 |
RArray<TInt>* keycodeArray = editPane->KeycodeArray(); |
|
1085 |
TInt keystrokeCount = keystrokeArray->Count(); |
|
1086 |
TInt phraseCount = editPane->PhraseArray()->Count(); |
|
1087 |
TBool valid = ETrue; |
|
1088 |
TInt index = 0; |
|
1089 |
TInt count = 0; |
|
1090 |
TInt stringBeforeLength = 0; |
|
1091 |
TInt stringAfterLength = 0; |
|
1092 |
TInt keyCode = 0; |
|
1093 |
TInt invalidPos = 0; |
|
1094 |
TBuf<1> delimiter; |
|
1095 |
delimiter.Append( KStrokeDelimiter ); |
|
1096 |
||
50
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
1097 |
// Get the current core id |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
1098 |
TInt coreID = 0; |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
1099 |
TRAP_IGNORE( coreID = iOwner->PtiEngine()->HandleCommandL( EPtiCommandGetCoreID )); |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
1100 |
|
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
1101 |
if ( TUid::Uid( coreID ) == KPtiSogouCoreUid ) |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
1102 |
{ |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
1103 |
CDesCArrayFlat* phrase = editPane->PhraseArray(); |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
1104 |
phraseCount = 0; |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
1105 |
for ( TInt j = 0; j < phrase->Count(); j++ ) |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
1106 |
{ |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
1107 |
phraseCount += phrase->MdcaPoint(j).Length();; |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
1108 |
} |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
1109 |
} |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
1110 |
|
44 | 1111 |
//set warning color stroke after 7th group when it's more than 7 groups. |
1112 |
if ( 0 == keystrokeCount ) |
|
1113 |
{ |
|
1114 |
return; |
|
1115 |
} |
|
1116 |
||
1117 |
if ( CheckAllGroupStroke() ) |
|
1118 |
{ |
|
1119 |
return; |
|
1120 |
} |
|
1121 |
||
1122 |
TInt delimiterCount = phraseCount + editPane->GetDelimiterCount(); |
|
1123 |
invalidPos = editPane->GetInvalidIndex(); |
|
1124 |
index = invalidPos; |
|
1125 |
ClearPtiEngineKeystroke(); |
|
1126 |
for ( TInt i = invalidPos; i < keystrokeCount; ++i ) |
|
1127 |
{ |
|
1128 |
count = count + 1; |
|
1129 |
//GetKeystrokeCode( keyCode, keystrokeArray->MdcaPoint( i ) ); |
|
1130 |
keyCode = (*keycodeArray)[i]; |
|
1131 |
if ( EPtiKeyQwertySpace == keyCode ) |
|
1132 |
{ |
|
1133 |
delimiterCount = delimiterCount + 1; |
|
50
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
1134 |
|
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
1135 |
// For Sogou core, there is no need to limit characters count to |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
1136 |
// KMaxPhraseCreationCount. |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
1137 |
if ( TUid::Uid( coreID ) != KPtiSogouCoreUid ) |
44 | 1138 |
{ |
50
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
1139 |
if ( delimiterCount == KMaxPhraseCreationCount ) |
44 | 1140 |
{ |
50
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
1141 |
if ( !valid ) |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
1142 |
{ |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
1143 |
editPane->SetHighlight( |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
1144 |
phraseCount + index, |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
1145 |
phraseCount + keystrokeCount - 1 ); |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
1146 |
} |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
1147 |
else |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
1148 |
{ |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
1149 |
editPane->SetHighlight( |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
1150 |
phraseCount + i, |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
1151 |
phraseCount + keystrokeCount - 1 ); |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
1152 |
} |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
1153 |
break; |
44 | 1154 |
} |
1155 |
} |
|
50
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
1156 |
|
44 | 1157 |
if ( ( !valid ) || ( 0 == i ) ) |
1158 |
{ |
|
1159 |
editPane->SetHighlight( |
|
1160 |
phraseCount + index, |
|
1161 |
phraseCount + index + count - 1 ); |
|
1162 |
} |
|
1163 |
else if ( i > 0 ) |
|
1164 |
{ |
|
1165 |
if ( 0 == keystrokeArray->MdcaPoint( i - 1 ).Compare( delimiter ) ) |
|
1166 |
{ |
|
1167 |
editPane->SetHighlight( |
|
1168 |
phraseCount + index, |
|
1169 |
phraseCount + index + count - 1 ); |
|
1170 |
} |
|
1171 |
} |
|
1172 |
valid = ETrue; |
|
1173 |
index = i + 1; |
|
1174 |
count = 0; |
|
1175 |
ClearPtiEngineKeystroke(); |
|
1176 |
} |
|
1177 |
else if ( valid ) |
|
1178 |
{ |
|
1179 |
stringBeforeLength = ptiengine->GetPhoneticSpelling(1).Length(); |
|
1180 |
stringAfterLength = |
|
1181 |
ptiengine->AppendKeyPress((TPtiKey)keyCode).Length(); |
|
50
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
1182 |
stringAfterLength = ptiengine->GetPhoneticSpelling(1).Length(); |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
1183 |
|
44 | 1184 |
if ( stringBeforeLength == stringAfterLength ) |
1185 |
{ |
|
1186 |
valid = EFalse; |
|
1187 |
} |
|
1188 |
} |
|
1189 |
||
1190 |
if ( ( !valid ) && |
|
1191 |
( keystrokeCount == i + 1 ) && |
|
1192 |
( EPtiKeyQwertySpace != keyCode ) ) |
|
1193 |
{ |
|
1194 |
editPane->SetHighlight( |
|
1195 |
phraseCount + index, |
|
1196 |
phraseCount + index + count - 1 ); |
|
1197 |
} |
|
1198 |
} |
|
1199 |
||
1200 |
} |
|
1201 |
||
1202 |
// --------------------------------------------------------- |
|
1203 |
// TAknFepInputMiniQwertyStrokePhraseBase::SetWarningColor |
|
1204 |
// Set warning color. |
|
1205 |
// --------------------------------------------------------- |
|
1206 |
// |
|
1207 |
void TAknFepInputMiniQwertyStrokePhraseBase::ChangeCbaL() |
|
1208 |
{ |
|
1209 |
MAknFepManagerUIInterface* fepMan = iOwner->FepMan(); |
|
1210 |
MAknFepUICtrlEditPane* editPane = UIContainer()->EditPaneWindow(); |
|
1211 |
TInt candidateCount = UIContainer()->CandidatePane()->CandidateArray()->Count(); |
|
1212 |
TInt keyStrokeCount = editPane->KeystrokeArray()->Count(); |
|
1213 |
TInt phraseCount = editPane->PhraseArray()->Count(); |
|
1214 |
TInt currentCBAResId = editPane->GetCurrentCBAResID(); |
|
1215 |
if ( ( candidateCount == 0 && keyStrokeCount != 0 ) || |
|
1216 |
( phraseCount == 1 && keyStrokeCount == 0 ) ) |
|
1217 |
{ |
|
1218 |
if (R_AKNFEP_SOFTKEYS_EMPTY_CANCEL_EMPTY != currentCBAResId ) |
|
1219 |
{ |
|
1220 |
fepMan->UpdateCbaL( R_AKNFEP_SOFTKEYS_EMPTY_CANCEL_EMPTY ); |
|
1221 |
editPane->SetCurrentCBAResID( R_AKNFEP_SOFTKEYS_EMPTY_CANCEL_EMPTY ); |
|
1222 |
} |
|
1223 |
||
1224 |
} |
|
1225 |
else if ( keyStrokeCount == 0 ) |
|
1226 |
{ |
|
1227 |
if ( R_AKNFEP_SOFTKEYS_DONE_CANCEL_DONE != currentCBAResId ) |
|
1228 |
{ |
|
1229 |
fepMan->UpdateCbaL( R_AKNFEP_SOFTKEYS_DONE_CANCEL_DONE ); |
|
1230 |
editPane->SetCurrentCBAResID( R_AKNFEP_SOFTKEYS_DONE_CANCEL_DONE ); |
|
1231 |
} |
|
1232 |
} |
|
1233 |
else if ( R_AKNFEP_SOFTKEYS_OK_SELECT_CANCEL != currentCBAResId ) |
|
1234 |
{ |
|
1235 |
fepMan->UpdateCbaL( R_AKNFEP_SOFTKEYS_OK_SELECT_CANCEL ); |
|
1236 |
editPane->SetCurrentCBAResID( R_AKNFEP_SOFTKEYS_OK_SELECT_CANCEL ); |
|
1237 |
} |
|
1238 |
} |
|
1239 |
||
1240 |
// --------------------------------------------------------- |
|
1241 |
// TAknFepInputMiniQwertyStrokePhraseBase::MoveCursorLeft |
|
1242 |
// Move the cursor to Left. |
|
1243 |
// --------------------------------------------------------- |
|
1244 |
// |
|
1245 |
TBool TAknFepInputMiniQwertyStrokePhraseBase::MoveCursorLeft() |
|
1246 |
{ |
|
1247 |
MAknFepUICtrlContainerChinese* uiContainer = UIContainer(); |
|
1248 |
MAknFepUICtrlEditPane* editPane = uiContainer->EditPaneWindow(); |
|
1249 |
TInt keystrokeCount = editPane->KeystrokeArray()->Count(); |
|
1250 |
TInt index = editPane->GetCursorIndexOfKeystroke(); |
|
1251 |
TInt phraseCount = editPane->PhraseArray()->Count(); |
|
1252 |
||
1253 |
if ( EMiniQwertyEdit != iState ) |
|
1254 |
{ |
|
1255 |
return EFalse; |
|
1256 |
} |
|
1257 |
if ( 0 == keystrokeCount ) |
|
1258 |
{ |
|
1259 |
return EFalse; |
|
1260 |
} |
|
1261 |
||
1262 |
if ( 0 == index ) |
|
1263 |
{ |
|
1264 |
editPane->SetCursorIndexOfKeystroke( keystrokeCount ); |
|
1265 |
ShowInfoOnEEPPane(); |
|
1266 |
SetWarningColor(); |
|
1267 |
} |
|
1268 |
else if ( ( phraseCount > 0 ) && ( 1 == index ) ) |
|
1269 |
{ |
|
1270 |
editPane->SetCursorIndexOfKeystroke( 0 ); |
|
1271 |
ShowInfoOnEEPPane(); |
|
1272 |
SetWarningColor(); |
|
1273 |
} |
|
1274 |
else |
|
1275 |
{ |
|
1276 |
editPane->MoveCursorLeft(); |
|
1277 |
editPane->SetCursorIndexOfKeystroke( index - 1 ); |
|
1278 |
} |
|
1279 |
||
1280 |
editPane->SetAutoChangeStateFlag( EManualChangeState ); |
|
1281 |
||
1282 |
return ETrue; |
|
1283 |
} |
|
1284 |
||
1285 |
// --------------------------------------------------------- |
|
1286 |
// TAknFepInputMiniQwertyStrokePhraseBase::MoveCursorRight |
|
1287 |
// Move the cursor to Right. |
|
1288 |
// --------------------------------------------------------- |
|
1289 |
// |
|
1290 |
TBool TAknFepInputMiniQwertyStrokePhraseBase::MoveCursorRight() |
|
1291 |
{ |
|
1292 |
MAknFepUICtrlContainerChinese* uiContainer = UIContainer(); |
|
1293 |
MAknFepUICtrlEditPane* editPane = uiContainer->EditPaneWindow(); |
|
1294 |
TInt keystrokeCount = editPane->KeystrokeArray()->Count(); |
|
1295 |
TInt index = editPane->GetCursorIndexOfKeystroke(); |
|
1296 |
||
1297 |
if ( EMiniQwertyEdit != iState ) |
|
1298 |
{ |
|
1299 |
return EFalse; |
|
1300 |
} |
|
1301 |
if ( 0 == keystrokeCount ) |
|
1302 |
{ |
|
1303 |
return EFalse; |
|
1304 |
} |
|
1305 |
if ( index >= keystrokeCount ) |
|
1306 |
{ |
|
1307 |
editPane->SetCursorIndexOfKeystroke( 0 ); |
|
1308 |
ShowInfoOnEEPPane(); |
|
1309 |
SetWarningColor(); |
|
1310 |
} |
|
1311 |
else |
|
1312 |
{ |
|
1313 |
editPane->MoveCursorRight(); |
|
1314 |
editPane->SetCursorIndexOfKeystroke( index + 1 ); |
|
1315 |
} |
|
1316 |
||
1317 |
editPane->SetAutoChangeStateFlag( EManualChangeState ); |
|
1318 |
||
1319 |
return ETrue; |
|
1320 |
} |
|
1321 |
||
1322 |
// --------------------------------------------------------- |
|
1323 |
// TAknFepInputMiniQwertyStrokePhraseBase::HandleKeyFromCandidateL |
|
1324 |
// Handle key from candidate. |
|
1325 |
// --------------------------------------------------------- |
|
1326 |
// |
|
1327 |
void TAknFepInputMiniQwertyStrokePhraseBase::HandleKeyFromCandidateL( |
|
1328 |
TInt aKey, TKeyPressLength /*aLength*/ ) |
|
1329 |
{ |
|
1330 |
TInt index = 0; |
|
1331 |
MAknFepUICtrlCandidatePane* candidatePane = UIContainer()->CandidatePane(); |
|
1332 |
#ifdef RD_INTELLIGENT_TEXT_INPUT |
|
1333 |
// it may be one of the 'valid' numbers.. |
|
1334 |
TPtiKeyboardType keyboardtype = iOwner->FepMan()->KeyboardLayout(); |
|
1335 |
if ( EPtiKeyboardQwerty4x10 == keyboardtype || EPtiKeyboardQwerty3x11 |
|
1336 |
== keyboardtype || EPtiKeyboardHalfQwerty == keyboardtype |
|
1337 |
|| EPtiKeyboardCustomQwerty == keyboardtype ) |
|
1338 |
{ |
|
1339 |
MPtiLanguage *lang= NULL; |
|
1340 |
RArray < TPtiNumericKeyBinding > keybinding; |
|
1341 |
TBool validnumkey = EFalse; |
|
1342 |
CPtiEngine* ptiengine = iOwner->PtiEngine(); |
|
1343 |
||
1344 |
if( ptiengine != NULL ) |
|
1345 |
{ |
|
1346 |
lang = ptiengine->CurrentLanguage(); |
|
1347 |
} |
|
1348 |
if ( ptiengine && lang ) |
|
1349 |
{ |
|
1350 |
TRAP_IGNORE(ptiengine->GetNumericModeKeysForQwertyL(lang->LanguageCode(), keybinding, keyboardtype)); |
|
1351 |
TInt numericKeysCount = keybinding.Count(); |
|
1352 |
while (numericKeysCount-- ) |
|
1353 |
{ |
|
1354 |
TPtiNumericKeyBinding numKeyBind = |
|
1355 |
keybinding[numericKeysCount]; |
|
1356 |
if ( (numKeyBind.iChar >= KKey1 && numKeyBind.iChar <= KKey6) |
|
1357 |
&&(aKey == numKeyBind.iKey) ) |
|
1358 |
{ |
|
1359 |
index = numKeyBind.iChar - EPtiKey0 -1; |
|
1360 |
if ( candidatePane->SelectIndex( index ) ) |
|
1361 |
{ |
|
1362 |
validnumkey = ETrue; |
|
1363 |
} |
|
1364 |
break; |
|
1365 |
} |
|
1366 |
} |
|
1367 |
} |
|
1368 |
keybinding.Reset(); |
|
1369 |
keybinding.Close(); |
|
1370 |
if ( !validnumkey ) |
|
1371 |
{ |
|
1372 |
iOwner->FepMan()->PlaySound( EAvkonSIDErrorTone ); |
|
1373 |
return; |
|
1374 |
} |
|
1375 |
} |
|
1376 |
else |
|
1377 |
{ |
|
1378 |
#endif |
|
1379 |
index = MapKeyToIndex( aKey ); |
|
1380 |
#ifdef RD_INTELLIGENT_TEXT_INPUT |
|
1381 |
} |
|
1382 |
#endif |
|
1383 |
TPtrC text = candidatePane->CurrentPhraseCandidate(); |
|
1384 |
if ( text.Length( ) ) |
|
1385 |
{ |
|
1386 |
if ( !CommitInlineEEPL( text ) ) |
|
1387 |
{ |
|
1388 |
DoActionAfterCommit( ); |
|
1389 |
} |
|
1390 |
else |
|
1391 |
{ |
|
1392 |
if ( CheckFirstGroupStroke( ) ) |
|
1393 |
{ |
|
1394 |
RefreshUI( ); |
|
1395 |
UIContainer()->CandidatePane()->SelectFirstPhrase( ); |
|
1396 |
} |
|
1397 |
else |
|
1398 |
{ |
|
1399 |
UIContainer()->EditPaneWindow()->SetAutoChangeStateFlag( EAutoChangeStateFromCandidate ); |
|
1400 |
iOwner->ChangeState( EMiniQwertyEdit ); |
|
1401 |
} |
|
1402 |
} |
|
1403 |
} |
|
1404 |
} |
|
1405 |
||
1406 |
// --------------------------------------------------------- |
|
1407 |
// TAknFepInputMiniQwertyStrokePhraseBase::CheckAllGroupStroke |
|
1408 |
// check the all group stroke of keystroke. |
|
1409 |
// --------------------------------------------------------- |
|
1410 |
// |
|
1411 |
TBool TAknFepInputMiniQwertyStrokePhraseBase::CheckAllGroupStroke() |
|
1412 |
{ |
|
1413 |
CPtiEngine* ptiengine = iOwner->PtiEngine(); |
|
1414 |
MAknFepUICtrlContainerChinese* uiContainer = UIContainer(); |
|
1415 |
MAknFepUICtrlEditPane* editPane = uiContainer->EditPaneWindow(); |
|
1416 |
CDesCArrayFlat* keystroke = editPane->KeystrokeArray(); |
|
1417 |
RArray<TInt>* keycodeArray = editPane->KeycodeArray(); |
|
1418 |
TInt phraseCount = editPane->PhraseArray()->Count(); |
|
1419 |
TInt keystrokeCount = keystroke->Count(); |
|
1420 |
TInt keyCode = 0; |
|
1421 |
TInt stringBeforeLength = 0; |
|
1422 |
TInt stringAfterLength = 0; |
|
1423 |
TInt lastDLTPos = 0; |
|
1424 |
TBool check = ETrue; |
|
1425 |
TInt delimiterCount = 0; |
|
1426 |
//If has phrase on the entry pane then the all keystroke is invalid. |
|
1427 |
if ( ( phraseCount > 0 ) || ( 0 == keystrokeCount ) ) |
|
1428 |
{ |
|
1429 |
editPane->SetAllValidFlag( EFalse ); |
|
1430 |
editPane->SetDelimiterCount( 0 ); |
|
1431 |
editPane->SetInvalidIndex( 0 ); |
|
1432 |
return EFalse; |
|
1433 |
} |
|
1434 |
||
1435 |
ClearPtiEngineKeystroke(); |
|
1436 |
for ( TInt i = 0; i < keystrokeCount; ++i ) |
|
1437 |
{ |
|
1438 |
//GetKeystrokeCode( keyCode, keystroke->MdcaPoint( i ) ); |
|
1439 |
keyCode = (*keycodeArray)[i]; |
|
1440 |
if ( EPtiKeyQwertySpace == keyCode ) |
|
1441 |
{ |
|
1442 |
//If first keystroke is delimiter then all keystroke is not valid. |
|
1443 |
if ( i == 0 ) |
|
1444 |
{ |
|
1445 |
editPane->SetAllValidFlag( EFalse ); |
|
1446 |
editPane->SetDelimiterCount( 0 ); |
|
1447 |
editPane->SetInvalidIndex( 0 ); |
|
1448 |
return EFalse; |
|
1449 |
} |
|
1450 |
//If two delimiter is border upon then the check evaluate EFalse. |
|
1451 |
else if ( lastDLTPos == ( i - 1 ) ) |
|
1452 |
{ |
|
1453 |
check = EFalse; |
|
1454 |
} |
|
1455 |
//lastDLTPos evaluate last delimiter that has not border upon deliminter. |
|
1456 |
else if ( check ) |
|
1457 |
{ |
|
1458 |
delimiterCount = delimiterCount + 1; |
|
1459 |
lastDLTPos = i; |
|
1460 |
} |
|
1461 |
} |
|
1462 |
stringBeforeLength = ptiengine->GetPhoneticSpelling(1).Length(); |
|
1463 |
stringAfterLength = |
|
1464 |
ptiengine->AppendKeyPress((TPtiKey)keyCode).Length(); |
|
50
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
1465 |
stringAfterLength = ptiengine->GetPhoneticSpelling(1).Length(); |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
1466 |
|
44 | 1467 |
if ( stringBeforeLength == stringAfterLength ) |
1468 |
{ |
|
1469 |
editPane->SetAllValidFlag( EFalse ); |
|
1470 |
if ( 0 == lastDLTPos ) |
|
1471 |
{ |
|
1472 |
editPane->SetDelimiterCount( 0 ); |
|
1473 |
editPane->SetInvalidIndex( 0 ); |
|
1474 |
} |
|
1475 |
else |
|
1476 |
{ |
|
1477 |
editPane->SetDelimiterCount( delimiterCount ); |
|
1478 |
editPane->SetInvalidIndex( lastDLTPos + 1 ); |
|
1479 |
} |
|
1480 |
return EFalse; |
|
1481 |
} |
|
1482 |
} |
|
1483 |
||
1484 |
editPane->SetAllValidFlag( ETrue ); |
|
1485 |
editPane->SetDelimiterCount( 0 ); |
|
1486 |
editPane->SetInvalidIndex( 0 ); |
|
1487 |
return ETrue; |
|
1488 |
} |
|
1489 |
||
1490 |
||
1491 |
// --------------------------------------------------------- |
|
1492 |
// TAknFepInputMiniQwertyStrokePhraseBase::DoActionAfterCommit |
|
1493 |
// Do action afer commit, change state to predictive or not. |
|
1494 |
// --------------------------------------------------------- |
|
1495 |
// |
|
1496 |
void TAknFepInputMiniQwertyStrokePhraseBase::DoActionAfterCommit() |
|
1497 |
{ |
|
1498 |
TRAP_IGNORE( DoActionAfterCommitL() ); |
|
1499 |
} |
|
1500 |
||
1501 |
// --------------------------------------------------------- |
|
1502 |
// TAknFepInputMiniQwertyStrokePhraseBase::DoActionAfterCommitL |
|
1503 |
// Do action afer commit, change state to predictive or not. |
|
1504 |
// --------------------------------------------------------- |
|
1505 |
// |
|
1506 |
void TAknFepInputMiniQwertyStrokePhraseBase::DoActionAfterCommitL( ) |
|
1507 |
{ |
|
1508 |
if ( UIContainer()->EditPaneWindow()->KeystrokeArray()->Count( ) != 0 ) |
|
1509 |
{ |
|
1510 |
UIContainer()->EditPaneWindow()->ResetAllArray( ); |
|
1511 |
CAknWarningNote* errnote = new( ELeave ) CAknWarningNote(); |
|
1512 |
errnote->SetTone( CAknNoteDialog::EWarningTone ); |
|
1513 |
errnote->ExecuteLD( KMaxPhraseNote ); |
|
1514 |
} |
|
1515 |
else if ( !UIContainer()->EditPaneWindow()->GetPhraseCreationFlag( ) ) |
|
1516 |
{ |
|
1517 |
#ifdef RD_INTELLIGENT_TEXT_INPUT |
|
1518 |
TBool isEditorFull = iOwner->FepMan()->IsFlagSet(CAknFepManager::EFlagEditorFull); |
|
50
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
1519 |
|
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
1520 |
// For sogou core, the predictive is not endless, so when there |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
1521 |
// is no predictive candidates, we should call TryCloseUiL(). |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
1522 |
TBool noCandidates = EFalse; |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
1523 |
|
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
1524 |
TInt coreID = iOwner->PtiEngine()->HandleCommandL( EPtiCommandGetCoreID ); |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
1525 |
if ( TUid::Uid( coreID ) == KPtiSogouCoreUid ) |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
1526 |
{ |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
1527 |
// Get the predictive candidates. |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
1528 |
CDesCArrayFlat* phraseCandidates = new(ELeave) CDesCArrayFlat( 1 ); |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
1529 |
CleanupStack::PushL ( phraseCandidates ); |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
1530 |
phraseCandidates->Reset(); |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
1531 |
iOwner->PtiEngine()->GetChinesePhraseCandidatesL( *phraseCandidates ); |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
1532 |
if ( phraseCandidates->Count() == 0 ) |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
1533 |
{ |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
1534 |
noCandidates = ETrue; |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
1535 |
} |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
1536 |
CleanupStack::PopAndDestroy( phraseCandidates ); |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
1537 |
} |
5a1685599b76
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
44
diff
changeset
|
1538 |
if ( !isEditorFull && !noCandidates ) |
44 | 1539 |
{ |
1540 |
iOwner->ChangeState( EPredictiveCandidate ); |
|
1541 |
UIContainer()->EditPaneWindow()->SetChangeState(ETrue); |
|
1542 |
} |
|
1543 |
else |
|
1544 |
{ |
|
1545 |
iOwner->FepMan()->ClearFlag(CAknFepManager::EFlagEditorFull); |
|
1546 |
iOwner->FepMan()->TryCloseUiL(); |
|
1547 |
} |
|
1548 |
#endif |
|
1549 |
} |
|
1550 |
else |
|
1551 |
{ |
|
1552 |
iOwner->FepMan()->TryCloseUiL( ); |
|
1553 |
} |
|
1554 |
} |
|
1555 |
// --------------------------------------------------------- |
|
1556 |
// TAknFepInputMiniQwertyStrokePhraseBase::CheckSpellingDLT |
|
1557 |
// Check the delimiter of spelling. |
|
1558 |
// --------------------------------------------------------- |
|
1559 |
// |
|
1560 |
TBool TAknFepInputMiniQwertyStrokePhraseBase::CheckSpellingDLT( const TDesC& aKeystroke ) |
|
1561 |
{ |
|
1562 |
if ( aKeystroke.Length() == 0 ) |
|
1563 |
{ |
|
1564 |
return EFalse; |
|
1565 |
} |
|
1566 |
if ( KStrokeDelimiter == aKeystroke[0] ) |
|
1567 |
{ |
|
1568 |
return ETrue; |
|
1569 |
} |
|
1570 |
return EFalse; |
|
1571 |
} |
|
1572 |
||
1573 |
// --------------------------------------------------------------------------- |
|
1574 |
// TAknFepInputMiniQwertyStrokePhraseBase::HandleCommandL |
|
1575 |
// Handling Command |
|
1576 |
// --------------------------------------------------------------------------- |
|
1577 |
// |
|
1578 |
void TAknFepInputMiniQwertyStrokePhraseBase::HandleCommandL( TInt aCommandId ) |
|
1579 |
{ |
|
1580 |
switch ( aCommandId ) |
|
1581 |
{ |
|
1582 |
// Handle the event frome command. |
|
1583 |
case EAknSoftkeySelect: |
|
1584 |
//case (TUint16)EAknSoftkeySelect: //the Selected in soft CBA |
|
1585 |
HandleCommitL( EShortKeyPress ); |
|
1586 |
break; |
|
1587 |
default: |
|
1588 |
TAknFepInputStateChineseBase::HandleCommandL( aCommandId ); |
|
1589 |
break; |
|
1590 |
} |
|
1591 |
} |
|
1592 |
// End of file |