fep/aknfep/src/AknFepUiInputStateCandidateMiniQwertyZhuyinPhrase.cpp
branchRCL_3
changeset 44 ecbabf52600f
child 50 5a1685599b76
equal deleted inserted replaced
43:ebd48d2de13c 44:ecbabf52600f
       
     1 /*
       
     2 * Copyright (c) 2002-2005 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0""
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:            Implementation of Zhuyin phrase candidate state
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 
       
    23 
       
    24 
       
    25 
       
    26 
       
    27 
       
    28 
       
    29 // System includes
       
    30 #include <PtiEngine.h>   
       
    31 
       
    32 // User includes
       
    33 #include "AknFepUiInputStateCandidateMiniQwertyZhuyinPhrase.h"
       
    34 #include "AknFepUiInputStateCandidateQwertyBaseChinesePhrase.h"
       
    35 #include "AknFepUiCtrlContainerChinese.h"
       
    36 #include "AknFepUICtrlCandidatePane.h"
       
    37 #include "AknFepUICtrlPinyinPopup.h"
       
    38 #include "AknFepUICtrlInputPane.h"
       
    39 #include "AknFepUIManagerStateInterface.h"  
       
    40 #include "AknFepManager.h" 
       
    41 #include <aknfep.rsg>   
       
    42 
       
    43 #include "aknfepuictrleditpane.h"           //for zhuyin phrase creation
       
    44 #include "aknfepinputstateminiqwertyzhuyinkeymap.h"
       
    45 #include "aknfepuiinputstateminiqwertyzhuyinphrase.h"
       
    46 // Constant definition
       
    47 const TInt KMinCandidateCount = 1;
       
    48 const TInt KInputPaneLength = 32;
       
    49 //_LIT( KDelimiter, "\x2022");
       
    50 _LIT( KDelimiter, "'");
       
    51 _LIT( KSaiStroke,"\x311D" );
       
    52 
       
    53 struct TToneZhuYinMap
       
    54     {
       
    55     TUint16 iValue;
       
    56     TInt iInputTone;
       
    57     };
       
    58 const TToneZhuYinMap ZhuyinToneMap[] =
       
    59     {
       
    60         {0x0020, 1},
       
    61         {0x02CA, 2},
       
    62         {0x02c7, 3},
       
    63         {0x02CB, 4},
       
    64         {0x02D9, 5}
       
    65     };
       
    66 
       
    67 // ---------------------------------------------------------------------------
       
    68 // AknFepUiInputStateCandidateMiniQwertyZhuyinPhrase::
       
    69 // TAknFepUiInputStateCandidateMiniQwertyZhuyinPhrase
       
    70 // (other items were commented in a header).
       
    71 // ---------------------------------------------------------------------------
       
    72 //
       
    73 TAknFepUiInputStateCandidateMiniQwertyZhuyinPhrase::TAknFepUiInputStateCandidateMiniQwertyZhuyinPhrase(
       
    74     MAknFepUIManagerStateInterface* aOwner,
       
    75     MAknFepUICtrlContainerChinese* aUIContainer ) :
       
    76     TAknFepInputStateCandidateQwertyBaseChinesePhrase( aOwner, aUIContainer)
       
    77     {
       
    78     iState = ECandidate;
       
    79     MAknFepUICtrlContainerChinese* uiContainer = UIContainer();
       
    80 
       
    81     TBool multiplePages = !(uiContainer->CandidatePane()->IsLastPage() && uiContainer->CandidatePane()->IsFirstPage());
       
    82     TInt bufLength = iOwner->PtiEngine()->CandidatePage().Length();
       
    83     TBool showHorizontalScrollArrows = multiplePages || bufLength
       
    84         > KMinCandidateCount;
       
    85 
       
    86     uiContainer->ShowHorizontalScrollArrows( showHorizontalScrollArrows );
       
    87     uiContainer->ShowVerticalScrollArrows( multiplePages );
       
    88     uiContainer->FocusCandidatePane( ETrue );
       
    89     uiContainer->CandidatePane()->ShowCandidateOrdinals( ETrue );
       
    90     uiContainer->CandidatePane()->SelectFirstPhrase();
       
    91     UpdateIndicator();
       
    92 
       
    93     }
       
    94 
       
    95 // ---------------------------------------------------------------------------
       
    96 // AknFepUiInputStateCandidateMiniQwertyZhuyinPhrase::HandleKeyL
       
    97 // (other items were commented in a header).
       
    98 // ---------------------------------------------------------------------------
       
    99 //
       
   100 TBool TAknFepUiInputStateCandidateMiniQwertyZhuyinPhrase::HandleKeyL(
       
   101     TInt aKey, TKeyPressLength aLength )
       
   102     {
       
   103     if (iOwner->FepMan()->KeyboardLayout() == EPtiKeyboardQwerty4x10 || iOwner->FepMan()->KeyboardLayout() == EPtiKeyboardQwerty3x11)
       
   104         {
       
   105         return HandleKeyForMiniQwertyL(aKey, aLength);
       
   106         }
       
   107     else
       
   108         {
       
   109         return HandleKeyForHalfAndCustomQwertyL(aKey, aLength);
       
   110         }
       
   111     }
       
   112 // ---------------------------------------------------------------------------
       
   113 // TAknFepUiInputStateCandidateMiniQwertyZhuyinPhrase::ComitPhraseCreatedToEditor()
       
   114 // commit the phrase created to the editor
       
   115 // ---------------------------------------------------------------------------
       
   116 //
       
   117 TBool TAknFepUiInputStateCandidateMiniQwertyZhuyinPhrase::ComitPhraseCreatedToEditorL()
       
   118     {
       
   119     TPtrC text = UIContainer()->CandidatePane()->CurrentPhraseCandidate();
       
   120     if ( text.Length() )
       
   121         {
       
   122         MAknFepManagerUIInterface* fepMan = iOwner->FepMan();
       
   123         
       
   124     
       
   125         TBuf<KInputPaneLength> highText;
       
   126         UIContainer()->InputPane()->GetText( highText );
       
   127         TInt groupNum = GetInputPaneKeyStrokeCount( highText );
       
   128         TInt canidateCout = text.Length();
       
   129         if ( groupNum > canidateCout )
       
   130             {
       
   131             FillPhraseAndStrokArrayL( highText, text );
       
   132             }
       
   133         else
       
   134             {
       
   135             fepMan->NewTextL( text );
       
   136             fepMan->CommitInlineEditL();
       
   137             iOwner->PtiEngine()->SetPredictiveChineseChar( text );
       
   138             UIContainer()->EditPaneWindow()->ResetAllArray();
       
   139             UIContainer()->EditPaneWindow()->SetEffictiveLength( 0 );
       
   140             if ( fepMan->IsFlagSet( CAknFepManager::EFlagEditorFull ) )
       
   141                 {
       
   142                 fepMan->ClearFlag( CAknFepManager::EFlagEditorFull );
       
   143                 iOwner->FepMan()->TryCloseUiL();
       
   144                 }
       
   145             else
       
   146                 {
       
   147                 UIContainer()->EditPaneWindow()->SetChangeState(ETrue);
       
   148                 iOwner->ChangeState( EPredictiveCandidate );
       
   149                 }
       
   150             }
       
   151         }
       
   152     return ETrue;
       
   153     }
       
   154 // ---------------------------------------------------------------------------
       
   155 // TAknFepUiInputStateCandidateMiniQwertyZhuyinPhrase::GetInputPaneKeyStrokeCount()
       
   156 // get the input pane key stroke count 
       
   157 // ---------------------------------------------------------------------------
       
   158 //
       
   159 TInt TAknFepUiInputStateCandidateMiniQwertyZhuyinPhrase::GetInputPaneKeyStrokeCount(
       
   160     const TDesC& aBuf )
       
   161     {
       
   162     TInt groupNum = 1;
       
   163     for (TInt i = 0; i < aBuf.Length() - 1; i++ )
       
   164         {
       
   165         TInt num = sizeof(ZhuyinToneMap )/( sizeof(ZhuyinToneMap[0] ) );
       
   166         TBool isFindTone = EFalse;
       
   167         TInt isFindDel = 0;
       
   168         for (TInt m =0; m< num; m++ )
       
   169             {
       
   170             if ( aBuf[i] == ZhuyinToneMap[m].iValue )
       
   171                 {
       
   172                 isFindTone = ETrue;
       
   173                 break;
       
   174                 }
       
   175             }
       
   176         if ( !isFindTone )
       
   177             {
       
   178             isFindDel = aBuf.Mid(i,1).Compare( KDelimiter );
       
   179             }
       
   180         if ( 0 == isFindDel || isFindTone )
       
   181             {
       
   182             groupNum++;
       
   183             }
       
   184         }
       
   185     if ( 0 == aBuf.Right( 1 ).Compare( KDelimiter ) )
       
   186         {
       
   187         groupNum++;
       
   188         }
       
   189     return groupNum;
       
   190     }
       
   191 // ---------------------------------------------------------------------------
       
   192 // TAknFepUiInputStateCandidateMiniQwertyZhuyinPhrase::GetIndexOfToneMark()
       
   193 // get the index of the tonemark 
       
   194 // ---------------------------------------------------------------------------
       
   195 //
       
   196 TInt TAknFepUiInputStateCandidateMiniQwertyZhuyinPhrase::GetIndexOfToneMark( const TDesC& aText)
       
   197     {
       
   198     TInt num = sizeof(ZhuyinToneMap )/( sizeof(ZhuyinToneMap[0]));
       
   199     TInt len = aText.Length();
       
   200     for( TInt j = 0; j< len ;j++ )
       
   201         {
       
   202         for (TInt i = 0; i<num; i++ )
       
   203             {
       
   204             if ( aText[j] == ZhuyinToneMap[i].iValue )
       
   205                 {
       
   206                 return j;
       
   207                 }
       
   208             }
       
   209         }
       
   210     return -1;
       
   211     }
       
   212 // ---------------------------------------------------------------------------
       
   213 // TAknFepUiInputStateCandidateMiniQwertyZhuyinPhrase::FillPhraseAndStrokArray()
       
   214 // fill the phrase and keystroke array
       
   215 // ---------------------------------------------------------------------------
       
   216 //
       
   217 void TAknFepUiInputStateCandidateMiniQwertyZhuyinPhrase::FillPhraseAndStrokArrayL(
       
   218     const TDesC& aText, const TDesC& aPhrase )
       
   219     {
       
   220     CDesCArrayFlat* keyStrokeArray = UIContainer()->EditPaneWindow()->KeystrokeArray();
       
   221     CDesCArrayFlat* phraseKeyStrokeArray = UIContainer()->EditPaneWindow()->PhraseShowKeyStrokeArray() ;
       
   222     CDesCArrayFlat* phraseArray = UIContainer()->EditPaneWindow()->PhraseArray();
       
   223     CDesCArrayFlat* phraseZhuYinSpellingArray = UIContainer()->EditPaneWindow()->PhraseZhuYinSpellingArray();
       
   224     
       
   225     RArray<TInt>* keyCodeArray = UIContainer()->EditPaneWindow()->KeycodeArray();
       
   226     RArray<TInt>* keyCodePhraseArray = UIContainer()->EditPaneWindow()->PhraseKeycodeArray();
       
   227     phraseArray->AppendL( aPhrase );
       
   228     
       
   229     //we store zhuyin-spelling for this phrase
       
   230 	TInt delCount = phraseZhuYinSpellingArray->Count() - phraseArray->Count();//we can sure delCount>=0,impossible <0
       
   231 	if(delCount > 0) 
       
   232 		{
       
   233 		phraseZhuYinSpellingArray->Delete( phraseArray->Count(),delCount );//keep same count,del from tail one by one
       
   234 		}
       
   235 	TInt pos = -1;
       
   236 	if(-1 == pos)
       
   237 		pos = aText.Find( KDelimiter );//single quote
       
   238 	if(-1 == pos)
       
   239 		pos = GetIndexOfToneMark( aText );
       
   240 	if(-1 == pos)
       
   241 		pos = aText.Length();//impossible
       
   242 	phraseZhuYinSpellingArray->AppendL(aText.Left(pos+1));//we are sure the first spelling-group from left  match the aPhrase 
       
   243     	
       
   244     
       
   245     TBuf<KInputPaneLength> keyStoke;
       
   246     TInt replaceCount = 0;
       
   247     TInt delimiterIndex = aText.Find( KDelimiter );
       
   248     if ( KErrNotFound == delimiterIndex )
       
   249         {
       
   250         delimiterIndex = -1;
       
   251         }
       
   252     TInt indexOfToneMark = GetIndexOfToneMark( aText );
       
   253     if ( -1 == delimiterIndex && indexOfToneMark == -1 )
       
   254         {
       
   255         replaceCount = aText.Length();
       
   256         }
       
   257     else if ( delimiterIndex >= 0 && indexOfToneMark == -1 )
       
   258         {
       
   259         replaceCount = delimiterIndex;
       
   260         }
       
   261     else if ( delimiterIndex >= 0 && indexOfToneMark >= 0 )
       
   262         {
       
   263         replaceCount = Min( delimiterIndex, indexOfToneMark );
       
   264         if ( delimiterIndex > indexOfToneMark )
       
   265             {
       
   266             replaceCount++;
       
   267             }
       
   268         }
       
   269     else
       
   270         {
       
   271         replaceCount = indexOfToneMark + 1;// have tonemark  but has not deli
       
   272         }
       
   273     for (TInt i = 0; i < replaceCount; i++ )
       
   274         {
       
   275         TPtrC ptr = keyStrokeArray->MdcaPoint( 0 );
       
   276         keyStoke.Append( ptr );
       
   277         keyStrokeArray->Delete( 0 );
       
   278         // added for the keycode
       
   279         TInt keyCodeValue = (*keyCodeArray)[0];
       
   280         keyCodePhraseArray->AppendL( keyCodeValue );
       
   281         keyCodeArray->Remove( 0 );
       
   282         }
       
   283     phraseKeyStrokeArray->AppendL( keyStoke );   
       
   284     if ( CheckToneMarkBorderUpon()|| 0 ==keyStrokeArray->MdcaPoint( 0 ).Compare( KSaiStroke ) )
       
   285         {
       
   286         iOwner->ChangeState( EMiniQwertyEdit );
       
   287         }
       
   288     else
       
   289         {
       
   290         //change to the spelling selecting state
       
   291         iOwner->ChangeState( EZhuyinSpelling );
       
   292         }
       
   293     }
       
   294 // ---------------------------------------------------------------------------
       
   295 // TAknFepInputMiniQwertyZhuyinPhraseBase::GetValidKeystroke
       
   296 // Get the valid keystroke.
       
   297 // ---------------------------------------------------------------------------
       
   298 //
       
   299 TBool TAknFepUiInputStateCandidateMiniQwertyZhuyinPhrase::CheckToneMarkBorderUpon()
       
   300     {
       
   301     MAknFepUICtrlContainerChinese* uiContainer = UIContainer();
       
   302     MAknFepUICtrlEditPane* editPane = uiContainer->EditPaneWindow();
       
   303     CDesCArrayFlat* keystroke = editPane->KeystrokeArray();
       
   304     
       
   305     if ( keystroke->Count() > 1 )
       
   306         {
       
   307         for ( TInt i = 1; i < keystroke->Count(); ++i )
       
   308             {
       
   309             if ( ( 1 == keystroke->MdcaPoint( i - 1 ).Length() ) &&
       
   310                 ( 1 == keystroke->MdcaPoint( i ).Length() ) )
       
   311                 {
       
   312                 return ETrue;
       
   313                 }
       
   314             }
       
   315         }
       
   316     
       
   317     return EFalse;
       
   318     }
       
   319 
       
   320 // ---------------------------------------------------------------------------
       
   321 // AknFepUiInputStateCandidateMiniQwertyZhuyinPhrase::HandleKeyForHalfAndCustomQwertyL
       
   322 // (other items were commented in a header).
       
   323 // ---------------------------------------------------------------------------
       
   324 //
       
   325 TBool TAknFepUiInputStateCandidateMiniQwertyZhuyinPhrase::HandleKeyForHalfAndCustomQwertyL(TInt aKey,
       
   326                                                                     TKeyPressLength aLength)
       
   327     {
       
   328     TInt selected = UIContainer()->CandidatePane()->SelectedIndex();
       
   329     TInt numbertotal = UIContainer()->CandidatePane()->VisibleCandidateCount();
       
   330     
       
   331     if (iOwner->FepMan()->FnKeyState())
       
   332         {
       
   333         return ETrue;
       
   334         }
       
   335     else if(aKey == EStdKeySpace)
       
   336         {
       
   337         iOwner->FepMan()->PlaySound(EAvkonSIDErrorTone);
       
   338         return ETrue;
       
   339         }
       
   340     else if(aKey == EStdKeyBackspace )
       
   341         {
       
   342         iOwner->ChangeState(EEntry);
       
   343         iOwner->FepMan()->UpdateCbaL(R_AKNFEP_SOFTKEYS_OK_SELECT_CANCEL);
       
   344 
       
   345         return ETrue;
       
   346         }
       
   347     else if(aKey == EStdKeyUpArrow)   
       
   348         {
       
   349         if(UIContainer()->CandidatePane()->IsFirstPage())
       
   350             {
       
   351             iOwner->ChangeState(EEntry);
       
   352             iOwner->FepMan()->UpdateCbaL(R_AKNFEP_SOFTKEYS_OK_SELECT_CANCEL);
       
   353             return ETrue;
       
   354             }
       
   355         else
       
   356             {
       
   357             return TAknFepInputStateCandidateQwertyBaseChinesePhrase::HandleKeyL(aKey, aLength);
       
   358             }   
       
   359         }
       
   360     else if ( aKey == EStdKeyEnter)
       
   361         {
       
   362         TBuf<MAknFepUICtrlInputPane::EMaxInputCharsPinyinPopupNotIncludingToneMark> atext;
       
   363         UIContainer()->PinyinPopupWindow()->GetItemText(
       
   364                                     UIContainer()->PinyinPopupWindow()->CurrentSelection(),
       
   365                                     atext);
       
   366         if(atext.Length())
       
   367             {            
       
   368             MAknFepManagerUIInterface* fepMan = iOwner->FepMan();
       
   369             fepMan->NewTextL(atext);
       
   370             fepMan->CommitInlineEditL();
       
   371             iOwner->FepMan()->TryCloseUiL();
       
   372             }
       
   373         return ETrue;
       
   374         }
       
   375     else if ( aKey == EStdKeyLeftArrow )
       
   376        {
       
   377        if ( selected == 0 )
       
   378           {
       
   379           UIContainer()->CandidatePane()->SelectIndex( numbertotal - 1 );
       
   380           }
       
   381        else
       
   382           {
       
   383           UIContainer()->CandidatePane()->SelectIndex( selected - 1 );
       
   384           }     
       
   385        UpdateIndicator();
       
   386        return ETrue;    
       
   387        }
       
   388     else if ( aKey == EStdKeyRightArrow )
       
   389        {
       
   390         if ( selected == numbertotal - 1 )
       
   391             {
       
   392             UIContainer()->CandidatePane()->SelectIndex( 0 );
       
   393             }
       
   394         else
       
   395             {
       
   396             UIContainer()->CandidatePane()->SelectIndex( selected + 1 );
       
   397             } 
       
   398         UpdateIndicator();
       
   399         return ETrue;       
       
   400        }
       
   401     else if ( aKey == EStdKeyDevice0 || aKey == EStdKeyDevice3 )
       
   402         {             
       
   403         TPtrC text = UIContainer()->CandidatePane()->CurrentPhraseCandidate();
       
   404         if(text.Length())
       
   405             {            
       
   406             MAknFepManagerUIInterface* fepMan = iOwner->FepMan();
       
   407             fepMan->NewTextL(text);
       
   408             fepMan->CommitInlineEditL();
       
   409             iOwner->PtiEngine()->SetPredictiveChineseChar(text);
       
   410             if (fepMan->IsFlagSet(CAknFepManager::EFlagEditorFull))
       
   411                 {
       
   412                 fepMan->ClearFlag(CAknFepManager::EFlagEditorFull);
       
   413                 iOwner->FepMan()->TryCloseUiL();
       
   414                 }
       
   415             else
       
   416                 {
       
   417                 UIContainer()->EditPaneWindow()->SetChangeState(ETrue);
       
   418                 iOwner->ChangeState(EPredictiveCandidate);
       
   419                 }
       
   420             }
       
   421         return ETrue;
       
   422         }   
       
   423     else
       
   424         {
       
   425         return TAknFepInputStateCandidateQwertyBaseChinesePhrase::HandleKeyL(aKey, aLength);
       
   426         } 
       
   427     }
       
   428 // ---------------------------------------------------------------------------
       
   429 // AknFepUiInputStateCandidateMiniQwertyZhuyinPhrase::HandleKeyForMiniQwertyL
       
   430 // (other items were commented in a header).
       
   431 // ---------------------------------------------------------------------------
       
   432 //
       
   433 TBool TAknFepUiInputStateCandidateMiniQwertyZhuyinPhrase::HandleKeyForMiniQwertyL(
       
   434     TInt aKey, TKeyPressLength aLength )
       
   435     {
       
   436     MAknFepUICtrlCandidatePane* candidatePane = UIContainer()->CandidatePane();
       
   437     MAknFepUICtrlEditPane* editPane = UIContainer()->EditPaneWindow();
       
   438     TInt selected = UIContainer()->CandidatePane()->SelectedIndex();
       
   439     TInt numbertotal = UIContainer()->CandidatePane()->VisibleCandidateCount();
       
   440     //  TInt isSelect = UIContainer()->CandidatePane()->SelectIndex( index, EFalse );
       
   441     if ( CAknFepFnKeyManager::EFnKeyNext == iOwner->FepMan()->FnKeyState() || 
       
   442          CAknFepFnKeyManager::EFnKeyLock == iOwner->FepMan()->FnKeyState() )
       
   443         {
       
   444         return ETrue;
       
   445         }
       
   446     else if ( aKey == EStdKeyDevice1 )
       
   447         {
       
   448         iOwner->FepMan()->TryCloseUiL();
       
   449         return ETrue;
       
   450         }
       
   451     else if ( aKey == EStdKeySpace )
       
   452         {
       
   453         iOwner->FepMan()->PlaySound( EAvkonSIDErrorTone );
       
   454         return ETrue;
       
   455         }
       
   456     else if ( aKey == EStdKeyBackspace )
       
   457         {
       
   458         UIContainer()->EditPaneWindow()->SetChangeState( ETrue );
       
   459         iOwner->ChangeState( EEntry );
       
   460         return ETrue;
       
   461         }
       
   462     else if ( aKey == EStdKeyUpArrow )
       
   463         {
       
   464         if ( UIContainer()->CandidatePane()->IsFirstPage() )
       
   465             {
       
   466             iOwner->ChangeState( EEntry );
       
   467             return ETrue;
       
   468             }
       
   469         else
       
   470             {
       
   471             return TAknFepInputStateCandidateQwertyBaseChinesePhrase::HandleKeyL(
       
   472                 aKey, aLength );
       
   473             }
       
   474         }
       
   475     else if ( aKey == EStdKeyDownArrow || aKey == EStdKeySpace )
       
   476         {
       
   477         TBool state = ETrue;
       
   478         if ( editPane->IsChangeState() && aLength == ELongKeyPress )
       
   479             {
       
   480             state = EFalse;
       
   481             }
       
   482         else
       
   483             {
       
   484             editPane->SetChangeState( EFalse );
       
   485             }
       
   486         if ( state )
       
   487             {
       
   488             return TAknFepInputStateCandidateQwertyBaseChinesePhrase::HandleKeyL(
       
   489                             aKey, aLength );
       
   490             }
       
   491         }
       
   492     else if ( aKey == EStdKeyEnter )
       
   493         {
       
   494         return ETrue;
       
   495         }
       
   496     else if ( aKey == EStdKeyLeftArrow )
       
   497         {
       
   498         if ( selected == 0 )
       
   499             {
       
   500             UIContainer()->CandidatePane()->SelectIndex( numbertotal-1 );
       
   501             }
       
   502         else
       
   503             {
       
   504             UIContainer()->CandidatePane()->SelectIndex( selected - 1 );
       
   505             }
       
   506         return ETrue;
       
   507         }
       
   508     else if ( aKey == EStdKeyRightArrow )
       
   509         {
       
   510         if ( selected == numbertotal-1 )
       
   511             {
       
   512             UIContainer()->CandidatePane()->SelectIndex( 0 );
       
   513             }
       
   514         else
       
   515             {
       
   516             UIContainer()->CandidatePane()->SelectIndex( selected + 1 );
       
   517             }
       
   518         return ETrue;
       
   519         }
       
   520     else
       
   521         {
       
   522         TInt index = 0;
       
   523         TBool isIndex = MapKeyToIndexSelectCandidate( aKey, index );
       
   524         if ( aLength == EShortKeyPress && 
       
   525             ( ( isIndex && UIContainer()->CandidatePane()->SelectIndex( index ) ) ||
       
   526                 aKey == EStdKeyDevice0 || 
       
   527                 aKey == EStdKeyDevice3 ) )
       
   528             {
       
   529             editPane->SetNeedClearDeliberateSelection( ETrue );
       
   530             ComitPhraseCreatedToEditorL();
       
   531             return ETrue;
       
   532             }
       
   533         else
       
   534             {
       
   535             return TAknFepInputStateCandidateQwertyBaseChinesePhrase::HandleKeyL(
       
   536                 aKey, aLength );
       
   537             }
       
   538         }
       
   539         return EFalse;
       
   540     }
       
   541 // ---------------------------------------------------------------------------
       
   542 // TAknFepUiInputStateCandidateMiniQwertyZhuyinPhrase::HandleCommandL
       
   543 // Handling Command
       
   544 // ---------------------------------------------------------------------------
       
   545 //
       
   546 void TAknFepUiInputStateCandidateMiniQwertyZhuyinPhrase::HandleCommandL(
       
   547     TInt aCommandId )
       
   548     {
       
   549     TPtrC text = UIContainer()->CandidatePane()->CurrentPhraseCandidate( );
       
   550     switch ( aCommandId )
       
   551         {
       
   552         // Handle the event frome command.
       
   553         case EAknSoftkeySelect:
       
   554     //    case (TUint16)EAknSoftkeySelect: //the Selected in soft CBA            
       
   555             if ( text.Length( ) )
       
   556                 {
       
   557                 MAknFepManagerUIInterface* fepMan = iOwner->FepMan( );
       
   558                 fepMan->NewTextL( text );
       
   559                 fepMan->CommitInlineEditL( );
       
   560                 iOwner->PtiEngine()->SetPredictiveChineseChar( text );
       
   561                 if ( fepMan->IsFlagSet( CAknFepManager::EFlagEditorFull ) )
       
   562                     {
       
   563                     fepMan->ClearFlag( CAknFepManager::EFlagEditorFull );
       
   564                     iOwner->FepMan()->TryCloseUiL( );
       
   565                     }
       
   566                 else
       
   567                     {
       
   568                     iOwner->ChangeState( EPredictiveCandidate );
       
   569                     }
       
   570                 }
       
   571             break;
       
   572         default:
       
   573             TAknFepInputStateChineseBase::HandleCommandL( aCommandId );
       
   574             break;
       
   575         }
       
   576     }
       
   577 
       
   578 // End of file