fep/aknfep/src/AknFepUiManagerChinese.cpp
changeset 36 a7632c26d895
parent 35 0f326f2e628e
child 42 b3eaa440ab06
equal deleted inserted replaced
35:0f326f2e628e 36:a7632c26d895
     1 /*
       
     2 * Copyright (c) 2003-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:           
       
    15 *       Provides the CAknFepUIManagerChinese methods.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 
       
    23 
       
    24 
       
    25 
       
    26 
       
    27 
       
    28 
       
    29 
       
    30 // INCLUDE FILES
       
    31 #include <e32svr.h> // RDebug stuff...
       
    32 #include <e32keys.h>
       
    33 
       
    34 #include "AknFepUiManagerBase.h"
       
    35 #include "AknFepUiManagerChinese.h"
       
    36 #include "AknFepManagerUIInterface.h"
       
    37 #include "AknFepGlobalEnums.h"
       
    38 #include "AknFepUiCtrlContainerChinese.h"
       
    39 #include "AknFepUICtrlInputPane.h"
       
    40 #include "AknFepUICtrlCandidatePane.h"
       
    41 #include "AknFepUICtrlPinyinPopup.h"
       
    42 #include "AknFepUiInputStateCandidate.h"
       
    43 #include "AknFepUiInputStateCandidateChinese.h"
       
    44 #include "AknFepUiInputStatePredictiveCandidate.h"
       
    45 #include "AknFepUiInputStatePredictiveInput.h"
       
    46 #include "AknFepUiInputStatePredictiveInputChinese.h"
       
    47 #include "AknFepUiInputStateInitialChineseGeneric.h"
       
    48 #include "AknFepUiInputStateInitialLatinMultitap.h"
       
    49 #include "AknFepUiInputStateInitialNumber.h"
       
    50 #include "AknFepUiInputStateEntryPinyin.h"
       
    51 #include "AknFepUiInputStateEntryZhuyin.h"
       
    52 #include "AknFepUiInputStateInitialZhuyinFind.h"
       
    53 #include "AknFepUiInputStateInitialStrokeFind.h"
       
    54 #include "AknFepUiInputStateEntryStroke.h"
       
    55 #include "AknFepUiInputStateInitialWesternPredictive.h"
       
    56 #include "AknFepUiInputStateEntryWesternPredictive.h"
       
    57 #include "AknFepUiInputStatePredictiveCandidatePinyin.h"
       
    58 #include "AknFepUiInputStatePredictiveCandidateStroke.h"
       
    59 #include "AknFepCaseManager.h"
       
    60 #include "AknFepPanic.h"
       
    61 
       
    62 #include "AknFepUiCtrlContainerChinese.h"				// phrase input container
       
    63 #include "AknFepUiInputStateEntryPinyinPhrase.h"		// phrase pinyin entry state class
       
    64 #include "aknfepuiinputstateentrypinyinphrasecreation.h"   // pinyin phrase creation
       
    65 #include "aknfepinputstatespellingpinyinphrasecreation.h"  // pinyin phrase creation
       
    66 #include "aknfepinputstatecandidatepinyinphrasecreation.h" // pinyin phrase creation
       
    67 #include "aknfepuiinputstateentryzhuyinphrasecreation.h"     // zhuyin phrase creation
       
    68 #include "AknFepUiInputStateEntryZhuyinPhrase.h"		// phrase zhuyin entry state class
       
    69 #include "AknFepUiInputStateEntryStrokePhrase.h"		// phrase Stroke entry state class
       
    70 #include "AknFepUiInputStateCandidateChinesePhrase.h"          // phrase candidate state class
       
    71 #include "aknfepuictrleditpane.h"           //phrase EEP control
       
    72 #include "AknFepUiInputStateCandidatePinyinAndStrokePhrase.h"
       
    73 #include "AknFepUiInputStatePredictiveInputPhrase.h"
       
    74 #include "AknFepUiInputStatePredictiveInputChinesePhrase.h"
       
    75 // Qwerty input
       
    76 #include "AknFepUiInputStateInitialChineseGenericQwerty.h"
       
    77 #include "AknFepUiInputStateEntryQwertyPinyin.h"
       
    78 #include "AknFepUiInputStateEntryQwertyStroke.h"
       
    79 #include "AknFepUiInputStateEntryQwertyCangJie.h"
       
    80 #include "AknFepUiInputStateEntryQwertyZhuyin.h"
       
    81 #include "AknFepUiInputStateCandidateQwertyZhuyin.h"
       
    82 #include "AknFepUiInputStatePredictiveCandidateQwertyZhuyin.h"
       
    83 #include "AknFepUiInputStatePredictiveInputQwerty.h"
       
    84 #include "AknFepUiInputStatePredictiveInputQwertyPinyin.h"
       
    85 #include "AknFepUiInputStatePredictiveInputQwertyZhuyin.h"
       
    86 #include "AknFepUiInputStatePredictiveCandidatePinyinPhrase.h"
       
    87 #include "AknFepUiInputStatePredictiveCandidateStrokePhrase.h"
       
    88 #include "AknFepUiInputStatePredictiveCandidatePhrase.h"
       
    89 #include "AknFepUiInputStatePredictiveInputQwertyStroke.h"
       
    90 // Qwerty phrase input
       
    91 #include "AknFepUiInputStateEntryQwertyStrokePhrase.h"
       
    92 #include "AknFepUiInputStateEntryQwertyPinyinPhrase.h"
       
    93 #include "AknFepUiInputStatePredictiveInputQwertyChinesePhrase.h"
       
    94 #include "AknFepUiInputStatePredictiveInputQwertyPinyinPhrase.h"
       
    95 #include "AknFepUiInputStateEntryQwertyZhuyinPhrase.h"
       
    96 #include "AknFepUiInputStateCandidateQwertyZhuyinPhrase.h"
       
    97 #include "AknFepUiInputStatePredictiveCandidateQwertyZhuyinPhrase.h"
       
    98 #include "AknFepUiInputStatePredictiveInputQwertyZhuyinPhrase.h"
       
    99 #include "AknFepUiInputStatePredictiveInputQwertyStrokePhrase.h"
       
   100 #ifdef RD_INTELLIGENT_TEXT_INPUT        
       
   101 #include "AknFepUIInputStateEntryMiniQwertyPinyinPhrase.h"
       
   102 #include "AknFepUiInputStateCandidateMiniQwertyPinyinAndStrokePhrase.h"
       
   103 #include "AknFepUiInputStatePredictiveInputMiniQwertyChinesePhrase.h"
       
   104 #include "AknFepUiInputStatePredictiveCandidateMiniQwertyChinesePhrase.h"
       
   105 #include "AknFepUiInputStateEntryMiniQwertyZhuyinPhrase.h"
       
   106 #include "AknFepUiInputStateCandidateMiniQwertyZhuyinPhrase.h"
       
   107 #include "aknfepuiinputstateminiqwertyzhuyinphrase.h"//phrase creation for mini qwerty zhuyin
       
   108 #include "aknfepuiinputstateminiqwertystrokephrase.h"
       
   109 #include "AknFepUIInputStateEntryMiniQwertyCangJie.h"
       
   110 #include "aknfepuiinputstateentryhalfqwertyphrase.h"
       
   111 #include "AknFepUiInputStateCandidateHalfQwertyChinesePhrase.h"
       
   112 #include "AknFepUiInputStateInitialChineseGenericHalfQwerty.h"
       
   113 #include "AknFepUiInputStatePredictiveCandidateHalfQwertyChinesePhrase.h"
       
   114 #endif
       
   115 // Qwerty Chinese find
       
   116 #include "AknFepUiInputStatelStrokeFindQwerty.h"
       
   117 #include "AknFepUiInputStateZhuyinFindQwerty.h"
       
   118 #include <AknIndicatorContainer.h>  
       
   119 
       
   120 #include <PtiEngine.h> 
       
   121 #include <PtiDefs.h>
       
   122 
       
   123 #include <avkon.rsg>        //phrase creation
       
   124 #include <aknfep.rsg>
       
   125 
       
   126 // CONSTANTS
       
   127 const TInt16 KStrokeHorizontalValue = 0x4e00; 
       
   128 const TInt16 KStrokeVerticalValue = 0x4e28;
       
   129 const TInt16 KStrokeDownToLeftValue = 0x4e3f;
       
   130 const TInt16 KStrokeDownToRightValue = 0x4e36;
       
   131 const TInt16 KStrokeBendingValue = 0x4e5b;
       
   132 const TInt16 KStrokeQuestionValue = 0x003f;
       
   133 const TInt16 KStrokeUnicode = 0x2461;
       
   134 const TInt16 KZhuyinIndicator = 0x2462;
       
   135 /**
       
   136 *  CAknFepUIManagerChinese class.
       
   137 * 
       
   138 */
       
   139 
       
   140 //============================ MEMBER FUNCTIONS ==============================
       
   141 
       
   142 // ---------------------------------------------------------------------------
       
   143 // CAknFepUIManagerChinese::NewL
       
   144 // 
       
   145 // 
       
   146 // ---------------------------------------------------------------------------
       
   147 //
       
   148 CAknFepUIManagerChinese* CAknFepUIManagerChinese::NewL(MAknFepManagerUIInterface* aFepMan, 
       
   149                                        CAknFepCaseManager* aCaseMan, TLanguage aLanguage)
       
   150     {   
       
   151     CAknFepUIManagerChinese* self = new(ELeave)CAknFepUIManagerChinese(aFepMan, aCaseMan);
       
   152     CleanupStack::PushL(self);
       
   153     self->ConstructL(aLanguage);
       
   154     CleanupStack::Pop();
       
   155     return self;
       
   156     }
       
   157 
       
   158 // ---------------------------------------------------------------------------
       
   159 // CAknFepUIManagerChinese::~CAknFepUIManagerChinese
       
   160 // 
       
   161 // 
       
   162 // ---------------------------------------------------------------------------
       
   163 //
       
   164 CAknFepUIManagerChinese::~CAknFepUIManagerChinese()
       
   165     {
       
   166     delete iContainerPane;
       
   167     }
       
   168 
       
   169 // ---------------------------------------------------------------------------
       
   170 // CAknFepUIManagerChinese::HandleKeyL
       
   171 // 
       
   172 // 
       
   173 // ---------------------------------------------------------------------------
       
   174 //
       
   175 TBool CAknFepUIManagerChinese::HandleKeyL(TInt aKey, TKeyPressLength aLength, TEventCode aEventCode)
       
   176     {
       
   177 #ifdef __ITI_LONGPRESS_NUM_SHIFT_COPYPASTE__
       
   178 #ifdef RD_INTELLIGENT_TEXT_INPUT    
       
   179     // In the initial state, use the base implementation which support long
       
   180     // press number entry on QWERTY. In other states the long press is not
       
   181     // handled.
       
   182     if ( (aLength == EShortKeyPress && iFepUiState.State() == EInitial) ||
       
   183          (aLength == ELongKeyPress && iInitialFepUIState == EInitial) )
       
   184         {
       
   185         return CAknFepUIManagerBase::HandleKeyL( aKey, aLength );
       
   186         }
       
   187     else if ( iFepMan->EditorHasFreeSpace() )
       
   188         {
       
   189 #endif // RD_INTELLIGENT_TEXT_INPUT
       
   190 #endif // __ITI_LONGPRESS_NUM_SHIFT_COPYPASTE__
       
   191     TUIState currentState = iFepUiState.State();
       
   192     
       
   193     //when the state is EEntry and input mode is pinyin or zhuyin and akey = starkey
       
   194     //just handles EEventKey
       
   195     if( EPtiKeyStar == aKey && currentState == EEntry 
       
   196     		&& ( iFepMan->InputMode() == EPinyin || iFepMan->InputMode() == EZhuyin )
       
   197     		&& aEventCode != EEventKey )
       
   198     	{
       
   199     	return EFalse;
       
   200     	}
       
   201     if (aLength == EShortKeyPress)
       
   202         {
       
   203         iInitialFepUIState = currentState;
       
   204         }
       
   205 
       
   206     if(!iStatePtr->HandleKeyL(aKey, aLength))
       
   207         {
       
   208         if(currentState != iStatePtr->State()) //Check to see if we've changed state.
       
   209             {
       
   210             return iStatePtr->HandleKeyL(aKey, aLength);
       
   211             }
       
   212         return EFalse; // we've failed to handle it..
       
   213         }
       
   214     return ETrue; //we're ok.
       
   215 #ifdef __ITI_LONGPRESS_NUM_SHIFT_COPYPASTE__
       
   216 #ifdef RD_INTELLIGENT_TEXT_INPUT
       
   217         }
       
   218     else
       
   219         {
       
   220         // FepManager must let some long press events to pass here even when
       
   221         // editor has no space, because long press may still work. But if
       
   222         // the long press was not handled, then the key event should not be
       
   223         // handled at all in this case.
       
   224         return EFalse;
       
   225         }
       
   226 #endif // RD_INTELLIGENT_TEXT_INPUT
       
   227 #endif // __ITI_LONGPRESS_NUM_SHIFT_COPYPASTE__    
       
   228     }
       
   229 
       
   230 // ---------------------------------------------------------------------------
       
   231 // CAknFepUIManagerChinese::CloseUI
       
   232 // 
       
   233 // 
       
   234 // ---------------------------------------------------------------------------
       
   235 //
       
   236 void CAknFepUIManagerChinese::CloseUI()
       
   237     {
       
   238     // update cba
       
   239     TRAP_IGNORE(FepMan()->UpdateCbaL(NULL));
       
   240     iContainerPane->EditPaneWindow()->SetCurrentCBAResID( 0 );
       
   241     
       
   242     if (iQwertyMode)
       
   243         {
       
   244 #ifdef RD_INTELLIGENT_TEXT_INPUT 
       
   245         if ( EPtiKeyboardHalfQwerty == iPtiEngine->KeyboardType() )
       
   246             {
       
   247             ChangeState(EHalfQwerty);
       
   248             }
       
   249         else
       
   250 #endif
       
   251             {
       
   252             ChangeState(EQwerty);
       
   253             }
       
   254         }
       
   255     else
       
   256         {
       
   257         ChangeState(EInitial);
       
   258         }
       
   259     if (iContainerPane)
       
   260         {
       
   261         iContainerPane->CandidatePane()->ResetCandidateState();
       
   262         iContainerPane->EditPaneWindow()->ResetAllArray();
       
   263         iContainerPane->Enable(EFalse);
       
   264         }
       
   265     }
       
   266 
       
   267 // ---------------------------------------------------------------------------
       
   268 // CAknFepUIManagerChinese::GetFormatOfFepInlineText
       
   269 // 
       
   270 // 
       
   271 // ---------------------------------------------------------------------------
       
   272 //
       
   273 void CAknFepUIManagerChinese::GetFormatOfFepInlineText(TCharFormat& aFormat, 
       
   274          TInt& aNumberOfCharactersWithSameFormat, TInt aPositionOfCharacter) const
       
   275     {
       
   276     if (iPredictive && iFepUiState.State() == EEntry)   // EInitial???
       
   277         {
       
   278         aFormat.iFontPresentation.iUnderline = EUnderlineOn;
       
   279         if (iFepMan->IsFlagSet(CAknFepManager::EFlagNoMatches))
       
   280             {
       
   281             aFormat.iFontPresentation.iHighlightStyle = 
       
   282                                    TFontPresentation::EFontHighlightNoMatchesIndicator;
       
   283             }
       
   284         TCursorSelection uncommit = iFepMan->UncommittedText();
       
   285         if (uncommit.Length()-aPositionOfCharacter>0)                   
       
   286             {
       
   287             aNumberOfCharactersWithSameFormat=uncommit.Length() - aPositionOfCharacter;
       
   288             }
       
   289         }
       
   290     }
       
   291 
       
   292 
       
   293 // ---------------------------------------------------------------------------
       
   294 // CAknFepUIManagerChinese::SupportLanguage
       
   295 // 
       
   296 // 
       
   297 // ---------------------------------------------------------------------------
       
   298 //
       
   299 TInt CAknFepUIManagerChinese::SupportLanguage(TInt aMode) const
       
   300     {
       
   301     TInt lang = iLanguage;
       
   302     switch (aMode)
       
   303         {
       
   304         case ELatin:
       
   305             {
       
   306             lang = ELangEnglish;
       
   307             }
       
   308             break;
       
   309         case ENumber:
       
   310         case EPinyin:
       
   311         case EStroke:
       
   312         case ECangJie:
       
   313         case EStrokeFind:
       
   314         case EZhuyin:
       
   315         case EZhuyinFind:
       
   316         default:
       
   317             break;
       
   318         }
       
   319     return lang;
       
   320     }
       
   321 
       
   322 // ---------------------------------------------------------------------------
       
   323 // CAknFepUIManagerChinese::SetEditorContext
       
   324 // 
       
   325 // 
       
   326 // ---------------------------------------------------------------------------
       
   327 //
       
   328 void CAknFepUIManagerChinese::SetEditorContext(TInt aContext)
       
   329     {
       
   330     if(iContainerPane)
       
   331         {
       
   332         iContainerPane->SetIsShownWithPopupWindows(
       
   333             aContext == CAknIndicatorContainer::EQueryEditorIndicators);
       
   334         }
       
   335    }
       
   336 
       
   337 // ---------------------------------------------------------------------------
       
   338 // CAknFepUIManagerChinese::ChangeState
       
   339 // 
       
   340 // 
       
   341 // ---------------------------------------------------------------------------
       
   342 //
       
   343 TUIState CAknFepUIManagerChinese::ChangeState(TUIState aState)
       
   344     {
       
   345     // ask pti engine if phrase input is supported
       
   346     if(iPrevMode != iMode)
       
   347         {
       
   348         iPrevMode = iMode;
       
   349         ResetFlags();
       
   350         }
       
   351     if(!IsFlagSet(EQueryPtiEngineAlready))  
       
   352         {
       
   353         QueryPtiEngine();
       
   354         }
       
   355      
       
   356     // distinguish if Qwerty input in editing window state
       
   357     if(aState == EQwerty)
       
   358         {
       
   359         iQwertyMode = ETrue;
       
   360         }
       
   361     else if(aState == EInitial)
       
   362         {
       
   363         iQwertyMode = EFalse;
       
   364         }
       
   365 
       
   366     if(iQwertyMode)
       
   367         {
       
   368         ChangeStateQwerty(aState);
       
   369         }
       
   370     else
       
   371         {
       
   372         ChangeStatetItut(aState);
       
   373         }
       
   374         
       
   375     iPtiEngine->SetObserver(&iFepUiState);
       
   376 #ifdef _DEBUG
       
   377     RDebug::Print(_L("UI Manager: New State: %d"), iFepUiState.State());
       
   378 #endif
       
   379     // cba update: when input window exists, softkeys are not shown.
       
   380     TRAPD(err, iStatePtr->InitializeStateL());
       
   381     if(err != KErrNone)
       
   382         {
       
   383 #ifdef _DEBUG
       
   384     RDebug::Print(_L("UI Manager: Initial Error: Mode = %d, State = %d"), 
       
   385                     iMode, iStatePtr->State());
       
   386 #endif
       
   387         }
       
   388     return iStatePtr->State();
       
   389     }
       
   390 
       
   391 // ---------------------------------------------------------------------------
       
   392 // CAknFepUIManagerChinese::IsValidChineseInputKey
       
   393 // 
       
   394 // 
       
   395 // ---------------------------------------------------------------------------
       
   396 //
       
   397 TBool CAknFepUIManagerChinese::IsValidChineseInputKey(TInt aKey) const
       
   398     {
       
   399     // This doesn't include checking for the 'tone' key, which is different...
       
   400 
       
   401     TBool response = ETrue;
       
   402     switch(aKey)
       
   403         {
       
   404     case EPtiKey0:
       
   405         if(((iMode == EPinyin) && (!IsFlagSet(ESupportPinyinPhrase) || 
       
   406             !iContainerPane->IsEnabled())) ||
       
   407            ((iMode == EStroke) && (!IsFlagSet(ESupportStrokePhrase) || 
       
   408             !iContainerPane->IsEnabled()))  || (iMode == EStrokeFind)) 
       
   409             {
       
   410             response = EFalse;
       
   411             }
       
   412         break;
       
   413     case EPtiKey1:
       
   414         if((iMode == EPinyin)&& (!IsFlagSet(ESupportPinyinPhrase) || !iContainerPane->IsEnabled()))
       
   415             {
       
   416             response = EFalse;
       
   417             }
       
   418         break;
       
   419     case EPtiKey2: //fall through
       
   420     case EPtiKey3:
       
   421     case EPtiKey4:
       
   422     case EPtiKey5:
       
   423     case EPtiKey6:
       
   424         break;  //always valid
       
   425     case EPtiKey7: //fall through
       
   426     case EPtiKey8:
       
   427     case EPtiKey9:
       
   428         if((iMode == EStroke) || (iMode == EStrokeFind))
       
   429             response = EFalse;
       
   430         break;
       
   431     default:
       
   432         response = EFalse;
       
   433         break;
       
   434         }
       
   435     return response;
       
   436     }
       
   437 #ifdef RD_INTELLIGENT_TEXT_INPUT
       
   438 // ---------------------------------------------------------------------------
       
   439 // CAknFepUIManagerChinese::IsKeyMappedStroke
       
   440 // 
       
   441 // 
       
   442 // ---------------------------------------------------------------------------
       
   443 //
       
   444 
       
   445 TBool  CAknFepUIManagerChinese::IsKeyMappedStroke(TInt aKey) const
       
   446     {
       
   447     TBuf<KMaxName> lowerdata;   
       
   448     iPtiEngine->MappingDataForKey((TPtiKey)aKey, lowerdata, EPtiCaseLower);  
       
   449     TInt StrokeUnicodePosition =0;
       
   450     
       
   451     if(lowerdata.Length()>0)
       
   452         {
       
   453         for(TInt i=0;i<lowerdata.Length();i++)
       
   454             {
       
   455             if(lowerdata[i]==KStrokeUnicode)
       
   456                 {
       
   457                 StrokeUnicodePosition = i+1;
       
   458                 break;
       
   459                 }
       
   460             }
       
   461         }
       
   462     if(lowerdata.Length() > StrokeUnicodePosition)
       
   463         {
       
   464         if (lowerdata[StrokeUnicodePosition] == KStrokeHorizontalValue || 
       
   465                 lowerdata[StrokeUnicodePosition] == KStrokeVerticalValue || 
       
   466                 lowerdata[StrokeUnicodePosition] == KStrokeDownToLeftValue || 
       
   467                 lowerdata[StrokeUnicodePosition] == KStrokeDownToRightValue || 
       
   468                 lowerdata[StrokeUnicodePosition] == KStrokeBendingValue ||
       
   469                 lowerdata[StrokeUnicodePosition] == KStrokeQuestionValue)
       
   470             {
       
   471             return ETrue;
       
   472             }
       
   473         }
       
   474     
       
   475     return EFalse;
       
   476     }
       
   477 #endif
       
   478 // ---------------------------------------------------------------------------
       
   479 // CAknFepUIManagerChinese::IsValidChineseInputKeyQwerty
       
   480 // 
       
   481 // 
       
   482 // ---------------------------------------------------------------------------
       
   483 //
       
   484 TBool CAknFepUIManagerChinese::IsValidChineseInputKeyQwerty(TInt aKey) const
       
   485     {
       
   486     TBool response = EFalse;
       
   487 #ifdef RD_INTELLIGENT_TEXT_INPUT     
       
   488     
       
   489     TPtiKeyboardType keyboardType = EPtiKeyboardNone;
       
   490     if( iPtiEngine != NULL )        
       
   491         {
       
   492         keyboardType = iPtiEngine->KeyboardType();
       
   493         }
       
   494 #endif
       
   495 
       
   496     if(iMode == EPinyin)
       
   497         {
       
   498         if( (aKey >= EPtiKeyQwertyA && aKey <= EPtiKeyQwertyZ) ||
       
   499         	(aKey >= EPtiKeyQwerty1 && aKey <= EPtiKeyQwerty9) ||
       
   500             (IsFlagSet(ESupportPinyinPhrase) && aKey == EPtiKeyQwertyApostrophe 
       
   501              && State() != EInitial))
       
   502             {
       
   503             response = ETrue;
       
   504             }
       
   505 #ifdef RD_INTELLIGENT_TEXT_INPUT          
       
   506         if ( State() == EInitial && EPtiKeyboardHalfQwerty == keyboardType &&
       
   507            ( aKey == EPtiKeyQwertyU || aKey == EPtiKeyQwertyI || aKey == EPtiKeyQwerty3 ))
       
   508             {
       
   509             response = EFalse;
       
   510             }
       
   511 #endif
       
   512         }
       
   513 
       
   514     if(iMode == EStroke || iMode == EStrokeFind)
       
   515         {
       
   516 #ifdef RD_INTELLIGENT_TEXT_INPUT        
       
   517         if(EPtiKeyboardQwerty4x10 == keyboardType ||EPtiKeyboardQwerty3x11 == keyboardType )
       
   518             {            
       
   519             if( IsKeyMappedStroke(aKey)|| EPtiKeyQwertySpace == aKey)
       
   520                 {
       
   521                 response = ETrue;
       
   522                 if(aKey == EPtiKeyQwertySpace && (State() == EInitial || State() ==EPredictiveInput))
       
   523                     {
       
   524                     response = EFalse;
       
   525                     }
       
   526                 }
       
   527             }
       
   528         else if( EPtiKeyboardHalfQwerty == keyboardType ||
       
   529            EPtiKeyboardCustomQwerty == keyboardType)
       
   530             {
       
   531             MPtiLanguage *lang = NULL;
       
   532             RArray < TPtiNumericKeyBinding > keybinding;
       
   533             TBool IsStrokeKey = EFalse;
       
   534             if(iPtiEngine)
       
   535             { 
       
   536             	  lang = iPtiEngine->CurrentLanguage();
       
   537             }
       
   538             if( iPtiEngine && lang )
       
   539                 {
       
   540                 TRAP_IGNORE(iPtiEngine->GetNumericModeKeysForQwertyL(
       
   541                 						lang->LanguageCode(),
       
   542                 				 		keybinding, keyboardType));
       
   543                 TInt numericKeysCount = keybinding.Count();
       
   544                 while ( numericKeysCount-- )
       
   545                     {
       
   546                     TPtiNumericKeyBinding numKeyBind = keybinding[numericKeysCount];
       
   547                     if ( (numKeyBind.iChar >= 0x31 && numKeyBind.iChar <= 0x36)&&(aKey == numKeyBind.iKey))
       
   548                         {
       
   549                            IsStrokeKey = ETrue;
       
   550                            break;              
       
   551                         }
       
   552                     }
       
   553                 }
       
   554             keybinding.Reset();
       
   555             if(IsStrokeKey || (aKey == EPtiKeyQwertySpace))
       
   556                 {
       
   557                 if((aKey >= EPtiKeyQwertyA && aKey <= EPtiKeyQwertyZ) ||
       
   558                    (aKey >= EPtiKeyQwerty0 && aKey <= EPtiKeyQwerty6) ||		
       
   559                    (aKey == EPtiKeyQwertySpace))
       
   560                     {
       
   561                     response = ETrue;
       
   562                     if(aKey == EPtiKeyQwertySpace && 
       
   563                     	(State() == EInitial || State() ==EPredictiveInput))
       
   564                         {
       
   565                         response = EFalse;
       
   566                         }                  
       
   567                     }
       
   568                 }               
       
   569             }
       
   570         else
       
   571             {
       
   572 #endif
       
   573         switch(aKey)
       
   574             {
       
   575             case EPtiKeyQwertyQ:
       
   576             case EPtiKeyQwertyW:
       
   577             case EPtiKeyQwertyE:
       
   578             case EPtiKeyQwertyA:
       
   579             case EPtiKeyQwertyS:
       
   580             case EPtiKeyQwertyD:
       
   581             case EPtiKeyQwertyI:
       
   582             case EPtiKeyQwertyO:
       
   583             case EPtiKeyQwertyP:
       
   584             case EPtiKeyQwertyJ:
       
   585             case EPtiKeyQwertyK:
       
   586             case EPtiKeyQwertyL:
       
   587             case EPtiKeyQwertySpace:
       
   588                 {
       
   589                 response = ETrue;
       
   590                 if(aKey == EPtiKeyQwertySpace && (State() == EInitial 
       
   591                 || State() ==EPredictiveInput))
       
   592                     {
       
   593                     response = EFalse;
       
   594                     }
       
   595                 }
       
   596                 break;
       
   597             }
       
   598         }
       
   599 #ifdef RD_INTELLIGENT_TEXT_INPUT        
       
   600         }
       
   601 #endif
       
   602     
       
   603     if(iMode == ECangJie)
       
   604         {
       
   605         if (aKey >= EPtiKeyQwertyA && aKey <= EPtiKeyQwertyZ)
       
   606             {
       
   607             response = ETrue;
       
   608             }
       
   609         }
       
   610     
       
   611     if(iMode == EZhuyin || iMode == EZhuyinFind)
       
   612         {
       
   613 #ifdef RD_INTELLIGENT_TEXT_INPUT        
       
   614         if(EPtiKeyboardQwerty4x10 == keyboardType ||
       
   615            EPtiKeyboardQwerty3x11 == keyboardType )
       
   616             {
       
   617             TBuf<KMaxName> lowerdata;
       
   618             iPtiEngine->MappingDataForKey((TPtiKey)aKey, lowerdata, EPtiCaseLower);
       
   619        //     TInt ZhuyinUnicodeCur =0;
       
   620             for(TInt i=0;i<lowerdata.Length();i++)
       
   621                 {
       
   622                 if(lowerdata[i]==KZhuyinIndicator)
       
   623                     {
       
   624                 response = ETrue;
       
   625                 }   
       
   626                 }
       
   627             }
       
   628         else if( EPtiKeyboardCustomQwerty == keyboardType)        
       
   629             {
       
   630 			if((aKey >= EPtiKeyQwertyA && aKey <= EPtiKeyQwertyZ))
       
   631     			{
       
   632 				response = ETrue;        
       
   633     			}       	
       
   634             }
       
   635         else if (  EPtiKeyboardHalfQwerty == keyboardType )
       
   636             {
       
   637             if((aKey >= EPtiKeyQwertyA && aKey <= EPtiKeyQwertyZ) || 
       
   638                     (aKey >= EPtiKey0 && aKey <= EPtiKey9) ||
       
   639                     aKey == EPtiKeyQwertySpace )
       
   640                 {
       
   641                 response = ETrue;        
       
   642                 }  
       
   643             }
       
   644         else
       
   645             {
       
   646 #endif
       
   647         if((aKey >= EPtiKeyQwertyA && aKey <= EPtiKeyQwertyZ) ||
       
   648             (aKey >= EPtiKeyQwerty0 && aKey <= EPtiKeyQwerty9)||
       
   649             (aKey == EPtiKeyQwertySemicolon) ||
       
   650             (aKey == EPtiKeyQwertyApostrophe) ||
       
   651             (aKey == EPtiKeyQwertyComma) ||
       
   652             (aKey == EPtiKeyQwertyFullstop) ||
       
   653             (aKey == EPtiKeyQwertySlash))
       
   654             {
       
   655             response = ETrue;        
       
   656             }
       
   657         }
       
   658 #ifdef RD_INTELLIGENT_TEXT_INPUT        
       
   659         }
       
   660 #endif        
       
   661 #ifdef RD_INTELLIGENT_TEXT_INPUT        
       
   662     
       
   663     if( iPtiEngine != NULL && EPtiKeyboardQwerty4x12 == iPtiEngine->KeyboardType())
       
   664         {
       
   665 #endif
       
   666     if(iMode == EZhuyin && IsFlagSet(ESupportZhuyinPhrase) && aKey == EPtiKeyQwertyApostrophe)
       
   667         {
       
   668         response = ETrue;
       
   669         }
       
   670 #ifdef RD_INTELLIGENT_TEXT_INPUT        
       
   671         }
       
   672 #endif
       
   673     return response;
       
   674     }
       
   675 
       
   676 TBool CAknFepUIManagerChinese::IsQwertyZhuyinToneMarkKey(TInt aKey) const
       
   677     {
       
   678     // only return ETrue when qwerty and zhuyin symbol input supported for corresponding key
       
   679     TInt supportSCTToneMarks = EFalse;
       
   680     MPtiCoreInfo* ptiCoreInfo = iPtiEngine->CoreInfo(EPtiEngineZhuyin);
       
   681 #ifdef RD_INTELLIGENT_TEXT_INPUT        
       
   682     TPtiKeyboardType keyboardType = iPtiEngine->KeyboardType();
       
   683 #endif
       
   684 
       
   685     if(ptiCoreInfo)
       
   686         {
       
   687         supportSCTToneMarks = ptiCoreInfo->CapsBits() & ESupportSCTToneMarks;
       
   688         }
       
   689 
       
   690     ptiCoreInfo = iPtiEngine->CoreInfo(EPtiEngineZhuyinByPhrase);
       
   691     if(ptiCoreInfo)    
       
   692         {
       
   693         supportSCTToneMarks = 
       
   694                     supportSCTToneMarks || (ptiCoreInfo->CapsBits() & ESupportSCTToneMarks);
       
   695         }
       
   696 
       
   697     if(iQwertyMode && (iMode == EZhuyin) && supportSCTToneMarks)
       
   698         {
       
   699 #ifdef RD_INTELLIGENT_TEXT_INPUT 
       
   700         if( keyboardType == EPtiKeyboardQwerty4x12)
       
   701             {
       
   702 #endif            
       
   703             if(aKey == EPtiKeyQwerty3 || aKey == EPtiKeyQwerty4 || aKey == EPtiKeyQwerty6 || aKey == EPtiKeyQwerty7)
       
   704                 {
       
   705                 return ETrue;
       
   706                 }
       
   707             else
       
   708                 {
       
   709                 return EFalse;
       
   710                 }
       
   711 #ifdef RD_INTELLIGENT_TEXT_INPUT 
       
   712             }
       
   713         else if( keyboardType == EPtiKeyboardQwerty4x10 || keyboardType == EPtiKeyboardQwerty3x11)
       
   714             {
       
   715             if(aKey == EPtiKeyQwertyE || aKey == EPtiKeyQwertyR || aKey == EPtiKeyQwertyY || aKey == EPtiKeyQwertyU)
       
   716                 {
       
   717                 return ETrue;
       
   718                 }
       
   719             else
       
   720                 {
       
   721                 return EFalse;
       
   722                 }
       
   723             }
       
   724 #endif        
       
   725         }
       
   726     else 
       
   727         {
       
   728         return EFalse;
       
   729         }
       
   730     return EFalse;
       
   731     }
       
   732 
       
   733 // ---------------------------------------------------------------------------
       
   734 // CAknFepUIManagerChinese::GetLatestDeliberateSelection
       
   735 // 
       
   736 // 
       
   737 // ---------------------------------------------------------------------------
       
   738 //
       
   739 TPtr CAknFepUIManagerChinese::GetLatestDeliberateSelection() const
       
   740     {
       
   741     // need to cast around constness, as this is a const get but needs to call Des which isn't const
       
   742     typedef TBufC<MAknFepUICtrlInputPane::EMaxInputCharsPinyinPopupNotIncludingToneMark> pinyinBuffer;
       
   743     pinyinBuffer* bufPtr = CONST_CAST(pinyinBuffer*, &iLatestDeliberateSelection);
       
   744     return TPtr(bufPtr->Des());
       
   745     }
       
   746 
       
   747 // ---------------------------------------------------------------------------
       
   748 // CAknFepUIManagerChinese::FepUIState
       
   749 // 
       
   750 // 
       
   751 // ---------------------------------------------------------------------------
       
   752 //
       
   753 TAknFepInputStateBase* CAknFepUIManagerChinese::FepUIState()
       
   754     {
       
   755     return &iFepUiState;
       
   756     }
       
   757 
       
   758 // ---------------------------------------------------------------------------
       
   759 // CAknFepUIManagerChinese::UIContainer
       
   760 // 
       
   761 // 
       
   762 // ---------------------------------------------------------------------------
       
   763 //
       
   764 MAknFepUICtrlContainerChinese* CAknFepUIManagerChinese::UIContainer() const
       
   765     {
       
   766     return iContainerPane;
       
   767     }
       
   768 
       
   769 // ---------------------------------------------------------------------------
       
   770 // CAknFepUIManagerChinese::IsValidShiftKeyPress
       
   771 // 
       
   772 // 
       
   773 // ---------------------------------------------------------------------------
       
   774 //
       
   775 TBool CAknFepUIManagerChinese::IsValidShiftKeyPress() const
       
   776     {
       
   777     TUIState state = State();
       
   778     TInt mode = FepMan()->InputMode();
       
   779 #ifdef RD_INTELLIGENT_TEXT_INPUT        
       
   780     TPtiKeyboardType kbdType = iFepMan->KeyboardLayout();
       
   781     if (EPtiKeyboardQwerty4x12 == kbdType)
       
   782         {
       
   783 #endif
       
   784     if (mode == EPinyin || mode == EZhuyin || mode == EStroke || mode == ECangJie)
       
   785         {
       
   786         if (mode == EZhuyin && state == EPredictiveInput)
       
   787             {
       
   788             return EFalse;
       
   789             }
       
   790         if (mode == EZhuyin && state == EPredictiveCandidate)
       
   791             {
       
   792             return ETrue;
       
   793             }
       
   794         
       
   795         if (state == EEntry || state == ECandidate || state == EPredictiveCandidate)
       
   796             {
       
   797             return EFalse;
       
   798             }
       
   799         }
       
   800 #ifdef RD_INTELLIGENT_TEXT_INPUT        
       
   801         }
       
   802     else if(EPtiKeyboardQwerty4x10 == kbdType ||
       
   803             EPtiKeyboardQwerty3x11 == kbdType ||
       
   804             EPtiKeyboardHalfQwerty == kbdType ||
       
   805             EPtiKeyboardCustomQwerty == kbdType)
       
   806         {
       
   807     	if (mode == EPinyin || mode == EZhuyin || mode == EStroke || mode == ECangJie)
       
   808             {
       
   809             if ( state == EEntry || state == ECandidate || /*state == EPredictiveCandidate ||*/ 
       
   810                 state == EPredictiveInput || state == EMiniQwertyEdit || 
       
   811                 state == EZhuyinSpelling || state == EZhuyinCandidate )
       
   812                 {
       
   813                 return EFalse;
       
   814                 }         
       
   815             }
       
   816         }
       
   817 #endif    
       
   818     
       
   819     return ETrue;
       
   820     }
       
   821 
       
   822 #ifdef RD_INTELLIGENT_TEXT_INPUT        
       
   823 TBool CAknFepUIManagerChinese::IsValidFnKeyPress() const
       
   824     {
       
   825     TUIState uiState = State();
       
   826     TInt mode = FepMan()->InputMode();
       
   827     if (mode == EPinyin || mode == EZhuyin || mode == EStroke || mode == ECangJie)
       
   828         {
       
   829         //if (uiState == EPredictiveCandidate || uiState == ECandidate)
       
   830         if (uiState == EEntry || 
       
   831         	uiState == ECandidate ||
       
   832         	uiState == EPredictiveCandidate || 
       
   833             uiState == EPredictiveInput ||
       
   834             uiState == EMiniQwertyEdit || uiState == EZhuyinSpelling ||
       
   835             uiState == EZhuyinCandidate )
       
   836             {
       
   837             return EFalse;
       
   838             }         
       
   839         }
       
   840     							   
       
   841     return ETrue;
       
   842     }
       
   843 
       
   844 TBool CAknFepUIManagerChinese::IsValidLongChrKeyPress() const
       
   845     {
       
   846     TUIState state = State();
       
   847     TInt mode = FepMan()->InputMode();
       
   848     if ( mode == EPinyin || mode == EZhuyin || mode == EStroke )
       
   849         {
       
   850         if ( state == EEntry || state == EPredictiveInput )
       
   851             {
       
   852             return EFalse;
       
   853             }
       
   854         }
       
   855     return ETrue;
       
   856     }
       
   857 
       
   858 #endif
       
   859 
       
   860 // ---------------------------------------------------------------------------
       
   861 // CAknFepUIManagerChinese::SetInputLanguageL
       
   862 // 
       
   863 // 
       
   864 // ---------------------------------------------------------------------------
       
   865 //
       
   866 void CAknFepUIManagerChinese::SetInputLanguageL(TLanguage aLanguage)
       
   867     {
       
   868     iLanguage = aLanguage;
       
   869     CloseUI();
       
   870     }
       
   871 
       
   872 
       
   873 // ---------------------------------------------------------------------------
       
   874 // CAknFepUIManagerChinese::CAknFepUIManagerChinese
       
   875 // 
       
   876 // 
       
   877 // ---------------------------------------------------------------------------
       
   878 //
       
   879 CAknFepUIManagerChinese::CAknFepUIManagerChinese(MAknFepManagerUIInterface* aFepMan, 
       
   880                                                  CAknFepCaseManager* aCaseMan)
       
   881     : CAknFepUIManagerBase(aFepMan, aCaseMan),
       
   882       iFepUiState(NULL, NULL),
       
   883       iPrevMode(ENumber),
       
   884       iQwertyMode(ETrue)
       
   885     {
       
   886     }
       
   887 
       
   888 // ---------------------------------------------------------------------------
       
   889 // CAknFepUIManagerChinese::ConstructL
       
   890 // 
       
   891 // 
       
   892 // ---------------------------------------------------------------------------
       
   893 //
       
   894 void CAknFepUIManagerChinese::ConstructL(TLanguage aLanguage)
       
   895     {
       
   896     CAknFepUIManagerBase::ConstructL(aLanguage);
       
   897     iContainerPane = FepMan()->UiInterface()->NewAknFepUICtrlContainerChineseL();
       
   898     ResetFlags();  
       
   899     }
       
   900 
       
   901 // ---------------------------------------------------------------------------
       
   902 // CAknFepUIManagerChinese::QueryPtiEngine
       
   903 // 
       
   904 // 
       
   905 // ---------------------------------------------------------------------------
       
   906 //
       
   907 void CAknFepUIManagerChinese::QueryPtiEngine(void)
       
   908     {
       
   909     MPtiLanguage* ptiLang = iPtiEngine->CurrentLanguage();
       
   910 
       
   911     // query ptiengine 
       
   912     if(ptiLang)
       
   913         {
       
   914         SetFlag(EQueryPtiEngineAlready);
       
   915         if(ptiLang->HasInputMode(EPtiEnginePinyinByPhrase))
       
   916             {
       
   917             SetFlag(ESupportPinyinPhrase);
       
   918             }
       
   919             
       
   920         if(ptiLang->HasInputMode(EPtiEngineZhuyinByPhrase))
       
   921             {
       
   922             SetFlag(ESupportZhuyinPhrase);
       
   923             }
       
   924             
       
   925         if (ptiLang->HasInputMode(EPtiEngineStrokeByPhrase))
       
   926             {
       
   927             SetFlag(ESupportStrokePhrase);
       
   928             }
       
   929         }
       
   930     }
       
   931 
       
   932 void CAknFepUIManagerChinese::ChangeStatetItut(TUIState aState)
       
   933     {
       
   934     switch(aState)
       
   935         {
       
   936         case EInitial:
       
   937             {
       
   938             switch(iMode)
       
   939             {
       
   940             case EPinyin:
       
   941             case EZhuyin:
       
   942             case EStroke:
       
   943             case ECangJie: 
       
   944                 iFepUiState = TAknFepInputStateInitialChineseGeneric(this, iContainerPane);
       
   945                 break;
       
   946             case EZhuyinFind:
       
   947                 iFepUiState = TAknFepInputStateInitialZhuyinFind(this, iContainerPane);
       
   948                 break;
       
   949             case EStrokeFind:
       
   950                 iFepUiState = TAknFepInputStateInitialStrokeFind(this, iContainerPane);
       
   951                 break;
       
   952             case ELatin:
       
   953                 {
       
   954                 if (iPredictive)
       
   955                     {
       
   956                     iFepUiState = TAknFepInputStateInitialWesternPredictive(this);
       
   957                     }
       
   958                 else
       
   959                     {
       
   960                     iFepUiState = TAknFepInputStateInitialLatinMultitap(this);
       
   961                     }
       
   962                 }
       
   963                 break;
       
   964             case ENumber:
       
   965                 {
       
   966                 // Map directly to the resources...
       
   967                 iFepUiState = TAknFepInputStateInitialNumber(this);
       
   968                 break;
       
   969                 }
       
   970             default:
       
   971                 AknFepPanic(EAknFepPanicBadInputState);
       
   972             }
       
   973             break;
       
   974             }
       
   975         case EEntry:
       
   976             {
       
   977             switch(iMode)
       
   978                 {
       
   979                 case EPinyin:
       
   980                     if(IsFlagSet(ESupportPinyinPhrase))
       
   981                         {
       
   982                         iFepUiState = TAknFepInputStateEntryPinyinPhrase(this,iContainerPane);
       
   983                         }
       
   984                     else 
       
   985                         {
       
   986                         iFepUiState = TAknFepInputStateEntryPinyin(this,iContainerPane);
       
   987                         }
       
   988                     break;
       
   989                 case EZhuyin:
       
   990                     if(IsFlagSet(ESupportZhuyinPhrase))
       
   991                         {	
       
   992                         iFepUiState = TAknFepInputStateEntryZhuyinPhrase(this,iContainerPane);
       
   993                         }
       
   994                     else
       
   995                         {
       
   996                         iFepUiState = TAknFepInputStateEntryZhuyin(this,iContainerPane);
       
   997                         }
       
   998                     break;
       
   999                 case EStroke:
       
  1000                     if (IsFlagSet(ESupportStrokePhrase))
       
  1001                         {
       
  1002                         iFepUiState = TAknFepInputStateEntryStrokePhrase(this,iContainerPane);
       
  1003                         }
       
  1004                     else
       
  1005                         {
       
  1006                         iFepUiState = TAknFepInputStateEntryStroke(this,iContainerPane);
       
  1007                         }
       
  1008                     break;
       
  1009                 case ELatin:
       
  1010                     iFepUiState = TAknFepInputStateEntryWesternPredictive(this);
       
  1011                     break;
       
  1012                 default:
       
  1013                     AknFepPanic(EAknFepPanicBadInputState);
       
  1014                 }
       
  1015             }
       
  1016             break;
       
  1017         case ECandidate:
       
  1018             {
       
  1019             // modify for phrase creation
       
  1020             FepMan()->EntryPhrase( ETrue );
       
  1021             FepMan()->EnableKeyStar( EFalse );
       
  1022             switch ( iMode )
       
  1023                 {
       
  1024                 case EPinyin:
       
  1025                     {
       
  1026                     if ( IsFlagSet( ESupportPinyinPhrase ) )
       
  1027                         {
       
  1028                         iFepUiState
       
  1029                             = TAknFepUiInputStateCandidatePinyinAndStrokePhrase(
       
  1030                                 this, iContainerPane );
       
  1031                         }
       
  1032                     }
       
  1033                     break;
       
  1034                 case EStroke:
       
  1035                     {
       
  1036                     if ( IsFlagSet( ESupportStrokePhrase ) )
       
  1037                         {
       
  1038                         iFepUiState
       
  1039                             = TAknFepInputStateCandidateStrokePhrase(
       
  1040                                 this, iContainerPane );
       
  1041                         }
       
  1042                     }
       
  1043                     break;
       
  1044                 case EZhuyin:
       
  1045                     {
       
  1046                     if ( IsFlagSet( ESupportZhuyinPhrase ) )
       
  1047                         {
       
  1048                         iFepUiState
       
  1049                             = TAknFepInputStateCandidateChinesePhrase( this,
       
  1050                                 iContainerPane );
       
  1051                         }
       
  1052                     }
       
  1053                     break;
       
  1054                 default:
       
  1055                     {
       
  1056                     iFepUiState = TAknFepInputStateCandidateChinese( this,
       
  1057                         iContainerPane );
       
  1058                     }
       
  1059                 }
       
  1060             }
       
  1061             break;
       
  1062             
       
  1063         case EPredictiveCandidate:
       
  1064             {
       
  1065             // add for phrase creation
       
  1066             FepMan()->PhraseCreation( EFalse );
       
  1067             FepMan()->PinyinPhraseCreation( EFalse );
       
  1068             FepMan()->EntryPhrase( ETrue );
       
  1069             FepMan()->EnableKeyStar( ETrue );
       
  1070             TRAP_IGNORE( FepMan()->UpdateCbaL( R_AKNFEP_SOFTKEYS_PHRASE_CREATION_SELECT_CANCEL_SELECT ) );
       
  1071             iContainerPane->PinyinPopupWindow()->ResetStrokeArray();
       
  1072             switch(iMode)
       
  1073                 {
       
  1074                 case EPinyin:
       
  1075                     if(IsFlagSet(ESupportPinyinPhrase))
       
  1076                         {
       
  1077                         iFepUiState = TAknFepInputStatePredictiveCandidatePinyinPhrase(
       
  1078                                                                     this,iContainerPane);
       
  1079                         }
       
  1080                     else
       
  1081                         {
       
  1082                         iFepUiState = TAknFepInputStatePredictiveCandidatePinyin(
       
  1083                                                              this,iContainerPane);     
       
  1084                         }
       
  1085                     break;
       
  1086                 case EStroke:
       
  1087                     if (IsFlagSet(ESupportStrokePhrase))
       
  1088                         {
       
  1089                         iFepUiState = TAknFepInputStatePredictiveCandidateStrokePhrase(
       
  1090                                                                    this,iContainerPane);     
       
  1091                         }
       
  1092                     else
       
  1093                         {
       
  1094                         iFepUiState = TAknFepInputStatePredictiveCandidateStroke(
       
  1095                                                               this,iContainerPane);     
       
  1096                         } 
       
  1097                     break;
       
  1098                 case EZhuyin:
       
  1099                         if(IsFlagSet(ESupportZhuyinPhrase))
       
  1100                             {
       
  1101                             iFepUiState = TAknFepInputStatePredictiveCandidateChinesePhrase(
       
  1102                                                                         this,iContainerPane);
       
  1103                             }
       
  1104                         else
       
  1105                             {
       
  1106                             iFepUiState = TAknFepInputStatePredictiveCandidate(this,iContainerPane);
       
  1107                             }
       
  1108                     break;
       
  1109                 default:
       
  1110                 AknFepPanic(EAknFepPanicBadInputState);
       
  1111                 }
       
  1112             }
       
  1113             break;
       
  1114         case EPredictiveInput:
       
  1115             if((IsFlagSet(ESupportPinyinPhrase) || IsFlagSet(ESupportZhuyinPhrase) 
       
  1116              || IsFlagSet(ESupportStrokePhrase)) 
       
  1117                && (iMode != ECangJie))
       
  1118                 {
       
  1119                 iFepUiState = TAknFepInputStatePredictiveInputChinesePhrase(this, iContainerPane);
       
  1120                 }
       
  1121             else
       
  1122                 {
       
  1123                 iFepUiState = TAknFepInputStatePredictiveInputChinese(this, iContainerPane);
       
  1124                 }
       
  1125             break;
       
  1126         // add for phrase creation
       
  1127         case EStrokeSequenceEdit:
       
  1128             if ( IsFlagSet( ESupportStrokePhrase ) && ( iMode != ECangJie ) )
       
  1129                 {
       
  1130                 FepMan()->EnableKeyStar( EFalse );
       
  1131                 iFepUiState = TAknFepInputStateEditStrokePhrase( this, iContainerPane ); 
       
  1132                 }
       
  1133             break;
       
  1134         // add for phrase creation
       
  1135         case EKeySequenceEdit:
       
  1136             if ( IsFlagSet( ESupportPinyinPhrase ) && ( iMode != ECangJie ) )
       
  1137                 {
       
  1138                 iFepUiState = TAknFepInputStateEntryPinyinPhraseCreation( this, iContainerPane );
       
  1139                 }
       
  1140             break;
       
  1141         // add for phrase creation
       
  1142         case EZhuyinSequenceEdit:
       
  1143             if ( IsFlagSet( ESupportZhuyinPhrase ) && ( iMode != ECangJie ) )
       
  1144                 {
       
  1145                 iFepUiState = TAknFepInputStateEntryZhuyinPhraseCreation( this, iContainerPane );
       
  1146                 }
       
  1147             break;
       
  1148         // add for phrase creation
       
  1149         case ESpellingSelection:
       
  1150             if ( IsFlagSet( ESupportPinyinPhrase ) && (iMode != ECangJie) )
       
  1151                 {
       
  1152                 FepMan()->EnableKeyStar( EFalse );
       
  1153                 iFepUiState = TAknFepInputStateSpellingPinyinPhraseCreation( this, iContainerPane );
       
  1154                 }
       
  1155             break;
       
  1156         // add for phrase creation
       
  1157         case ECandidateSelection:
       
  1158             if ( IsFlagSet (ESupportPinyinPhrase) && ( iMode != ECangJie ) )
       
  1159                 {
       
  1160                 FepMan()->EnableKeyStar( EFalse );
       
  1161                 iFepUiState = TAknFepInputStateCandidatePinyinPhraseCreation( this, iContainerPane );
       
  1162                 }
       
  1163             break;
       
  1164         default:
       
  1165             AknFepPanic(EAknFepPanicBadInputState);
       
  1166         }
       
  1167     
       
  1168     }
       
  1169     
       
  1170 void CAknFepUIManagerChinese::ChangeStateQwerty(TUIState aState)
       
  1171     {
       
  1172 #ifdef RD_INTELLIGENT_TEXT_INPUT        
       
  1173     TPtiKeyboardType kbdType = iFepMan->KeyboardLayout();    
       
  1174 #endif    
       
  1175     switch(aState)
       
  1176         {
       
  1177         case EQwerty:
       
  1178             if(iMode == EPinyin || iMode == EStroke || iMode == EZhuyin || iMode == ECangJie)
       
  1179                 {
       
  1180                 iFepUiState = TAknFepInputStateInitialChineseGenericQwerty(this, iMode);
       
  1181                 }
       
  1182             else if(iMode == EStrokeFind)
       
  1183                 {
       
  1184 #ifdef RD_INTELLIGENT_TEXT_INPUT 
       
  1185                 if(EPtiKeyboardQwerty4x10 == kbdType ||
       
  1186                    EPtiKeyboardQwerty3x11 == kbdType)
       
  1187                     {
       
  1188                     iFepUiState = TAknFepInputStateStrokeFindMiniQwerty(this,iMode);
       
  1189                     }
       
  1190                 else
       
  1191                     {
       
  1192 #endif //RD_INTELLIGENT_TEXT_INPUT                
       
  1193                 iFepUiState = TAknFepInputStateStrokeFindQwerty(this,iContainerPane);
       
  1194 #ifdef RD_INTELLIGENT_TEXT_INPUT 
       
  1195                     }
       
  1196 #endif                
       
  1197                 }
       
  1198             else if(iMode == EZhuyinFind)
       
  1199                 {
       
  1200 #ifdef RD_INTELLIGENT_TEXT_INPUT 
       
  1201                 if(EPtiKeyboardQwerty4x10 == kbdType ||
       
  1202                    EPtiKeyboardQwerty3x11 == kbdType)
       
  1203                     {
       
  1204                     iFepUiState = TAknFepInputStateZhuyinFindMiniQwerty(this,iMode);
       
  1205                     }
       
  1206                 else
       
  1207                     {
       
  1208 #endif //RD_INTELLIGENT_TEXT_INPUT                 
       
  1209                 iFepUiState = TAknFepInputStateZhuyinFindQwerty(this,iContainerPane);
       
  1210 #ifdef RD_INTELLIGENT_TEXT_INPUT 
       
  1211                     }
       
  1212 #endif  
       
  1213                 }
       
  1214             break;
       
  1215 #ifdef RD_INTELLIGENT_TEXT_INPUT
       
  1216 #ifdef __HALF_QWERTY_KEYPAD
       
  1217         case EHalfQwerty: 
       
  1218             if (iMode == EPinyin || iMode == EStroke || iMode == EZhuyin)
       
  1219                 {
       
  1220                 iFepUiState = TAknFepInputStateInitialChineseGenericHalfQwerty(
       
  1221                         this, iMode);
       
  1222                 }
       
  1223             else if(iMode ==EStrokeFind)
       
  1224                 {
       
  1225                 iFepUiState = TAknFepInputStateStrokeFindHalfQwerty(this,
       
  1226                                             iMode);
       
  1227                 }    
       
  1228             else if(iMode ==EZhuyinFind)
       
  1229                 {
       
  1230                 iFepUiState = TAknFepInputStateZhuyinFindHalfQwerty(this,
       
  1231                                                             iMode);
       
  1232                 }
       
  1233             break;
       
  1234 #endif
       
  1235 #endif
       
  1236         case EEntry:
       
  1237             {
       
  1238             switch(iMode)
       
  1239                 {
       
  1240                 case EZhuyin:
       
  1241                     if(IsFlagSet(ESupportZhuyinPhrase))
       
  1242                         {
       
  1243 #ifdef RD_INTELLIGENT_TEXT_INPUT        
       
  1244                         if ( EPtiKeyboardQwerty4x10 == kbdType ||
       
  1245                              EPtiKeyboardQwerty3x11 == kbdType ||
       
  1246                              EPtiKeyboardCustomQwerty == kbdType)
       
  1247                            {
       
  1248                            iFepUiState = TAknFepInputStateEntryMiniQwertyZhuyinPhrase(this, iContainerPane); 
       
  1249                            }
       
  1250                         else if(EPtiKeyboardHalfQwerty == kbdType)
       
  1251                            {
       
  1252                            iFepUiState = TAknFepInputStateEntryHalfQwertyZhuyinPhrase(this, iContainerPane);
       
  1253                            }
       
  1254                         else
       
  1255                            {
       
  1256 #endif
       
  1257                         iFepUiState = TAknFepInputStateEntryQwertyZhuyinPhrase(this, 
       
  1258                                                                                iContainerPane);
       
  1259 #ifdef RD_INTELLIGENT_TEXT_INPUT        
       
  1260                            }   
       
  1261 #endif
       
  1262                         }
       
  1263                     else
       
  1264                         {
       
  1265                         iFepUiState = TAknFepInputStateEntryQwertyZhuyin(this, iContainerPane);
       
  1266                         }
       
  1267                     
       
  1268                     break;
       
  1269                 case EPinyin:
       
  1270                     if(IsFlagSet(ESupportPinyinPhrase))
       
  1271                         {
       
  1272 #ifdef RD_INTELLIGENT_TEXT_INPUT        
       
  1273                         if ( EPtiKeyboardQwerty4x10 == kbdType ||
       
  1274                              EPtiKeyboardQwerty3x11 == kbdType ||
       
  1275                              EPtiKeyboardCustomQwerty == kbdType)                            
       
  1276                             { 
       
  1277                             iFepUiState = TAknFepInputStateEntryMiniQwertyPinyinPhrase(this, iContainerPane);
       
  1278                             }
       
  1279                         else if (EPtiKeyboardHalfQwerty == kbdType)
       
  1280                             {
       
  1281                             iFepUiState = TAknFepInputStateEntryHalfQwertyPinyinPhrase(this, iContainerPane);
       
  1282                             }
       
  1283                         else
       
  1284                             {
       
  1285 #endif
       
  1286                         iFepUiState = TAknFepInputStateEntryQwertyPinyinPhrase(
       
  1287                                                            this, iContainerPane);
       
  1288 #ifdef RD_INTELLIGENT_TEXT_INPUT        
       
  1289                             }
       
  1290 #endif
       
  1291                         }
       
  1292                     else
       
  1293                         {
       
  1294                         iFepUiState = TAknFepInputStateEntryQwertyPinyin(this, iContainerPane);
       
  1295                         }
       
  1296                     break;
       
  1297                 case EStroke:
       
  1298                     if (IsFlagSet(ESupportStrokePhrase))
       
  1299                         {
       
  1300 #ifdef RD_INTELLIGENT_TEXT_INPUT        
       
  1301                         if ( EPtiKeyboardQwerty4x10 == kbdType ||
       
  1302                              EPtiKeyboardQwerty3x11 == kbdType ||
       
  1303                              EPtiKeyboardCustomQwerty == kbdType)                        	
       
  1304                             {
       
  1305                             iFepUiState = TAknFepInputStateEntryMiniQwertyStrokePhrase(
       
  1306                                                                   this, iContainerPane);
       
  1307                         	}
       
  1308                         else if (EPtiKeyboardHalfQwerty == kbdType)
       
  1309                             {
       
  1310                             iFepUiState= TAknFepInputStateEntryHalfQwertyStrokePhrase(this, iContainerPane);
       
  1311                             }
       
  1312                         else
       
  1313  	                       {
       
  1314 #endif
       
  1315                         	iFepUiState = TAknFepInputStateEntryQwertyStrokePhrase(
       
  1316                                                              this, iContainerPane);
       
  1317 #ifdef RD_INTELLIGENT_TEXT_INPUT        
       
  1318  	                       }	
       
  1319 #endif
       
  1320                         }
       
  1321                     else
       
  1322                         {
       
  1323                         iFepUiState = TAknFepInputStateEntryQwertyStroke(this, iContainerPane);
       
  1324                         }
       
  1325                     break;
       
  1326                 case ECangJie:
       
  1327 #ifdef RD_INTELLIGENT_TEXT_INPUT        
       
  1328                         if ( EPtiKeyboardQwerty4x10 == kbdType ||
       
  1329                              EPtiKeyboardQwerty3x11 == kbdType ||
       
  1330                              EPtiKeyboardHalfQwerty == kbdType ||
       
  1331                              EPtiKeyboardCustomQwerty == kbdType)                    	
       
  1332                         {
       
  1333                         iFepUiState = TAknFepInputStateEntryMiniQwertyCangJie(this, iContainerPane);                    	
       
  1334                     	}
       
  1335                     else
       
  1336                     	{
       
  1337 #endif
       
  1338                     	iFepUiState = TAknFepInputStateEntryQwertyCangJie(this, iContainerPane);
       
  1339 #ifdef RD_INTELLIGENT_TEXT_INPUT        
       
  1340                     	}
       
  1341 #endif
       
  1342                     break;
       
  1343                 default:
       
  1344                     AknFepPanic(EAknFepPanicBadInputState);
       
  1345                 }
       
  1346             }
       
  1347             break;
       
  1348         case ECandidate:
       
  1349             if(iMode == EZhuyin)
       
  1350                 {
       
  1351                 if(IsFlagSet(ESupportZhuyinPhrase))
       
  1352                     {
       
  1353 #ifdef RD_INTELLIGENT_TEXT_INPUT        
       
  1354                         if ( EPtiKeyboardQwerty4x10 == kbdType ||
       
  1355                              EPtiKeyboardQwerty3x11 == kbdType ||
       
  1356                              EPtiKeyboardCustomQwerty == kbdType)                    	
       
  1357                     	{
       
  1358                     	iFepUiState = TAknFepUiInputStateCandidateMiniQwertyZhuyinPhrase(
       
  1359                                                                   this, iContainerPane);
       
  1360                     	}
       
  1361 #ifdef __HALF_QWERTY_KEYPAD
       
  1362                         else if ( EPtiKeyboardHalfQwerty == kbdType )
       
  1363                             {
       
  1364                             iFepUiState = TAknFepUiInputStateCandidateHalfQwertyChinesePhrase(
       
  1365                                                                                               this, iContainerPane);
       
  1366                             }
       
  1367 #endif
       
  1368                     else
       
  1369          	            {
       
  1370 #endif
       
  1371          	            iFepUiState = TAknFepInputStateCandidateQwertyZhuyinPhrase(
       
  1372                                                             this, iContainerPane);
       
  1373 #ifdef RD_INTELLIGENT_TEXT_INPUT        
       
  1374          	            }	
       
  1375 #endif
       
  1376                     }
       
  1377                 else
       
  1378                     {
       
  1379                     iFepUiState = TAknFepInputStateCandidateQwertyZhuyin(this, iContainerPane);
       
  1380                     }
       
  1381                 }
       
  1382 #ifdef RD_INTELLIGENT_TEXT_INPUT        
       
  1383             else if(iMode == EPinyin)
       
  1384                 {
       
  1385                 if(IsFlagSet(ESupportPinyinPhrase))
       
  1386                     {
       
  1387                         if ( EPtiKeyboardQwerty4x10 == kbdType ||
       
  1388                              EPtiKeyboardQwerty3x11 == kbdType ||
       
  1389                              EPtiKeyboardCustomQwerty == kbdType)                    	
       
  1390                         { 
       
  1391                         iFepUiState = TAknFepUiInputStateCandidateMiniQwertyPinyinAndStrokePhrase(this, iContainerPane);
       
  1392                         }
       
  1393                         else if(EPtiKeyboardHalfQwerty == kbdType)
       
  1394                         {
       
  1395                         iFepUiState=TAknFepUiInputStateCandidateHalfQwertyChinesePhrase(
       
  1396                                                                              this, iContainerPane);
       
  1397                         }
       
  1398                     }                 
       
  1399                 }
       
  1400             else if(iMode == EStroke)
       
  1401             	{
       
  1402                  if (IsFlagSet(ESupportStrokePhrase))
       
  1403                         {
       
  1404                         if ( EPtiKeyboardQwerty4x10 == kbdType ||
       
  1405                              EPtiKeyboardQwerty3x11 == kbdType ||
       
  1406                              EPtiKeyboardCustomQwerty == kbdType)                    	
       
  1407                         	{
       
  1408                             iFepUiState = TAknFepUiInputStateCandidateMiniQwertyStrokePhrase(this, iContainerPane);
       
  1409                             }
       
  1410                         else if ( EPtiKeyboardHalfQwerty == kbdType )
       
  1411                             {
       
  1412                             iFepUiState=TAknFepUiInputStateCandidateHalfQwertyChinesePhrase( this, iContainerPane);
       
  1413                             }
       
  1414                        }
       
  1415             	}
       
  1416 	        else if(iMode == ECangJie)
       
  1417 	        	{
       
  1418                 if ( EPtiKeyboardQwerty4x10 == kbdType ||
       
  1419                      EPtiKeyboardQwerty3x11 == kbdType ||
       
  1420                      EPtiKeyboardHalfQwerty == kbdType ||
       
  1421                      EPtiKeyboardCustomQwerty == kbdType)                    	
       
  1422                 {
       
  1423                 iFepUiState = TAknFepUiInputStateCandidateMiniQwertyPinyinAndStrokePhrase(
       
  1424                                                                      this, iContainerPane);
       
  1425                 }
       
  1426 	        	}
       
  1427 #endif      
       
  1428             break;
       
  1429         case EPredictiveCandidate:
       
  1430             if(iMode == EZhuyin)
       
  1431                 {
       
  1432                 if(IsFlagSet(ESupportZhuyinPhrase))
       
  1433                     {
       
  1434 #ifdef RD_INTELLIGENT_TEXT_INPUT        
       
  1435                     if ( EPtiKeyboardQwerty4x10 == kbdType ||
       
  1436                          EPtiKeyboardQwerty3x11 == kbdType ||
       
  1437                          EPtiKeyboardCustomQwerty == kbdType)                    	
       
  1438                         {
       
  1439                     	iFepUiState = TAknFepInputStatePredictiveCandidateMiniQwertyChinesePhrase(
       
  1440                                                                           this, iContainerPane);
       
  1441                     	}
       
  1442 #ifdef __HALF_QWERTY_KEYPAD
       
  1443                     else if( EPtiKeyboardHalfQwerty == kbdType )
       
  1444                         {
       
  1445                         iFepUiState = TAknFepInputStatePredictiveCandidateHalfQwertyChinesePhrase(
       
  1446                                                                            this, iContainerPane);
       
  1447                         }
       
  1448 #endif
       
  1449                     else
       
  1450                     	{
       
  1451 #endif
       
  1452                     	iFepUiState = TAknFepInputStatePredictiveCandidateQwertyZhuyinPhrase(
       
  1453                                                                       this, iContainerPane);                    	
       
  1454 #ifdef RD_INTELLIGENT_TEXT_INPUT        
       
  1455                         }	
       
  1456 #endif
       
  1457                     }
       
  1458                 else
       
  1459                     {
       
  1460                     iFepUiState = TAknFepInputStatePredictiveCandidateQwertyZhuyin(
       
  1461                                                               this, iContainerPane);
       
  1462                     }
       
  1463                 
       
  1464                 }
       
  1465 #ifdef RD_INTELLIGENT_TEXT_INPUT        
       
  1466             else if(iMode == EPinyin)
       
  1467                 {
       
  1468                 if(IsFlagSet(ESupportPinyinPhrase))
       
  1469                     {
       
  1470                     if ( EPtiKeyboardQwerty4x10 == kbdType ||
       
  1471                          EPtiKeyboardQwerty3x11 == kbdType ||
       
  1472                          EPtiKeyboardCustomQwerty == kbdType)                    	
       
  1473                         {
       
  1474                         iFepUiState = TAknFepInputStatePredictiveCandidateMiniQwertyChinesePhrase(
       
  1475                                                                              this, iContainerPane);
       
  1476                         }
       
  1477 #ifdef __HALF_QWERTY_KEYPAD
       
  1478                     else if( EPtiKeyboardHalfQwerty == kbdType )
       
  1479                         {
       
  1480                         iFepUiState = TAknFepInputStatePredictiveCandidateHalfQwertyChinesePhrase(
       
  1481                                                                            this, iContainerPane);
       
  1482                         }
       
  1483 #endif
       
  1484                     }                 
       
  1485                 }
       
  1486            else if(iMode == EStroke)
       
  1487             	{
       
  1488                  if (IsFlagSet(ESupportStrokePhrase))
       
  1489                         {
       
  1490                         if ( EPtiKeyboardQwerty4x10 == kbdType ||
       
  1491                              EPtiKeyboardQwerty3x11 == kbdType ||
       
  1492                              EPtiKeyboardCustomQwerty == kbdType)                    	
       
  1493                         	{
       
  1494                             iFepUiState = 
       
  1495                                    TAknFepInputStatePredictiveCandidateMiniQwertyChinesePhrase(
       
  1496                                                                           this, iContainerPane);
       
  1497                         	}
       
  1498 #ifdef __HALF_QWERTY_KEYPAD
       
  1499                     else if( EPtiKeyboardHalfQwerty == kbdType )
       
  1500                         {
       
  1501                         iFepUiState = TAknFepInputStatePredictiveCandidateHalfQwertyChinesePhrase(
       
  1502                                                                            this, iContainerPane);
       
  1503                         }
       
  1504 #endif
       
  1505                        }
       
  1506 	
       
  1507             	}
       
  1508             else if(iMode == ECangJie)
       
  1509             	{
       
  1510 
       
  1511                 if ( EPtiKeyboardQwerty4x10 == kbdType ||
       
  1512                      EPtiKeyboardQwerty3x11 == kbdType ||
       
  1513                      EPtiKeyboardHalfQwerty == kbdType ||
       
  1514                      EPtiKeyboardCustomQwerty == kbdType)                    	
       
  1515                  {
       
  1516                  iFepUiState = TAknFepInputStatePredictiveCandidateMiniQwertyChinesePhrase(
       
  1517                                                                        this, iContainerPane);
       
  1518                  }
       
  1519 
       
  1520             	}
       
  1521 #endif
       
  1522             break;
       
  1523         case EPredictiveInput:
       
  1524             {
       
  1525             switch(iMode)
       
  1526                 {
       
  1527                 case EPinyin:
       
  1528                     if(IsFlagSet(ESupportPinyinPhrase))
       
  1529                         {
       
  1530 #ifdef RD_INTELLIGENT_TEXT_INPUT        
       
  1531                         if ( EPtiKeyboardQwerty4x10 == kbdType ||
       
  1532                              EPtiKeyboardQwerty3x11 == kbdType ||
       
  1533                              EPtiKeyboardHalfQwerty == kbdType ||
       
  1534                              EPtiKeyboardCustomQwerty == kbdType)                    	
       
  1535                             {
       
  1536                             iFepUiState = TAknFepInputStatePredictiveInputMiniQwertyChinesePhrase/*TAknFepInputStatePredictiveInputQwertyPinyinPhrase*/(this, iContainerPane);
       
  1537                             }
       
  1538                         else
       
  1539                             {
       
  1540 #endif
       
  1541                             iFepUiState = TAknFepInputStatePredictiveInputQwertyPinyinPhrase(
       
  1542                                                                         this, iContainerPane);
       
  1543 #ifdef RD_INTELLIGENT_TEXT_INPUT        
       
  1544 							}
       
  1545 #endif
       
  1546                         }
       
  1547                     else
       
  1548                         {
       
  1549                         iFepUiState = TAknFepInputStatePredictiveInputQwertyPinyin(
       
  1550                                                               this, iContainerPane);
       
  1551                         }
       
  1552                     break;
       
  1553                 case EStroke:                
       
  1554                     if(IsFlagSet(ESupportStrokePhrase))
       
  1555                         {
       
  1556 #ifdef RD_INTELLIGENT_TEXT_INPUT        
       
  1557                         if ( EPtiKeyboardQwerty4x10 == kbdType ||
       
  1558                              EPtiKeyboardQwerty3x11 == kbdType ||
       
  1559                              EPtiKeyboardHalfQwerty == kbdType ||
       
  1560                              EPtiKeyboardCustomQwerty == kbdType)                    	
       
  1561                       	   {
       
  1562                            iFepUiState = TAknFepInputStatePredictiveInputMiniQwertyChinesePhrase(
       
  1563                                                                              this, iContainerPane);
       
  1564                        	   }
       
  1565                         else
       
  1566          	               {
       
  1567 #endif
       
  1568          	               iFepUiState = TAknFepInputStatePredictiveInputQwertyStrokePhrase(
       
  1569                                                                      this, iContainerPane);                        	
       
  1570 #ifdef RD_INTELLIGENT_TEXT_INPUT        
       
  1571          	               }
       
  1572 #endif
       
  1573                         }
       
  1574                     else
       
  1575                         {
       
  1576                         iFepUiState = TAknFepInputStatePredictiveInputQwertyStroke(
       
  1577                                                               this, iContainerPane);
       
  1578                         }
       
  1579                     break;
       
  1580                 case ECangJie:
       
  1581 #ifdef RD_INTELLIGENT_TEXT_INPUT        
       
  1582                     if ( EPtiKeyboardQwerty4x10 == kbdType ||
       
  1583                          EPtiKeyboardQwerty3x11 == kbdType ||
       
  1584                          EPtiKeyboardHalfQwerty == kbdType ||
       
  1585                          EPtiKeyboardCustomQwerty == kbdType)                    	
       
  1586                         {
       
  1587                         iFepUiState = TAknFepInputStatePredictiveInputMiniQwertyChinesePhrase(
       
  1588                                                                           this,iContainerPane);
       
  1589 
       
  1590                         }
       
  1591                     else 
       
  1592                     	{
       
  1593 #endif
       
  1594                     	iFepUiState = TAknFepInputStatePredictiveInputQwerty(this, iContainerPane);
       
  1595 #ifdef RD_INTELLIGENT_TEXT_INPUT        
       
  1596                     	}    
       
  1597 #endif
       
  1598                     break;
       
  1599                 case EZhuyin:
       
  1600                     if(IsFlagSet(ESupportZhuyinPhrase))
       
  1601                         {
       
  1602 #ifdef RD_INTELLIGENT_TEXT_INPUT        
       
  1603                         if ( EPtiKeyboardQwerty4x10 == kbdType ||
       
  1604                              EPtiKeyboardQwerty3x11 == kbdType ||
       
  1605                              EPtiKeyboardHalfQwerty == kbdType ||
       
  1606                              EPtiKeyboardCustomQwerty == kbdType)                    	
       
  1607                         	{
       
  1608                             iFepUiState = TAknFepInputStatePredictiveInputMiniQwertyChinesePhrase/*TAknFepInputStatePredictiveInputQwertyPinyinPhrase*/(this, iContainerPane);
       
  1609                         	}
       
  1610                         else
       
  1611                         	{
       
  1612 #endif
       
  1613                         	iFepUiState = TAknFepInputStatePredictiveInputQwertyZhuyinPhrase(
       
  1614                                                                        this, iContainerPane);
       
  1615 #ifdef RD_INTELLIGENT_TEXT_INPUT        
       
  1616                         	}
       
  1617 #endif
       
  1618                         }
       
  1619                     else
       
  1620                         {
       
  1621                         iFepUiState = TAknFepInputStatePredictiveInputQwertyZhuyin(
       
  1622                                                               this, iContainerPane);
       
  1623                         }
       
  1624                     break;  
       
  1625                 default:
       
  1626                     AknFepPanic(EAknFepPanicBadInputState);
       
  1627                 }
       
  1628             }
       
  1629             break;
       
  1630 #ifdef RD_INTELLIGENT_TEXT_INPUT 
       
  1631         case EMiniQwertyEdit:
       
  1632             {
       
  1633             switch(iMode)
       
  1634                 {
       
  1635                 case EZhuyin:
       
  1636                     if(IsFlagSet(ESupportZhuyinPhrase))
       
  1637                         {
       
  1638 #ifdef RD_INTELLIGENT_TEXT_INPUT        
       
  1639                         if ( EPtiKeyboardQwerty4x10 == kbdType ||
       
  1640                              EPtiKeyboardQwerty3x11 == kbdType ||
       
  1641                              EPtiKeyboardHalfQwerty == kbdType ||
       
  1642                              EPtiKeyboardCustomQwerty == kbdType)
       
  1643                            {
       
  1644                            iFepUiState = TAknFepInputStateEditingMiniQwertyZhuyinPhrase( this, iContainerPane );
       
  1645                            }
       
  1646 #endif
       
  1647                         }
       
  1648                     break;
       
  1649                 case EPinyin:
       
  1650                     if(IsFlagSet(ESupportPinyinPhrase))
       
  1651                         {
       
  1652 #ifdef RD_INTELLIGENT_TEXT_INPUT        
       
  1653                         if ( EPtiKeyboardQwerty4x10 == kbdType ||
       
  1654                              EPtiKeyboardQwerty3x11 == kbdType ||
       
  1655                              EPtiKeyboardHalfQwerty == kbdType ||
       
  1656                              EPtiKeyboardCustomQwerty == kbdType)                            
       
  1657                             { 
       
  1658                             iFepUiState = 
       
  1659                                 TAknFepInputStateEditinigMiniQwertyPinyinPhrase( 
       
  1660                                                              this,
       
  1661                                                              iContainerPane );
       
  1662                             }                            
       
  1663 #endif
       
  1664                         }
       
  1665                     break;
       
  1666                 case EStroke:
       
  1667                     if (IsFlagSet(ESupportStrokePhrase))
       
  1668                         {
       
  1669 #ifdef RD_INTELLIGENT_TEXT_INPUT        
       
  1670                         if ( EPtiKeyboardQwerty4x10 == kbdType ||
       
  1671                              EPtiKeyboardQwerty3x11 == kbdType ||
       
  1672                              EPtiKeyboardHalfQwerty == kbdType ||
       
  1673                              EPtiKeyboardCustomQwerty == kbdType)                           
       
  1674                             {
       
  1675                             iFepUiState = 
       
  1676                                 TAknFepInputStateEditingMiniQwertyStrokePhrase(
       
  1677                                                               this, 
       
  1678                                                               iContainerPane);
       
  1679                             }
       
  1680 #endif
       
  1681                         }
       
  1682                     break;
       
  1683                 default:
       
  1684                     break;
       
  1685                 }   
       
  1686             }
       
  1687             break;
       
  1688         case EZhuyinSpelling:
       
  1689             {
       
  1690             iFepUiState = TAknFepInputStateSpellingMiniQwertyZhuyin( this, iContainerPane );
       
  1691             }
       
  1692             break;
       
  1693         case EZhuyinCandidate:
       
  1694             {
       
  1695             iFepUiState = TAknFepInputStateCanindateSelectingMiniQwertyZhuyin( this, iContainerPane );
       
  1696             }
       
  1697             break;
       
  1698 #endif
       
  1699         default:
       
  1700             AknFepPanic(EAknFepPanicBadInputState);
       
  1701     }
       
  1702 }
       
  1703     
       
  1704 void CAknFepUIManagerChinese::UpdateCangJieState()
       
  1705     {
       
  1706     // Reset mode
       
  1707     if (iMode == ECangJie)
       
  1708         {
       
  1709         ChangeStateQwerty( EQwerty );
       
  1710         }
       
  1711     }
       
  1712 
       
  1713 TBool CAknFepUIManagerChinese::IsValidChineseSymbol(TInt aKey) const
       
  1714 	{
       
  1715 	TBool respond = EFalse;
       
  1716 	if((aKey >= EStdKeyComma && aKey <= EStdKeyNkpPlus)|| aKey == EPtiKeyStar )
       
  1717 		{
       
  1718 		respond = ETrue;
       
  1719 		}
       
  1720 	return respond;
       
  1721 	}
       
  1722 #ifdef __ITI_LONGPRESS_NUM_SHIFT_COPYPASTE__
       
  1723 #ifdef RD_INTELLIGENT_TEXT_INPUT
       
  1724 // ---------------------------------------------------------------------------
       
  1725 // CAknFepUIManagerChinese::RollbackPreviousCharL
       
  1726 // 
       
  1727 // 
       
  1728 // ---------------------------------------------------------------------------
       
  1729 //
       
  1730 TBool CAknFepUIManagerChinese::RollbackPreviousCharL()
       
  1731     {
       
  1732     if ( iInputSeqLenDeltaWithLastKey > 0 )
       
  1733         {
       
  1734         HandleKeyL( EStdKeyBackspace, EShortKeyPress );
       
  1735         return ETrue;
       
  1736         }
       
  1737     else
       
  1738         {
       
  1739         return CAknFepUIManagerBase::RollbackPreviousCharL();
       
  1740         }
       
  1741     }
       
  1742 #endif // RD_INTELLIGENT_TEXT_INPUT
       
  1743 #endif // __ITI_LONGPRESS_NUM_SHIFT_COPYPASTE__
       
  1744 // End of file