fep/aknfep/src/AknFepUiInputStatePredictiveInputQwertyZhuyin.cpp
changeset 36 a7632c26d895
parent 35 0f326f2e628e
child 42 b3eaa440ab06
equal deleted inserted replaced
35:0f326f2e628e 36:a7632c26d895
     1 /*
       
     2 * Copyright (c) 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 TAknFepInputStatePredictiveInputQwerty methods.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 
       
    23 
       
    24 
       
    25 
       
    26 
       
    27 
       
    28 
       
    29 
       
    30 #include "AknFepUiInputStatePredictiveInputQwertyZhuyin.h"
       
    31 #include "AknFepUICtrlCandidatePane.h"
       
    32 #include "AknFepUiCtrlContainerChinese.h"
       
    33 #include "AknFepUIManagerStateInterface.h"  //MAknFepUIManagerStateInterface
       
    34 #include "AknFepManagerUIInterface.h"       //MAknFepManagerUIInterface
       
    35 #include "AknFepManager.h"                  //FepMan flag
       
    36 #include "AknFepManagerUIInterface.h"
       
    37 
       
    38 #include <PtiEngine.h>                      //CPtiEngine
       
    39 
       
    40 TAknFepInputStatePredictiveInputQwertyZhuyin::TAknFepInputStatePredictiveInputQwertyZhuyin(
       
    41                                 MAknFepUIManagerStateInterface* aOwner,
       
    42                                 MAknFepUICtrlContainerChinese* aUIContainer)
       
    43     :TAknFepInputStateCandidateQwertyChinese(aOwner, aUIContainer)
       
    44     {
       
    45     iState = EPredictiveInput;
       
    46     
       
    47     CPtiEngine* ptiengine = iOwner->PtiEngine();
       
    48     MAknFepUICtrlContainerChinese* uiContainer = UIContainer();
       
    49     
       
    50     uiContainer->CandidatePane()->SelectFirst(); 
       
    51 
       
    52     TBool multiplePages = ptiengine->MoreCandidatePages();
       
    53     TInt bufLength = ptiengine->CandidatePage().Length();
       
    54     TBool showHorizontalScrollArrows = multiplePages || bufLength>1;
       
    55     
       
    56     uiContainer->ShowVerticalScrollArrows(multiplePages);
       
    57     uiContainer->ShowHorizontalScrollArrows(showHorizontalScrollArrows);
       
    58     uiContainer->CandidatePane()->ShowCandidateOrdinals(ETrue);    
       
    59     UpdateIndicator();
       
    60     }
       
    61 
       
    62 TBool TAknFepInputStatePredictiveInputQwertyZhuyin::HandleKeyL(TInt aKey, TKeyPressLength aLength)
       
    63     {
       
    64     TBool ret = ETrue;
       
    65 
       
    66     if (iOwner->FepMan()->IsFlagSet(CAknFepManager::EFlagQwertyShiftMode) ||
       
    67         iOwner->FepMan()->IsFlagSet(CAknFepManager::EFlagQwertyChrKeyDepressed))
       
    68         {
       
    69         iOwner->FepMan()->TryCloseUiL();
       
    70         ret = EFalse;
       
    71         }
       
    72     else if(aKey == EStdKeyBackspace)
       
    73         {
       
    74         iOwner->FepMan()->TryCloseUiL();
       
    75         }
       
    76     else if(aKey == EStdKeyLeftFunc && aLength == EShortKeyPress)
       
    77         {
       
    78         MAknFepManagerUIInterface* fepMan = iOwner->FepMan();
       
    79         if (fepMan->IsAbleToLaunchSCT())
       
    80             {
       
    81             fepMan->LaunchSpecialCharacterTableL();
       
    82             }
       
    83         }
       
    84     else if(iOwner->IsValidChineseInputKeyQwerty(aKey) && 
       
    85             !(aKey >= EPtiKeyQwerty0 && aKey <= EPtiKeyQwerty9))
       
    86         {
       
    87         CPtiEngine* ptiengine = iOwner->PtiEngine();
       
    88         // it is needed when we use phrase input engine, otherwise it seems not cleared
       
    89         ptiengine->ClearCurrentWord(); 
       
    90         ptiengine->ResetToneMark();
       
    91 
       
    92         iOwner->ChangeState(EEntry);
       
    93         ret = EFalse; //passes to entry state to handle the key
       
    94         }
       
    95     else 
       
    96         {
       
    97         ret = TAknFepInputStateCandidateQwertyChinese::HandleKeyL(aKey, aLength);
       
    98         }
       
    99     return ret;
       
   100     }
       
   101 
       
   102 // End of file