|
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 TAknFepInputStateEntryZhuyinPhraseCreation methods. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 #include <PtiEngine.h> //CPtiEngine |
|
30 #include <PtiUserDicEntry.h> |
|
31 |
|
32 #include <PtiDefs.h> //keys |
|
33 #include <avkon.rsg> |
|
34 #include <AknFep.rsg> |
|
35 #include <aknnotewrappers.h> |
|
36 |
|
37 #include "AknFepPanic.h" |
|
38 #include "aknfepuiinputstateentryzhuyinphrasecreation.h" |
|
39 #include "AknFepUIManagerStateInterface.h" //MAknFepUIManagerStateInterface |
|
40 #include "AknFepManagerUIInterface.h" //MAknFepManagerUIInterface |
|
41 #include "AknFepUiCtrlContainerChinese.h" |
|
42 #include "AknFepUICtrlInputPane.h" |
|
43 #include "AknFepUICtrlCandidatePane.h" |
|
44 #include "AknFepUICtrlPinyinPopup.h" //Pinyin phrase |
|
45 #include "aknfepuictrleditpane.h" //pinyin phrase creation |
|
46 #include "AknFepManager.h" |
|
47 #include "aknfepzhuyinkeyhandlerinterface.h" |
|
48 #include "AknFepZhuyinAnalyser.h" |
|
49 #include "aknfepzhuyinconvertion.h" |
|
50 |
|
51 const TInt KMaxPhraseCount = 50; |
|
52 |
|
53 const TInt KMaxKeystrokeCount = 100; |
|
54 const TInt KMaxPhraseCreationCount = 7; |
|
55 const TInt KStateFromKeyDown = 0; |
|
56 const TInt KStateAuto = 1; |
|
57 // it means "the max phrase's length is seven" |
|
58 _LIT( KDelimiter, "\x002E" ); |
|
59 |
|
60 // --------------------------------------------------------- |
|
61 // C++ constructor |
|
62 // --------------------------------------------------------- |
|
63 // |
|
64 TAknFepInputStateEntryZhuyinPhraseCreation::TAknFepInputStateEntryZhuyinPhraseCreation( |
|
65 MAknFepUIManagerStateInterface* aOwner, |
|
66 MAknFepUICtrlContainerChinese* aUIContainer ) : |
|
67 TAknFepInputStateZhuyinPhraseCreationBase( aOwner, aUIContainer) |
|
68 { |
|
69 iState = EZhuyinSequenceEdit; |
|
70 |
|
71 MAknFepUICtrlContainerChinese* uiContainer = UIContainer(); |
|
72 uiContainer->FocusCandidatePane( EFalse ); |
|
73 uiContainer->CandidatePane()->ShowCandidateOrdinals( EFalse ); |
|
74 uiContainer->SetLayout( MAknFepUICtrlContainerChinese::ELayoutKeystroke ); |
|
75 uiContainer->CandidatePane()->SelectFirstPhrase(); |
|
76 uiContainer->ShowVerticalScrollArrows( ETrue ); |
|
77 uiContainer->ShowHorizontalScrollArrows( EFalse ); |
|
78 uiContainer->InputPane()->SetOverrideFontId( 0 ); |
|
79 |
|
80 iOwner->PtiEngine()->SetInputMode( EPtiEngineZhuyinByPhrase ); |
|
81 iOwner->PtiEngine()->SetCandidatePageLength( KMaxPhraseCount ); |
|
82 uiContainer->EditPaneWindow()->ActiveCursor(); |
|
83 // in the case that we are coming back to the input pane from the candidate pane, |
|
84 // we need to ensure that the current selection is selected correctly |
|
85 UpdateEEPContent(); |
|
86 RefreshUI(); |
|
87 // however we also need to clear the deliberate selection, in case we are not |
|
88 // coming back to the input pane from the candidate pane |
|
89 UpdateIndicator(); |
|
90 TRAP_IGNORE( ChangeCbaL() ); |
|
91 } |
|
92 |
|
93 // --------------------------------------------------------------------------- |
|
94 // TAknFepInputStateEntryZhuyinPhraseCreation::HandleKeyL |
|
95 // --------------------------------------------------------------------------- |
|
96 // |
|
97 TBool TAknFepInputStateEntryZhuyinPhraseCreation::HandleKeyL( |
|
98 TInt aKey, |
|
99 TKeyPressLength aLength ) |
|
100 { |
|
101 MAknFepUICtrlContainerChinese* uiContainer = UIContainer(); |
|
102 MAknFepUICtrlPinyinPopup* popup = uiContainer->PinyinPopupWindow(); |
|
103 |
|
104 CDesCArrayFlat* keystrokeArray = popup->ZhuyinSymbols(); |
|
105 CDesCArrayFlat* ChineseArray = popup->ChineseCharsDisped(); |
|
106 |
|
107 CDesCArrayFlat* candidateArray = |
|
108 uiContainer->CandidatePane()->CandidateArray(); |
|
109 TBuf<1> keyBuf; |
|
110 TBuf<1> keyShow; |
|
111 TBuf<KMaxPhraseCreationCount> phraseCreated; |
|
112 |
|
113 if ( aKey == EKeyBackspace ) |
|
114 { |
|
115 DeleteZhuyinSymbolOrChinese(); |
|
116 UpdateEEPContent(); |
|
117 RefreshUI(); |
|
118 if ( AutoChangeState() ) |
|
119 { |
|
120 popup->SetChangeState( ETrue ); |
|
121 iOwner->ZhuyinKeyHandler()->SetState( KStateAuto ); |
|
122 iOwner->ZhuyinKeyHandler()->SetStatusChgFlag(MZhuyinKeyHandler::EInit); |
|
123 ChangeCbaL(); |
|
124 iOwner->ChangeState( EEntry ); |
|
125 return ETrue; |
|
126 } |
|
127 else |
|
128 { |
|
129 ChangeCbaL(); |
|
130 } |
|
131 |
|
132 if ( keystrokeArray->Count() == 0 |
|
133 && ChineseArray->Count() == 0 ) |
|
134 { |
|
135 iOwner->FepMan()->TryCloseUiL(); |
|
136 if (aLength == ELongKeyPress) |
|
137 { |
|
138 iOwner->FepMan()->SetLongClearAfterCloseUI(ETrue); |
|
139 } |
|
140 } |
|
141 |
|
142 if ( 0 == ChineseArray->Count() ) |
|
143 { |
|
144 iOwner->FepMan()->PhraseCreation( EFalse ); |
|
145 } |
|
146 } |
|
147 else if ( aKey == EKeyRightArrow ) |
|
148 { |
|
149 if ( KMaxPhraseCreationCount == ChineseArray->Count() ) |
|
150 { |
|
151 iOwner->FepMan()->PlaySound( EAvkonSIDStandardKeyClick ); |
|
152 } |
|
153 else if ( 0 == keystrokeArray->Count() ) |
|
154 { |
|
155 iOwner->FepMan()->PlaySound( EAvkonSIDStandardKeyClick ); |
|
156 } |
|
157 else |
|
158 { |
|
159 if( !MoveIndexOfKeystrokeRight() ) |
|
160 { |
|
161 iOwner->FepMan()->PlaySound( EAvkonSIDStandardKeyClick ); |
|
162 } |
|
163 else |
|
164 { |
|
165 iOwner->ZhuyinKeyHandler()->SetState( KStateFromKeyDown ); |
|
166 } |
|
167 } |
|
168 } |
|
169 else if ( aKey == EKeyLeftArrow ) |
|
170 { |
|
171 if ( KMaxPhraseCreationCount == ChineseArray->Count() ) |
|
172 { |
|
173 iOwner->FepMan()->PlaySound( EAvkonSIDErrorTone ); |
|
174 } |
|
175 else if ( 0 == keystrokeArray->Count() ) |
|
176 { |
|
177 iOwner->FepMan()->PlaySound( EAvkonSIDErrorTone ); |
|
178 } |
|
179 else |
|
180 { |
|
181 if ( !MoveIndexOfKeystrokeLeft() ) |
|
182 { |
|
183 iOwner->FepMan()->PlaySound( EAvkonSIDErrorTone ); |
|
184 } |
|
185 else |
|
186 { |
|
187 iOwner->ZhuyinKeyHandler()->SetState( KStateFromKeyDown ); |
|
188 } |
|
189 } |
|
190 } |
|
191 else if ( aKey == EKeyOK || aKey == EKeyCBA1 ) |
|
192 { |
|
193 if ( ( ChineseArray->Count() >= 2 ) && ( 0 |
|
194 == keystrokeArray->Count() ) ) |
|
195 { |
|
196 //commit the chinese character. |
|
197 MAknFepManagerUIInterface* fepMan = iOwner->FepMan(); |
|
198 candidateArray->Reset(); |
|
199 for (TInt i = 0; i < ChineseArray->Count(); ++i ) |
|
200 { |
|
201 phraseCreated.Append( ChineseArray->MdcaPoint( i ) ); |
|
202 } |
|
203 candidateArray->AppendL( ChineseArray->MdcaPoint( |
|
204 ChineseArray->Count() - 1 ) ); |
|
205 uiContainer->CandidatePane()->SelectFirst(); |
|
206 uiContainer->CandidatePane()->SetCandidateBuffer( ChineseArray->MdcaPoint( |
|
207 ChineseArray->Count() - 1 ) ); |
|
208 AddPhraseToDB( phraseCreated ); |
|
209 fepMan->NewTextL( phraseCreated ); |
|
210 fepMan->CommitInlineEditL(); |
|
211 iOwner->FepMan()->TryCloseUiL(); //no more keys, close the UI. |
|
212 } |
|
213 else if ( ( 1 == ChineseArray->Count() ) && |
|
214 ( 0 == keystrokeArray->Count() ) ) |
|
215 { |
|
216 iOwner->FepMan()->PlaySound( EAvkonSIDErrorTone ); |
|
217 } |
|
218 else if ( !CheckHighLightL() ) |
|
219 { |
|
220 popup->SetChangeState( ETrue ); |
|
221 iOwner->ZhuyinKeyHandler()->SetState( KStateFromKeyDown ); |
|
222 iOwner->ZhuyinKeyHandler()->Reset(); |
|
223 iOwner->ChangeState( EEntry ); |
|
224 } |
|
225 else |
|
226 { |
|
227 iOwner->FepMan()->PlaySound( EAvkonSIDErrorTone ); |
|
228 } |
|
229 } |
|
230 else if ( aKey == EKeyDownArrow ) |
|
231 { |
|
232 if ( !CheckHighLightL() ) |
|
233 { |
|
234 if ( 0 == keystrokeArray->Count() ) |
|
235 { |
|
236 iOwner->FepMan()->PlaySound( EAvkonSIDErrorTone ); |
|
237 } |
|
238 else |
|
239 { |
|
240 popup->SetChangeState( ETrue ); |
|
241 iOwner->ZhuyinKeyHandler()->SetState( KStateFromKeyDown ); |
|
242 iOwner->ZhuyinKeyHandler()->SetStatusChgFlag( |
|
243 MZhuyinKeyHandler::EFromSpellingEditingToEntry); |
|
244 iOwner->ZhuyinKeyHandler()->Reset(); |
|
245 iOwner->ChangeState( EEntry ); |
|
246 } |
|
247 } |
|
248 else |
|
249 { |
|
250 iOwner->FepMan()->PlaySound( EAvkonSIDErrorTone ); |
|
251 } |
|
252 } |
|
253 else if ( aKey == EKeyUpArrow ) |
|
254 { |
|
255 iOwner->FepMan()->PlaySound( EAvkonSIDErrorTone ); |
|
256 } |
|
257 else if ( aLength == EShortKeyPress ) // don't want repeats on these keys |
|
258 { |
|
259 iOwner->FepMan()->SetCcpuFlag( CAknFepManager::ECcpuStateIgnoreStarUp ); |
|
260 if ( iOwner->IsValidChineseInputKey( aKey ) ) |
|
261 { |
|
262 if ( AddKeystrokeL( aKey ) ) |
|
263 { |
|
264 UpdateEEPContent(); |
|
265 if ( AutoChangeState() ) |
|
266 { |
|
267 popup->SetChangeState( ETrue ); |
|
268 iOwner->ZhuyinKeyHandler()->SetState( KStateAuto ); |
|
269 RefreshUI(); |
|
270 ChangeCbaL(); |
|
271 iOwner->ChangeState( EEntry ); |
|
272 } |
|
273 else |
|
274 { |
|
275 RefreshUI(); |
|
276 ChangeCbaL(); |
|
277 } |
|
278 } |
|
279 else |
|
280 { |
|
281 iOwner->FepMan()->PlaySound( EAvkonSIDErrorTone ); |
|
282 } |
|
283 } |
|
284 else if ( aKey == EPtiKeyStar ) |
|
285 { |
|
286 if ( AddToneMarkL() ) |
|
287 { |
|
288 UpdateEEPContent(); |
|
289 if ( AutoChangeState() ) |
|
290 { |
|
291 popup->SetChangeState( ETrue ); |
|
292 iOwner->ZhuyinKeyHandler()->SetState( KStateAuto ); |
|
293 iOwner->ZhuyinKeyHandler()->Reset(); |
|
294 ChangeCbaL(); |
|
295 iOwner->ChangeState( EEntry ); |
|
296 } |
|
297 else |
|
298 { |
|
299 RefreshUI(); |
|
300 ChangeCbaL(); |
|
301 } |
|
302 } |
|
303 else |
|
304 { |
|
305 iOwner->FepMan()->PlaySound( EAvkonSIDErrorTone ); |
|
306 } |
|
307 } |
|
308 else if ( aKey == EKeyCBA2 ) |
|
309 { |
|
310 iOwner->FepMan()->TryCloseUiL(); |
|
311 } |
|
312 else |
|
313 { |
|
314 iOwner->FepMan()->PlaySound( EAvkonSIDErrorTone ); |
|
315 } |
|
316 } |
|
317 return ETrue; |
|
318 } |
|
319 |
|
320 // --------------------------------------------------------- |
|
321 // set high light |
|
322 // --------------------------------------------------------- |
|
323 // |
|
324 void TAknFepInputStateEntryZhuyinPhraseCreation::SetHighLight() |
|
325 { |
|
326 MAknFepUICtrlContainerChinese* uiContainer = UIContainer(); |
|
327 MAknFepUICtrlPinyinPopup* popup = uiContainer->PinyinPopupWindow(); |
|
328 MAknFepUICtrlEditPane* editPane = uiContainer->EditPaneWindow(); |
|
329 TInt symbolsShowCount = popup->GetEEPContent().Length(); |
|
330 TInt chineseCount = popup->ChineseCharsDisped()->Count(); |
|
331 |
|
332 editPane->SetHighlight( chineseCount, symbolsShowCount ); |
|
333 } |
|
334 |
|
335 // --------------------------------------------------------- |
|
336 // set high light |
|
337 // --------------------------------------------------------- |
|
338 // |
|
339 void TAknFepInputStateEntryZhuyinPhraseCreation::SetHighLightMoreThanMax() |
|
340 { |
|
341 TInt begPos = BegPosOfMoreThanSeven(); |
|
342 |
|
343 if ( begPos ) |
|
344 { |
|
345 HighlightMoreThanSeven( begPos ); |
|
346 } |
|
347 } |
|
348 |
|
349 // --------------------------------------------------------- |
|
350 // move index of the keystroke left. |
|
351 // --------------------------------------------------------- |
|
352 // |
|
353 TBool TAknFepInputStateEntryZhuyinPhraseCreation::MoveIndexOfKeystrokeLeft() |
|
354 { |
|
355 MAknFepUICtrlEditPane* editPane = UIContainer()->EditPaneWindow(); |
|
356 MAknFepUICtrlPinyinPopup* popup = UIContainer()->PinyinPopupWindow(); |
|
357 CDesCArrayFlat* zhuyinSymbol = popup->ZhuyinSymbols(); |
|
358 CDesCArrayFlat* chineseArray = popup->ChineseCharsDisped(); |
|
359 TInt currentIndex = editPane->GetCursorIndexOfKeystroke(); |
|
360 TInt cursorPosition = editPane->GetCursor(); |
|
361 |
|
362 TBool ret = EFalse; |
|
363 TBuf<KMaxKeystrokeCount> buf; |
|
364 TBuf<KMaxKeystrokeCount> symbolBuf; |
|
365 |
|
366 if ( cursorPosition < chineseArray->Count() ) |
|
367 { |
|
368 return EFalse; |
|
369 } |
|
370 |
|
371 for ( TInt i = 0; i < zhuyinSymbol->Count(); ++i ) |
|
372 { |
|
373 symbolBuf.Append( zhuyinSymbol->MdcaPoint( i ) ); |
|
374 } |
|
375 buf.Append( popup->GetEEPContent() ); |
|
376 |
|
377 if ( chineseArray->Count() == cursorPosition ) |
|
378 { |
|
379 TRAP_IGNORE( ret = CheckHighLightL() ); |
|
380 if ( ret ) |
|
381 { |
|
382 editPane->Reset(); |
|
383 editPane->SetTextForZhuyin( buf, buf.Length(), |
|
384 chineseArray->Count(), symbolBuf, |
|
385 zhuyinSymbol->Count(), ETrue ); |
|
386 SetHighLight(); |
|
387 } |
|
388 else |
|
389 { |
|
390 editPane->Reset(); |
|
391 editPane->SetTextForZhuyin( buf, buf.Length(), |
|
392 chineseArray->Count(), symbolBuf, |
|
393 zhuyinSymbol->Count() ); |
|
394 SetHighLightMoreThanMax(); |
|
395 } |
|
396 editPane->SetCursorIndexOfKeystroke( zhuyinSymbol->Count() ); |
|
397 return ETrue; |
|
398 } |
|
399 |
|
400 if ( 1 == cursorPosition - chineseArray->Count() ) |
|
401 { |
|
402 TRAP_IGNORE( ret = CheckHighLightL() ); |
|
403 if ( ret ) |
|
404 { |
|
405 editPane->Reset(); |
|
406 editPane->SetTextForZhuyin( buf, chineseArray->Count(), |
|
407 chineseArray->Count(), symbolBuf, zhuyinSymbol->Count(), ETrue ); |
|
408 SetHighLight(); |
|
409 } |
|
410 else |
|
411 { |
|
412 editPane->Reset(); |
|
413 editPane->SetTextForZhuyin( buf, chineseArray->Count(), |
|
414 chineseArray->Count(), symbolBuf, zhuyinSymbol->Count() ); |
|
415 SetHighLightMoreThanMax(); |
|
416 } |
|
417 editPane->SetCursorIndexOfKeystroke( 0 ); |
|
418 return ETrue; |
|
419 } |
|
420 |
|
421 |
|
422 if ( 0 == buf.Mid( |
|
423 (cursorPosition - 2 ), 1 ).Compare( KDelimiter ) ) |
|
424 { |
|
425 editPane->MoveCursorLeft( 2 ); |
|
426 editPane->SetCursorIndexOfKeystroke( currentIndex - 1 ); |
|
427 } |
|
428 else |
|
429 { |
|
430 editPane->MoveCursorLeft(); |
|
431 editPane->SetCursorIndexOfKeystroke( currentIndex - 1 ); |
|
432 } |
|
433 return ETrue; |
|
434 } |
|
435 |
|
436 // --------------------------------------------------------- |
|
437 // move index of the keystroke right. |
|
438 // --------------------------------------------------------- |
|
439 // |
|
440 TBool TAknFepInputStateEntryZhuyinPhraseCreation::MoveIndexOfKeystrokeRight() |
|
441 { |
|
442 MAknFepUICtrlEditPane* editPane = UIContainer()->EditPaneWindow(); |
|
443 MAknFepUICtrlPinyinPopup* popup = UIContainer()->PinyinPopupWindow(); |
|
444 CDesCArrayFlat* zhuyinSymbol = popup->ZhuyinSymbols(); |
|
445 CDesCArrayFlat* chineseArray = popup->ChineseCharsDisped(); |
|
446 TInt currentIndex = editPane->GetCursorIndexOfKeystroke(); |
|
447 TInt cursorPosition = editPane->GetCursor(); |
|
448 |
|
449 TBool ret = EFalse; |
|
450 TBuf<KMaxKeystrokeCount> buf; |
|
451 TBuf<KMaxKeystrokeCount> symbolBuf; |
|
452 |
|
453 for ( TInt i = 0; i < zhuyinSymbol->Count(); ++i ) |
|
454 { |
|
455 symbolBuf.Append( zhuyinSymbol->MdcaPoint( i ) ); |
|
456 } |
|
457 buf.Append( popup->GetEEPContent() ); |
|
458 |
|
459 if ( buf.Length() == cursorPosition ) |
|
460 { |
|
461 TRAP_IGNORE( ret = CheckHighLightL() ); |
|
462 if ( ret ) |
|
463 { |
|
464 editPane->Reset(); |
|
465 editPane->SetTextForZhuyin( buf, chineseArray->Count(), |
|
466 chineseArray->Count(), symbolBuf, 0, ETrue ); |
|
467 SetHighLight(); |
|
468 } |
|
469 else |
|
470 { |
|
471 editPane->Reset(); |
|
472 editPane->SetTextForZhuyin( buf, chineseArray->Count(), |
|
473 chineseArray->Count(), symbolBuf, 0 ); |
|
474 SetHighLightMoreThanMax(); |
|
475 } |
|
476 editPane->SetCursorIndexOfKeystroke( 0 ); |
|
477 return ETrue; |
|
478 } |
|
479 |
|
480 if ( chineseArray->Count() == cursorPosition ) |
|
481 { |
|
482 editPane->MoveCursorRight(); |
|
483 editPane->SetCursorIndexOfKeystroke( 1 ); |
|
484 return ETrue; |
|
485 } |
|
486 |
|
487 if ( buf.Length() == cursorPosition + 1 ) |
|
488 { |
|
489 editPane->MoveCursorRight(); |
|
490 editPane->SetCursorIndexOfKeystroke( zhuyinSymbol->Count() ); |
|
491 return ETrue; |
|
492 } |
|
493 |
|
494 if ( 0 == buf.Mid( ( cursorPosition ), 1 ).Compare( KDelimiter ) ) |
|
495 { |
|
496 editPane->MoveCursorRight( 2 ); |
|
497 editPane->SetCursorIndexOfKeystroke( currentIndex + 1 ); |
|
498 } |
|
499 else |
|
500 { |
|
501 editPane->MoveCursorRight(); |
|
502 editPane->SetCursorIndexOfKeystroke( currentIndex + 1 ); |
|
503 } |
|
504 |
|
505 return ETrue; |
|
506 } |
|
507 |
|
508 // --------------------------------------------------------- |
|
509 // Initialize State. |
|
510 // --------------------------------------------------------- |
|
511 // |
|
512 void TAknFepInputStateEntryZhuyinPhraseCreation::InitializeState() |
|
513 { |
|
514 TRAP_IGNORE( ChangeCbaL() ); |
|
515 } |
|
516 |
|
517 // --------------------------------------------------------- |
|
518 // check auto change state. |
|
519 // --------------------------------------------------------- |
|
520 // |
|
521 TBool TAknFepInputStateEntryZhuyinPhraseCreation::AutoChangeState() |
|
522 { |
|
523 TInt keystrokeCount = |
|
524 UIContainer()->PinyinPopupWindow()->ZhuyinSymbols()->Count(); |
|
525 TBool ret = EFalse; |
|
526 |
|
527 TRAP_IGNORE( ret = CheckHighLightL() ); |
|
528 |
|
529 if ( ( !ret ) && |
|
530 ( KStateFromKeyDown != iOwner->ZhuyinKeyHandler()->GetState() ) && |
|
531 ( 0 != keystrokeCount ) ) |
|
532 { |
|
533 return ETrue; |
|
534 } |
|
535 |
|
536 return EFalse; |
|
537 } |
|
538 |
|
539 // --------------------------------------------------------- |
|
540 // Add phrase to DB. |
|
541 // --------------------------------------------------------- |
|
542 // |
|
543 TBool TAknFepInputStateEntryZhuyinPhraseCreation::AddPhraseToDB( const TDesC& aPhraseAdd ) |
|
544 { |
|
545 TInt retCode; |
|
546 TPtiUserDictionaryEntry addUdbEntry(aPhraseAdd); |
|
547 //Add the phrase to the DB by PTI Engine |
|
548 retCode = iOwner->PtiEngine()->AddUserDictionaryEntry( addUdbEntry ); |
|
549 if ( KErrNone != retCode ) |
|
550 { |
|
551 return EFalse; |
|
552 } |
|
553 |
|
554 return ETrue; |
|
555 } |
|
556 |
|
557 // --------------------------------------------------------- |
|
558 // Check high light. |
|
559 // --------------------------------------------------------- |
|
560 // |
|
561 TBool TAknFepInputStateEntryZhuyinPhraseCreation::CheckHighLightL() |
|
562 { |
|
563 MAknFepUICtrlPinyinPopup* popup = UIContainer()->PinyinPopupWindow(); |
|
564 CDesCArrayFlat* zhuyinSymbol = popup->ZhuyinSymbols(); |
|
565 CDesCArrayFlat* candidateArray = |
|
566 UIContainer()->CandidatePane()->CandidateArray(); |
|
567 TBuf<KMaxKeystrokeCount> inputBuf; |
|
568 |
|
569 inputBuf.Zero(); |
|
570 |
|
571 if ( 0 == candidateArray->Count() ) |
|
572 { |
|
573 return ETrue; |
|
574 } |
|
575 |
|
576 for ( TInt i = 0; i < zhuyinSymbol->Count(); ++i ) |
|
577 { |
|
578 inputBuf.Append( zhuyinSymbol->MdcaPoint( i ) ); |
|
579 } |
|
580 |
|
581 if ( 0 == inputBuf.Length() ) |
|
582 { |
|
583 return EFalse; |
|
584 } |
|
585 |
|
586 if ( !iOwner->ZhuyinAnalyser()->AnalyzeL( inputBuf ) ) |
|
587 { |
|
588 return ETrue; |
|
589 } |
|
590 |
|
591 return EFalse; |
|
592 } |
|
593 |
|
594 // End of file |