|
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 // System includes |
|
31 #include <e32cmn.h> |
|
32 #include <PtiEngine.h> |
|
33 #include <PtiDefs.h> |
|
34 #include <avkon.rsg> |
|
35 #include <AknFep.rsg> |
|
36 #include <PtiUserDicEntry.h> |
|
37 #include <aknnotewrappers.h> //CAknWarningNote |
|
38 // User includes |
|
39 #include "AknFepUIManagerStateInterface.h" |
|
40 #include "AknFepUICtrlInputPane.h" |
|
41 #include "AknFepUICtrlPinyinPopup.h" //Pinyin phrase |
|
42 #include "aknfepuictrleditpane.h" //pinyin phrase creation |
|
43 #include "AknFepUICtrlCandidatePane.h" |
|
44 #include "AknFepManager.h" |
|
45 #include "aknfepuiinputminiqwertypinyinphrasebase.h" |
|
46 |
|
47 // Constant definition |
|
48 const TInt KMaxPhraseCount = 50; |
|
49 const TInt KMaxPhraseCreationCount = 7; |
|
50 const TInt KMaxKeystrokeCount = 31; |
|
51 const TInt KInvalidToneMark = -1; |
|
52 const TUint16 KAutoDLT = 0x002E; |
|
53 const TUint16 KManualDLT = 0x0027; |
|
54 const TUint16 KPYa = 0x0061; |
|
55 const TUint16 KPYb = 0x0062; |
|
56 const TUint16 KPYc = 0x0063; |
|
57 const TUint16 KPYd = 0x0064; |
|
58 const TUint16 KPYe = 0x0065; |
|
59 const TUint16 KPYf = 0x0066; |
|
60 const TUint16 KPYg = 0x0067; |
|
61 const TUint16 KPYh = 0x0068; |
|
62 const TUint16 KPYi = 0x0069; |
|
63 const TUint16 KPYj = 0x006A; |
|
64 const TUint16 KPYk = 0x006B; |
|
65 const TUint16 KPYl = 0x006C; |
|
66 const TUint16 KPYm = 0x006D; |
|
67 const TUint16 KPYn = 0x006E; |
|
68 const TUint16 KPYo = 0x006F; |
|
69 const TUint16 KPYp = 0x0070; |
|
70 const TUint16 KPYq = 0x0071; |
|
71 const TUint16 KPYr = 0x0072; |
|
72 const TUint16 KPYs = 0x0073; |
|
73 const TUint16 KPYt = 0x0074; |
|
74 const TUint16 KPYu = 0x0075; |
|
75 const TUint16 KPYv = 0x0076; |
|
76 const TUint16 KPYw = 0x0077; |
|
77 const TUint16 KPYx = 0x0078; |
|
78 const TUint16 KPYy = 0x0079; |
|
79 const TUint16 KPYz = 0x007A; |
|
80 |
|
81 _LIT( KMaxPhraseNote,"\x8BCD\x7EC4\x6700\x957F\x4E3A\x4E03\x5B57" ); |
|
82 |
|
83 const TMiniQwertyKeyMap StrokeMap[] = |
|
84 { |
|
85 {KPYa, EPtiKeyQwertyA}, |
|
86 {KPYb, EPtiKeyQwertyB}, |
|
87 {KPYc, EPtiKeyQwertyC}, |
|
88 {KPYd, EPtiKeyQwertyD}, |
|
89 {KPYe, EPtiKeyQwertyE}, |
|
90 {KPYf, EPtiKeyQwertyF}, |
|
91 {KPYg, EPtiKeyQwertyG}, |
|
92 {KPYh, EPtiKeyQwertyH}, |
|
93 {KPYi, EPtiKeyQwertyI}, |
|
94 {KPYj, EPtiKeyQwertyJ}, |
|
95 {KPYk, EPtiKeyQwertyK}, |
|
96 {KPYl, EPtiKeyQwertyL}, |
|
97 {KPYm, EPtiKeyQwertyM}, |
|
98 {KPYn, EPtiKeyQwertyN}, |
|
99 {KPYo, EPtiKeyQwertyO}, |
|
100 {KPYp, EPtiKeyQwertyP}, |
|
101 {KPYq, EPtiKeyQwertyQ}, |
|
102 {KPYr, EPtiKeyQwertyR}, |
|
103 {KPYs, EPtiKeyQwertyS}, |
|
104 {KPYt, EPtiKeyQwertyT}, |
|
105 {KPYu, EPtiKeyQwertyU}, |
|
106 {KPYv, EPtiKeyQwertyV}, |
|
107 {KPYw, EPtiKeyQwertyW}, |
|
108 {KPYx, EPtiKeyQwertyX}, |
|
109 {KPYy, EPtiKeyQwertyY}, |
|
110 {KPYz, EPtiKeyQwertyZ}, |
|
111 {KManualDLT, EPtiKeyQwertySpace} |
|
112 }; |
|
113 |
|
114 const TMiniQwertyToneMap PinyinToneMap[] = |
|
115 { |
|
116 {0x02C9, 1}, |
|
117 {0x02CA, 2}, |
|
118 {0x02C7, 3}, |
|
119 {0x02CB, 4}, |
|
120 {0x02D9, 5} |
|
121 }; |
|
122 |
|
123 // --------------------------------------------------------------------------- |
|
124 // TAknFepInputStateStrokePhraseCreationBase::TAknFepInputStateStrokePhraseCreationBase |
|
125 // C++ default constructor |
|
126 // --------------------------------------------------------------------------- |
|
127 // |
|
128 TAknFepInputMiniQwertyPinyinPhraseBase::TAknFepInputMiniQwertyPinyinPhraseBase( |
|
129 MAknFepUIManagerStateInterface* aOwner, |
|
130 MAknFepUICtrlContainerChinese* aUIContainer) : |
|
131 TAknFepInputStateCandidateQwertyBaseChinesePhrase(aOwner, aUIContainer) |
|
132 { |
|
133 if (iOwner->PtiEngine()->InputMode() != EPtiEnginePinyinPhraseQwerty) |
|
134 { |
|
135 iOwner->PtiEngine()->SetInputMode(EPtiEnginePinyinPhraseQwerty); |
|
136 } |
|
137 iOwner->PtiEngine()->SetCandidatePageLength(KMaxPhraseCount); |
|
138 MAknFepUICtrlContainerChinese* uiContainer = UIContainer(); |
|
139 TBool multiplePages = !(uiContainer->CandidatePane()->IsLastPage() && uiContainer->CandidatePane()->IsFirstPage()); |
|
140 uiContainer->ShowVerticalScrollArrows(multiplePages); |
|
141 } |
|
142 |
|
143 // --------------------------------------------------------------------------- |
|
144 // TAknFepInputMiniQwertyPinyinPhraseBase::HandleKeyL |
|
145 // Handle system key press event. |
|
146 // --------------------------------------------------------------------------- |
|
147 // |
|
148 TBool TAknFepInputMiniQwertyPinyinPhraseBase::HandleKeyL(TInt aKey, |
|
149 TKeyPressLength aLength) |
|
150 { |
|
151 // |
|
152 switch (aKey) |
|
153 { |
|
154 case EKeyLeftShift: |
|
155 case EKeyLeftCtrl: |
|
156 case EKeyRightCtrl: |
|
157 case EStdKeyDevice1:// CBA2 |
|
158 { |
|
159 iOwner->FepMan()->TryCloseUiL(); |
|
160 break; |
|
161 } |
|
162 case EKeyRightFunc: |
|
163 { |
|
164 iOwner->FepMan()->PlaySound(EAvkonSIDErrorTone); |
|
165 break; |
|
166 } |
|
167 case EStdKeyLeftFunc: //tone mark. |
|
168 { |
|
169 HandlToneMarkL(); |
|
170 break; |
|
171 } |
|
172 case EStdKeyBackspace: |
|
173 { |
|
174 if (CheckKeyNeedRepeat(aLength) ) |
|
175 { |
|
176 HandleKeyBackspaceL(aLength); |
|
177 } |
|
178 else |
|
179 { |
|
180 iOwner->FepMan()->PlaySound(EAvkonSIDErrorTone); |
|
181 } |
|
182 break; |
|
183 } |
|
184 case EStdKeyEnter://Enter keypress. |
|
185 { |
|
186 HandlEnterKeyL(); |
|
187 break; |
|
188 } |
|
189 case EStdKeyDevice0:// CBA1 |
|
190 case EStdKeyDevice3:// CBASelect |
|
191 { |
|
192 HandleCommitL(); |
|
193 break; |
|
194 } |
|
195 case EStdKeyUpArrow: |
|
196 { |
|
197 iOwner->FepMan()->PlaySound(EAvkonSIDErrorTone); |
|
198 break; |
|
199 } |
|
200 case EStdKeyDownArrow: |
|
201 { |
|
202 if (EMiniQwertyEdit == iState) |
|
203 { |
|
204 if (CheckFirstGroupStroke() ) |
|
205 { |
|
206 iOwner->ChangeState(EEntry); |
|
207 } |
|
208 } |
|
209 else |
|
210 { |
|
211 iOwner->FepMan()->PlaySound(EAvkonSIDErrorTone); |
|
212 } |
|
213 break; |
|
214 } |
|
215 case EStdKeyLeftArrow: |
|
216 { |
|
217 if (EMiniQwertyEdit == iState) |
|
218 { |
|
219 UIContainer()->EditPaneWindow()->SetAutoChangeStateFlag( EManualChangeState ); |
|
220 MoveCursorLeft(); |
|
221 } |
|
222 else |
|
223 { |
|
224 iOwner->FepMan()->PlaySound(EAvkonSIDErrorTone); |
|
225 } |
|
226 break; |
|
227 } |
|
228 case EStdKeyRightArrow: |
|
229 { |
|
230 if (EMiniQwertyEdit == iState) |
|
231 { |
|
232 UIContainer()->EditPaneWindow()->SetAutoChangeStateFlag( EManualChangeState ); |
|
233 MoveCursorRight(); |
|
234 } |
|
235 else |
|
236 { |
|
237 iOwner->FepMan()->PlaySound(EAvkonSIDErrorTone); |
|
238 } |
|
239 break; |
|
240 } |
|
241 case EStdKeySpace: |
|
242 { |
|
243 if (EShortKeyPress == aLength) |
|
244 { |
|
245 HandlSpaceKeyL(); |
|
246 break; |
|
247 } |
|
248 break; |
|
249 } |
|
250 default: |
|
251 { |
|
252 if (CAknFepFnKeyManager::EFnKeyNext == iOwner->FepMan()->FnKeyState() || CAknFepFnKeyManager::EFnKeyLock |
|
253 == iOwner->FepMan()->FnKeyState() |
|
254 || ( CAknFepFnKeyManager::EFnKeyDown == iOwner->FepMan()->FnKeyState() && iState != ECandidate )) |
|
255 { |
|
256 iOwner->FepMan()->PlaySound(EAvkonSIDErrorTone); |
|
257 return ETrue; |
|
258 } |
|
259 else |
|
260 if (iOwner->FepMan()->IsFlagSet(CAknFepManager::EFlagShiftKeyDepressed) |
|
261 || iOwner->FepMan()->IsFlagSet(CAknFepManager::EFlagQwertyChrKeyDepressed)) |
|
262 { |
|
263 iOwner->FepMan()->TryCloseUiL(); |
|
264 return EFalse; |
|
265 } |
|
266 else |
|
267 if ( (EShortKeyPress == aLength ) |
|
268 && (iOwner->IsValidChineseInputKeyQwerty(aKey) )) |
|
269 { |
|
270 if (iState == ECandidate) |
|
271 { |
|
272 HandleKeyFromCandidateL(aKey, aLength); |
|
273 } |
|
274 else |
|
275 { |
|
276 HandleDefaultKeyL(aKey); |
|
277 } |
|
278 } |
|
279 else |
|
280 { |
|
281 iOwner->FepMan()->PlaySound(EAvkonSIDErrorTone); |
|
282 } |
|
283 break; |
|
284 } |
|
285 } |
|
286 |
|
287 return ETrue; |
|
288 } |
|
289 |
|
290 // --------------------------------------------------------------------------- |
|
291 // TAknFepInputMiniQwertyPinyinPhraseBase::RefreshUI |
|
292 // Update input window. |
|
293 // --------------------------------------------------------------------------- |
|
294 // |
|
295 void TAknFepInputMiniQwertyPinyinPhraseBase::RefreshUI(TBool aRefresh) |
|
296 { |
|
297 MAknFepUICtrlContainerChinese* uiContainer = UIContainer(); |
|
298 // get cursor position |
|
299 if (aRefresh) |
|
300 { |
|
301 TPoint baseLine; |
|
302 TInt height(0); |
|
303 TInt ascent(0); |
|
304 TRAPD(ret,iOwner->FepMan()->GetScreenCoordinatesL(baseLine,height,ascent)) |
|
305 ; |
|
306 if (ret == KErrNone) |
|
307 { |
|
308 uiContainer->SetContainerPosition(baseLine, height); |
|
309 } |
|
310 } |
|
311 if ( (uiContainer->EditPaneWindow()->KeystrokeArray()->Count() > 0 ) || |
|
312 (uiContainer->EditPaneWindow()->PhraseArray()->Count() > 0 ) ) |
|
313 { |
|
314 ShowInfoOnEEPPane(); |
|
315 SetWarningColor(); |
|
316 ShowInfoOnCandidatePane(); |
|
317 UpdateIndicator(); |
|
318 TRAP_IGNORE( ChangeCbaL() ); |
|
319 } |
|
320 } |
|
321 |
|
322 // --------------------------------------------------------------------------- |
|
323 // TAknFepInputMiniQwertyPinyinPhraseBase::CheckFirstGroupStroke |
|
324 // check the first group stroke of keystroke. |
|
325 // --------------------------------------------------------------------------- |
|
326 // |
|
327 TBool TAknFepInputMiniQwertyPinyinPhraseBase::CheckFirstGroupStroke() |
|
328 { |
|
329 CPtiEngine* ptiengine = iOwner->PtiEngine(); |
|
330 MAknFepUICtrlContainerChinese* uiContainer = UIContainer(); |
|
331 MAknFepUICtrlEditPane* editPane = uiContainer->EditPaneWindow(); |
|
332 CDesCArrayFlat* showKeystroke = editPane->ShowKeystrokeArray(); |
|
333 TInt stringBeforeLength = 0; |
|
334 TInt stringAfterLength = 0; |
|
335 TInt keyCode = 0; |
|
336 TInt toneMark = 0; |
|
337 if ( 0 == showKeystroke->Count() ) |
|
338 { |
|
339 return EFalse; |
|
340 } |
|
341 |
|
342 if (KInvalidToneMark != ToneMark(showKeystroke->MdcaPoint( 0) ) ) |
|
343 { |
|
344 return EFalse; |
|
345 } |
|
346 |
|
347 ClearPtiEngineKeystroke(); |
|
348 for (TInt i = 0; i < showKeystroke->Count(); ++i) |
|
349 { |
|
350 if (CheckSpellingDLT(showKeystroke->MdcaPoint(i) ) ) |
|
351 { |
|
352 if ( 0 == i) |
|
353 { |
|
354 return EFalse; |
|
355 } |
|
356 else |
|
357 { |
|
358 return ETrue; |
|
359 } |
|
360 } |
|
361 toneMark = ToneMark(showKeystroke->MdcaPoint(i) ); |
|
362 if (KInvalidToneMark != toneMark) |
|
363 { |
|
364 for (TInt j = 0; j < toneMark; ++j) |
|
365 { |
|
366 ptiengine->IncrementToneMark(ETrue); |
|
367 TPtrC ptr0 = getCurrentLeastDLTSpell(); |
|
368 if (ptr0.Length() > 0) |
|
369 { |
|
370 if ( 0 |
|
371 == ptr0.Mid( ptr0.Length() - 1, 1 ).Compare(showKeystroke->MdcaPoint(i) ) ) |
|
372 { |
|
373 return ETrue; |
|
374 } |
|
375 } |
|
376 } |
|
377 TPtrC ptr = getCurrentLeastDLTSpell(); |
|
378 if ( 0 == ptr.Mid( ptr.Length() - 1, 1 ).Compare(showKeystroke->MdcaPoint(i) ) ) |
|
379 { |
|
380 return ETrue; |
|
381 } |
|
382 else |
|
383 { |
|
384 return EFalse; |
|
385 } |
|
386 } |
|
387 GetKeystrokeCode(keyCode, showKeystroke->MdcaPoint(i) ); |
|
388 stringBeforeLength = getCurrentLeastDLTSpell().Length(); |
|
389 ptiengine->AppendKeyPress((TPtiKey)keyCode).Length(); |
|
390 stringAfterLength = getCurrentLeastDLTSpell().Length(); |
|
391 //the keystroke is invalid. |
|
392 if (stringBeforeLength == stringAfterLength) |
|
393 { |
|
394 return EFalse; |
|
395 } |
|
396 } |
|
397 return ETrue; |
|
398 } |
|
399 |
|
400 // --------------------------------------------------------------------------- |
|
401 // TAknFepInputMiniQwertyPinyinPhraseBase::HandlEnterKey |
|
402 // Handle Enter key press |
|
403 // --------------------------------------------------------------------------- |
|
404 // |
|
405 TInt TAknFepInputMiniQwertyPinyinPhraseBase::GetCursorPos() |
|
406 { |
|
407 MAknFepUICtrlContainerChinese* uiContainer = UIContainer(); |
|
408 MAknFepUICtrlEditPane* editPane = uiContainer->EditPaneWindow(); |
|
409 CDesCArrayFlat* showKeystroke = editPane->ShowKeystrokeArray(); |
|
410 CDesCArrayFlat* keystroke = editPane->KeystrokeArray(); |
|
411 TInt phraseCount = editPane->PhraseArray()->Count(); |
|
412 TInt index = editPane->GetCursorIndexOfKeystroke(); |
|
413 TInt pos = 0; |
|
414 TInt count = 0; |
|
415 TBuf<1> autoDLT; |
|
416 autoDLT.Append(KAutoDLT); |
|
417 |
|
418 if ( 0 == index) |
|
419 { |
|
420 pos = phraseCount; |
|
421 } |
|
422 else |
|
423 if (keystroke->Count() == index) |
|
424 { |
|
425 pos = phraseCount + showKeystroke->Count(); |
|
426 } |
|
427 else |
|
428 { |
|
429 for (TInt i = 0; i < showKeystroke->Count(); ++i) |
|
430 { |
|
431 if ( 0 != showKeystroke->MdcaPoint( i ).Compare(autoDLT) ) |
|
432 { |
|
433 count = count + 1; |
|
434 } |
|
435 if (count == index) |
|
436 { |
|
437 pos = phraseCount + i + 1; |
|
438 break; |
|
439 } |
|
440 } |
|
441 } |
|
442 return pos; |
|
443 } |
|
444 |
|
445 // --------------------------------------------------------------------------- |
|
446 // TAknFepInputMiniQwertyPinyinPhraseBase::HandlEnterKeyL |
|
447 // Handle Enter key press |
|
448 // --------------------------------------------------------------------------- |
|
449 // |
|
450 void TAknFepInputMiniQwertyPinyinPhraseBase::HandlEnterKeyL() |
|
451 { |
|
452 TBuf<KMaxKeystrokeCount> currentText; |
|
453 MAknFepUICtrlEditPane* editpane = UIContainer()->EditPaneWindow(); |
|
454 CDesCArrayFlat* showkeyStoke = editpane->ShowKeystrokeArray(); |
|
455 CDesCArrayFlat* phraseArray = editpane->PhraseArray(); |
|
456 TInt phraseCount = phraseArray->Count(); |
|
457 TInt keyStrokeCount = showkeyStoke->Count(); |
|
458 TInt i = 0; |
|
459 TBuf<1> autoDLT; |
|
460 autoDLT.Append(KAutoDLT); |
|
461 |
|
462 for (i = 0; i < phraseCount; i++) |
|
463 { |
|
464 currentText.Append(phraseArray->MdcaPoint(i) ); |
|
465 } |
|
466 for (i = 0; i < keyStrokeCount; i++) |
|
467 { |
|
468 currentText.Append(showkeyStoke->MdcaPoint(i) ); |
|
469 } |
|
470 |
|
471 while (currentText.Find(autoDLT)> 0) |
|
472 { |
|
473 currentText.Replace(currentText.Find(autoDLT), 1, KNullDesC); |
|
474 } |
|
475 |
|
476 if (currentText.Length() ) |
|
477 { |
|
478 MAknFepManagerUIInterface* fepMan = iOwner->FepMan(); |
|
479 fepMan->NewTextL(currentText); |
|
480 fepMan->CommitInlineEditL(); |
|
481 if (keyStrokeCount == 0 && currentText.Length() > 1) |
|
482 { |
|
483 AddPhraseToDB(currentText); |
|
484 } |
|
485 |
|
486 UIContainer()->EditPaneWindow()->ResetAllArray(); |
|
487 UIContainer()->EditPaneWindow()->SetPhraseCreationFlag(EFalse); |
|
488 |
|
489 if (fepMan->IsFlagSet(CAknFepManager::EFlagEditorFull)) |
|
490 { |
|
491 fepMan->ClearFlag(CAknFepManager::EFlagEditorFull); |
|
492 iOwner->FepMan()->TryCloseUiL(); |
|
493 } |
|
494 else |
|
495 { |
|
496 iOwner->FepMan()->TryCloseUiL(); |
|
497 } |
|
498 } |
|
499 } |
|
500 |
|
501 // --------------------------------------------------------------------------- |
|
502 // TAknFepInputMiniQwertyPinyinPhraseBase::HandlToneMarkL |
|
503 // Handle tone mark key press. |
|
504 // --------------------------------------------------------------------------- |
|
505 // |
|
506 void TAknFepInputMiniQwertyPinyinPhraseBase::HandlSpaceKeyL() |
|
507 { |
|
508 MAknFepUICtrlContainerChinese* uiContainer = UIContainer(); |
|
509 MAknFepUICtrlEditPane* editPane = uiContainer->EditPaneWindow(); |
|
510 CDesCArrayFlat* keystrokeArray = editPane->KeystrokeArray(); |
|
511 TInt phraseCount = editPane->PhraseArray()->Count(); |
|
512 TInt showKeystrokeCount = editPane->ShowKeystrokeArray()->Count(); |
|
513 TInt index = editPane->GetCursorIndexOfKeystroke(); |
|
514 TBuf<1> manualDLT; |
|
515 TBuf<1> autoDLT; |
|
516 manualDLT.Append( KManualDLT ); |
|
517 autoDLT.Append( KAutoDLT ); |
|
518 |
|
519 TBool firstGroup = CheckFirstGroupStroke(); |
|
520 |
|
521 keystrokeArray->InsertL(index, manualDLT); |
|
522 editPane->SetCursorIndexOfKeystroke(index + 1); |
|
523 AnalyseL(); |
|
524 |
|
525 if ( editPane->ShowKeystrokeArray()->Count() > KMaxKeystrokeCount ) |
|
526 { |
|
527 keystrokeArray->Delete( index ); |
|
528 editPane->SetCursorIndexOfKeystroke( index ); |
|
529 iOwner->FepMan()->PlaySound(EAvkonSIDErrorTone); |
|
530 AnalyseL(); |
|
531 return; |
|
532 } |
|
533 |
|
534 //Auto change from EMiniQwertyEdit state to EEntry state. |
|
535 if (EMiniQwertyEdit == iState) |
|
536 { |
|
537 if ( ( !firstGroup ) && CheckFirstGroupStroke() ) |
|
538 { |
|
539 if ( EAutoChangeStateFromCandidate == editPane->GetAutoChangeStateFlag() ) |
|
540 { |
|
541 RefreshUI(); |
|
542 editPane->SetChangeState(ETrue); |
|
543 iOwner->ChangeState(ECandidate); |
|
544 } |
|
545 else if ( EAutoChangeStateFromInput == editPane->GetAutoChangeStateFlag() ) |
|
546 { |
|
547 editPane->SetChangeState(ETrue); |
|
548 iOwner->ChangeState(EEntry); |
|
549 } |
|
550 else |
|
551 { |
|
552 RefreshUI(); |
|
553 } |
|
554 return; |
|
555 } |
|
556 } |
|
557 |
|
558 //Auto change from EEntry state to EMiniQwertyEdit state. |
|
559 if (EEntry == iState) |
|
560 { |
|
561 if ( !CheckFirstGroupStroke() ) |
|
562 { |
|
563 editPane->SetAutoChangeStateFlag(EAutoChangeStateFromInput); |
|
564 editPane->SetChangeState(ETrue); |
|
565 iOwner->ChangeState(EMiniQwertyEdit); |
|
566 return; |
|
567 } |
|
568 } |
|
569 |
|
570 RefreshUI(); |
|
571 } |
|
572 |
|
573 // --------------------------------------------------------------------------- |
|
574 // TAknFepInputMiniQwertyPinyinPhraseBase::HandlToneMarkL |
|
575 // Handle tone mark key press. |
|
576 // --------------------------------------------------------------------------- |
|
577 // |
|
578 void TAknFepInputMiniQwertyPinyinPhraseBase::HandlToneMarkL() |
|
579 { |
|
580 MAknFepUICtrlContainerChinese* uiContainer = UIContainer(); |
|
581 MAknFepUICtrlEditPane* editPane = uiContainer->EditPaneWindow(); |
|
582 TBool firstGroup = CheckFirstGroupStroke(); |
|
583 AddToneMarkL(); |
|
584 AnalyseL(); |
|
585 //Auto change from EMiniQwertyEdit state to EEntry state. |
|
586 if (EMiniQwertyEdit == iState) |
|
587 { |
|
588 if ( ( !firstGroup ) && CheckFirstGroupStroke() ) |
|
589 { |
|
590 if ( EAutoChangeStateFromCandidate == editPane->GetAutoChangeStateFlag() ) |
|
591 { |
|
592 RefreshUI(); |
|
593 editPane->SetChangeState(ETrue); |
|
594 iOwner->ChangeState(ECandidate); |
|
595 } |
|
596 else if ( EAutoChangeStateFromInput == editPane->GetAutoChangeStateFlag() ) |
|
597 { |
|
598 editPane->SetChangeState(ETrue); |
|
599 iOwner->ChangeState(EEntry); |
|
600 } |
|
601 else |
|
602 { |
|
603 RefreshUI(); |
|
604 } |
|
605 return; |
|
606 } |
|
607 } |
|
608 |
|
609 //Auto change from EEntry state to EMiniQwertyEdit state. |
|
610 if (EEntry == iState) |
|
611 { |
|
612 if ( !CheckFirstGroupStroke() ) |
|
613 { |
|
614 editPane->SetAutoChangeStateFlag(EAutoChangeStateFromInput); |
|
615 editPane->SetChangeState(ETrue); |
|
616 iOwner->ChangeState(EMiniQwertyEdit); |
|
617 return; |
|
618 } |
|
619 } |
|
620 RefreshUI(); |
|
621 } |
|
622 |
|
623 // --------------------------------------------------------------------------- |
|
624 // TAknFepInputMiniQwertyPinyinPhraseBase::CheckManualDelimiter |
|
625 // Check the delimiter that wether is manual delimiter. |
|
626 // --------------------------------------------------------------------------- |
|
627 // |
|
628 TBool TAknFepInputMiniQwertyPinyinPhraseBase::CheckManualDelimiter( |
|
629 const TInt aCount, const TDesC& aKeystroke) |
|
630 { |
|
631 TInt keyCount = 0; |
|
632 for (TInt i = 0; i < aKeystroke.Length(); ++i) |
|
633 { |
|
634 if (KManualDLT != aKeystroke[i]) |
|
635 { |
|
636 keyCount = keyCount + 1; |
|
637 } |
|
638 if (aCount == keyCount) |
|
639 { |
|
640 break; |
|
641 } |
|
642 } |
|
643 |
|
644 if (keyCount != aCount) |
|
645 { |
|
646 return EFalse; |
|
647 } |
|
648 |
|
649 if (aKeystroke.Length() == keyCount) |
|
650 { |
|
651 return EFalse; |
|
652 } |
|
653 |
|
654 if (KManualDLT != aKeystroke[keyCount]) |
|
655 { |
|
656 return EFalse; |
|
657 } |
|
658 |
|
659 return ETrue; |
|
660 } |
|
661 |
|
662 // --------------------------------------------------------------------------- |
|
663 // TAknFepInputMiniQwertyPinyinPhraseBase::AnalyseSpellingL |
|
664 // Analyse Pinyin spelling. |
|
665 // --------------------------------------------------------------------------- |
|
666 // |
|
667 void TAknFepInputMiniQwertyPinyinPhraseBase::AnalyseSpellingL( |
|
668 const TDesC& aKeystroke, const TDesC& aSpelling, |
|
669 CDesCArrayFlat* aShowKeystroke) |
|
670 { |
|
671 TInt count = 0; |
|
672 TBuf<1> manualDLT; |
|
673 TBuf<1> autoDLT; |
|
674 manualDLT.Append(KManualDLT); |
|
675 autoDLT.Append(KAutoDLT); |
|
676 |
|
677 if ( 0 == aSpelling.Compare(aKeystroke) ) |
|
678 { |
|
679 for (TInt i = 0; i < aKeystroke.Length(); ++i) |
|
680 { |
|
681 aShowKeystroke->AppendL(aKeystroke.Mid(i, 1) ); |
|
682 } |
|
683 return; |
|
684 } |
|
685 |
|
686 for (TInt i = 0; i < aSpelling.Length(); ++i) |
|
687 { |
|
688 if (KManualDLT == aSpelling[i]) |
|
689 { |
|
690 //Manual delimiter |
|
691 if (CheckManualDelimiter(count, aKeystroke) ) |
|
692 { |
|
693 aShowKeystroke->AppendL(manualDLT); |
|
694 } |
|
695 else |
|
696 { |
|
697 aShowKeystroke->AppendL(autoDLT); |
|
698 } |
|
699 } |
|
700 else |
|
701 { |
|
702 aShowKeystroke->AppendL(aSpelling.Mid(i, 1) ); |
|
703 count = count + 1; |
|
704 } |
|
705 } |
|
706 } |
|
707 |
|
708 // --------------------------------------------------------------------------- |
|
709 // TAknFepInputMiniQwertyPinyinPhraseBase::AnalyseSpellingAddToneMarkL |
|
710 // Analyse spelling after user press tone mark. |
|
711 // --------------------------------------------------------------------------- |
|
712 // |
|
713 void TAknFepInputMiniQwertyPinyinPhraseBase::AnalyseSpellingAddToneMarkL( |
|
714 TInt aI, |
|
715 TInt aToneMarkCount, |
|
716 CDesCArrayFlat* aKeystroke, |
|
717 CDesCArrayFlat* aShowKeystroke ) |
|
718 { |
|
719 TBuf<1> atuoDLT; |
|
720 TBuf<1> manualDLT; |
|
721 atuoDLT.Append(KAutoDLT); |
|
722 manualDLT.Append(KManualDLT); |
|
723 if ( CheckSpellingDLT( aKeystroke->MdcaPoint( aI - 1 ) ) || |
|
724 ( KInvalidToneMark != ToneMark( aKeystroke->MdcaPoint( aI - 1 ) ) ) ) |
|
725 { |
|
726 aShowKeystroke->AppendL( aKeystroke->MdcaPoint( aI ) ); |
|
727 } |
|
728 else |
|
729 { |
|
730 if ( CheckSpellingAddToneMarkToPTIL( aToneMarkCount ) ) |
|
731 { |
|
732 aShowKeystroke->AppendL( aKeystroke->MdcaPoint( aI - 1 ) ); |
|
733 aShowKeystroke->AppendL( aKeystroke->MdcaPoint( aI ) ); |
|
734 } |
|
735 else |
|
736 { |
|
737 if ( aShowKeystroke->Count() == 0 ) |
|
738 { |
|
739 aShowKeystroke->AppendL( aKeystroke->MdcaPoint( aI - 1 ) ); |
|
740 aShowKeystroke->AppendL( aKeystroke->MdcaPoint( aI ) ); |
|
741 } |
|
742 else |
|
743 { |
|
744 if ( ( !CheckSpellingDLT(aShowKeystroke->MdcaPoint( |
|
745 aShowKeystroke->Count() - 1 ) ) ) && |
|
746 ( KInvalidToneMark == ToneMark( aShowKeystroke-> |
|
747 MdcaPoint( aShowKeystroke->Count() - 1 ) ) ) ) |
|
748 { |
|
749 aShowKeystroke->AppendL( atuoDLT ); |
|
750 } |
|
751 aShowKeystroke->AppendL( aKeystroke->MdcaPoint( aI - 1 ) ); |
|
752 aShowKeystroke->AppendL( aKeystroke->MdcaPoint( aI ) ); |
|
753 } |
|
754 } |
|
755 } |
|
756 } |
|
757 |
|
758 // --------------------------------------------------------------------------- |
|
759 // TAknFepInputMiniQwertyPinyinPhraseBase::AnalyseSpellingAddKeyL |
|
760 // Analyse spelling after user press key that is not tone mark. |
|
761 // --------------------------------------------------------------------------- |
|
762 // |
|
763 void TAknFepInputMiniQwertyPinyinPhraseBase::AnalyseSpellingAddKeyL( |
|
764 TInt& aI, |
|
765 TInt aDelimterPos, |
|
766 CDesCArrayFlat* aKeystroke, |
|
767 CDesCArrayFlat* aShowKeystroke ) |
|
768 { |
|
769 CPtiEngine* ptiengine = iOwner->PtiEngine(); |
|
770 TBuf<1> atuoDLT; |
|
771 TBuf<1> manualDLT; |
|
772 atuoDLT.Append(KAutoDLT); |
|
773 manualDLT.Append(KManualDLT); |
|
774 if ( 0 == aI ) |
|
775 { |
|
776 if ( aI + 1 < aKeystroke->Count() ) |
|
777 { |
|
778 if ( ( KInvalidToneMark != ToneMark( aKeystroke->MdcaPoint( aI + 1 ) ) ) || |
|
779 ( CheckSpellingDLT( aKeystroke->MdcaPoint( aI + 1 ) ) ) ) |
|
780 { |
|
781 aShowKeystroke->AppendL( aKeystroke->MdcaPoint( aI ) ); |
|
782 aShowKeystroke->AppendL( aKeystroke->MdcaPoint( aI + 1 ) ); |
|
783 aI = aI + 1; |
|
784 } |
|
785 else |
|
786 { |
|
787 aShowKeystroke->AppendL( aKeystroke->MdcaPoint( aI ) ); |
|
788 aShowKeystroke->AppendL( atuoDLT ); |
|
789 } |
|
790 } |
|
791 else |
|
792 { |
|
793 aShowKeystroke->AppendL( aKeystroke->MdcaPoint( aI ) ); |
|
794 } |
|
795 } |
|
796 else if ( aI + 1 == aKeystroke->Count() ) |
|
797 { |
|
798 if ( ( 1 == aDelimterPos ) || ( -1 == aDelimterPos ) ) |
|
799 { |
|
800 if ( ( !CheckSpellingDLT( aShowKeystroke-> |
|
801 MdcaPoint( aShowKeystroke->Count() - 1 ) ) && |
|
802 ( KInvalidToneMark == ToneMark( aShowKeystroke-> |
|
803 MdcaPoint( aShowKeystroke->Count() - 1 ) ) ) ) ) |
|
804 { |
|
805 aShowKeystroke->AppendL( atuoDLT ); |
|
806 } |
|
807 aShowKeystroke->AppendL( aKeystroke->MdcaPoint( aI ) ); |
|
808 } |
|
809 else |
|
810 { |
|
811 for ( TInt ii = 0; ii < aDelimterPos - 1; ++ii ) |
|
812 { |
|
813 aShowKeystroke->Delete( aShowKeystroke->Count() - 1 ); |
|
814 } |
|
815 if ( ( !CheckSpellingDLT( aShowKeystroke-> |
|
816 MdcaPoint( aShowKeystroke->Count() - 1 ) ) ) && |
|
817 ( KInvalidToneMark == ToneMark( aShowKeystroke->MdcaPoint( |
|
818 aShowKeystroke->Count() - 1 ) ) ) ) |
|
819 { |
|
820 aShowKeystroke->AppendL( atuoDLT ); |
|
821 } |
|
822 aI = aI - aDelimterPos; |
|
823 } |
|
824 } |
|
825 else |
|
826 { |
|
827 if ( -1 == aDelimterPos ) |
|
828 { |
|
829 if ( ( !CheckSpellingDLT( aShowKeystroke->MdcaPoint( |
|
830 aShowKeystroke->Count() - 1 ) ) ) && |
|
831 ( KInvalidToneMark == ToneMark( aShowKeystroke->MdcaPoint( |
|
832 aShowKeystroke->Count() - 1 ) ) ) ) |
|
833 { |
|
834 aShowKeystroke->AppendL( atuoDLT ); |
|
835 } |
|
836 if ( 0 == getCurrentLeastDLTSpell().Length() ) |
|
837 { |
|
838 aShowKeystroke->AppendL( aKeystroke->MdcaPoint( aI ) ); |
|
839 if ( KInvalidToneMark != ToneMark( aKeystroke->MdcaPoint( aI + 1 ) ) ) |
|
840 { |
|
841 aShowKeystroke->AppendL( aKeystroke->MdcaPoint( aI + 1 ) ); |
|
842 aI = aI + 1; |
|
843 } |
|
844 } |
|
845 else |
|
846 { |
|
847 aI = aI - 1; |
|
848 } |
|
849 } |
|
850 else |
|
851 { |
|
852 for ( TInt ii = 0; ii < aDelimterPos - 1; ++ii ) |
|
853 { |
|
854 aShowKeystroke->Delete( aShowKeystroke->Count() - 1 ); |
|
855 } |
|
856 if ( ( !CheckSpellingDLT( aShowKeystroke->MdcaPoint( |
|
857 aShowKeystroke->Count() - 1 ) ) ) && |
|
858 ( KInvalidToneMark == ToneMark( aShowKeystroke->MdcaPoint( |
|
859 aShowKeystroke->Count() - 1 ) ) ) ) |
|
860 { |
|
861 aShowKeystroke->AppendL( atuoDLT ); |
|
862 } |
|
863 aI = aI - aDelimterPos; |
|
864 } |
|
865 } |
|
866 } |
|
867 |
|
868 // --------------------------------------------------------------------------- |
|
869 // TAknFepInputMiniQwertyPinyinPhraseBase::AnalyseL |
|
870 // Analyse key storke. |
|
871 // --------------------------------------------------------------------------- |
|
872 // |
|
873 void TAknFepInputMiniQwertyPinyinPhraseBase::AnalyseL() |
|
874 { |
|
875 CPtiEngine* ptiengine = iOwner->PtiEngine(); |
|
876 MAknFepUICtrlContainerChinese* uiContainer = UIContainer(); |
|
877 MAknFepUICtrlEditPane* editPane = uiContainer->EditPaneWindow(); |
|
878 //user pressed keystroke sequence |
|
879 CDesCArrayFlat* keystroke = editPane->KeystrokeArray(); |
|
880 //stroke to be shown |
|
881 CDesCArrayFlat* showKeystroke = editPane->ShowKeystrokeArray(); |
|
882 TInt start = 0; |
|
883 TInt toneMarkCount = KInvalidToneMark; |
|
884 TInt delimiterPosition = 0; |
|
885 showKeystroke->Reset(); |
|
886 TBuf<1> atuoDLT; |
|
887 TBuf<1> manualDLT; |
|
888 atuoDLT.Append(KAutoDLT); |
|
889 manualDLT.Append(KManualDLT); |
|
890 TBuf<KMaxKeystrokeCount> keyTmp; |
|
891 |
|
892 if ( keystroke->Count() == 0 ) |
|
893 { |
|
894 return; |
|
895 } |
|
896 |
|
897 //if the first keystroke is delimiter or ToneMark, analyse frome the next one |
|
898 if ( CheckSpellingDLT( keystroke->MdcaPoint( 0 ) ) || |
|
899 ( KInvalidToneMark != ToneMark( keystroke->MdcaPoint( 0 ) ) ) ) |
|
900 { |
|
901 showKeystroke->AppendL(keystroke->MdcaPoint( 0 ) ); |
|
902 start = 1; |
|
903 } |
|
904 |
|
905 ClearPtiEngineKeystroke(); |
|
906 |
|
907 for ( TInt i = start; i < keystroke->Count(); ++i ) |
|
908 { |
|
909 toneMarkCount = ToneMark( keystroke->MdcaPoint( i ) ); |
|
910 // current keystroke is delimiter |
|
911 if ( CheckSpellingDLT( keystroke->MdcaPoint( i ) ) ) |
|
912 { |
|
913 showKeystroke->AppendL(keystroke->MdcaPoint( i ) ); |
|
914 ClearPtiEngineKeystroke(); |
|
915 } |
|
916 // current keystroke is tone mark |
|
917 else if ( KInvalidToneMark != toneMarkCount ) |
|
918 { |
|
919 AnalyseSpellingAddToneMarkL( i, toneMarkCount, keystroke, showKeystroke ); |
|
920 ClearPtiEngineKeystroke(); |
|
921 } |
|
922 // current keystroke is A - Z |
|
923 else |
|
924 { |
|
925 delimiterPosition = CheckSpellingAddKeyToPTIL( keystroke->MdcaPoint( i ) ); |
|
926 if ( 0 == delimiterPosition ) |
|
927 { |
|
928 if ( ( 0 != i ) && |
|
929 ( 1 == this->getCurrentLeastDLTSpell().Length() ) ) |
|
930 { |
|
931 if ( ( !CheckSpellingDLT( showKeystroke-> |
|
932 MdcaPoint( showKeystroke->Count() - 1 ) ) ) && |
|
933 ( KInvalidToneMark == ToneMark( showKeystroke-> |
|
934 MdcaPoint( showKeystroke->Count() - 1 ) ) ) ) |
|
935 { |
|
936 showKeystroke->AppendL( atuoDLT ); |
|
937 } |
|
938 } |
|
939 if ( i + 1 < keystroke->Count() ) |
|
940 { |
|
941 if ( KInvalidToneMark == ToneMark( keystroke->MdcaPoint( i + 1 ) ) ) |
|
942 { |
|
943 showKeystroke->AppendL( keystroke->MdcaPoint( i ) ); |
|
944 } |
|
945 } |
|
946 else |
|
947 { |
|
948 showKeystroke->AppendL( keystroke->MdcaPoint( i ) ); |
|
949 } |
|
950 } |
|
951 else |
|
952 { |
|
953 AnalyseSpellingAddKeyL( i, delimiterPosition, keystroke, showKeystroke ); |
|
954 ClearPtiEngineKeystroke(); |
|
955 } |
|
956 } |
|
957 } |
|
958 } |
|
959 |
|
960 // --------------------------------------------------------------------------- |
|
961 // TAknFepInputMiniQwertyPinyinPhraseBase::HandleCommitL |
|
962 // Handle CBA1 or select event. |
|
963 // --------------------------------------------------------------------------- |
|
964 // |
|
965 void TAknFepInputMiniQwertyPinyinPhraseBase::HandleCommitL() |
|
966 { |
|
967 MAknFepUICtrlContainerChinese* uiContainer = UIContainer(); |
|
968 MAknFepUICtrlEditPane* editPane = uiContainer->EditPaneWindow(); |
|
969 TInt keyCount = editPane->KeystrokeArray()->Count(); |
|
970 TInt showKeyCount = editPane->ShowKeystrokeArray()->Count(); |
|
971 CDesCArrayFlat* phrase = editPane->PhraseArray(); |
|
972 TInt cdtCount = uiContainer->CandidatePane()->CandidateArray()->Count(); |
|
973 MAknFepManagerUIInterface* fepMan = iOwner->FepMan(); |
|
974 |
|
975 if (EMiniQwertyEdit == iState) |
|
976 { |
|
977 if ( ( showKeyCount > 0 ) && (cdtCount > 0 ) ) |
|
978 { |
|
979 UIContainer()->EditPaneWindow()->SetChangeState(ETrue); |
|
980 iOwner->ChangeState(ECandidate); |
|
981 return; |
|
982 } |
|
983 |
|
984 if ( keyCount > 0 ) |
|
985 { |
|
986 iOwner->FepMan()->PlaySound(EAvkonSIDErrorTone); |
|
987 return; |
|
988 } |
|
989 } |
|
990 |
|
991 if ( ( 0 == keyCount ) && (phrase->Count() <= 1 ) ) |
|
992 { |
|
993 iOwner->FepMan()->PlaySound(EAvkonSIDErrorTone); |
|
994 return; |
|
995 } |
|
996 |
|
997 if ( ( 0 == keyCount ) && (phrase->Count() > 1 ) ) |
|
998 { |
|
999 TBuf<KMaxPhraseCreationCount> phraseCreated; |
|
1000 for (TInt i = 0; ( (i < phrase->Count() ) && (i |
|
1001 < KMaxPhraseCreationCount ) ); ++i ) |
|
1002 { |
|
1003 phraseCreated.Append(phrase->MdcaPoint( i ) ); |
|
1004 AddPhraseToDB(phraseCreated); |
|
1005 } |
|
1006 fepMan->NewTextL(phraseCreated); |
|
1007 fepMan->CommitInlineEditL(); |
|
1008 if ( !UIContainer()->EditPaneWindow()->GetPhraseCreationFlag() ) |
|
1009 { |
|
1010 UIContainer()->EditPaneWindow()->SetPhraseCreationFlag(EFalse); |
|
1011 iOwner->PtiEngine()->SetPredictiveChineseChar(phraseCreated); |
|
1012 #ifdef RD_INTELLIGENT_TEXT_INPUT |
|
1013 UIContainer()->EditPaneWindow()->SetChangeState(ETrue); |
|
1014 if (EPtiKeyboardQwerty4x10 == iOwner->FepMan()->KeyboardLayout() || |
|
1015 EPtiKeyboardQwerty3x11 == iOwner->FepMan()->KeyboardLayout() ) |
|
1016 { |
|
1017 iOwner->ChangeState(EPredictiveCandidate); |
|
1018 } |
|
1019 #endif |
|
1020 } |
|
1021 else |
|
1022 { |
|
1023 UIContainer()->EditPaneWindow()->SetPhraseCreationFlag(EFalse); |
|
1024 iOwner->FepMan()->TryCloseUiL(); |
|
1025 } |
|
1026 return; |
|
1027 } |
|
1028 |
|
1029 TPtrC text = UIContainer()->CandidatePane()->CurrentPhraseCandidate(); |
|
1030 if (text.Length() == 0) |
|
1031 { |
|
1032 return; |
|
1033 } |
|
1034 |
|
1035 if ( !CommitInlineEEPL(text) ) |
|
1036 { |
|
1037 DoActionAfterCommit(); |
|
1038 } |
|
1039 else |
|
1040 { |
|
1041 if ( !CheckFirstGroupStroke() ) |
|
1042 { |
|
1043 if ( iState == EEntry ) |
|
1044 { |
|
1045 editPane->SetAutoChangeStateFlag(EAutoChangeStateFromInput); |
|
1046 } |
|
1047 else |
|
1048 { |
|
1049 editPane->SetAutoChangeStateFlag(EAutoChangeStateFromCandidate); |
|
1050 } |
|
1051 iOwner->ChangeState(EMiniQwertyEdit); |
|
1052 return; |
|
1053 } |
|
1054 else |
|
1055 { |
|
1056 if ( iState == EEntry ) |
|
1057 { |
|
1058 UIContainer()->EditPaneWindow()->SetChangeState( ETrue ); |
|
1059 iOwner->ChangeState( ECandidate ); |
|
1060 } |
|
1061 } |
|
1062 AnalyseL(); |
|
1063 RefreshUI(); |
|
1064 } |
|
1065 } |
|
1066 |
|
1067 // --------------------------------------------------------------------------- |
|
1068 // TAknFepInputMiniQwertyPinyinPhraseBase::HandleKeyBackspaceL |
|
1069 // Handle KeyBackspace event. |
|
1070 // --------------------------------------------------------------------------- |
|
1071 // |
|
1072 void TAknFepInputMiniQwertyPinyinPhraseBase::HandleKeyBackspaceL( |
|
1073 TKeyPressLength aLength) |
|
1074 { |
|
1075 MAknFepUICtrlContainerChinese* uiContainer = UIContainer(); |
|
1076 MAknFepUICtrlEditPane* editPane = uiContainer->EditPaneWindow(); |
|
1077 TInt index = editPane->GetCursorIndexOfKeystroke(); |
|
1078 CDesCArrayFlat* keystroke = editPane->KeystrokeArray(); |
|
1079 TInt phraseCount = editPane->PhraseArray()->Count(); |
|
1080 TBool firstGroup = CheckFirstGroupStroke(); |
|
1081 |
|
1082 if ( ( 0 == index ) && (phraseCount != 0 ) ) |
|
1083 { |
|
1084 RevertPhraseToKeystrokeL(); |
|
1085 } |
|
1086 else |
|
1087 if ( ( 0 == index ) && (keystroke->Count() > 0 ) ) |
|
1088 { |
|
1089 iOwner->FepMan()->PlaySound(EAvkonSIDErrorTone); |
|
1090 } |
|
1091 else |
|
1092 { |
|
1093 if ( !DeleteKeystrokeL() ) |
|
1094 { |
|
1095 iOwner->FepMan()->PlaySound(EAvkonSIDErrorTone); |
|
1096 } |
|
1097 } |
|
1098 |
|
1099 //if the keystroke is null and phrase is null then close input window. |
|
1100 if ( ( 0 == phraseCount ) && (keystroke->Count() == 0 )) |
|
1101 { |
|
1102 iOwner->FepMan()->TryCloseUiL(); //no more keys, close the UI. |
|
1103 if (aLength == ELongKeyPress) |
|
1104 { |
|
1105 iOwner->FepMan()->SetLongClearAfterCloseUI(ETrue); |
|
1106 } |
|
1107 return; |
|
1108 } |
|
1109 |
|
1110 AnalyseL(); |
|
1111 //Auto change from EMiniQwertyEdit state to EEntry state. |
|
1112 if (EMiniQwertyEdit == iState) |
|
1113 { |
|
1114 if ( ( !firstGroup ) && CheckFirstGroupStroke() ) |
|
1115 { |
|
1116 if ( EAutoChangeStateFromCandidate == editPane->GetAutoChangeStateFlag() ) |
|
1117 { |
|
1118 RefreshUI(); |
|
1119 editPane->SetChangeState(ETrue); |
|
1120 iOwner->ChangeState(ECandidate); |
|
1121 } |
|
1122 else if ( EAutoChangeStateFromInput == editPane->GetAutoChangeStateFlag() ) |
|
1123 { |
|
1124 editPane->SetChangeState(ETrue); |
|
1125 iOwner->ChangeState(EEntry); |
|
1126 } |
|
1127 else |
|
1128 { |
|
1129 RefreshUI(); |
|
1130 } |
|
1131 return; |
|
1132 } |
|
1133 } |
|
1134 |
|
1135 //Auto change from EEntry state to EMiniQwertyEdit state. |
|
1136 if (EEntry == iState) |
|
1137 { |
|
1138 if ( (firstGroup ) && ( !CheckFirstGroupStroke() )) |
|
1139 { |
|
1140 editPane->SetChangeState(EFalse); |
|
1141 editPane->SetAutoChangeStateFlag(EAutoChangeStateFromInput); |
|
1142 iOwner->ChangeState(EMiniQwertyEdit); |
|
1143 return; |
|
1144 } |
|
1145 } |
|
1146 |
|
1147 RefreshUI(); |
|
1148 } |
|
1149 |
|
1150 // --------------------------------------------------------------------------- |
|
1151 // TAknFepInputMiniQwertyPinyinPhraseBase::HandleDefaultKeyL |
|
1152 // Handle default key press event. |
|
1153 // --------------------------------------------------------------------------- |
|
1154 // |
|
1155 void TAknFepInputMiniQwertyPinyinPhraseBase::HandleDefaultKeyL(TInt aKey) |
|
1156 { |
|
1157 MAknFepUICtrlContainerChinese* uiContainer = UIContainer(); |
|
1158 MAknFepUICtrlEditPane* editPane = uiContainer->EditPaneWindow(); |
|
1159 TBool firstGroup = CheckFirstGroupStroke(); |
|
1160 |
|
1161 if ( !AddKeystrokeL(aKey) ) |
|
1162 { |
|
1163 iOwner->FepMan()->PlaySound(EAvkonSIDErrorTone); |
|
1164 return; |
|
1165 } |
|
1166 |
|
1167 AnalyseL(); |
|
1168 |
|
1169 //Auto change from EMiniQwertyEdit state to EEntry state. |
|
1170 if (EMiniQwertyEdit == iState) |
|
1171 { |
|
1172 if ( ( !firstGroup ) && CheckFirstGroupStroke() ) |
|
1173 { |
|
1174 if ( EAutoChangeStateFromCandidate == editPane->GetAutoChangeStateFlag() ) |
|
1175 { |
|
1176 RefreshUI(); |
|
1177 editPane->SetChangeState(ETrue); |
|
1178 iOwner->ChangeState(ECandidate); |
|
1179 } |
|
1180 else if ( EAutoChangeStateFromInput == editPane->GetAutoChangeStateFlag() ) |
|
1181 { |
|
1182 editPane->SetChangeState(ETrue); |
|
1183 iOwner->ChangeState(EEntry); |
|
1184 } |
|
1185 else |
|
1186 { |
|
1187 RefreshUI(); |
|
1188 } |
|
1189 return; |
|
1190 } |
|
1191 } |
|
1192 |
|
1193 //Auto change from EEntry state to EMiniQwertyEdit state. |
|
1194 if (EEntry == iState) |
|
1195 { |
|
1196 if ( !CheckFirstGroupStroke() ) |
|
1197 { |
|
1198 editPane->SetAutoChangeStateFlag(EAutoChangeStateFromInput); |
|
1199 editPane->SetChangeState(ETrue); |
|
1200 iOwner->ChangeState(EMiniQwertyEdit); |
|
1201 return; |
|
1202 } |
|
1203 } |
|
1204 |
|
1205 RefreshUI(); |
|
1206 } |
|
1207 |
|
1208 // --------------------------------------------------------------------------- |
|
1209 // TAknFepInputMiniQwertyPinyinPhraseBase::ShowInfoOnEEP |
|
1210 // Show the showinfo on the EEP ctrl. |
|
1211 // --------------------------------------------------------------------------- |
|
1212 // |
|
1213 void TAknFepInputMiniQwertyPinyinPhraseBase::ShowInfoOnEEPPane() |
|
1214 { |
|
1215 MAknFepUICtrlContainerChinese* uiContainer = UIContainer(); |
|
1216 MAknFepUICtrlEditPane* editPane = uiContainer->EditPaneWindow(); |
|
1217 CDesCArrayFlat* showKeystroke = editPane->ShowKeystrokeArray(); |
|
1218 CDesCArrayFlat* keystrokeArray = editPane->KeystrokeArray(); |
|
1219 CDesCArrayFlat* phrase = editPane->PhraseArray(); |
|
1220 TBuf<KMaxKeystrokeCount> showInfo; |
|
1221 TBuf<KMaxKeystrokeCount> keyBuf; |
|
1222 for (TInt i = 0; i < phrase->Count(); ++i) |
|
1223 { |
|
1224 showInfo.Append(phrase->MdcaPoint(i) ); |
|
1225 } |
|
1226 |
|
1227 for (TInt ii = 0; ii < showKeystroke->Count(); ++ii) |
|
1228 { |
|
1229 showInfo.Append(showKeystroke->MdcaPoint(ii) ); |
|
1230 } |
|
1231 |
|
1232 for (TInt j = 0; j < keystrokeArray->Count(); ++j) |
|
1233 { |
|
1234 keyBuf.Append(keystrokeArray->MdcaPoint(j) ); |
|
1235 } |
|
1236 |
|
1237 editPane->SetTextForZhuyin(showInfo, GetCursorPos(), phrase->Count(), |
|
1238 keyBuf, editPane->GetCursorIndexOfKeystroke() ); |
|
1239 |
|
1240 if (iState == ECandidate) |
|
1241 { |
|
1242 editPane->DisableCursor(); |
|
1243 } |
|
1244 else |
|
1245 if (iState == EEntry) |
|
1246 { |
|
1247 editPane->EnableCursor(); |
|
1248 editPane->DeactiveCursor(); |
|
1249 } |
|
1250 else |
|
1251 if (iState == EMiniQwertyEdit) |
|
1252 { |
|
1253 editPane->EnableCursor(); |
|
1254 editPane->ActiveCursor(); |
|
1255 } |
|
1256 } |
|
1257 |
|
1258 // --------------------------------------------------------------------------- |
|
1259 // TAknFepInputMiniQwertyPinyinPhraseBase::ShowInfoOnEEP |
|
1260 // Show the showinfo on the EEP ctrl. |
|
1261 // --------------------------------------------------------------------------- |
|
1262 // |
|
1263 void TAknFepInputMiniQwertyPinyinPhraseBase::ShowInfoOnCandidatePane() |
|
1264 { |
|
1265 MAknFepUICtrlContainerChinese* uiContainer = UIContainer(); |
|
1266 CDesCArrayFlat* phrase = uiContainer->CandidatePane()->CandidateArray(); |
|
1267 MAknFepUICtrlEditPane* editPane = uiContainer->EditPaneWindow(); |
|
1268 if (KMaxPhraseCreationCount == editPane->PhraseArray()->Count() ) |
|
1269 { |
|
1270 phrase->Reset(); |
|
1271 TRAP_IGNORE( phrase->AppendL( KMaxPhraseNote ) ); |
|
1272 uiContainer->CandidatePane()->SplitPhraseCandidatesIntoPages(); |
|
1273 uiContainer->CandidatePane()->SetCandidateBuffer(); |
|
1274 uiContainer->Enable(ETrue); |
|
1275 uiContainer->ShowHorizontalScrollArrows(EFalse); |
|
1276 uiContainer->ShowVerticalScrollArrows(EFalse); |
|
1277 } |
|
1278 |
|
1279 TRAP_IGNORE( GetCandidateL() ); |
|
1280 if (phrase->Count() > 0) |
|
1281 { |
|
1282 // layout candidate and fill candidate buffer for first display page |
|
1283 uiContainer->CandidatePane()->SplitPhraseCandidatesIntoPages(); |
|
1284 uiContainer->CandidatePane()->SetCandidateBuffer(); |
|
1285 uiContainer->Enable(ETrue); |
|
1286 TBool multiplePages = !(uiContainer->CandidatePane()->IsLastPage() && uiContainer->CandidatePane()->IsFirstPage()); |
|
1287 uiContainer->ShowVerticalScrollArrows(multiplePages); |
|
1288 if (iState == EMiniQwertyEdit) |
|
1289 { |
|
1290 UIContainer()->FocusCandidatePane(EFalse); |
|
1291 } |
|
1292 else |
|
1293 { |
|
1294 UIContainer()->FocusCandidatePane(ETrue); |
|
1295 UIContainer()->CandidatePane()->SelectFirstPhrase(); |
|
1296 } |
|
1297 } |
|
1298 else |
|
1299 { |
|
1300 uiContainer->CandidatePane()->SplitPhraseCandidatesIntoPages(); |
|
1301 uiContainer->CandidatePane()->SetCandidateBuffer(); |
|
1302 uiContainer->Enable(ETrue); |
|
1303 uiContainer->ShowHorizontalScrollArrows(EFalse); |
|
1304 uiContainer->ShowVerticalScrollArrows(EFalse); |
|
1305 uiContainer->SetControlInVisible( EFalse ); |
|
1306 } |
|
1307 } |
|
1308 |
|
1309 // --------------------------------------------------------------------------- |
|
1310 // TAknFepInputMiniQwertyPinyinPhraseBase::GetShowKeystroke |
|
1311 //Handle horizontal navigation. |
|
1312 // --------------------------------------------------------------------------- |
|
1313 // |
|
1314 void TAknFepInputMiniQwertyPinyinPhraseBase::GetShowKeystroke(TInt aKey, |
|
1315 TDes& aKeystroke) |
|
1316 { |
|
1317 TInt count = sizeof(StrokeMap )/sizeof(StrokeMap[0] ); |
|
1318 for (TInt i = 0; i < count; i++) |
|
1319 { |
|
1320 if (aKey == StrokeMap[i].iKeyCode) |
|
1321 { |
|
1322 aKeystroke.Append(StrokeMap[i].iValue); |
|
1323 break; |
|
1324 } |
|
1325 } |
|
1326 } |
|
1327 |
|
1328 // --------------------------------------------------------------------------- |
|
1329 // TAknFepInputMiniQwertyPinyinPhraseBase::HandleHorizontalNavigation |
|
1330 //Handle horizontal navigation. |
|
1331 // --------------------------------------------------------------------------- |
|
1332 // |
|
1333 TBool TAknFepInputMiniQwertyPinyinPhraseBase::HandleHorizontalNavigation( |
|
1334 TInt aKey) |
|
1335 { |
|
1336 MAknFepUICtrlCandidatePane* candidatePane = UIContainer()->CandidatePane(); |
|
1337 TBool response = EFalse; |
|
1338 |
|
1339 // Do navigation... |
|
1340 if (aKey == EStdKeyLeftArrow) |
|
1341 { |
|
1342 if (!candidatePane->SelectPrev()) |
|
1343 { |
|
1344 candidatePane->SetCandidateBuffer(); |
|
1345 candidatePane->SelectLastPhrase(); |
|
1346 } |
|
1347 response = ETrue; |
|
1348 } |
|
1349 else |
|
1350 if (aKey == EStdKeyRightArrow) |
|
1351 { |
|
1352 if (!candidatePane->SelectNext()) |
|
1353 { |
|
1354 candidatePane->SetCandidateBuffer(); |
|
1355 candidatePane->SelectFirstPhrase(); |
|
1356 } |
|
1357 response = ETrue; |
|
1358 } |
|
1359 |
|
1360 if (response) |
|
1361 { |
|
1362 UpdateIndicator(); |
|
1363 } |
|
1364 |
|
1365 return response; |
|
1366 } |
|
1367 |
|
1368 // --------------------------------------------------------- |
|
1369 // TAknFepInputMiniQwertyPinyinPhraseBase::UpdateIndicator |
|
1370 // Update Indicator. |
|
1371 // --------------------------------------------------------- |
|
1372 // |
|
1373 void TAknFepInputMiniQwertyPinyinPhraseBase::UpdateIndicator() |
|
1374 { |
|
1375 MAknFepUICtrlContainerChinese* uiContainer = UIContainer(); |
|
1376 MAknFepUICtrlCandidatePane* candidatePane = uiContainer->CandidatePane(); |
|
1377 |
|
1378 if (candidatePane->IsFirstPage()) |
|
1379 { |
|
1380 uiContainer->CandidatePane()->ShowUpScrollArrows(EFalse); |
|
1381 } |
|
1382 else |
|
1383 { |
|
1384 uiContainer->CandidatePane()->ShowUpScrollArrows(ETrue); |
|
1385 } |
|
1386 |
|
1387 if (candidatePane->IsLastPage()) |
|
1388 { |
|
1389 uiContainer->CandidatePane()->ShowDownScrollArrows(EFalse); |
|
1390 } |
|
1391 else |
|
1392 { |
|
1393 uiContainer->CandidatePane()->ShowDownScrollArrows(ETrue); |
|
1394 } |
|
1395 #ifdef RD_INTELLIGENT_TEXT_INPUT |
|
1396 if (iOwner->FepMan()->KeyboardLayout() == EPtiKeyboardQwerty4x10) |
|
1397 { |
|
1398 if (candidatePane->VisibleCandidateCount()==1) |
|
1399 { |
|
1400 uiContainer->CandidatePane()->ShowLeftScrollArrows(EFalse); |
|
1401 uiContainer->CandidatePane()->ShowRightScrollArrows(EFalse); |
|
1402 } |
|
1403 else |
|
1404 { |
|
1405 uiContainer->CandidatePane()->ShowLeftScrollArrows(ETrue); |
|
1406 uiContainer->CandidatePane()->ShowRightScrollArrows(ETrue); |
|
1407 } |
|
1408 } |
|
1409 else |
|
1410 { |
|
1411 #endif |
|
1412 if (candidatePane->SelectedIndex() == 0 |
|
1413 && candidatePane->IsFirstPage() ) |
|
1414 { |
|
1415 uiContainer->CandidatePane()->ShowLeftScrollArrows(EFalse); |
|
1416 } |
|
1417 else |
|
1418 { |
|
1419 uiContainer->CandidatePane()->ShowLeftScrollArrows(ETrue); |
|
1420 } |
|
1421 |
|
1422 if (candidatePane->IsLastPage() && (candidatePane->SelectedIndex() |
|
1423 == candidatePane->VisibleCandidateCount() - 1)) |
|
1424 { |
|
1425 uiContainer->CandidatePane()->ShowRightScrollArrows(EFalse); |
|
1426 } |
|
1427 else |
|
1428 { |
|
1429 uiContainer->CandidatePane()->ShowRightScrollArrows(ETrue); |
|
1430 } |
|
1431 } |
|
1432 #ifdef RD_INTELLIGENT_TEXT_INPUT |
|
1433 } |
|
1434 #endif |
|
1435 |
|
1436 // --------------------------------------------------------- |
|
1437 // TAknFepInputMiniQwertyPinyinPhraseBase::DeleteMoreKeystrokeL |
|
1438 // Delete more keystroke than max leng. |
|
1439 // --------------------------------------------------------- |
|
1440 // |
|
1441 void TAknFepInputMiniQwertyPinyinPhraseBase::DeleteMoreKeystrokeL() |
|
1442 { |
|
1443 MAknFepUICtrlContainerChinese* uiContainer = UIContainer(); |
|
1444 MAknFepUICtrlEditPane* editPane = uiContainer->EditPaneWindow(); |
|
1445 CDesCArrayFlat* keystroke = editPane->KeystrokeArray(); |
|
1446 CDesCArrayFlat* showKeystroke = editPane->ShowKeystrokeArray(); |
|
1447 TInt index = editPane->GetCursorIndexOfKeystroke(); |
|
1448 TBuf<1> autoDLT; |
|
1449 autoDLT.Append( KAutoDLT ); |
|
1450 AnalyseL(); |
|
1451 // the count keystroke more than max length. |
|
1452 TInt count = showKeystroke->Count() - KMaxKeystrokeCount; |
|
1453 |
|
1454 for ( TInt i = 0; i < count; ++i ) |
|
1455 { |
|
1456 if ( 0 != showKeystroke->MdcaPoint( showKeystroke->Count() - 1 ).Compare( autoDLT ) ) |
|
1457 { |
|
1458 showKeystroke->Delete( showKeystroke->Count() - 1 ); |
|
1459 keystroke->Delete( keystroke->Count() - 1 ); |
|
1460 } |
|
1461 } |
|
1462 |
|
1463 if ( index > keystroke->Count() ) |
|
1464 { |
|
1465 editPane->SetCursorIndexOfKeystroke( keystroke->Count() ); |
|
1466 } |
|
1467 } |
|
1468 // --------------------------------------------------------- |
|
1469 // TAknFepInputMiniQwertyPinyinPhraseBase::DeleteKeystrokeL |
|
1470 // Delete current keystroke. |
|
1471 // --------------------------------------------------------- |
|
1472 // |
|
1473 TBool TAknFepInputMiniQwertyPinyinPhraseBase::DeleteKeystrokeL() |
|
1474 { |
|
1475 MAknFepUICtrlContainerChinese* uiContainer = UIContainer(); |
|
1476 MAknFepUICtrlEditPane* editPane = uiContainer->EditPaneWindow(); |
|
1477 CDesCArrayFlat* keystroke = editPane->KeystrokeArray(); |
|
1478 TInt index = editPane->GetCursorIndexOfKeystroke(); |
|
1479 TInt showKeyCount = editPane->ShowKeystrokeArray()->Count(); |
|
1480 |
|
1481 if ( ( 0 == index ) || (keystroke->Count() == 0 )) |
|
1482 { |
|
1483 return EFalse; |
|
1484 } |
|
1485 if ( 1 == index ) |
|
1486 { |
|
1487 editPane->Reset(); |
|
1488 } |
|
1489 if (index >= keystroke->Count() ) |
|
1490 { |
|
1491 keystroke->Delete(keystroke->Count() - 1); |
|
1492 editPane->SetCursorIndexOfKeystroke(keystroke->Count() ); |
|
1493 } |
|
1494 else |
|
1495 { |
|
1496 keystroke->Delete(index - 1); |
|
1497 editPane->SetCursorIndexOfKeystroke(index - 1); |
|
1498 } |
|
1499 |
|
1500 if ( showKeyCount >= KMaxKeystrokeCount - 1 ) |
|
1501 { |
|
1502 DeleteMoreKeystrokeL(); |
|
1503 } |
|
1504 |
|
1505 return ETrue; |
|
1506 } |
|
1507 |
|
1508 // --------------------------------------------------------- |
|
1509 // TAknFepInputMiniQwertyPinyinPhraseBase::AddPhraseToDB |
|
1510 // Add phrase to DB. |
|
1511 // --------------------------------------------------------- |
|
1512 // |
|
1513 void TAknFepInputMiniQwertyPinyinPhraseBase::AddPhraseToDB( |
|
1514 const TDesC& aPhraseAdd) |
|
1515 { |
|
1516 TPtiUserDictionaryEntry addUdbEntry(aPhraseAdd); |
|
1517 //Add the phrase to the DB by PTI Engine |
|
1518 iOwner->PtiEngine()->AddUserDictionaryEntry(addUdbEntry); |
|
1519 } |
|
1520 |
|
1521 // --------------------------------------------------------------------------- |
|
1522 // TAknFepInputMiniQwertyPinyinPhraseBase::RefreshCandidate |
|
1523 // Refresh candidate |
|
1524 // --------------------------------------------------------------------------- |
|
1525 // |
|
1526 void TAknFepInputMiniQwertyPinyinPhraseBase::RefreshCandidate() |
|
1527 { |
|
1528 MAknFepUICtrlContainerChinese* uiContainer = UIContainer(); |
|
1529 uiContainer->CandidatePane()->SetCandidateBuffer(); |
|
1530 uiContainer->Enable(ETrue); |
|
1531 |
|
1532 TBool multiplePages = !(uiContainer->CandidatePane()->IsLastPage() && |
|
1533 uiContainer->CandidatePane()->IsFirstPage()); |
|
1534 uiContainer->ShowVerticalScrollArrows(multiplePages); |
|
1535 |
|
1536 uiContainer->CandidatePane()->SelectFirstPhrase(); |
|
1537 UpdateIndicator(); |
|
1538 } |
|
1539 |
|
1540 // --------------------------------------------------------------------------- |
|
1541 // TAknFepInputMiniQwertyPinyinPhraseBase::CheckKeyNeedRepeat |
|
1542 // Check key whether need repeat. |
|
1543 // --------------------------------------------------------------------------- |
|
1544 // |
|
1545 TBool TAknFepInputMiniQwertyPinyinPhraseBase::CheckKeyNeedRepeat( |
|
1546 TKeyPressLength aLength) |
|
1547 { |
|
1548 MAknFepUICtrlEditPane* editPane = UIContainer()->EditPaneWindow(); |
|
1549 if (editPane->IsChangeState() && aLength == ELongKeyPress) |
|
1550 { |
|
1551 return EFalse; |
|
1552 } |
|
1553 else |
|
1554 { |
|
1555 editPane->SetChangeState(EFalse); |
|
1556 } |
|
1557 return ETrue; |
|
1558 } |
|
1559 |
|
1560 // --------------------------------------------------------------------------- |
|
1561 // TAknFepInputMiniQwertyPinyinPhraseBase::CommitInlineEEPL |
|
1562 // Commint text to EEP or editor |
|
1563 // --------------------------------------------------------------------------- |
|
1564 // |
|
1565 TBool TAknFepInputMiniQwertyPinyinPhraseBase::CommitInlineEEPL( |
|
1566 const TDesC& aDes) |
|
1567 { |
|
1568 TInt charCount = aDes.Length(); |
|
1569 MAknFepManagerUIInterface* fepMan = iOwner->FepMan(); |
|
1570 MAknFepUICtrlEditPane* editpane = UIContainer()->EditPaneWindow(); |
|
1571 CDesCArrayFlat* showkeyStoke = editpane->ShowKeystrokeArray(); |
|
1572 CDesCArrayFlat* keyStoke = editpane->KeystrokeArray(); |
|
1573 CDesCArrayFlat* phraseArray = editpane->PhraseArray(); |
|
1574 CDesCArrayFlat* phraseShowKeyStroke = |
|
1575 editpane->PhraseShowKeyStrokeArray(); |
|
1576 TBuf<KMaxKeystrokeCount> buf; |
|
1577 TBuf<1> autoDLT; |
|
1578 autoDLT.Append(KAutoDLT); |
|
1579 |
|
1580 if (phraseArray->Count() == 0) |
|
1581 { |
|
1582 editpane->SetPhraseCreationFlag(EFalse); |
|
1583 } |
|
1584 phraseArray->AppendL(aDes); |
|
1585 |
|
1586 TInt delCount = 0; |
|
1587 for (TInt i = 0; i < showkeyStoke->Count() && charCount |
|
1588 && keyStoke->Count() != 0; i++) |
|
1589 { |
|
1590 TPtrC showptr = showkeyStoke->MdcaPoint(i); |
|
1591 TPtrC ptr = keyStoke->MdcaPoint( 0); |
|
1592 if (CheckSpellingDLT(showptr) || (KInvalidToneMark |
|
1593 != ToneMark(showptr) )) |
|
1594 { |
|
1595 charCount--; |
|
1596 } |
|
1597 if (showptr.Compare(autoDLT) != 0) |
|
1598 { |
|
1599 buf.Append(ptr); |
|
1600 keyStoke->Delete( 0); |
|
1601 } |
|
1602 delCount++; |
|
1603 } |
|
1604 |
|
1605 TInt phraseCount = phraseArray->Count(); |
|
1606 if (phraseCount > KMaxPhraseCreationCount) |
|
1607 { |
|
1608 phraseCount = KMaxPhraseCreationCount; |
|
1609 } |
|
1610 |
|
1611 if (keyStoke->Count() == 0 || phraseCount == KMaxPhraseCreationCount) |
|
1612 { |
|
1613 TBuf<KMaxPhraseCreationCount> phraseCreated; |
|
1614 for (TInt ii = 0; ii < phraseCount; ++ii) |
|
1615 { |
|
1616 phraseCreated.Append(phraseArray->MdcaPoint(ii) ); |
|
1617 } |
|
1618 fepMan->NewTextL(phraseCreated); |
|
1619 fepMan->CommitInlineEditL(); |
|
1620 iOwner->PtiEngine()->SetPredictiveChineseChar(phraseCreated); |
|
1621 AddPhraseToDB(phraseCreated); |
|
1622 return EFalse; |
|
1623 } |
|
1624 |
|
1625 for (TInt j = 0; j < delCount; j++) |
|
1626 { |
|
1627 showkeyStoke->Delete( 0); |
|
1628 } |
|
1629 phraseShowKeyStroke->AppendL(buf); |
|
1630 |
|
1631 editpane->SetCursorIndexOfKeystroke( 0); |
|
1632 editpane->DisableCursor(); |
|
1633 editpane->SetPhraseCreationFlag(ETrue); |
|
1634 return ETrue; |
|
1635 } |
|
1636 // --------------------------------------------------------- |
|
1637 // TAknFepInputMiniQwertyPinyinPhraseBase::ClearPtiEngineKeystroke |
|
1638 // clear the ptiengine keystroke; |
|
1639 // --------------------------------------------------------- |
|
1640 // |
|
1641 void TAknFepInputMiniQwertyPinyinPhraseBase::ClearPtiEngineKeystroke() |
|
1642 { |
|
1643 iOwner->PtiEngine()->ClearCurrentWord(); |
|
1644 } |
|
1645 |
|
1646 // --------------------------------------------------------- |
|
1647 // TAknFepInputMiniQwertyPinyinPhraseBase::AddKeystrokeL |
|
1648 // Add keystroke. |
|
1649 // --------------------------------------------------------- |
|
1650 // |
|
1651 TBool TAknFepInputMiniQwertyPinyinPhraseBase::AddKeystrokeL(TInt aKey) |
|
1652 { |
|
1653 MAknFepUICtrlContainerChinese* uiContainer = UIContainer(); |
|
1654 MAknFepUICtrlEditPane* editPane = uiContainer->EditPaneWindow(); |
|
1655 CDesCArrayFlat* keystrokeArray = editPane->KeystrokeArray(); |
|
1656 TInt phraseCount = editPane->PhraseArray()->Count(); |
|
1657 TInt showKeystrokeCount = editPane->ShowKeystrokeArray()->Count(); |
|
1658 TInt index = editPane->GetCursorIndexOfKeystroke(); |
|
1659 TBuf<1> keystroke; |
|
1660 |
|
1661 if ( phraseCount + showKeystrokeCount >= KMaxKeystrokeCount ) |
|
1662 { |
|
1663 return EFalse; |
|
1664 } |
|
1665 |
|
1666 GetShowKeystroke(aKey, keystroke); |
|
1667 if ( index >= keystrokeArray->Count() ) |
|
1668 { |
|
1669 keystrokeArray->AppendL(keystroke); |
|
1670 editPane->SetCursorIndexOfKeystroke(keystrokeArray->Count() ); |
|
1671 } |
|
1672 else |
|
1673 { |
|
1674 keystrokeArray->InsertL(index, keystroke); |
|
1675 editPane->SetCursorIndexOfKeystroke(index + 1); |
|
1676 } |
|
1677 |
|
1678 if ( phraseCount + showKeystrokeCount >= KMaxKeystrokeCount - 1 ) |
|
1679 { |
|
1680 AnalyseL(); |
|
1681 if ( phraseCount + editPane->ShowKeystrokeArray()->Count() <= KMaxKeystrokeCount ) |
|
1682 { |
|
1683 return ETrue; |
|
1684 } |
|
1685 else |
|
1686 { |
|
1687 keystrokeArray->Delete( index ); |
|
1688 editPane->SetCursorIndexOfKeystroke( index ); |
|
1689 AnalyseL(); |
|
1690 return EFalse; |
|
1691 } |
|
1692 } |
|
1693 |
|
1694 |
|
1695 return ETrue; |
|
1696 } |
|
1697 |
|
1698 // --------------------------------------------------------- |
|
1699 // TAknFepInputMiniQwertyPinyinPhraseBase::AddToneMarkL |
|
1700 // Add tone mark. |
|
1701 // --------------------------------------------------------- |
|
1702 // |
|
1703 TBool TAknFepInputMiniQwertyPinyinPhraseBase::AddToneMarkL() |
|
1704 { |
|
1705 MAknFepUICtrlContainerChinese* uiContainer = UIContainer(); |
|
1706 MAknFepUICtrlEditPane* editPane = uiContainer->EditPaneWindow(); |
|
1707 CDesCArrayFlat* keystrokeArray = editPane->KeystrokeArray(); |
|
1708 TInt phraseCount = editPane->PhraseArray()->Count(); |
|
1709 TInt showKeystrokeCount = editPane->ShowKeystrokeArray()->Count(); |
|
1710 TInt index = editPane->GetCursorIndexOfKeystroke(); |
|
1711 TInt i = 0; |
|
1712 const TInt MaxToneMark = 4; |
|
1713 if ( phraseCount + showKeystrokeCount >= KMaxKeystrokeCount ) |
|
1714 { |
|
1715 if ( 0 == index ) |
|
1716 { |
|
1717 return EFalse; |
|
1718 } |
|
1719 else |
|
1720 { |
|
1721 if ( KInvalidToneMark == ToneMark( keystrokeArray->MdcaPoint( index - 1 ) ) ) |
|
1722 { |
|
1723 return EFalse; |
|
1724 } |
|
1725 } |
|
1726 } |
|
1727 |
|
1728 TBuf<1> toneMark; |
|
1729 |
|
1730 if ( 0 == index ) |
|
1731 { |
|
1732 toneMark.Append(PinyinToneMap[0].iValue); |
|
1733 keystrokeArray->InsertL( 0, toneMark); |
|
1734 editPane->SetCursorIndexOfKeystroke( 1); |
|
1735 return ETrue; |
|
1736 } |
|
1737 |
|
1738 TInt num = sizeof(PinyinToneMap )/( sizeof(PinyinToneMap[0])); |
|
1739 for ( i = 0; i < num; ++i ) |
|
1740 { |
|
1741 if (PinyinToneMap[i].iValue == keystrokeArray->MdcaPoint( index - 1 )[0]) |
|
1742 { |
|
1743 break; |
|
1744 } |
|
1745 } |
|
1746 |
|
1747 if ( i > MaxToneMark ) |
|
1748 { |
|
1749 toneMark.Append(PinyinToneMap[0].iValue); |
|
1750 keystrokeArray->InsertL(index, toneMark); |
|
1751 editPane->SetCursorIndexOfKeystroke( index + 1 ); |
|
1752 } |
|
1753 else |
|
1754 { |
|
1755 if ( MaxToneMark == i ) |
|
1756 { |
|
1757 toneMark.Append(PinyinToneMap[0].iValue); |
|
1758 } |
|
1759 else |
|
1760 { |
|
1761 toneMark.Append(PinyinToneMap[ i + 1 ].iValue); |
|
1762 } |
|
1763 keystrokeArray->Delete(index - 1); |
|
1764 keystrokeArray->InsertL(index - 1, toneMark); |
|
1765 } |
|
1766 |
|
1767 if ( phraseCount + showKeystrokeCount >= KMaxKeystrokeCount - 1 ) |
|
1768 { |
|
1769 AnalyseL(); |
|
1770 if ( phraseCount + editPane->ShowKeystrokeArray()->Count() > KMaxKeystrokeCount ) |
|
1771 { |
|
1772 if ( i > MaxToneMark ) |
|
1773 { |
|
1774 keystrokeArray->Delete( index ); |
|
1775 editPane->SetCursorIndexOfKeystroke( index ); |
|
1776 } |
|
1777 else |
|
1778 { |
|
1779 toneMark.Zero(); |
|
1780 toneMark.Append( PinyinToneMap[i].iValue ); |
|
1781 keystrokeArray->Delete( index - 1 ); |
|
1782 keystrokeArray->InsertL( index - 1, toneMark ); |
|
1783 } |
|
1784 AnalyseL(); |
|
1785 return EFalse; |
|
1786 } |
|
1787 } |
|
1788 |
|
1789 return ETrue; |
|
1790 } |
|
1791 |
|
1792 // --------------------------------------------------------- |
|
1793 // TAknFepInputMiniQwertyPinyinPhraseBase::GetCandidateL |
|
1794 // Get the candidate info. |
|
1795 // --------------------------------------------------------- |
|
1796 // |
|
1797 void TAknFepInputMiniQwertyPinyinPhraseBase::GetCandidateL() |
|
1798 { |
|
1799 CPtiEngine* ptiengine = iOwner->PtiEngine(); |
|
1800 MAknFepUICtrlContainerChinese* uiContainer = UIContainer(); |
|
1801 MAknFepUICtrlEditPane* editPane = uiContainer->EditPaneWindow(); |
|
1802 CDesCArrayFlat* phraseCandidates = |
|
1803 uiContainer->CandidatePane()->CandidateArray(); |
|
1804 CDesCArrayFlat* keystroke = editPane->KeystrokeArray(); |
|
1805 CDesCArrayFlat* showKeystroke = editPane->ShowKeystrokeArray(); |
|
1806 TInt phraseCount = editPane->PhraseArray()->Count(); |
|
1807 phraseCandidates->Reset(); |
|
1808 TBuf<KMaxKeystrokeCount> buf; |
|
1809 TBuf<1> delimiter; |
|
1810 delimiter.Append( KManualDLT ); |
|
1811 TInt keyCode; |
|
1812 TInt count = KInvalidToneMark; |
|
1813 ClearPtiEngineKeystroke(); |
|
1814 |
|
1815 if ( showKeystroke->Count() == 0 ) |
|
1816 { |
|
1817 return; |
|
1818 } |
|
1819 |
|
1820 if ( CheckAllGroupStroke() && ( phraseCount == 0 ) ) |
|
1821 { |
|
1822 getCurrentLeastDLTSpell(); |
|
1823 ptiengine->GetChinesePhraseCandidatesL( *phraseCandidates ); |
|
1824 return; |
|
1825 } |
|
1826 |
|
1827 if ( CheckFirstGroupStroke() ) |
|
1828 { |
|
1829 ClearPtiEngineKeystroke(); |
|
1830 for ( TInt i = 0; i < showKeystroke->Count(); ++i ) |
|
1831 { |
|
1832 count = ToneMark( keystroke->MdcaPoint( i ) ); |
|
1833 if ( CheckSpellingDLT( showKeystroke->MdcaPoint( i ) ) ) |
|
1834 { |
|
1835 break; |
|
1836 } |
|
1837 else if ( KInvalidToneMark != count ) |
|
1838 { |
|
1839 for ( TInt j = 0; j < count; ++j ) |
|
1840 { |
|
1841 ptiengine->IncrementToneMark( ETrue ); |
|
1842 } |
|
1843 break; |
|
1844 } |
|
1845 else |
|
1846 { |
|
1847 GetKeystrokeCode( keyCode, keystroke->MdcaPoint( i ) ); |
|
1848 ptiengine->AppendKeyPress((TPtiKey)keyCode); |
|
1849 } |
|
1850 } |
|
1851 } |
|
1852 else |
|
1853 { |
|
1854 return; |
|
1855 } |
|
1856 getCurrentLeastDLTSpell(); |
|
1857 ptiengine->GetChinesePhraseCandidatesL( *phraseCandidates ); |
|
1858 } |
|
1859 |
|
1860 // --------------------------------------------------------- |
|
1861 // TAknFepInputMiniQwertyPinyinPhraseBase::GetKeystrokeCode |
|
1862 // get Code of the key stroke. |
|
1863 // --------------------------------------------------------- |
|
1864 // |
|
1865 void TAknFepInputMiniQwertyPinyinPhraseBase::GetKeystrokeCode(TInt& aKey, |
|
1866 const TDesC& aKeystroke) |
|
1867 { |
|
1868 TInt count = sizeof(StrokeMap )/sizeof(StrokeMap[0] ); |
|
1869 for (TInt i = 0; i < count; i++) |
|
1870 { |
|
1871 TBuf<1> buf; |
|
1872 buf.Append(StrokeMap[i].iValue); |
|
1873 if (0 == aKeystroke.Compare(buf)) |
|
1874 { |
|
1875 aKey = StrokeMap[i].iKeyCode; |
|
1876 break; |
|
1877 } |
|
1878 } |
|
1879 } |
|
1880 |
|
1881 // --------------------------------------------------------- |
|
1882 // TAknFepInputMiniQwertyPinyinPhraseBase::RevertPhraseToKeystrokeL |
|
1883 // Revert the phrase to keystroke. |
|
1884 // --------------------------------------------------------- |
|
1885 // |
|
1886 void TAknFepInputMiniQwertyPinyinPhraseBase::RevertPhraseToKeystrokeL() |
|
1887 { |
|
1888 MAknFepUICtrlContainerChinese* uiContainer = UIContainer(); |
|
1889 MAknFepUICtrlEditPane* editPane = uiContainer->EditPaneWindow(); |
|
1890 CDesCArrayFlat* keystrokeArray = editPane->KeystrokeArray(); |
|
1891 CDesCArrayFlat* shownKeystrokeArray = editPane->ShowKeystrokeArray(); |
|
1892 CDesCArrayFlat* phrase = editPane->PhraseArray(); |
|
1893 CDesCArrayFlat* phraseStroke = editPane->PhraseShowKeyStrokeArray(); |
|
1894 TBuf<KMaxKeystrokeCount> buf; |
|
1895 if ( (phrase->Count() == 0 ) || (phraseStroke->Count() == 0 )) |
|
1896 { |
|
1897 return; |
|
1898 } |
|
1899 |
|
1900 buf.Append(phraseStroke->MdcaPoint(phraseStroke->Count() - 1) ); |
|
1901 for (TInt i = buf.Length() - 1; i >= 0; --i) |
|
1902 { |
|
1903 keystrokeArray->InsertL( 0, buf.Mid(i, 1) ); |
|
1904 } |
|
1905 phrase->Delete(phrase->Count() - 1); |
|
1906 phraseStroke->Delete(phraseStroke->Count() - 1); |
|
1907 AnalyseL(); |
|
1908 TInt showCount = editPane->ShowKeystrokeArray()->Count(); |
|
1909 TInt leng = phrase->Count() + showCount; |
|
1910 TInt deleteCount = 0; |
|
1911 if (leng > KMaxKeystrokeCount) |
|
1912 { |
|
1913 for (TInt i = 0; i < leng - KMaxKeystrokeCount; ++i) |
|
1914 { |
|
1915 if (KAutoDLT != shownKeystrokeArray->MdcaPoint( shownKeystrokeArray->Count() - 1 )[0]) |
|
1916 { |
|
1917 deleteCount = deleteCount + 1; |
|
1918 } |
|
1919 shownKeystrokeArray->Delete(shownKeystrokeArray->Count() - 1); |
|
1920 } |
|
1921 if (KAutoDLT == shownKeystrokeArray->MdcaPoint( shownKeystrokeArray->Count() - 1 )[0]) |
|
1922 { |
|
1923 shownKeystrokeArray->Delete(shownKeystrokeArray->Count() - 1); |
|
1924 } |
|
1925 } |
|
1926 for (TInt i = 0; i < deleteCount; ++i) |
|
1927 { |
|
1928 keystrokeArray->Delete(keystrokeArray->Count() - 1); |
|
1929 } |
|
1930 |
|
1931 editPane->SetCursorIndexOfKeystroke(buf.Length() ); |
|
1932 keystrokeArray->Compress(); |
|
1933 phrase->Compress(); |
|
1934 phraseStroke->Compress(); |
|
1935 |
|
1936 } |
|
1937 |
|
1938 // --------------------------------------------------------- |
|
1939 // TAknFepInputMiniQwertyPinyinPhraseBase::SetWarningColor |
|
1940 // Set warning color. |
|
1941 // --------------------------------------------------------- |
|
1942 // |
|
1943 void TAknFepInputMiniQwertyPinyinPhraseBase::SetWarningColor( |
|
1944 TInt aCount, |
|
1945 TInt aIndex, |
|
1946 TInt aI, |
|
1947 TInt aPhraseCount, |
|
1948 TInt aToneMark, |
|
1949 TBool aValid, |
|
1950 CDesCArrayFlat* aShowKeystroke |
|
1951 ) |
|
1952 { |
|
1953 CPtiEngine* ptiengine = iOwner->PtiEngine(); |
|
1954 MAknFepUICtrlEditPane* editPane = UIContainer()->EditPaneWindow(); |
|
1955 if ( ( !aValid ) || CheckSpellingDLT(aShowKeystroke->MdcaPoint(aI |
|
1956 - 1) ) || (KInvalidToneMark |
|
1957 != ToneMark( aShowKeystroke->MdcaPoint( aI - 1 ) ) )) |
|
1958 { |
|
1959 editPane->SetHighlight(aPhraseCount + aIndex, aPhraseCount |
|
1960 + aIndex + aCount - 1 ); |
|
1961 } |
|
1962 else |
|
1963 { |
|
1964 TPtrC ptr1 = getCurrentLeastDLTSpell(); |
|
1965 for (TInt j = 0; j < aToneMark; ++j) |
|
1966 { |
|
1967 ptiengine->IncrementToneMark(ETrue); |
|
1968 TPtrC ptr0 = getCurrentLeastDLTSpell(); |
|
1969 if (ptr0.Length() > 0) |
|
1970 { |
|
1971 if ( 0 == ptr0.Mid( ptr0.Length() - 1, 1 ). |
|
1972 Compare(aShowKeystroke->MdcaPoint( aI ) ) ) |
|
1973 { |
|
1974 break; |
|
1975 } |
|
1976 } |
|
1977 } |
|
1978 TPtrC ptr2 = getCurrentLeastDLTSpell(); |
|
1979 if ( ( ( 1 + ptr1.Length() ) != ptr2.Length() ) || ( 0 |
|
1980 != ptr2.Mid( ptr2.Length() - 1, 1 ). |
|
1981 CompareC( aShowKeystroke->MdcaPoint( aI ) ) )) |
|
1982 { |
|
1983 editPane->SetHighlight( aPhraseCount + aIndex, aPhraseCount |
|
1984 + aIndex + aCount - 1); |
|
1985 } |
|
1986 } |
|
1987 ClearPtiEngineKeystroke(); |
|
1988 } |
|
1989 |
|
1990 // --------------------------------------------------------- |
|
1991 // TAknFepInputMiniQwertyPinyinPhraseBase::SetWarningColor |
|
1992 // Set warning color. |
|
1993 // --------------------------------------------------------- |
|
1994 // |
|
1995 void TAknFepInputMiniQwertyPinyinPhraseBase::SetWarningColor() |
|
1996 { |
|
1997 CPtiEngine* ptiengine = iOwner->PtiEngine(); |
|
1998 MAknFepUICtrlEditPane* editPane = UIContainer()->EditPaneWindow(); |
|
1999 CDesCArrayFlat* showKeystroke = editPane->ShowKeystrokeArray(); |
|
2000 TInt phraseCount = editPane->PhraseArray()->Count(); |
|
2001 TBool valid = ETrue; |
|
2002 TInt index = 0; |
|
2003 TInt count = 0; |
|
2004 TInt stringBeforeLength = 0; |
|
2005 TInt stringAfterLength = 0; |
|
2006 TInt start = 0; |
|
2007 TInt keyCode = 0; |
|
2008 TInt toneMark = KInvalidToneMark; |
|
2009 |
|
2010 if (showKeystroke->Count() == 0) |
|
2011 { |
|
2012 return; |
|
2013 } |
|
2014 |
|
2015 if (CheckAllGroupStroke() ) |
|
2016 { |
|
2017 return; |
|
2018 } |
|
2019 ClearPtiEngineKeystroke(); |
|
2020 if (CheckSpellingDLT(showKeystroke->MdcaPoint( 0) ) || (KInvalidToneMark |
|
2021 != ToneMark(showKeystroke->MdcaPoint( 0) ) )) |
|
2022 { |
|
2023 start = 1; |
|
2024 editPane->SetHighlight(phraseCount, phraseCount); |
|
2025 index = 1; |
|
2026 } |
|
2027 |
|
2028 for ( TInt i = start; i < showKeystroke->Count(); ++i ) |
|
2029 { |
|
2030 count = count + 1; |
|
2031 // tone mark |
|
2032 toneMark = ToneMark(showKeystroke->MdcaPoint(i) ); |
|
2033 if ( KInvalidToneMark != toneMark ) |
|
2034 { |
|
2035 SetWarningColor( count, |
|
2036 index, |
|
2037 i, |
|
2038 phraseCount, |
|
2039 toneMark, |
|
2040 valid, |
|
2041 showKeystroke ); |
|
2042 index = i + 1; |
|
2043 count = 0; |
|
2044 valid = ETrue; |
|
2045 } |
|
2046 else |
|
2047 if ( CheckSpellingDLT(showKeystroke->MdcaPoint(i) ) ) |
|
2048 { |
|
2049 if ( ( !valid ) |
|
2050 || CheckSpellingDLT(showKeystroke->MdcaPoint(i - 1) ) |
|
2051 || (KInvalidToneMark |
|
2052 != ToneMark(showKeystroke->MdcaPoint(i - 1) ) )) |
|
2053 { |
|
2054 editPane->SetHighlight(phraseCount + index, phraseCount |
|
2055 + index + count - 1); |
|
2056 } |
|
2057 ClearPtiEngineKeystroke(); |
|
2058 index = i + 1; |
|
2059 count = 0; |
|
2060 valid = ETrue; |
|
2061 } |
|
2062 else |
|
2063 { |
|
2064 if ( valid ) |
|
2065 { |
|
2066 GetKeystrokeCode(keyCode, showKeystroke->MdcaPoint(i) ); |
|
2067 stringBeforeLength = getCurrentLeastDLTSpell().Length(); |
|
2068 ptiengine->AppendKeyPress((TPtiKey)keyCode).Length(); |
|
2069 stringAfterLength = getCurrentLeastDLTSpell().Length(); |
|
2070 if ( stringBeforeLength == stringAfterLength )//the keystroke is invalid |
|
2071 { |
|
2072 ClearPtiEngineKeystroke(); |
|
2073 valid = EFalse; |
|
2074 } |
|
2075 } |
|
2076 } |
|
2077 |
|
2078 if ( ( showKeystroke->Count() == i + 1 ) && ( !valid ) ) |
|
2079 { |
|
2080 editPane->SetHighlight( |
|
2081 phraseCount + index, |
|
2082 phraseCount + index + count - 1 ); |
|
2083 ClearPtiEngineKeystroke(); |
|
2084 } |
|
2085 } |
|
2086 } |
|
2087 |
|
2088 // --------------------------------------------------------- |
|
2089 // TAknFepInputMiniQwertyPinyinPhraseBase::SetWarningColor |
|
2090 // Set warning color. |
|
2091 // --------------------------------------------------------- |
|
2092 // |
|
2093 void TAknFepInputMiniQwertyPinyinPhraseBase::ChangeCbaL() |
|
2094 { |
|
2095 MAknFepManagerUIInterface* fepMan = iOwner->FepMan( ); |
|
2096 MAknFepUICtrlEditPane* editPane = UIContainer()->EditPaneWindow( ); |
|
2097 TInt candidateCount = UIContainer()->CandidatePane()->CandidateArray()->Count( ); |
|
2098 TInt keyStrokeCount = editPane->KeystrokeArray()->Count( ); |
|
2099 TInt phraseCount = editPane->PhraseArray()->Count( ); |
|
2100 TInt currentCBAResId = editPane->GetCurrentCBAResID( ); |
|
2101 if ( (candidateCount == 0 && keyStrokeCount != 0 ) || (phraseCount == 1 |
|
2102 && keyStrokeCount == 0 ) ) |
|
2103 { |
|
2104 if ( R_AKNFEP_SOFTKEYS_EMPTY_CANCEL_EMPTY != currentCBAResId ) |
|
2105 { |
|
2106 fepMan->UpdateCbaL( R_AKNFEP_SOFTKEYS_EMPTY_CANCEL_EMPTY ); |
|
2107 editPane->SetCurrentCBAResID( R_AKNFEP_SOFTKEYS_EMPTY_CANCEL_EMPTY ); |
|
2108 } |
|
2109 |
|
2110 } |
|
2111 else if ( keyStrokeCount == 0 ) |
|
2112 { |
|
2113 if ( R_AKNFEP_SOFTKEYS_DONE_CANCEL_DONE != currentCBAResId ) |
|
2114 { |
|
2115 fepMan->UpdateCbaL( R_AKNFEP_SOFTKEYS_DONE_CANCEL_DONE ); |
|
2116 editPane->SetCurrentCBAResID( R_AKNFEP_SOFTKEYS_DONE_CANCEL_DONE ); |
|
2117 } |
|
2118 } |
|
2119 else if ( R_AKNFEP_SOFTKEYS_OK_SELECT_CANCEL != currentCBAResId ) |
|
2120 { |
|
2121 fepMan->UpdateCbaL( R_AKNFEP_SOFTKEYS_OK_SELECT_CANCEL ); |
|
2122 editPane->SetCurrentCBAResID( R_AKNFEP_SOFTKEYS_OK_SELECT_CANCEL ); |
|
2123 } |
|
2124 } |
|
2125 |
|
2126 // --------------------------------------------------------- |
|
2127 // TAknFepInputMiniQwertyPinyinPhraseBase::MoveCursorLeft |
|
2128 // Move the cursor to Left. |
|
2129 // --------------------------------------------------------- |
|
2130 // |
|
2131 void TAknFepInputMiniQwertyPinyinPhraseBase::MoveCursorLeft() |
|
2132 { |
|
2133 MAknFepUICtrlContainerChinese* uiContainer = UIContainer(); |
|
2134 MAknFepUICtrlEditPane* editPane = uiContainer->EditPaneWindow(); |
|
2135 CDesCArrayFlat* showKeyStoke = editPane->ShowKeystrokeArray(); |
|
2136 TInt showKeyStokeCount = editPane->ShowKeystrokeArray()->Count(); |
|
2137 TInt indexOfKeystroke = editPane->GetCursorIndexOfKeystroke(); |
|
2138 TInt cursorPos = editPane->GetCursor() - editPane->PhraseArray()->Count(); |
|
2139 |
|
2140 TBuf<1> autoDLT; |
|
2141 autoDLT.Append(KAutoDLT); |
|
2142 const TInt offset = 2; |
|
2143 if (cursorPos <= 0) |
|
2144 { |
|
2145 cursorPos = 0; |
|
2146 } |
|
2147 else |
|
2148 if (cursorPos >= showKeyStokeCount) |
|
2149 { |
|
2150 cursorPos = showKeyStokeCount; |
|
2151 } |
|
2152 |
|
2153 if (cursorPos == 0) |
|
2154 { |
|
2155 editPane->SetCursorIndexOfKeystroke(editPane->KeystrokeArray()->Count() ); |
|
2156 ShowInfoOnEEPPane(); |
|
2157 SetWarningColor(); |
|
2158 } |
|
2159 else |
|
2160 if (cursorPos == 1) |
|
2161 { |
|
2162 editPane->SetCursorIndexOfKeystroke( 0); |
|
2163 ShowInfoOnEEPPane(); |
|
2164 SetWarningColor(); |
|
2165 } |
|
2166 else |
|
2167 { |
|
2168 if (showKeyStoke->MdcaPoint( cursorPos - 2 ).Compare(autoDLT) == 0) |
|
2169 { |
|
2170 editPane->MoveCursorLeft(offset); |
|
2171 editPane->SetCursorIndexOfKeystroke(indexOfKeystroke - 1); |
|
2172 } |
|
2173 else |
|
2174 { |
|
2175 editPane->MoveCursorLeft(); |
|
2176 editPane->SetCursorIndexOfKeystroke(indexOfKeystroke - 1); |
|
2177 } |
|
2178 } |
|
2179 } |
|
2180 |
|
2181 // --------------------------------------------------------- |
|
2182 // TAknFepInputMiniQwertyPinyinPhraseBase::MoveCursorRight |
|
2183 // Move the cursor to Right. |
|
2184 // --------------------------------------------------------- |
|
2185 // |
|
2186 void TAknFepInputMiniQwertyPinyinPhraseBase::MoveCursorRight() |
|
2187 { |
|
2188 MAknFepUICtrlContainerChinese* uiContainer = UIContainer(); |
|
2189 MAknFepUICtrlEditPane* editPane = uiContainer->EditPaneWindow(); |
|
2190 CDesCArrayFlat* showKeyStoke = editPane->ShowKeystrokeArray(); |
|
2191 TInt showKeyStokeCount = editPane->ShowKeystrokeArray()->Count(); |
|
2192 TInt indexOfKeystroke = editPane->GetCursorIndexOfKeystroke(); |
|
2193 TInt cursorPos = editPane->GetCursor() - editPane->PhraseArray()->Count(); |
|
2194 TBuf<1> autoDLT; |
|
2195 autoDLT.Append(KAutoDLT); |
|
2196 const TInt offset = 2; |
|
2197 |
|
2198 if (cursorPos <= 0) |
|
2199 { |
|
2200 cursorPos = 0; |
|
2201 } |
|
2202 else |
|
2203 if (cursorPos >= showKeyStokeCount) |
|
2204 { |
|
2205 cursorPos = showKeyStokeCount; |
|
2206 } |
|
2207 |
|
2208 if (cursorPos == showKeyStokeCount) |
|
2209 { |
|
2210 editPane->SetCursorIndexOfKeystroke( 0); |
|
2211 ShowInfoOnEEPPane(); |
|
2212 SetWarningColor(); |
|
2213 } |
|
2214 else |
|
2215 if (cursorPos == showKeyStokeCount - 1) |
|
2216 { |
|
2217 editPane->MoveCursorRight(); |
|
2218 editPane->SetCursorIndexOfKeystroke(editPane->KeystrokeArray()->Count() ); |
|
2219 ShowInfoOnEEPPane(); |
|
2220 SetWarningColor(); |
|
2221 } |
|
2222 else |
|
2223 { |
|
2224 if (showKeyStoke->MdcaPoint( cursorPos ).Compare(autoDLT) == 0) |
|
2225 { |
|
2226 editPane->MoveCursorRight(offset); |
|
2227 editPane->SetCursorIndexOfKeystroke(indexOfKeystroke + 1); |
|
2228 } |
|
2229 else |
|
2230 { |
|
2231 editPane->MoveCursorRight(); |
|
2232 editPane->SetCursorIndexOfKeystroke(indexOfKeystroke + 1); |
|
2233 } |
|
2234 } |
|
2235 } |
|
2236 |
|
2237 // --------------------------------------------------------- |
|
2238 // TAknFepInputMiniQwertyPinyinPhraseBase::CheckSpecialKey |
|
2239 // Check the special keystroke( i,u,v ). |
|
2240 // --------------------------------------------------------- |
|
2241 // |
|
2242 TBool TAknFepInputMiniQwertyPinyinPhraseBase::CheckSpecialKey(const TInt aKey) |
|
2243 { |
|
2244 if ( (aKey == EPtiKeyQwertyI ) || (aKey == EPtiKeyQwertyU ) || (aKey |
|
2245 == EPtiKeyQwertyV )) |
|
2246 { |
|
2247 return ETrue; |
|
2248 } |
|
2249 return EFalse; |
|
2250 } |
|
2251 |
|
2252 // --------------------------------------------------------- |
|
2253 // TAknFepInputMiniQwertyPinyinPhraseBase::CheckSpellingDLT |
|
2254 // Check the delimiter of spelling. |
|
2255 // --------------------------------------------------------- |
|
2256 // |
|
2257 TBool TAknFepInputMiniQwertyPinyinPhraseBase::CheckSpellingDLT( |
|
2258 const TDesC& aKeystroke) |
|
2259 { |
|
2260 if ( aKeystroke.Length() == 0 ) |
|
2261 { |
|
2262 return EFalse; |
|
2263 } |
|
2264 |
|
2265 if ( ( KAutoDLT == aKeystroke[0] ) || ( KManualDLT == aKeystroke[0] ) ) |
|
2266 { |
|
2267 return ETrue; |
|
2268 } |
|
2269 |
|
2270 return EFalse; |
|
2271 } |
|
2272 |
|
2273 // --------------------------------------------------------- |
|
2274 // TAknFepInputMiniQwertyPinyinPhraseBase::ToneMark |
|
2275 // Get pinyin tone mark. |
|
2276 // --------------------------------------------------------- |
|
2277 // |
|
2278 TInt TAknFepInputMiniQwertyPinyinPhraseBase::ToneMark(const TDesC& aKeystroke) |
|
2279 { |
|
2280 TInt numOfToneMark = sizeof (PinyinToneMap)/sizeof(PinyinToneMap[0]); |
|
2281 for (TInt i = 0; i < numOfToneMark; i++) |
|
2282 { |
|
2283 if (PinyinToneMap[i].iValue == aKeystroke[0]) |
|
2284 return PinyinToneMap[i].iInputTone; |
|
2285 } |
|
2286 return KInvalidToneMark; |
|
2287 } |
|
2288 |
|
2289 // --------------------------------------------------------- |
|
2290 // TAknFepInputMiniQwertyPinyinPhraseBase::ToneMark |
|
2291 // Get pinyin tone mark. |
|
2292 // --------------------------------------------------------- |
|
2293 // |
|
2294 TBool TAknFepInputMiniQwertyPinyinPhraseBase::CheckSpellingAddToneMarkToPTIL( |
|
2295 const TInt aToneMark ) |
|
2296 { |
|
2297 CPtiEngine* ptiengine = iOwner->PtiEngine(); |
|
2298 MAknFepUICtrlContainerChinese* uiContainer = UIContainer(); |
|
2299 MAknFepUICtrlEditPane* editPane = uiContainer->EditPaneWindow(); |
|
2300 TBuf<1> toneMark; |
|
2301 TBuf<1> delimiter; |
|
2302 |
|
2303 toneMark.Append( PinyinToneMap[aToneMark - 1].iValue ); |
|
2304 delimiter.Append( KManualDLT ); |
|
2305 |
|
2306 for ( TInt i = 0; i < aToneMark; ++i ) |
|
2307 { |
|
2308 ptiengine->IncrementToneMark(ETrue); |
|
2309 TPtrC ptr = getCurrentLeastDLTSpell(); |
|
2310 if ( ( 0 == ptr.Mid( ptr.Length() - 1, 1 ).Compare( toneMark ) ) && |
|
2311 ( KErrNotFound == ptr.Find( delimiter ) ) |
|
2312 ) |
|
2313 { |
|
2314 return ETrue; |
|
2315 } |
|
2316 } |
|
2317 |
|
2318 |
|
2319 return EFalse; |
|
2320 } |
|
2321 TPtrC TAknFepInputMiniQwertyPinyinPhraseBase::getCurrentLeastDLTSpell() |
|
2322 { |
|
2323 CPtiEngine* ptiengine = iOwner->PtiEngine(); |
|
2324 CDesC16ArrayFlat* allSpell = new CDesC16ArrayFlat(1); |
|
2325 TPtrC currentSpell; |
|
2326 TBuf<1> delimiter; |
|
2327 TBuf<KMaxKeystrokeCount> preDltPosizeArr; |
|
2328 TBuf<KMaxKeystrokeCount> curDltPosizeArr; |
|
2329 preDltPosizeArr.FillZ(KMaxKeystrokeCount); |
|
2330 preDltPosizeArr.SetLength(KMaxKeystrokeCount); |
|
2331 curDltPosizeArr.FillZ(KMaxKeystrokeCount); |
|
2332 curDltPosizeArr.SetLength(KMaxKeystrokeCount); |
|
2333 |
|
2334 TInt index = 1; |
|
2335 delimiter.Append( KManualDLT ); |
|
2336 TRAP_IGNORE( ptiengine->GetPhoneticSpellingsL(*allSpell)); |
|
2337 TInt allCount = ptiengine->PhoneticSpellingCount(); |
|
2338 |
|
2339 |
|
2340 for( TInt i = 0; i < allCount; i++) |
|
2341 { |
|
2342 |
|
2343 currentSpell.Set(allSpell->MdcaPoint(i)); |
|
2344 TInt dltIndex = 0; |
|
2345 curDltPosizeArr.FillZ(KMaxKeystrokeCount); |
|
2346 curDltPosizeArr.SetLength(KMaxKeystrokeCount); |
|
2347 TInt preIndex = 0; |
|
2348 for (TInt j = 0; j < currentSpell.Length(); j++) |
|
2349 { |
|
2350 |
|
2351 if (currentSpell.Mid(j, 1).Compare(delimiter) == 0 ) |
|
2352 { |
|
2353 curDltPosizeArr[dltIndex] = j - preIndex - 1; |
|
2354 preIndex = j; |
|
2355 dltIndex++; |
|
2356 } |
|
2357 else if ((j+1) == currentSpell.Length()) |
|
2358 { |
|
2359 curDltPosizeArr[dltIndex] = j - preIndex; |
|
2360 } |
|
2361 |
|
2362 } |
|
2363 |
|
2364 for (TInt k = 0; k < KMaxKeystrokeCount; k++) |
|
2365 { |
|
2366 |
|
2367 if (preDltPosizeArr[k] < curDltPosizeArr[k] ) |
|
2368 { |
|
2369 preDltPosizeArr.Copy(curDltPosizeArr); |
|
2370 index = i + 1; |
|
2371 break; |
|
2372 } |
|
2373 else if (preDltPosizeArr[k] > curDltPosizeArr[k] ) |
|
2374 { |
|
2375 break; |
|
2376 } |
|
2377 } |
|
2378 |
|
2379 } |
|
2380 |
|
2381 if (allSpell) |
|
2382 { |
|
2383 delete allSpell; |
|
2384 } |
|
2385 ptiengine->SelectPhoneticSpelling( index ); |
|
2386 return ptiengine->GetPhoneticSpelling(index); |
|
2387 |
|
2388 } |
|
2389 // --------------------------------------------------------- |
|
2390 // TAknFepInputMiniQwertyPinyinPhraseBase::CheckSpellingAddKeyToPTIL |
|
2391 // Check the spelling after add key to the PTI. |
|
2392 // --------------------------------------------------------- |
|
2393 // |
|
2394 TInt TAknFepInputMiniQwertyPinyinPhraseBase::CheckSpellingAddKeyToPTIL( |
|
2395 const TDesC& aKeystroke ) |
|
2396 { |
|
2397 CPtiEngine* ptiengine = iOwner->PtiEngine(); |
|
2398 MAknFepUICtrlContainerChinese* uiContainer = UIContainer(); |
|
2399 MAknFepUICtrlEditPane* editPane = uiContainer->EditPaneWindow(); |
|
2400 |
|
2401 TBuf<1> delimiter; |
|
2402 TInt keyCode = 0; |
|
2403 TInt stringBeforeLength = 0; |
|
2404 TInt stringAfterLength = 0; |
|
2405 TInt delimiterIndex = 0; |
|
2406 delimiter.Append( KManualDLT ); |
|
2407 |
|
2408 GetKeystrokeCode( keyCode, aKeystroke ); |
|
2409 //get the string before append this keystroke |
|
2410 TPtrC ptr = getCurrentLeastDLTSpell(); |
|
2411 stringBeforeLength = ptr.Length(); |
|
2412 //get the string after append this keystroke |
|
2413 ptiengine->AppendKeyPress((TPtiKey)keyCode); |
|
2414 TPtrC ptr1 = getCurrentLeastDLTSpell(); |
|
2415 stringAfterLength = ptr1.Length(); |
|
2416 |
|
2417 if ( stringBeforeLength != stringAfterLength ) |
|
2418 { |
|
2419 TPtrC ptr = getCurrentLeastDLTSpell(); |
|
2420 if ( KErrNotFound == ptr.Find( delimiter ) ) |
|
2421 { |
|
2422 return 0; |
|
2423 } |
|
2424 else |
|
2425 { |
|
2426 delimiterIndex = ptr.Length() - ptr.Find( delimiter ) - 1; |
|
2427 return delimiterIndex; |
|
2428 } |
|
2429 } |
|
2430 else |
|
2431 { |
|
2432 return -1; |
|
2433 } |
|
2434 } |
|
2435 |
|
2436 // --------------------------------------------------------- |
|
2437 // TAknFepInputMiniQwertyPinyinPhraseBase::HandleKeyFromCandidateL |
|
2438 // Handle key from candidate. |
|
2439 // --------------------------------------------------------- |
|
2440 // |
|
2441 void TAknFepInputMiniQwertyPinyinPhraseBase::HandleKeyFromCandidateL( |
|
2442 TInt aKey, TKeyPressLength /*aLength*/) |
|
2443 { |
|
2444 TInt index = 0; |
|
2445 #ifdef RD_INTELLIGENT_TEXT_INPUT |
|
2446 // it may be one of the 'valid' numbers.. |
|
2447 TPtiKeyboardType keyboardtype = iOwner->FepMan()->KeyboardLayout(); |
|
2448 if (EPtiKeyboardQwerty4x10 == keyboardtype || EPtiKeyboardQwerty3x11 |
|
2449 == keyboardtype || EPtiKeyboardHalfQwerty == keyboardtype |
|
2450 || EPtiKeyboardCustomQwerty == keyboardtype) |
|
2451 { |
|
2452 MPtiLanguage *lang= NULL; |
|
2453 RArray <TPtiNumericKeyBinding> keybinding; |
|
2454 TBool validnumkey = EFalse; |
|
2455 CPtiEngine* ptiengine = iOwner->PtiEngine(); |
|
2456 lang = ptiengine->CurrentLanguage(); |
|
2457 if (ptiengine && lang) |
|
2458 { |
|
2459 TRAP_IGNORE(ptiengine->GetNumericModeKeysForQwertyL(lang->LanguageCode(), keybinding, keyboardtype)); |
|
2460 TInt numericKeysCount = keybinding.Count(); |
|
2461 while (numericKeysCount--) |
|
2462 { |
|
2463 TPtiNumericKeyBinding numKeyBind = |
|
2464 keybinding[numericKeysCount]; |
|
2465 if ( (numKeyBind.iChar >= 0x31 && numKeyBind.iChar <= 0x36) |
|
2466 &&(aKey == numKeyBind.iKey)) |
|
2467 { |
|
2468 index = numKeyBind.iChar - EPtiKey0 -1; |
|
2469 validnumkey = ETrue; |
|
2470 break; |
|
2471 } |
|
2472 } |
|
2473 } |
|
2474 keybinding.Reset(); |
|
2475 keybinding.Close(); |
|
2476 if ( !validnumkey) |
|
2477 { |
|
2478 iOwner->FepMan()->PlaySound(EAvkonSIDErrorTone); |
|
2479 return; |
|
2480 } |
|
2481 } |
|
2482 else |
|
2483 { |
|
2484 #endif |
|
2485 index = MapKeyToIndex(aKey); |
|
2486 #ifdef RD_INTELLIGENT_TEXT_INPUT |
|
2487 } |
|
2488 #endif |
|
2489 MAknFepUICtrlCandidatePane* candidatePane = UIContainer()->CandidatePane(); |
|
2490 |
|
2491 if (candidatePane->SelectIndex(index) || aKey == EStdKeyDevice3 || aKey |
|
2492 == EStdKeyEnter) |
|
2493 { |
|
2494 TPtrC text = candidatePane->CurrentPhraseCandidate(); |
|
2495 if (text.Length() ) |
|
2496 { |
|
2497 if ( !CommitInlineEEPL(text) ) |
|
2498 { |
|
2499 DoActionAfterCommit(); |
|
2500 } |
|
2501 else |
|
2502 { |
|
2503 if (CheckFirstGroupStroke() ) |
|
2504 { |
|
2505 RefreshUI(EFalse); |
|
2506 UIContainer()->CandidatePane()->SelectFirstPhrase(); |
|
2507 } |
|
2508 else |
|
2509 { |
|
2510 UIContainer()->EditPaneWindow()->SetAutoChangeStateFlag(EAutoChangeStateFromCandidate); |
|
2511 iOwner->ChangeState(EMiniQwertyEdit); |
|
2512 } |
|
2513 } |
|
2514 } |
|
2515 } |
|
2516 } |
|
2517 |
|
2518 // --------------------------------------------------------- |
|
2519 // TAknFepInputMiniQwertyPinyinPhraseBase::CheckAllGroupStroke |
|
2520 // check the all group stroke of keystroke. |
|
2521 // --------------------------------------------------------- |
|
2522 // |
|
2523 TBool TAknFepInputMiniQwertyPinyinPhraseBase::CheckAllGroupStroke() |
|
2524 { |
|
2525 CPtiEngine* ptiengine = iOwner->PtiEngine(); |
|
2526 MAknFepUICtrlContainerChinese* uiContainer = UIContainer(); |
|
2527 MAknFepUICtrlEditPane* editPane = uiContainer->EditPaneWindow(); |
|
2528 CDesCArrayFlat* keystroke = editPane->KeystrokeArray(); |
|
2529 TInt phraseCount = editPane->PhraseArray()->Count(); |
|
2530 TInt keyCode = 0; |
|
2531 TInt stringBeforeLength = 0; |
|
2532 TInt stringAfterLength = 0; |
|
2533 TInt toneMarkCount = KInvalidToneMark; |
|
2534 |
|
2535 ClearPtiEngineKeystroke(); |
|
2536 |
|
2537 //If there is phrase on the entry pane then the all keystroke is invalid. |
|
2538 if ( phraseCount > 0 ) |
|
2539 { |
|
2540 return EFalse; |
|
2541 } |
|
2542 |
|
2543 //If the first keystroke is delimiter or tone mark |
|
2544 //then all keystroke is invalid. |
|
2545 if ( ( keystroke->Count() == 0 ) |
|
2546 || (CheckSpellingDLT(keystroke->MdcaPoint( 0 ) ) ) |
|
2547 || (KInvalidToneMark != ToneMark(keystroke->MdcaPoint( 0 ) ) ) ) |
|
2548 { |
|
2549 return EFalse; |
|
2550 } |
|
2551 |
|
2552 for (TInt i = 0; i < keystroke->Count(); ++i ) |
|
2553 { |
|
2554 toneMarkCount = ToneMark(keystroke->MdcaPoint( i ) ); |
|
2555 if ( KInvalidToneMark != toneMarkCount ) |
|
2556 { |
|
2557 if ( (CheckSpellingDLT(keystroke->MdcaPoint( i - 1 ) ) ) |
|
2558 || (KInvalidToneMark != ToneMark(keystroke->MdcaPoint( i - 1 ) ) ) ) |
|
2559 { |
|
2560 return EFalse; |
|
2561 } |
|
2562 for (TInt j =0; j < toneMarkCount; ++j) |
|
2563 { |
|
2564 ptiengine->IncrementToneMark(ETrue); |
|
2565 TPtrC ptr1 = getCurrentLeastDLTSpell(); |
|
2566 if (ptr1.Length() > 0) |
|
2567 { |
|
2568 if ( 0 == ptr1.Mid( ptr1.Length() - 1 ).Compare(keystroke->MdcaPoint( i ) ) ) |
|
2569 { |
|
2570 break; |
|
2571 } |
|
2572 } |
|
2573 } |
|
2574 TPtrC ptr = getCurrentLeastDLTSpell(); |
|
2575 if ( 0 != ptr.Mid( ptr.Length() - 1, 1 ).Compare(keystroke->MdcaPoint( i ) ) ) |
|
2576 { |
|
2577 return EFalse; |
|
2578 } |
|
2579 } |
|
2580 else |
|
2581 { |
|
2582 if ( (CheckSpellingDLT(keystroke->MdcaPoint( i ) ) ) |
|
2583 && (KInvalidToneMark != ToneMark(keystroke->MdcaPoint( i - 1 ) ) ) ) |
|
2584 { |
|
2585 return EFalse; |
|
2586 } |
|
2587 GetKeystrokeCode(keyCode, keystroke->MdcaPoint(i) ); |
|
2588 stringBeforeLength = getCurrentLeastDLTSpell().Length(); |
|
2589 ptiengine->AppendKeyPress((TPtiKey)keyCode).Length(); |
|
2590 stringAfterLength = getCurrentLeastDLTSpell().Length(); |
|
2591 if ( stringBeforeLength == stringAfterLength ) |
|
2592 { |
|
2593 return EFalse; |
|
2594 } |
|
2595 } |
|
2596 } |
|
2597 |
|
2598 return ETrue; |
|
2599 } |
|
2600 |
|
2601 // --------------------------------------------------------- |
|
2602 // TAknFepInputMiniQwertyPinyinPhraseBase::DoActionAfterCommit |
|
2603 // Do action afer commit, change state to predictive or not. |
|
2604 // --------------------------------------------------------- |
|
2605 // |
|
2606 void TAknFepInputMiniQwertyPinyinPhraseBase::DoActionAfterCommit() |
|
2607 { |
|
2608 TRAP_IGNORE( DoActionAfterCommitL() ); |
|
2609 } |
|
2610 |
|
2611 // --------------------------------------------------------- |
|
2612 // TAknFepInputMiniQwertyPinyinPhraseBase::DoActionAfterCommitL |
|
2613 // Do action afer commit, change state to predictive or not. |
|
2614 // --------------------------------------------------------- |
|
2615 // |
|
2616 void TAknFepInputMiniQwertyPinyinPhraseBase::DoActionAfterCommitL() |
|
2617 { |
|
2618 MAknFepManagerUIInterface* fepMan = iOwner->FepMan(); |
|
2619 if (fepMan->IsFlagSet(CAknFepManager::EFlagEditorFull) ) |
|
2620 { |
|
2621 UIContainer()->EditPaneWindow()->SetPhraseCreationFlag(EFalse); |
|
2622 fepMan->ClearFlag(CAknFepManager::EFlagEditorFull); |
|
2623 UIContainer()->EditPaneWindow()->SetPhraseCreationFlag(EFalse); |
|
2624 if (UIContainer()->EditPaneWindow()->KeystrokeArray()->Count() != 0) |
|
2625 { |
|
2626 UIContainer()->EditPaneWindow()->ResetAllArray(); |
|
2627 UIContainer()->EditPaneWindow()->SetPhraseCreationFlag(EFalse); |
|
2628 CAknWarningNote* errnote = new( ELeave ) CAknWarningNote(); |
|
2629 errnote->SetTone(CAknNoteDialog::EWarningTone); |
|
2630 errnote->ExecuteLD(KMaxPhraseNote); |
|
2631 } |
|
2632 iOwner->FepMan()->TryCloseUiL(); |
|
2633 } |
|
2634 else |
|
2635 { |
|
2636 if (UIContainer()->EditPaneWindow()->KeystrokeArray()->Count() != 0) |
|
2637 { |
|
2638 UIContainer()->EditPaneWindow()->ResetAllArray(); |
|
2639 UIContainer()->EditPaneWindow()->SetPhraseCreationFlag(EFalse); |
|
2640 CAknWarningNote* errnote = new( ELeave ) CAknWarningNote(); |
|
2641 errnote->SetTone(CAknNoteDialog::EWarningTone); |
|
2642 errnote->ExecuteLD(KMaxPhraseNote); |
|
2643 } |
|
2644 else |
|
2645 { |
|
2646 UIContainer()->EditPaneWindow()->ResetAllArray(); |
|
2647 if ( !UIContainer()->EditPaneWindow()->GetPhraseCreationFlag() ) |
|
2648 { |
|
2649 UIContainer()->EditPaneWindow()->SetPhraseCreationFlag(EFalse); |
|
2650 UIContainer()->EditPaneWindow()->SetChangeState(ETrue); |
|
2651 iOwner->ChangeState(EPredictiveCandidate); |
|
2652 } |
|
2653 else |
|
2654 { |
|
2655 UIContainer()->EditPaneWindow()->SetPhraseCreationFlag(EFalse); |
|
2656 iOwner->FepMan()->TryCloseUiL(); |
|
2657 } |
|
2658 } |
|
2659 } |
|
2660 } |
|
2661 // --------------------------------------------------------------------------- |
|
2662 // TAknFepInputMiniQwertyPinyinPhraseBase::HandleCommandL |
|
2663 // Handling Command |
|
2664 // --------------------------------------------------------------------------- |
|
2665 // |
|
2666 void TAknFepInputMiniQwertyPinyinPhraseBase::HandleCommandL( TInt aCommandId ) |
|
2667 { |
|
2668 switch ( aCommandId ) |
|
2669 { |
|
2670 // Handle the event frome command. |
|
2671 case EAknSoftkeySelect: |
|
2672 //case (TUint16)EAknSoftkeySelect: //the Selected in soft CBA |
|
2673 HandleCommitL( ); |
|
2674 break; |
|
2675 default: |
|
2676 TAknFepInputStateChineseBase::HandleCommandL( aCommandId ); |
|
2677 break; |
|
2678 } |
|
2679 } |
|
2680 // End of file |