fep/aknfep/src/AknFepUiManagerChinese.cpp
changeset 0 eb1f2e154e89
child 7 6defe5d1bd39
equal deleted inserted replaced
-1:000000000000 0:eb1f2e154e89
       
     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     TPtiKeyboardType keyboardType = iPtiEngine->KeyboardType();
       
   489 #endif
       
   490 
       
   491     if(iMode == EPinyin)
       
   492         {
       
   493         if( (aKey >= EPtiKeyQwertyA && aKey <= EPtiKeyQwertyZ) ||
       
   494         	(aKey >= EPtiKeyQwerty1 && aKey <= EPtiKeyQwerty9) ||
       
   495             (IsFlagSet(ESupportPinyinPhrase) && aKey == EPtiKeyQwertyApostrophe 
       
   496              && State() != EInitial))
       
   497             {
       
   498             response = ETrue;
       
   499             }
       
   500 #ifdef RD_INTELLIGENT_TEXT_INPUT          
       
   501         if ( State() == EInitial && EPtiKeyboardHalfQwerty == keyboardType &&
       
   502            ( aKey == EPtiKeyQwertyU || aKey == EPtiKeyQwertyI || aKey == EPtiKeyQwerty3 ))
       
   503             {
       
   504             response = EFalse;
       
   505             }
       
   506 #endif
       
   507         }
       
   508 
       
   509     if(iMode == EStroke || iMode == EStrokeFind)
       
   510         {
       
   511 #ifdef RD_INTELLIGENT_TEXT_INPUT        
       
   512         if(EPtiKeyboardQwerty4x10 == keyboardType ||EPtiKeyboardQwerty3x11 == keyboardType )
       
   513             {            
       
   514             if( IsKeyMappedStroke(aKey)|| EPtiKeyQwertySpace == aKey)
       
   515                 {
       
   516                 response = ETrue;
       
   517                 if(aKey == EPtiKeyQwertySpace && (State() == EInitial || State() ==EPredictiveInput))
       
   518                     {
       
   519                     response = EFalse;
       
   520                     }
       
   521                 }
       
   522             }
       
   523         else if( EPtiKeyboardHalfQwerty == keyboardType ||
       
   524            EPtiKeyboardCustomQwerty == keyboardType)
       
   525             {
       
   526             MPtiLanguage *lang = NULL;
       
   527             RArray < TPtiNumericKeyBinding > keybinding;
       
   528             TBool IsStrokeKey = EFalse;
       
   529             if(iPtiEngine)
       
   530             { 
       
   531             	  lang = iPtiEngine->CurrentLanguage();
       
   532             }
       
   533             if( iPtiEngine && lang )
       
   534                 {
       
   535                 TRAP_IGNORE(iPtiEngine->GetNumericModeKeysForQwertyL(
       
   536                 						lang->LanguageCode(),
       
   537                 				 		keybinding, keyboardType));
       
   538                 TInt numericKeysCount = keybinding.Count();
       
   539                 while ( numericKeysCount-- )
       
   540                     {
       
   541                     TPtiNumericKeyBinding numKeyBind = keybinding[numericKeysCount];
       
   542                     if ( (numKeyBind.iChar >= 0x31 && numKeyBind.iChar <= 0x36)&&(aKey == numKeyBind.iKey))
       
   543                         {
       
   544                            IsStrokeKey = ETrue;
       
   545                            break;              
       
   546                         }
       
   547                     }
       
   548                 }
       
   549             keybinding.Reset();
       
   550             if(IsStrokeKey || (aKey == EPtiKeyQwertySpace))
       
   551                 {
       
   552                 if((aKey >= EPtiKeyQwertyA && aKey <= EPtiKeyQwertyZ) ||
       
   553                    (aKey >= EPtiKeyQwerty0 && aKey <= EPtiKeyQwerty6) ||		
       
   554                    (aKey == EPtiKeyQwertySpace))
       
   555                     {
       
   556                     response = ETrue;
       
   557                     if(aKey == EPtiKeyQwertySpace && 
       
   558                     	(State() == EInitial || State() ==EPredictiveInput))
       
   559                         {
       
   560                         response = EFalse;
       
   561                         }                  
       
   562                     }
       
   563                 }               
       
   564             }
       
   565         else
       
   566             {
       
   567 #endif
       
   568         switch(aKey)
       
   569             {
       
   570             case EPtiKeyQwertyQ:
       
   571             case EPtiKeyQwertyW:
       
   572             case EPtiKeyQwertyE:
       
   573             case EPtiKeyQwertyA:
       
   574             case EPtiKeyQwertyS:
       
   575             case EPtiKeyQwertyD:
       
   576             case EPtiKeyQwertyI:
       
   577             case EPtiKeyQwertyO:
       
   578             case EPtiKeyQwertyP:
       
   579             case EPtiKeyQwertyJ:
       
   580             case EPtiKeyQwertyK:
       
   581             case EPtiKeyQwertyL:
       
   582             case EPtiKeyQwertySpace:
       
   583                 {
       
   584                 response = ETrue;
       
   585                 if(aKey == EPtiKeyQwertySpace && (State() == EInitial 
       
   586                 || State() ==EPredictiveInput))
       
   587                     {
       
   588                     response = EFalse;
       
   589                     }
       
   590                 }
       
   591                 break;
       
   592             }
       
   593         }
       
   594 #ifdef RD_INTELLIGENT_TEXT_INPUT        
       
   595         }
       
   596 #endif
       
   597     
       
   598     if(iMode == ECangJie)
       
   599         {
       
   600         if (aKey >= EPtiKeyQwertyA && aKey <= EPtiKeyQwertyZ)
       
   601             {
       
   602             response = ETrue;
       
   603             }
       
   604         }
       
   605     
       
   606     if(iMode == EZhuyin || iMode == EZhuyinFind)
       
   607         {
       
   608 #ifdef RD_INTELLIGENT_TEXT_INPUT        
       
   609         if(EPtiKeyboardQwerty4x10 == keyboardType ||
       
   610            EPtiKeyboardQwerty3x11 == keyboardType )
       
   611             {
       
   612             TBuf<KMaxName> lowerdata;
       
   613             iPtiEngine->MappingDataForKey((TPtiKey)aKey, lowerdata, EPtiCaseLower);
       
   614        //     TInt ZhuyinUnicodeCur =0;
       
   615             for(TInt i=0;i<lowerdata.Length();i++)
       
   616                 {
       
   617                 if(lowerdata[i]==KZhuyinIndicator)
       
   618                     {
       
   619                 response = ETrue;
       
   620                 }   
       
   621                 }
       
   622             }
       
   623         else if( EPtiKeyboardCustomQwerty == keyboardType)        
       
   624             {
       
   625 			if((aKey >= EPtiKeyQwertyA && aKey <= EPtiKeyQwertyZ))
       
   626     			{
       
   627 				response = ETrue;        
       
   628     			}       	
       
   629             }
       
   630         else if (  EPtiKeyboardHalfQwerty == keyboardType )
       
   631             {
       
   632             if((aKey >= EPtiKeyQwertyA && aKey <= EPtiKeyQwertyZ) || 
       
   633                     (aKey >= EPtiKey0 && aKey <= EPtiKey9) ||
       
   634                     aKey == EPtiKeyQwertySpace )
       
   635                 {
       
   636                 response = ETrue;        
       
   637                 }  
       
   638             }
       
   639         else
       
   640             {
       
   641 #endif
       
   642         if((aKey >= EPtiKeyQwertyA && aKey <= EPtiKeyQwertyZ) ||
       
   643             (aKey >= EPtiKeyQwerty0 && aKey <= EPtiKeyQwerty9)||
       
   644             (aKey == EPtiKeyQwertySemicolon) ||
       
   645             (aKey == EPtiKeyQwertyApostrophe) ||
       
   646             (aKey == EPtiKeyQwertyComma) ||
       
   647             (aKey == EPtiKeyQwertyFullstop) ||
       
   648             (aKey == EPtiKeyQwertySlash))
       
   649             {
       
   650             response = ETrue;        
       
   651             }
       
   652         }
       
   653 #ifdef RD_INTELLIGENT_TEXT_INPUT        
       
   654         }
       
   655 #endif        
       
   656 #ifdef RD_INTELLIGENT_TEXT_INPUT        
       
   657     if(EPtiKeyboardQwerty4x12 == iPtiEngine->KeyboardType())
       
   658         {
       
   659 #endif
       
   660     if(iMode == EZhuyin && IsFlagSet(ESupportZhuyinPhrase) && aKey == EPtiKeyQwertyApostrophe)
       
   661         {
       
   662         response = ETrue;
       
   663         }
       
   664 #ifdef RD_INTELLIGENT_TEXT_INPUT        
       
   665         }
       
   666 #endif
       
   667     return response;
       
   668     }
       
   669 
       
   670 TBool CAknFepUIManagerChinese::IsQwertyZhuyinToneMarkKey(TInt aKey) const
       
   671     {
       
   672     // only return ETrue when qwerty and zhuyin symbol input supported for corresponding key
       
   673     TInt supportSCTToneMarks = EFalse;
       
   674     MPtiCoreInfo* ptiCoreInfo = iPtiEngine->CoreInfo(EPtiEngineZhuyin);
       
   675 #ifdef RD_INTELLIGENT_TEXT_INPUT        
       
   676     TPtiKeyboardType keyboardType = iPtiEngine->KeyboardType();
       
   677 #endif
       
   678 
       
   679     if(ptiCoreInfo)
       
   680         {
       
   681         supportSCTToneMarks = ptiCoreInfo->CapsBits() & ESupportSCTToneMarks;
       
   682         }
       
   683 
       
   684     ptiCoreInfo = iPtiEngine->CoreInfo(EPtiEngineZhuyinByPhrase);
       
   685     if(ptiCoreInfo)    
       
   686         {
       
   687         supportSCTToneMarks = 
       
   688                     supportSCTToneMarks || (ptiCoreInfo->CapsBits() & ESupportSCTToneMarks);
       
   689         }
       
   690 
       
   691     if(iQwertyMode && (iMode == EZhuyin) && supportSCTToneMarks)
       
   692         {
       
   693 #ifdef RD_INTELLIGENT_TEXT_INPUT 
       
   694         if( keyboardType == EPtiKeyboardQwerty4x12)
       
   695             {
       
   696 #endif            
       
   697             if(aKey == EPtiKeyQwerty3 || aKey == EPtiKeyQwerty4 || aKey == EPtiKeyQwerty6 || aKey == EPtiKeyQwerty7)
       
   698                 {
       
   699                 return ETrue;
       
   700                 }
       
   701             else
       
   702                 {
       
   703                 return EFalse;
       
   704                 }
       
   705 #ifdef RD_INTELLIGENT_TEXT_INPUT 
       
   706             }
       
   707         else if( keyboardType == EPtiKeyboardQwerty4x10 || keyboardType == EPtiKeyboardQwerty3x11)
       
   708             {
       
   709             if(aKey == EPtiKeyQwertyE || aKey == EPtiKeyQwertyR || aKey == EPtiKeyQwertyY || aKey == EPtiKeyQwertyU)
       
   710                 {
       
   711                 return ETrue;
       
   712                 }
       
   713             else
       
   714                 {
       
   715                 return EFalse;
       
   716                 }
       
   717             }
       
   718 #endif        
       
   719         }
       
   720     else 
       
   721         {
       
   722         return EFalse;
       
   723         }
       
   724     return EFalse;
       
   725     }
       
   726 
       
   727 // ---------------------------------------------------------------------------
       
   728 // CAknFepUIManagerChinese::GetLatestDeliberateSelection
       
   729 // 
       
   730 // 
       
   731 // ---------------------------------------------------------------------------
       
   732 //
       
   733 TPtr CAknFepUIManagerChinese::GetLatestDeliberateSelection() const
       
   734     {
       
   735     // need to cast around constness, as this is a const get but needs to call Des which isn't const
       
   736     typedef TBufC<MAknFepUICtrlInputPane::EMaxInputCharsPinyinPopupNotIncludingToneMark> pinyinBuffer;
       
   737     pinyinBuffer* bufPtr = CONST_CAST(pinyinBuffer*, &iLatestDeliberateSelection);
       
   738     return TPtr(bufPtr->Des());
       
   739     }
       
   740 
       
   741 // ---------------------------------------------------------------------------
       
   742 // CAknFepUIManagerChinese::FepUIState
       
   743 // 
       
   744 // 
       
   745 // ---------------------------------------------------------------------------
       
   746 //
       
   747 TAknFepInputStateBase* CAknFepUIManagerChinese::FepUIState()
       
   748     {
       
   749     return &iFepUiState;
       
   750     }
       
   751 
       
   752 // ---------------------------------------------------------------------------
       
   753 // CAknFepUIManagerChinese::UIContainer
       
   754 // 
       
   755 // 
       
   756 // ---------------------------------------------------------------------------
       
   757 //
       
   758 MAknFepUICtrlContainerChinese* CAknFepUIManagerChinese::UIContainer() const
       
   759     {
       
   760     return iContainerPane;
       
   761     }
       
   762 
       
   763 // ---------------------------------------------------------------------------
       
   764 // CAknFepUIManagerChinese::IsValidShiftKeyPress
       
   765 // 
       
   766 // 
       
   767 // ---------------------------------------------------------------------------
       
   768 //
       
   769 TBool CAknFepUIManagerChinese::IsValidShiftKeyPress() const
       
   770     {
       
   771     TUIState state = State();
       
   772     TInt mode = FepMan()->InputMode();
       
   773 #ifdef RD_INTELLIGENT_TEXT_INPUT        
       
   774     TPtiKeyboardType kbdType = iFepMan->KeyboardLayout();
       
   775     if (EPtiKeyboardQwerty4x12 == kbdType)
       
   776         {
       
   777 #endif
       
   778     if (mode == EPinyin || mode == EZhuyin || mode == EStroke || mode == ECangJie)
       
   779         {
       
   780         if (mode == EZhuyin && state == EPredictiveInput)
       
   781             {
       
   782             return EFalse;
       
   783             }
       
   784         if (mode == EZhuyin && state == EPredictiveCandidate)
       
   785             {
       
   786             return ETrue;
       
   787             }
       
   788         
       
   789         if (state == EEntry || state == ECandidate || state == EPredictiveCandidate)
       
   790             {
       
   791             return EFalse;
       
   792             }
       
   793         }
       
   794 #ifdef RD_INTELLIGENT_TEXT_INPUT        
       
   795         }
       
   796     else if(EPtiKeyboardQwerty4x10 == kbdType ||
       
   797             EPtiKeyboardQwerty3x11 == kbdType ||
       
   798             EPtiKeyboardHalfQwerty == kbdType ||
       
   799             EPtiKeyboardCustomQwerty == kbdType)
       
   800         {
       
   801     	if (mode == EPinyin || mode == EZhuyin || mode == EStroke || mode == ECangJie)
       
   802             {
       
   803             if ( state == EEntry || state == ECandidate || /*state == EPredictiveCandidate ||*/ 
       
   804                 state == EPredictiveInput || state == EMiniQwertyEdit || 
       
   805                 state == EZhuyinSpelling || state == EZhuyinCandidate )
       
   806                 {
       
   807                 return EFalse;
       
   808                 }         
       
   809             }
       
   810         }
       
   811 #endif    
       
   812     
       
   813     return ETrue;
       
   814     }
       
   815 
       
   816 #ifdef RD_INTELLIGENT_TEXT_INPUT        
       
   817 TBool CAknFepUIManagerChinese::IsValidFnKeyPress() const
       
   818     {
       
   819     TUIState uiState = State();
       
   820     TInt mode = FepMan()->InputMode();
       
   821     if (mode == EPinyin || mode == EZhuyin || mode == EStroke || mode == ECangJie)
       
   822         {
       
   823         //if (uiState == EPredictiveCandidate || uiState == ECandidate)
       
   824         if (uiState == EEntry || 
       
   825         	uiState == ECandidate ||
       
   826         	uiState == EPredictiveCandidate || 
       
   827             uiState == EPredictiveInput ||
       
   828             uiState == EMiniQwertyEdit || uiState == EZhuyinSpelling ||
       
   829             uiState == EZhuyinCandidate )
       
   830             {
       
   831             return EFalse;
       
   832             }         
       
   833         }
       
   834     							   
       
   835     return ETrue;
       
   836     }
       
   837 
       
   838 TBool CAknFepUIManagerChinese::IsValidLongChrKeyPress() const
       
   839     {
       
   840     TUIState state = State();
       
   841     TInt mode = FepMan()->InputMode();
       
   842     if ( mode == EPinyin || mode == EZhuyin || mode == EStroke )
       
   843         {
       
   844         if ( state == EEntry || state == EPredictiveInput )
       
   845             {
       
   846             return EFalse;
       
   847             }
       
   848         }
       
   849     return ETrue;
       
   850     }
       
   851 
       
   852 #endif
       
   853 
       
   854 // ---------------------------------------------------------------------------
       
   855 // CAknFepUIManagerChinese::SetInputLanguageL
       
   856 // 
       
   857 // 
       
   858 // ---------------------------------------------------------------------------
       
   859 //
       
   860 void CAknFepUIManagerChinese::SetInputLanguageL(TLanguage aLanguage)
       
   861     {
       
   862     iLanguage = aLanguage;
       
   863     CloseUI();
       
   864     }
       
   865 
       
   866 
       
   867 // ---------------------------------------------------------------------------
       
   868 // CAknFepUIManagerChinese::CAknFepUIManagerChinese
       
   869 // 
       
   870 // 
       
   871 // ---------------------------------------------------------------------------
       
   872 //
       
   873 CAknFepUIManagerChinese::CAknFepUIManagerChinese(MAknFepManagerUIInterface* aFepMan, 
       
   874                                                  CAknFepCaseManager* aCaseMan)
       
   875     : CAknFepUIManagerBase(aFepMan, aCaseMan),
       
   876       iFepUiState(NULL, NULL),
       
   877       iPrevMode(ENumber),
       
   878       iQwertyMode(ETrue)
       
   879     {
       
   880     }
       
   881 
       
   882 // ---------------------------------------------------------------------------
       
   883 // CAknFepUIManagerChinese::ConstructL
       
   884 // 
       
   885 // 
       
   886 // ---------------------------------------------------------------------------
       
   887 //
       
   888 void CAknFepUIManagerChinese::ConstructL(TLanguage aLanguage)
       
   889     {
       
   890     CAknFepUIManagerBase::ConstructL(aLanguage);
       
   891     iContainerPane = FepMan()->UiInterface()->NewAknFepUICtrlContainerChineseL();
       
   892     ResetFlags();  
       
   893     }
       
   894 
       
   895 // ---------------------------------------------------------------------------
       
   896 // CAknFepUIManagerChinese::QueryPtiEngine
       
   897 // 
       
   898 // 
       
   899 // ---------------------------------------------------------------------------
       
   900 //
       
   901 void CAknFepUIManagerChinese::QueryPtiEngine(void)
       
   902     {
       
   903     MPtiLanguage* ptiLang = iPtiEngine->CurrentLanguage();
       
   904 
       
   905     // query ptiengine 
       
   906     if(ptiLang)
       
   907         {
       
   908         SetFlag(EQueryPtiEngineAlready);
       
   909         if(ptiLang->HasInputMode(EPtiEnginePinyinByPhrase))
       
   910             {
       
   911             SetFlag(ESupportPinyinPhrase);
       
   912             }
       
   913             
       
   914         if(ptiLang->HasInputMode(EPtiEngineZhuyinByPhrase))
       
   915             {
       
   916             SetFlag(ESupportZhuyinPhrase);
       
   917             }
       
   918             
       
   919         if (ptiLang->HasInputMode(EPtiEngineStrokeByPhrase))
       
   920             {
       
   921             SetFlag(ESupportStrokePhrase);
       
   922             }
       
   923         }
       
   924     }
       
   925 
       
   926 void CAknFepUIManagerChinese::ChangeStatetItut(TUIState aState)
       
   927     {
       
   928     switch(aState)
       
   929         {
       
   930         case EInitial:
       
   931             {
       
   932             switch(iMode)
       
   933             {
       
   934             case EPinyin:
       
   935             case EZhuyin:
       
   936             case EStroke:
       
   937             case ECangJie: 
       
   938                 iFepUiState = TAknFepInputStateInitialChineseGeneric(this, iContainerPane);
       
   939                 break;
       
   940             case EZhuyinFind:
       
   941                 iFepUiState = TAknFepInputStateInitialZhuyinFind(this, iContainerPane);
       
   942                 break;
       
   943             case EStrokeFind:
       
   944                 iFepUiState = TAknFepInputStateInitialStrokeFind(this, iContainerPane);
       
   945                 break;
       
   946             case ELatin:
       
   947                 {
       
   948                 if (iPredictive)
       
   949                     {
       
   950                     iFepUiState = TAknFepInputStateInitialWesternPredictive(this);
       
   951                     }
       
   952                 else
       
   953                     {
       
   954                     iFepUiState = TAknFepInputStateInitialLatinMultitap(this);
       
   955                     }
       
   956                 }
       
   957                 break;
       
   958             case ENumber:
       
   959                 {
       
   960                 // Map directly to the resources...
       
   961                 iFepUiState = TAknFepInputStateInitialNumber(this);
       
   962                 break;
       
   963                 }
       
   964             default:
       
   965                 AknFepPanic(EAknFepPanicBadInputState);
       
   966             }
       
   967             break;
       
   968             }
       
   969         case EEntry:
       
   970             {
       
   971             switch(iMode)
       
   972                 {
       
   973                 case EPinyin:
       
   974                     if(IsFlagSet(ESupportPinyinPhrase))
       
   975                         {
       
   976                         iFepUiState = TAknFepInputStateEntryPinyinPhrase(this,iContainerPane);
       
   977                         }
       
   978                     else 
       
   979                         {
       
   980                         iFepUiState = TAknFepInputStateEntryPinyin(this,iContainerPane);
       
   981                         }
       
   982                     break;
       
   983                 case EZhuyin:
       
   984                     if(IsFlagSet(ESupportZhuyinPhrase))
       
   985                         {	
       
   986                         iFepUiState = TAknFepInputStateEntryZhuyinPhrase(this,iContainerPane);
       
   987                         }
       
   988                     else
       
   989                         {
       
   990                         iFepUiState = TAknFepInputStateEntryZhuyin(this,iContainerPane);
       
   991                         }
       
   992                     break;
       
   993                 case EStroke:
       
   994                     if (IsFlagSet(ESupportStrokePhrase))
       
   995                         {
       
   996                         iFepUiState = TAknFepInputStateEntryStrokePhrase(this,iContainerPane);
       
   997                         }
       
   998                     else
       
   999                         {
       
  1000                         iFepUiState = TAknFepInputStateEntryStroke(this,iContainerPane);
       
  1001                         }
       
  1002                     break;
       
  1003                 case ELatin:
       
  1004                     iFepUiState = TAknFepInputStateEntryWesternPredictive(this);
       
  1005                     break;
       
  1006                 default:
       
  1007                     AknFepPanic(EAknFepPanicBadInputState);
       
  1008                 }
       
  1009             }
       
  1010             break;
       
  1011         case ECandidate:
       
  1012             {
       
  1013             // modify for phrase creation
       
  1014             FepMan()->EntryPhrase( ETrue );
       
  1015             FepMan()->EnableKeyStar( EFalse );
       
  1016             switch ( iMode )
       
  1017                 {
       
  1018                 case EPinyin:
       
  1019                     {
       
  1020                     if ( IsFlagSet( ESupportPinyinPhrase ) )
       
  1021                         {
       
  1022                         iFepUiState
       
  1023                             = TAknFepUiInputStateCandidatePinyinAndStrokePhrase(
       
  1024                                 this, iContainerPane );
       
  1025                         }
       
  1026                     }
       
  1027                     break;
       
  1028                 case EStroke:
       
  1029                     {
       
  1030                     if ( IsFlagSet( ESupportStrokePhrase ) )
       
  1031                         {
       
  1032                         iFepUiState
       
  1033                             = TAknFepInputStateCandidateStrokePhrase(
       
  1034                                 this, iContainerPane );
       
  1035                         }
       
  1036                     }
       
  1037                     break;
       
  1038                 case EZhuyin:
       
  1039                     {
       
  1040                     if ( IsFlagSet( ESupportZhuyinPhrase ) )
       
  1041                         {
       
  1042                         iFepUiState
       
  1043                             = TAknFepInputStateCandidateChinesePhrase( this,
       
  1044                                 iContainerPane );
       
  1045                         }
       
  1046                     }
       
  1047                     break;
       
  1048                 default:
       
  1049                     {
       
  1050                     iFepUiState = TAknFepInputStateCandidateChinese( this,
       
  1051                         iContainerPane );
       
  1052                     }
       
  1053                 }
       
  1054             }
       
  1055             break;
       
  1056             
       
  1057         case EPredictiveCandidate:
       
  1058             {
       
  1059             // add for phrase creation
       
  1060             FepMan()->PhraseCreation( EFalse );
       
  1061             FepMan()->PinyinPhraseCreation( EFalse );
       
  1062             FepMan()->EntryPhrase( ETrue );
       
  1063             FepMan()->EnableKeyStar( ETrue );
       
  1064             TRAP_IGNORE( FepMan()->UpdateCbaL( R_AKNFEP_SOFTKEYS_PHRASE_CREATION_SELECT_CANCEL_SELECT ) );
       
  1065             iContainerPane->PinyinPopupWindow()->ResetStrokeArray();
       
  1066             switch(iMode)
       
  1067                 {
       
  1068                 case EPinyin:
       
  1069                     if(IsFlagSet(ESupportPinyinPhrase))
       
  1070                         {
       
  1071                         iFepUiState = TAknFepInputStatePredictiveCandidatePinyinPhrase(
       
  1072                                                                     this,iContainerPane);
       
  1073                         }
       
  1074                     else
       
  1075                         {
       
  1076                         iFepUiState = TAknFepInputStatePredictiveCandidatePinyin(
       
  1077                                                              this,iContainerPane);     
       
  1078                         }
       
  1079                     break;
       
  1080                 case EStroke:
       
  1081                     if (IsFlagSet(ESupportStrokePhrase))
       
  1082                         {
       
  1083                         iFepUiState = TAknFepInputStatePredictiveCandidateStrokePhrase(
       
  1084                                                                    this,iContainerPane);     
       
  1085                         }
       
  1086                     else
       
  1087                         {
       
  1088                         iFepUiState = TAknFepInputStatePredictiveCandidateStroke(
       
  1089                                                               this,iContainerPane);     
       
  1090                         } 
       
  1091                     break;
       
  1092                 case EZhuyin:
       
  1093                         if(IsFlagSet(ESupportZhuyinPhrase))
       
  1094                             {
       
  1095                             iFepUiState = TAknFepInputStatePredictiveCandidateChinesePhrase(
       
  1096                                                                         this,iContainerPane);
       
  1097                             }
       
  1098                         else
       
  1099                             {
       
  1100                             iFepUiState = TAknFepInputStatePredictiveCandidate(this,iContainerPane);
       
  1101                             }
       
  1102                     break;
       
  1103                 default:
       
  1104                 AknFepPanic(EAknFepPanicBadInputState);
       
  1105                 }
       
  1106             }
       
  1107             break;
       
  1108         case EPredictiveInput:
       
  1109             if((IsFlagSet(ESupportPinyinPhrase) || IsFlagSet(ESupportZhuyinPhrase) 
       
  1110              || IsFlagSet(ESupportStrokePhrase)) 
       
  1111                && (iMode != ECangJie))
       
  1112                 {
       
  1113                 iFepUiState = TAknFepInputStatePredictiveInputChinesePhrase(this, iContainerPane);
       
  1114                 }
       
  1115             else
       
  1116                 {
       
  1117                 iFepUiState = TAknFepInputStatePredictiveInputChinese(this, iContainerPane);
       
  1118                 }
       
  1119             break;
       
  1120         // add for phrase creation
       
  1121         case EStrokeSequenceEdit:
       
  1122             if ( IsFlagSet( ESupportStrokePhrase ) && ( iMode != ECangJie ) )
       
  1123                 {
       
  1124                 FepMan()->EnableKeyStar( EFalse );
       
  1125                 iFepUiState = TAknFepInputStateEditStrokePhrase( this, iContainerPane ); 
       
  1126                 }
       
  1127             break;
       
  1128         // add for phrase creation
       
  1129         case EKeySequenceEdit:
       
  1130             if ( IsFlagSet( ESupportPinyinPhrase ) && ( iMode != ECangJie ) )
       
  1131                 {
       
  1132                 iFepUiState = TAknFepInputStateEntryPinyinPhraseCreation( this, iContainerPane );
       
  1133                 }
       
  1134             break;
       
  1135         // add for phrase creation
       
  1136         case EZhuyinSequenceEdit:
       
  1137             if ( IsFlagSet( ESupportZhuyinPhrase ) && ( iMode != ECangJie ) )
       
  1138                 {
       
  1139                 iFepUiState = TAknFepInputStateEntryZhuyinPhraseCreation( this, iContainerPane );
       
  1140                 }
       
  1141             break;
       
  1142         // add for phrase creation
       
  1143         case ESpellingSelection:
       
  1144             if ( IsFlagSet( ESupportPinyinPhrase ) && (iMode != ECangJie) )
       
  1145                 {
       
  1146                 FepMan()->EnableKeyStar( EFalse );
       
  1147                 iFepUiState = TAknFepInputStateSpellingPinyinPhraseCreation( this, iContainerPane );
       
  1148                 }
       
  1149             break;
       
  1150         // add for phrase creation
       
  1151         case ECandidateSelection:
       
  1152             if ( IsFlagSet (ESupportPinyinPhrase) && ( iMode != ECangJie ) )
       
  1153                 {
       
  1154                 FepMan()->EnableKeyStar( EFalse );
       
  1155                 iFepUiState = TAknFepInputStateCandidatePinyinPhraseCreation( this, iContainerPane );
       
  1156                 }
       
  1157             break;
       
  1158         default:
       
  1159             AknFepPanic(EAknFepPanicBadInputState);
       
  1160         }
       
  1161     
       
  1162     }
       
  1163     
       
  1164 void CAknFepUIManagerChinese::ChangeStateQwerty(TUIState aState)
       
  1165     {
       
  1166 #ifdef RD_INTELLIGENT_TEXT_INPUT        
       
  1167     TPtiKeyboardType kbdType = iFepMan->KeyboardLayout();    
       
  1168 #endif    
       
  1169     switch(aState)
       
  1170         {
       
  1171         case EQwerty:
       
  1172             if(iMode == EPinyin || iMode == EStroke || iMode == EZhuyin || iMode == ECangJie)
       
  1173                 {
       
  1174                 iFepUiState = TAknFepInputStateInitialChineseGenericQwerty(this, iMode);
       
  1175                 }
       
  1176             else if(iMode == EStrokeFind)
       
  1177                 {
       
  1178 #ifdef RD_INTELLIGENT_TEXT_INPUT 
       
  1179                 if(EPtiKeyboardQwerty4x10 == kbdType ||
       
  1180                    EPtiKeyboardQwerty3x11 == kbdType)
       
  1181                     {
       
  1182                     iFepUiState = TAknFepInputStateStrokeFindMiniQwerty(this,iMode);
       
  1183                     }
       
  1184                 else
       
  1185                     {
       
  1186 #endif //RD_INTELLIGENT_TEXT_INPUT                
       
  1187                 iFepUiState = TAknFepInputStateStrokeFindQwerty(this,iContainerPane);
       
  1188 #ifdef RD_INTELLIGENT_TEXT_INPUT 
       
  1189                     }
       
  1190 #endif                
       
  1191                 }
       
  1192             else if(iMode == EZhuyinFind)
       
  1193                 {
       
  1194 #ifdef RD_INTELLIGENT_TEXT_INPUT 
       
  1195                 if(EPtiKeyboardQwerty4x10 == kbdType ||
       
  1196                    EPtiKeyboardQwerty3x11 == kbdType)
       
  1197                     {
       
  1198                     iFepUiState = TAknFepInputStateZhuyinFindMiniQwerty(this,iMode);
       
  1199                     }
       
  1200                 else
       
  1201                     {
       
  1202 #endif //RD_INTELLIGENT_TEXT_INPUT                 
       
  1203                 iFepUiState = TAknFepInputStateZhuyinFindQwerty(this,iContainerPane);
       
  1204 #ifdef RD_INTELLIGENT_TEXT_INPUT 
       
  1205                     }
       
  1206 #endif  
       
  1207                 }
       
  1208             break;
       
  1209 #ifdef RD_INTELLIGENT_TEXT_INPUT
       
  1210 #ifdef __HALF_QWERTY_KEYPAD
       
  1211         case EHalfQwerty: 
       
  1212             if (iMode == EPinyin || iMode == EStroke || iMode == EZhuyin)
       
  1213                 {
       
  1214                 iFepUiState = TAknFepInputStateInitialChineseGenericHalfQwerty(
       
  1215                         this, iMode);
       
  1216                 }
       
  1217             else if(iMode ==EStrokeFind)
       
  1218                 {
       
  1219                 iFepUiState = TAknFepInputStateStrokeFindHalfQwerty(this,
       
  1220                                             iMode);
       
  1221                 }    
       
  1222             else if(iMode ==EZhuyinFind)
       
  1223                 {
       
  1224                 iFepUiState = TAknFepInputStateZhuyinFindHalfQwerty(this,
       
  1225                                                             iMode);
       
  1226                 }
       
  1227             break;
       
  1228 #endif
       
  1229 #endif
       
  1230         case EEntry:
       
  1231             {
       
  1232             switch(iMode)
       
  1233                 {
       
  1234                 case EZhuyin:
       
  1235                     if(IsFlagSet(ESupportZhuyinPhrase))
       
  1236                         {
       
  1237 #ifdef RD_INTELLIGENT_TEXT_INPUT        
       
  1238                         if ( EPtiKeyboardQwerty4x10 == kbdType ||
       
  1239                              EPtiKeyboardQwerty3x11 == kbdType ||
       
  1240                              EPtiKeyboardCustomQwerty == kbdType)
       
  1241                            {
       
  1242                            iFepUiState = TAknFepInputStateEntryMiniQwertyZhuyinPhrase(this, iContainerPane); 
       
  1243                            }
       
  1244                         else if(EPtiKeyboardHalfQwerty == kbdType)
       
  1245                            {
       
  1246                            iFepUiState = TAknFepInputStateEntryHalfQwertyZhuyinPhrase(this, iContainerPane);
       
  1247                            }
       
  1248                         else
       
  1249                            {
       
  1250 #endif
       
  1251                         iFepUiState = TAknFepInputStateEntryQwertyZhuyinPhrase(this, 
       
  1252                                                                                iContainerPane);
       
  1253 #ifdef RD_INTELLIGENT_TEXT_INPUT        
       
  1254                            }   
       
  1255 #endif
       
  1256                         }
       
  1257                     else
       
  1258                         {
       
  1259                         iFepUiState = TAknFepInputStateEntryQwertyZhuyin(this, iContainerPane);
       
  1260                         }
       
  1261                     
       
  1262                     break;
       
  1263                 case EPinyin:
       
  1264                     if(IsFlagSet(ESupportPinyinPhrase))
       
  1265                         {
       
  1266 #ifdef RD_INTELLIGENT_TEXT_INPUT        
       
  1267                         if ( EPtiKeyboardQwerty4x10 == kbdType ||
       
  1268                              EPtiKeyboardQwerty3x11 == kbdType ||
       
  1269                              EPtiKeyboardCustomQwerty == kbdType)                            
       
  1270                             { 
       
  1271                             iFepUiState = TAknFepInputStateEntryMiniQwertyPinyinPhrase(this, iContainerPane);
       
  1272                             }
       
  1273                         else if (EPtiKeyboardHalfQwerty == kbdType)
       
  1274                             {
       
  1275                             iFepUiState = TAknFepInputStateEntryHalfQwertyPinyinPhrase(this, iContainerPane);
       
  1276                             }
       
  1277                         else
       
  1278                             {
       
  1279 #endif
       
  1280                         iFepUiState = TAknFepInputStateEntryQwertyPinyinPhrase(
       
  1281                                                            this, iContainerPane);
       
  1282 #ifdef RD_INTELLIGENT_TEXT_INPUT        
       
  1283                             }
       
  1284 #endif
       
  1285                         }
       
  1286                     else
       
  1287                         {
       
  1288                         iFepUiState = TAknFepInputStateEntryQwertyPinyin(this, iContainerPane);
       
  1289                         }
       
  1290                     break;
       
  1291                 case EStroke:
       
  1292                     if (IsFlagSet(ESupportStrokePhrase))
       
  1293                         {
       
  1294 #ifdef RD_INTELLIGENT_TEXT_INPUT        
       
  1295                         if ( EPtiKeyboardQwerty4x10 == kbdType ||
       
  1296                              EPtiKeyboardQwerty3x11 == kbdType ||
       
  1297                              EPtiKeyboardCustomQwerty == kbdType)                        	
       
  1298                             {
       
  1299                             iFepUiState = TAknFepInputStateEntryMiniQwertyStrokePhrase(
       
  1300                                                                   this, iContainerPane);
       
  1301                         	}
       
  1302                         else if (EPtiKeyboardHalfQwerty == kbdType)
       
  1303                             {
       
  1304                             iFepUiState= TAknFepInputStateEntryHalfQwertyStrokePhrase(this, iContainerPane);
       
  1305                             }
       
  1306                         else
       
  1307  	                       {
       
  1308 #endif
       
  1309                         	iFepUiState = TAknFepInputStateEntryQwertyStrokePhrase(
       
  1310                                                              this, iContainerPane);
       
  1311 #ifdef RD_INTELLIGENT_TEXT_INPUT        
       
  1312  	                       }	
       
  1313 #endif
       
  1314                         }
       
  1315                     else
       
  1316                         {
       
  1317                         iFepUiState = TAknFepInputStateEntryQwertyStroke(this, iContainerPane);
       
  1318                         }
       
  1319                     break;
       
  1320                 case ECangJie:
       
  1321 #ifdef RD_INTELLIGENT_TEXT_INPUT        
       
  1322                         if ( EPtiKeyboardQwerty4x10 == kbdType ||
       
  1323                              EPtiKeyboardQwerty3x11 == kbdType ||
       
  1324                              EPtiKeyboardHalfQwerty == kbdType ||
       
  1325                              EPtiKeyboardCustomQwerty == kbdType)                    	
       
  1326                         {
       
  1327                         iFepUiState = TAknFepInputStateEntryMiniQwertyCangJie(this, iContainerPane);                    	
       
  1328                     	}
       
  1329                     else
       
  1330                     	{
       
  1331 #endif
       
  1332                     	iFepUiState = TAknFepInputStateEntryQwertyCangJie(this, iContainerPane);
       
  1333 #ifdef RD_INTELLIGENT_TEXT_INPUT        
       
  1334                     	}
       
  1335 #endif
       
  1336                     break;
       
  1337                 default:
       
  1338                     AknFepPanic(EAknFepPanicBadInputState);
       
  1339                 }
       
  1340             }
       
  1341             break;
       
  1342         case ECandidate:
       
  1343             if(iMode == EZhuyin)
       
  1344                 {
       
  1345                 if(IsFlagSet(ESupportZhuyinPhrase))
       
  1346                     {
       
  1347 #ifdef RD_INTELLIGENT_TEXT_INPUT        
       
  1348                         if ( EPtiKeyboardQwerty4x10 == kbdType ||
       
  1349                              EPtiKeyboardQwerty3x11 == kbdType ||
       
  1350                              EPtiKeyboardCustomQwerty == kbdType)                    	
       
  1351                     	{
       
  1352                     	iFepUiState = TAknFepUiInputStateCandidateMiniQwertyZhuyinPhrase(
       
  1353                                                                   this, iContainerPane);
       
  1354                     	}
       
  1355 #ifdef __HALF_QWERTY_KEYPAD
       
  1356                         else if ( EPtiKeyboardHalfQwerty == kbdType )
       
  1357                             {
       
  1358                             iFepUiState = TAknFepUiInputStateCandidateHalfQwertyChinesePhrase(
       
  1359                                                                                               this, iContainerPane);
       
  1360                             }
       
  1361 #endif
       
  1362                     else
       
  1363          	            {
       
  1364 #endif
       
  1365          	            iFepUiState = TAknFepInputStateCandidateQwertyZhuyinPhrase(
       
  1366                                                             this, iContainerPane);
       
  1367 #ifdef RD_INTELLIGENT_TEXT_INPUT        
       
  1368          	            }	
       
  1369 #endif
       
  1370                     }
       
  1371                 else
       
  1372                     {
       
  1373                     iFepUiState = TAknFepInputStateCandidateQwertyZhuyin(this, iContainerPane);
       
  1374                     }
       
  1375                 }
       
  1376 #ifdef RD_INTELLIGENT_TEXT_INPUT        
       
  1377             else if(iMode == EPinyin)
       
  1378                 {
       
  1379                 if(IsFlagSet(ESupportPinyinPhrase))
       
  1380                     {
       
  1381                         if ( EPtiKeyboardQwerty4x10 == kbdType ||
       
  1382                              EPtiKeyboardQwerty3x11 == kbdType ||
       
  1383                              EPtiKeyboardCustomQwerty == kbdType)                    	
       
  1384                         { 
       
  1385                         iFepUiState = TAknFepUiInputStateCandidateMiniQwertyPinyinAndStrokePhrase(this, iContainerPane);
       
  1386                         }
       
  1387                         else if(EPtiKeyboardHalfQwerty == kbdType)
       
  1388                         {
       
  1389                         iFepUiState=TAknFepUiInputStateCandidateHalfQwertyChinesePhrase(
       
  1390                                                                              this, iContainerPane);
       
  1391                         }
       
  1392                     }                 
       
  1393                 }
       
  1394             else if(iMode == EStroke)
       
  1395             	{
       
  1396                  if (IsFlagSet(ESupportStrokePhrase))
       
  1397                         {
       
  1398                         if ( EPtiKeyboardQwerty4x10 == kbdType ||
       
  1399                              EPtiKeyboardQwerty3x11 == kbdType ||
       
  1400                              EPtiKeyboardCustomQwerty == kbdType)                    	
       
  1401                         	{
       
  1402                             iFepUiState = TAknFepUiInputStateCandidateMiniQwertyStrokePhrase(this, iContainerPane);
       
  1403                             }
       
  1404                         else if ( EPtiKeyboardHalfQwerty == kbdType )
       
  1405                             {
       
  1406                             iFepUiState=TAknFepUiInputStateCandidateHalfQwertyChinesePhrase( this, iContainerPane);
       
  1407                             }
       
  1408                        }
       
  1409             	}
       
  1410 	        else if(iMode == ECangJie)
       
  1411 	        	{
       
  1412                 if ( EPtiKeyboardQwerty4x10 == kbdType ||
       
  1413                      EPtiKeyboardQwerty3x11 == kbdType ||
       
  1414                      EPtiKeyboardHalfQwerty == kbdType ||
       
  1415                      EPtiKeyboardCustomQwerty == kbdType)                    	
       
  1416                 {
       
  1417                 iFepUiState = TAknFepUiInputStateCandidateMiniQwertyPinyinAndStrokePhrase(
       
  1418                                                                      this, iContainerPane);
       
  1419                 }
       
  1420 	        	}
       
  1421 #endif      
       
  1422             break;
       
  1423         case EPredictiveCandidate:
       
  1424             if(iMode == EZhuyin)
       
  1425                 {
       
  1426                 if(IsFlagSet(ESupportZhuyinPhrase))
       
  1427                     {
       
  1428 #ifdef RD_INTELLIGENT_TEXT_INPUT        
       
  1429                     if ( EPtiKeyboardQwerty4x10 == kbdType ||
       
  1430                          EPtiKeyboardQwerty3x11 == kbdType ||
       
  1431                          EPtiKeyboardCustomQwerty == kbdType)                    	
       
  1432                         {
       
  1433                     	iFepUiState = TAknFepInputStatePredictiveCandidateMiniQwertyChinesePhrase(
       
  1434                                                                           this, iContainerPane);
       
  1435                     	}
       
  1436 #ifdef __HALF_QWERTY_KEYPAD
       
  1437                     else if( EPtiKeyboardHalfQwerty == kbdType )
       
  1438                         {
       
  1439                         iFepUiState = TAknFepInputStatePredictiveCandidateHalfQwertyChinesePhrase(
       
  1440                                                                            this, iContainerPane);
       
  1441                         }
       
  1442 #endif
       
  1443                     else
       
  1444                     	{
       
  1445 #endif
       
  1446                     	iFepUiState = TAknFepInputStatePredictiveCandidateQwertyZhuyinPhrase(
       
  1447                                                                       this, iContainerPane);                    	
       
  1448 #ifdef RD_INTELLIGENT_TEXT_INPUT        
       
  1449                         }	
       
  1450 #endif
       
  1451                     }
       
  1452                 else
       
  1453                     {
       
  1454                     iFepUiState = TAknFepInputStatePredictiveCandidateQwertyZhuyin(
       
  1455                                                               this, iContainerPane);
       
  1456                     }
       
  1457                 
       
  1458                 }
       
  1459 #ifdef RD_INTELLIGENT_TEXT_INPUT        
       
  1460             else if(iMode == EPinyin)
       
  1461                 {
       
  1462                 if(IsFlagSet(ESupportPinyinPhrase))
       
  1463                     {
       
  1464                     if ( EPtiKeyboardQwerty4x10 == kbdType ||
       
  1465                          EPtiKeyboardQwerty3x11 == kbdType ||
       
  1466                          EPtiKeyboardCustomQwerty == kbdType)                    	
       
  1467                         {
       
  1468                         iFepUiState = TAknFepInputStatePredictiveCandidateMiniQwertyChinesePhrase(
       
  1469                                                                              this, iContainerPane);
       
  1470                         }
       
  1471 #ifdef __HALF_QWERTY_KEYPAD
       
  1472                     else if( EPtiKeyboardHalfQwerty == kbdType )
       
  1473                         {
       
  1474                         iFepUiState = TAknFepInputStatePredictiveCandidateHalfQwertyChinesePhrase(
       
  1475                                                                            this, iContainerPane);
       
  1476                         }
       
  1477 #endif
       
  1478                     }                 
       
  1479                 }
       
  1480            else if(iMode == EStroke)
       
  1481             	{
       
  1482                  if (IsFlagSet(ESupportStrokePhrase))
       
  1483                         {
       
  1484                         if ( EPtiKeyboardQwerty4x10 == kbdType ||
       
  1485                              EPtiKeyboardQwerty3x11 == kbdType ||
       
  1486                              EPtiKeyboardCustomQwerty == kbdType)                    	
       
  1487                         	{
       
  1488                             iFepUiState = 
       
  1489                                    TAknFepInputStatePredictiveCandidateMiniQwertyChinesePhrase(
       
  1490                                                                           this, iContainerPane);
       
  1491                         	}
       
  1492 #ifdef __HALF_QWERTY_KEYPAD
       
  1493                     else if( EPtiKeyboardHalfQwerty == kbdType )
       
  1494                         {
       
  1495                         iFepUiState = TAknFepInputStatePredictiveCandidateHalfQwertyChinesePhrase(
       
  1496                                                                            this, iContainerPane);
       
  1497                         }
       
  1498 #endif
       
  1499                        }
       
  1500 	
       
  1501             	}
       
  1502             else if(iMode == ECangJie)
       
  1503             	{
       
  1504 
       
  1505                 if ( EPtiKeyboardQwerty4x10 == kbdType ||
       
  1506                      EPtiKeyboardQwerty3x11 == kbdType ||
       
  1507                      EPtiKeyboardHalfQwerty == kbdType ||
       
  1508                      EPtiKeyboardCustomQwerty == kbdType)                    	
       
  1509                  {
       
  1510                  iFepUiState = TAknFepInputStatePredictiveCandidateMiniQwertyChinesePhrase(
       
  1511                                                                        this, iContainerPane);
       
  1512                  }
       
  1513 
       
  1514             	}
       
  1515 #endif
       
  1516             break;
       
  1517         case EPredictiveInput:
       
  1518             {
       
  1519             switch(iMode)
       
  1520                 {
       
  1521                 case EPinyin:
       
  1522                     if(IsFlagSet(ESupportPinyinPhrase))
       
  1523                         {
       
  1524 #ifdef RD_INTELLIGENT_TEXT_INPUT        
       
  1525                         if ( EPtiKeyboardQwerty4x10 == kbdType ||
       
  1526                              EPtiKeyboardQwerty3x11 == kbdType ||
       
  1527                              EPtiKeyboardHalfQwerty == kbdType ||
       
  1528                              EPtiKeyboardCustomQwerty == kbdType)                    	
       
  1529                             {
       
  1530                             iFepUiState = TAknFepInputStatePredictiveInputMiniQwertyChinesePhrase/*TAknFepInputStatePredictiveInputQwertyPinyinPhrase*/(this, iContainerPane);
       
  1531                             }
       
  1532                         else
       
  1533                             {
       
  1534 #endif
       
  1535                             iFepUiState = TAknFepInputStatePredictiveInputQwertyPinyinPhrase(
       
  1536                                                                         this, iContainerPane);
       
  1537 #ifdef RD_INTELLIGENT_TEXT_INPUT        
       
  1538 							}
       
  1539 #endif
       
  1540                         }
       
  1541                     else
       
  1542                         {
       
  1543                         iFepUiState = TAknFepInputStatePredictiveInputQwertyPinyin(
       
  1544                                                               this, iContainerPane);
       
  1545                         }
       
  1546                     break;
       
  1547                 case EStroke:                
       
  1548                     if(IsFlagSet(ESupportStrokePhrase))
       
  1549                         {
       
  1550 #ifdef RD_INTELLIGENT_TEXT_INPUT        
       
  1551                         if ( EPtiKeyboardQwerty4x10 == kbdType ||
       
  1552                              EPtiKeyboardQwerty3x11 == kbdType ||
       
  1553                              EPtiKeyboardHalfQwerty == kbdType ||
       
  1554                              EPtiKeyboardCustomQwerty == kbdType)                    	
       
  1555                       	   {
       
  1556                            iFepUiState = TAknFepInputStatePredictiveInputMiniQwertyChinesePhrase(
       
  1557                                                                              this, iContainerPane);
       
  1558                        	   }
       
  1559                         else
       
  1560          	               {
       
  1561 #endif
       
  1562          	               iFepUiState = TAknFepInputStatePredictiveInputQwertyStrokePhrase(
       
  1563                                                                      this, iContainerPane);                        	
       
  1564 #ifdef RD_INTELLIGENT_TEXT_INPUT        
       
  1565          	               }
       
  1566 #endif
       
  1567                         }
       
  1568                     else
       
  1569                         {
       
  1570                         iFepUiState = TAknFepInputStatePredictiveInputQwertyStroke(
       
  1571                                                               this, iContainerPane);
       
  1572                         }
       
  1573                     break;
       
  1574                 case ECangJie:
       
  1575 #ifdef RD_INTELLIGENT_TEXT_INPUT        
       
  1576                     if ( EPtiKeyboardQwerty4x10 == kbdType ||
       
  1577                          EPtiKeyboardQwerty3x11 == kbdType ||
       
  1578                          EPtiKeyboardHalfQwerty == kbdType ||
       
  1579                          EPtiKeyboardCustomQwerty == kbdType)                    	
       
  1580                         {
       
  1581                         iFepUiState = TAknFepInputStatePredictiveInputMiniQwertyChinesePhrase(
       
  1582                                                                           this,iContainerPane);
       
  1583 
       
  1584                         }
       
  1585                     else 
       
  1586                     	{
       
  1587 #endif
       
  1588                     	iFepUiState = TAknFepInputStatePredictiveInputQwerty(this, iContainerPane);
       
  1589 #ifdef RD_INTELLIGENT_TEXT_INPUT        
       
  1590                     	}    
       
  1591 #endif
       
  1592                     break;
       
  1593                 case EZhuyin:
       
  1594                     if(IsFlagSet(ESupportZhuyinPhrase))
       
  1595                         {
       
  1596 #ifdef RD_INTELLIGENT_TEXT_INPUT        
       
  1597                         if ( EPtiKeyboardQwerty4x10 == kbdType ||
       
  1598                              EPtiKeyboardQwerty3x11 == kbdType ||
       
  1599                              EPtiKeyboardHalfQwerty == kbdType ||
       
  1600                              EPtiKeyboardCustomQwerty == kbdType)                    	
       
  1601                         	{
       
  1602                             iFepUiState = TAknFepInputStatePredictiveInputMiniQwertyChinesePhrase/*TAknFepInputStatePredictiveInputQwertyPinyinPhrase*/(this, iContainerPane);
       
  1603                         	}
       
  1604                         else
       
  1605                         	{
       
  1606 #endif
       
  1607                         	iFepUiState = TAknFepInputStatePredictiveInputQwertyZhuyinPhrase(
       
  1608                                                                        this, iContainerPane);
       
  1609 #ifdef RD_INTELLIGENT_TEXT_INPUT        
       
  1610                         	}
       
  1611 #endif
       
  1612                         }
       
  1613                     else
       
  1614                         {
       
  1615                         iFepUiState = TAknFepInputStatePredictiveInputQwertyZhuyin(
       
  1616                                                               this, iContainerPane);
       
  1617                         }
       
  1618                     break;  
       
  1619                 default:
       
  1620                     AknFepPanic(EAknFepPanicBadInputState);
       
  1621                 }
       
  1622             }
       
  1623             break;
       
  1624 #ifdef RD_INTELLIGENT_TEXT_INPUT 
       
  1625         case EMiniQwertyEdit:
       
  1626             {
       
  1627             switch(iMode)
       
  1628                 {
       
  1629                 case EZhuyin:
       
  1630                     if(IsFlagSet(ESupportZhuyinPhrase))
       
  1631                         {
       
  1632 #ifdef RD_INTELLIGENT_TEXT_INPUT        
       
  1633                         if ( EPtiKeyboardQwerty4x10 == kbdType ||
       
  1634                              EPtiKeyboardQwerty3x11 == kbdType ||
       
  1635                              EPtiKeyboardHalfQwerty == kbdType ||
       
  1636                              EPtiKeyboardCustomQwerty == kbdType)
       
  1637                            {
       
  1638                            iFepUiState = TAknFepInputStateEditingMiniQwertyZhuyinPhrase( this, iContainerPane );
       
  1639                            }
       
  1640 #endif
       
  1641                         }
       
  1642                     break;
       
  1643                 case EPinyin:
       
  1644                     if(IsFlagSet(ESupportPinyinPhrase))
       
  1645                         {
       
  1646 #ifdef RD_INTELLIGENT_TEXT_INPUT        
       
  1647                         if ( EPtiKeyboardQwerty4x10 == kbdType ||
       
  1648                              EPtiKeyboardQwerty3x11 == kbdType ||
       
  1649                              EPtiKeyboardHalfQwerty == kbdType ||
       
  1650                              EPtiKeyboardCustomQwerty == kbdType)                            
       
  1651                             { 
       
  1652                             iFepUiState = 
       
  1653                                 TAknFepInputStateEditinigMiniQwertyPinyinPhrase( 
       
  1654                                                              this,
       
  1655                                                              iContainerPane );
       
  1656                             }                            
       
  1657 #endif
       
  1658                         }
       
  1659                     break;
       
  1660                 case EStroke:
       
  1661                     if (IsFlagSet(ESupportStrokePhrase))
       
  1662                         {
       
  1663 #ifdef RD_INTELLIGENT_TEXT_INPUT        
       
  1664                         if ( EPtiKeyboardQwerty4x10 == kbdType ||
       
  1665                              EPtiKeyboardQwerty3x11 == kbdType ||
       
  1666                              EPtiKeyboardHalfQwerty == kbdType ||
       
  1667                              EPtiKeyboardCustomQwerty == kbdType)                           
       
  1668                             {
       
  1669                             iFepUiState = 
       
  1670                                 TAknFepInputStateEditingMiniQwertyStrokePhrase(
       
  1671                                                               this, 
       
  1672                                                               iContainerPane);
       
  1673                             }
       
  1674 #endif
       
  1675                         }
       
  1676                     break;
       
  1677                 default:
       
  1678                     break;
       
  1679                 }   
       
  1680             }
       
  1681             break;
       
  1682         case EZhuyinSpelling:
       
  1683             {
       
  1684             iFepUiState = TAknFepInputStateSpellingMiniQwertyZhuyin( this, iContainerPane );
       
  1685             }
       
  1686             break;
       
  1687         case EZhuyinCandidate:
       
  1688             {
       
  1689             iFepUiState = TAknFepInputStateCanindateSelectingMiniQwertyZhuyin( this, iContainerPane );
       
  1690             }
       
  1691             break;
       
  1692 #endif
       
  1693         default:
       
  1694             AknFepPanic(EAknFepPanicBadInputState);
       
  1695     }
       
  1696 }
       
  1697     
       
  1698 void CAknFepUIManagerChinese::UpdateCangJieState()
       
  1699     {
       
  1700     // Reset mode
       
  1701     if (iMode == ECangJie)
       
  1702         {
       
  1703         ChangeStateQwerty( EQwerty );
       
  1704         }
       
  1705     }
       
  1706 
       
  1707 TBool CAknFepUIManagerChinese::IsValidChineseSymbol(TInt aKey) const
       
  1708 	{
       
  1709 	TBool respond = EFalse;
       
  1710 	if((aKey >= EStdKeyComma && aKey <= EStdKeyNkpPlus)|| aKey == EPtiKeyStar )
       
  1711 		{
       
  1712 		respond = ETrue;
       
  1713 		}
       
  1714 	return respond;
       
  1715 	}
       
  1716 #ifdef __ITI_LONGPRESS_NUM_SHIFT_COPYPASTE__
       
  1717 #ifdef RD_INTELLIGENT_TEXT_INPUT
       
  1718 // ---------------------------------------------------------------------------
       
  1719 // CAknFepUIManagerChinese::RollbackPreviousCharL
       
  1720 // 
       
  1721 // 
       
  1722 // ---------------------------------------------------------------------------
       
  1723 //
       
  1724 TBool CAknFepUIManagerChinese::RollbackPreviousCharL()
       
  1725     {
       
  1726     if ( iInputSeqLenDeltaWithLastKey > 0 )
       
  1727         {
       
  1728         HandleKeyL( EStdKeyBackspace, EShortKeyPress );
       
  1729         return ETrue;
       
  1730         }
       
  1731     else
       
  1732         {
       
  1733         return CAknFepUIManagerBase::RollbackPreviousCharL();
       
  1734         }
       
  1735     }
       
  1736 #endif // RD_INTELLIGENT_TEXT_INPUT
       
  1737 #endif // __ITI_LONGPRESS_NUM_SHIFT_COPYPASTE__
       
  1738 // End of file