fep/aknfep/src/AknFepUiInputStateNextWordJapanesePredictive.cpp
changeset 40 2cb9bae34d17
parent 31 f1bdd6b078d1
child 49 37f5d84451bd
equal deleted inserted replaced
31:f1bdd6b078d1 40:2cb9bae34d17
     1 /*
       
     2 * Copyright (c) 2002-2004 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 TAknFepUiInputStateNextWordJapanesePredictive methods.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 
       
    23 
       
    24 
       
    25 
       
    26 
       
    27 
       
    28 
       
    29 
       
    30 // INCLUDE FILES
       
    31 #include "AknFepUiInputStateNextWordJapanesePredictive.h"
       
    32 #include "AknFepUIManagerStateInterface.h"  // MAknFepUIManagerStateInterface
       
    33 #include "AknFepManagerUIInterface.h"       // MAknFepManagerUIInterface
       
    34 #include "AknFepUICtrlContainerJapanese.h"  // MAknFepUICtrlContainerJapanese
       
    35 #include "AknFepUICtrlCandidatePaneInterface.h"
       
    36                                        // MAknFepUICtrlCandidatePaneInterface
       
    37 #include "AknFepGlobalEnums.h"
       
    38 #include "AknFepPanic.h"
       
    39 
       
    40 #include <PtiDefs.h>                    // keys
       
    41 #include <PtiEngine.h>
       
    42 #include <PtiCompositionDataIF.h>       // MPtiEngineCompositionDataInterface
       
    43 #include <aknfep.rsg>
       
    44 
       
    45 
       
    46 // CONSTANTS
       
    47 
       
    48 /**
       
    49  *  TAknFepUiInputStateNextWordJapanesePredictive class.
       
    50  *
       
    51  */
       
    52 //============================ MEMBER FUNCTIONS ==============================
       
    53 
       
    54 // ---------------------------------------------------------------------------
       
    55 // TAknFepUiInputStateNextWordJapanesePredictive::
       
    56 //                              TAknFepUiInputStateNextWordJapanesePredictive
       
    57 // C++ default Constructor
       
    58 // ---------------------------------------------------------------------------
       
    59 //
       
    60 TAknFepUiInputStateNextWordJapanesePredictive::
       
    61     TAknFepUiInputStateNextWordJapanesePredictive(
       
    62                                 MAknFepUIManagerStateInterface* aOwner,
       
    63                                 MAknFepUICtrlContainerJapanese* aUIContainer)
       
    64     :TAknFepUiInputStateJapanesePredictiveBase(aOwner, aUIContainer)
       
    65     {
       
    66     iState = ENextWord;
       
    67     iCbaResourceID = R_AKNFEP_SOFTKEYS_EMPTY_CANCEL_SELECT;
       
    68     }
       
    69 
       
    70 // ---------------------------------------------------------------------------
       
    71 // TAknFepUiInputStateNextWordJapanesePredictive::InitializeStateL
       
    72 // Initialize State
       
    73 // ---------------------------------------------------------------------------
       
    74 //
       
    75 void TAknFepUiInputStateNextWordJapanesePredictive::InitializeStateL()
       
    76     {
       
    77     CDesCArrayFlat* candidateArray = iOwner->CandidateArray();
       
    78     iOwner->PtiEngine()->GetNextWordCandidateListL(*candidateArray);
       
    79     UpdateCandidateListL();
       
    80     }
       
    81 
       
    82 // ---------------------------------------------------------------------------
       
    83 // TAknFepUiInputStateNextWordJapanesePredictive::HandleCommandL
       
    84 // Handling Command
       
    85 // ---------------------------------------------------------------------------
       
    86 //
       
    87 void TAknFepUiInputStateNextWordJapanesePredictive::HandleCommandL(TInt aCommandId)
       
    88     {
       
    89     if (aCommandId == EAknFepAllCompletion)
       
    90         {
       
    91         iOwner->PtiEngine()->ClearCurrentWord();
       
    92         iOwner->ChangeState(EInitial);
       
    93         }
       
    94     else if (aCommandId == EAknFepSoftkeyCloseWindow)
       
    95         {
       
    96         CloseUI();
       
    97         iOwner->ChangeState(EInitial);
       
    98         }
       
    99     else if(aCommandId == EAknFepSoftkeySelectCandidate)
       
   100         {
       
   101         MAknFepManagerUIInterface* fepMan = iOwner->FepMan();
       
   102         fepMan->StartInlineEditL();
       
   103         iOwner->ChangeState(EMultiCompletion);
       
   104         }
       
   105     else if(aCommandId == EAknFepResourceChanged)
       
   106         {
       
   107         MAknFepUICtrlContainerJapanese* uicontainer = UIContainer();
       
   108         MAknFepUICtrlCandidatePaneInterface* predictivePane =
       
   109             uicontainer->CandidatePane(MAknFepUICtrlContainerJapanese::
       
   110                                        EJapanesePredictiveCandidatePane);
       
   111         TInt index = predictivePane->CurrentItemIndexOfCandidate();
       
   112         predictivePane->HideWindow();
       
   113         UpdateCandidateListL(index);
       
   114         }
       
   115     }
       
   116 
       
   117 // ---------------------------------------------------------------------------
       
   118 // TAknFepUiInputStateNextWordJapanesePredictive::HandleNumericKeyL
       
   119 // Handling short keypress events of the numeric and the star.
       
   120 // ---------------------------------------------------------------------------
       
   121 //
       
   122 TBool TAknFepUiInputStateNextWordJapanesePredictive::HandleNumericShortKeyL(TInt /*aKey*/)
       
   123     {
       
   124     CPtiEngine* ptiEngine = iOwner->PtiEngine();
       
   125     MAknFepUICtrlContainerJapanese* uicontainer = UIContainer();
       
   126     MAknFepUICtrlCandidatePaneInterface* predictivePane =
       
   127         uicontainer->CandidatePane(MAknFepUICtrlContainerJapanese::
       
   128                                    EJapanesePredictiveCandidatePane);
       
   129 
       
   130     ptiEngine->ClearCurrentWord();
       
   131     predictivePane->HideWindow();
       
   132     iOwner->ChangeState(EInitial);
       
   133     // This State doesn't Handle numeric key, always return false.
       
   134     return EFalse;
       
   135     }
       
   136 
       
   137 // ---------------------------------------------------------------------------
       
   138 // TAknFepUiInputStateNextWordJapanesePredictive::HandleAuxKeyL
       
   139 // Handling auxiliary keypress events including OK and Backspace
       
   140 // ---------------------------------------------------------------------------
       
   141 //
       
   142 TBool TAknFepUiInputStateNextWordJapanesePredictive::HandleAuxKeyL(TInt aKey,
       
   143                                                                    TKeyPressLength /*aLength*/)
       
   144     {
       
   145     MAknFepManagerUIInterface* fepMan = iOwner->FepMan();
       
   146     CPtiEngine* ptiEngine = iOwner->PtiEngine();
       
   147     MAknFepUICtrlContainerJapanese* uicontainer = UIContainer();
       
   148     MAknFepUICtrlCandidatePaneInterface* predictivePane =
       
   149         uicontainer->CandidatePane(MAknFepUICtrlContainerJapanese::
       
   150                                    EJapanesePredictiveCandidatePane);
       
   151     TBool ret = EFalse;
       
   152 
       
   153     switch(aKey)
       
   154         {
       
   155         case EKeyOK:
       
   156         case EStdKeyDevice3:        /* 0xA7 */
       
   157         case EStdKeyEnter:          /* 0x03 */
       
   158         case EStdKeyNkpEnter:       /* 0x88 */
       
   159             {
       
   160             fepMan->StartInlineEditL();
       
   161             iOwner->ChangeState(EMultiCompletion);
       
   162             }
       
   163             break;
       
   164         case EKeyBackspace:
       
   165         case EStdKeyBackspace:      /* 0x01 */
       
   166         case EStdKeyEscape:         /* 0x04 */
       
   167             {
       
   168             ptiEngine->ClearCurrentWord();
       
   169             predictivePane->HideWindow();
       
   170             iOwner->ChangeState(EInitial);
       
   171             ret = ETrue;
       
   172             }
       
   173             break;
       
   174         default: // Panic
       
   175             {
       
   176             AknFepPanic(EAknFepPanicNotSupportKey);
       
   177             }
       
   178             break;
       
   179         }
       
   180 
       
   181     return ret;
       
   182     }
       
   183 // End of file