fep/aknfep/src/AknFepUiInputStateCandidateQwertyChinesePhrase.cpp
changeset 36 a7632c26d895
parent 35 0f326f2e628e
child 42 b3eaa440ab06
equal deleted inserted replaced
35:0f326f2e628e 36:a7632c26d895
     1 /*
       
     2 * Copyright (c) 2002-2005 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0""
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:            Implementation of candidate qwerty chinese phrase state
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 
       
    23 
       
    24 
       
    25 
       
    26 
       
    27 
       
    28 
       
    29 #include "AknFepUIManagerStateInterface.h"  //MAknFepUIManagerStateInterface
       
    30 #include "AknFepUiCtrlContainerChinese.h"
       
    31 #include "AknFepManagerUIInterface.h"       //MAknFepManagerUIInterface
       
    32 #include "AknFepUICtrlCandidatePane.h"
       
    33 #include "AknFepUICtrlInputPane.h"
       
    34 #include "AknFepUiInputStateCandidateQwertyChinesePhrase.h"
       
    35 
       
    36 #include "AknFepManager.h"                  //FepMan flag
       
    37 
       
    38 #include <PtiEngine.h>      //CPtiEngine
       
    39 #include <e32keys.h>        //keys  
       
    40 
       
    41 TAknFepInputStateCandidateQwertyChinesePhrase::TAknFepInputStateCandidateQwertyChinesePhrase(
       
    42                                MAknFepUIManagerStateInterface* aOwner,
       
    43                                MAknFepUICtrlContainerChinese* aUIContainer)
       
    44     :TAknFepInputStateCandidateQwertyBaseChinesePhrase(aOwner, aUIContainer)
       
    45     {
       
    46     }
       
    47 
       
    48 TBool TAknFepInputStateCandidateQwertyChinesePhrase::HandleKeyL(TInt aKey, TKeyPressLength /*aLength*/)
       
    49     {
       
    50     if(aKey == EStdKeyDevice1)
       
    51         {
       
    52         iOwner->FepMan()->TryCloseUiL();
       
    53         }
       
    54     else if(!( HandleVerticalNavigation(aKey) || HandleHorizontalNavigation(aKey) ))
       
    55         {
       
    56         // it may be one of the 'valid' numbers..
       
    57         TInt index = MapKeyToIndex(aKey);
       
    58         MAknFepUICtrlCandidatePane* candidatePane = UIContainer()->CandidatePane();
       
    59 
       
    60         if(candidatePane->SelectIndex(index) || aKey == EStdKeyDevice3 || aKey == EStdKeyEnter)
       
    61             {
       
    62             TPtrC text = candidatePane->CurrentPhraseCandidate();
       
    63             if(text.Length())
       
    64                 {            
       
    65                 MAknFepManagerUIInterface* fepMan = iOwner->FepMan();
       
    66                 fepMan->NewTextL(text);
       
    67                 fepMan->CommitInlineEditL();
       
    68                 iOwner->PtiEngine()->SetPredictiveChineseChar(text);
       
    69                 if (fepMan->IsFlagSet(CAknFepManager::EFlagEditorFull))
       
    70                     {
       
    71                     fepMan->ClearFlag(CAknFepManager::EFlagEditorFull);
       
    72                     iOwner->FepMan()->TryCloseUiL();
       
    73                     }
       
    74                 else
       
    75                     {
       
    76                     iOwner->ChangeState(EPredictiveCandidate);
       
    77                     }
       
    78                 }
       
    79             else
       
    80                 {
       
    81                 // No candidates available. Back to Entry state.
       
    82                 iOwner->ChangeState(EEntry);
       
    83                 }
       
    84             }
       
    85         }
       
    86     return ETrue;
       
    87     }
       
    88 
       
    89 // ---------------------------------------------------------------------------
       
    90 // TAknFepInputStateCandidateQwertyChinesePhrase::HandleCommandL
       
    91 // Handling Command
       
    92 // ---------------------------------------------------------------------------
       
    93 //
       
    94 void TAknFepInputStateCandidateQwertyChinesePhrase::HandleCommandL(
       
    95     TInt aCommandId )
       
    96     {
       
    97     TAknFepInputStateChineseBase::HandleCommandL( aCommandId );
       
    98     }
       
    99 // End of file