fep/aknfep/src/AknFepUiInputStateCompletionLatinJapanese.cpp
changeset 36 a7632c26d895
parent 35 0f326f2e628e
child 42 b3eaa440ab06
equal deleted inserted replaced
35:0f326f2e628e 36:a7632c26d895
     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 TAknFepUiInputStateCompletionLatinJapanese methods.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 
       
    23 
       
    24 
       
    25 
       
    26 
       
    27 
       
    28 
       
    29 
       
    30 // INCLUDE FILES
       
    31 #include "AknFepUiInputStateCompletionLatinJapanese.h"
       
    32 #include "AknFepUIManagerStateInterface.h"   // MAknFepUIManagerStateInterface
       
    33 #include "AknFepManagerUIInterface.h"        // MAknFepManagerUIInterface
       
    34 #include "AknFepCaseManager.h"               // CAknFepCaseManager
       
    35 #include "AknFepGlobalEnums.h"
       
    36 
       
    37 #include <PtiDefs.h>                     // keys
       
    38 #include <PtiEngine.h>
       
    39 #include <PtiCompositionDataIF.h>        // MPtiEngineCompositionDataInterface
       
    40 
       
    41 // CONSTANTS
       
    42 
       
    43 /**
       
    44 *  TAknFepUiInputStateCompletionLatinJapanese class.
       
    45 *
       
    46 */
       
    47 
       
    48 //============================ MEMBER FUNCTIONS ==============================
       
    49 
       
    50 // ---------------------------------------------------------------------------
       
    51 // TAknFepUiInputStateCompletionLatinJapanese::
       
    52 //                              TAknFepUiInputStateCompletionLatinJapanese
       
    53 // C++ default Constructor
       
    54 // ---------------------------------------------------------------------------
       
    55 //
       
    56 TAknFepUiInputStateCompletionLatinJapanese::TAknFepUiInputStateCompletionLatinJapanese(
       
    57                                 MAknFepUIManagerStateInterface* aOwner,
       
    58                                 MAknFepUICtrlContainerJapanese* aUIContainer)
       
    59     :TAknFepUiInputStateCompletionJapaneseMultitap(aOwner, aUIContainer)
       
    60     {
       
    61     }
       
    62 
       
    63 // ---------------------------------------------------------------------------
       
    64 // TAknFepUiInputStateCompletionJapaneseMultitap::HandleNumericShortKeyL
       
    65 // Handling short keypress events of the numeric and the star.
       
    66 // ---------------------------------------------------------------------------
       
    67 //
       
    68 TBool TAknFepUiInputStateCompletionLatinJapanese::HandleNumericShortKeyL(TInt aKey)
       
    69     {
       
    70     MAknFepManagerUIInterface* fepMan = iOwner->FepMan();
       
    71     TBool ret = ETrue;
       
    72     CommitInlineEditingCharacterL();
       
    73     iOwner->ChangeState(EInitial);
       
    74     if (!iOwner->IsQwerty())
       
    75         {
       
    76         fepMan->SimulateKeyEventL(aKey, ETrue);
       
    77         }
       
    78     return ret;
       
    79     }
       
    80 
       
    81 // ---------------------------------------------------------------------------
       
    82 // TAknFepUiInputStateCompletionLatinJapanese::CommitInlineEditingCharacterL
       
    83 // Commit inline editing string
       
    84 // ---------------------------------------------------------------------------
       
    85 //
       
    86 TBool TAknFepUiInputStateCompletionLatinJapanese::CommitInlineEditingCharacterL()
       
    87     {
       
    88     TBool ret = EFalse;
       
    89     MAknFepManagerUIInterface* fepMan = iOwner->FepMan();
       
    90     CPtiEngine* ptiEngine = iOwner->PtiEngine();
       
    91     if (!iOwner->IsQwerty()
       
    92      && iOwner->FepMan()->IsSupportsSecretText()
       
    93      && fepMan->IsFlagSet(CAknFepManager::EFlagInsideMultitapInlineEditingTransaction))
       
    94         {
       
    95         fepMan->CommitInlineEditL();
       
    96         ptiEngine->ClearCurrentWord();
       
    97         iData = 0;
       
    98         ret = ETrue;
       
    99         }
       
   100     else
       
   101         {
       
   102         const MPtiEngineCompositionDataInterface* data = ptiEngine->CompositionData();
       
   103         TPtrC text = data->CompletedString();
       
   104         if (text.Length() > 0)
       
   105             {
       
   106             // Update case without Qwerty
       
   107             if (!iOwner->IsQwerty())
       
   108             {
       
   109             UpdateCase(text);
       
   110             }
       
   111 
       
   112         // Commit a character
       
   113         fepMan->CommitInlineEditL(text, text.Length());
       
   114 
       
   115         // Update case with Qwerty
       
   116         if (iOwner->IsQwerty())
       
   117             {
       
   118             CAknFepCaseManager* caseMan = iOwner->CaseMan();
       
   119             caseMan->UpdateCase(ENullNaviEvent);
       
   120                 }
       
   121 
       
   122             ptiEngine->ClearCurrentWord();
       
   123             iData = 0;
       
   124             ret = ETrue;
       
   125             }
       
   126         }
       
   127     return ret;
       
   128     }
       
   129 
       
   130 // ---------------------------------------------------------------------------
       
   131 // TAknFepUiInputStateCompletionLatinJapanese::HandleAuxKeyL
       
   132 // Handling auxiliary keypress events including OK and Backspace
       
   133 // ---------------------------------------------------------------------------
       
   134 //
       
   135 TBool TAknFepUiInputStateCompletionLatinJapanese::HandleAuxKeyL(TInt aKey,
       
   136                                                                    TKeyPressLength aLength)
       
   137     {
       
   138     TBool ret = ETrue;
       
   139     CPtiEngine* ptiEngine = iOwner->PtiEngine();
       
   140 
       
   141     if (aKey == EKeyOK
       
   142      || aKey == EStdKeyDevice3          /* 0xA7 */
       
   143      || aKey == EStdKeyEnter
       
   144      || aKey == EStdKeyNkpEnter)
       
   145         {
       
   146         TPtiEngineCommand ptiCommand = EPtiCommandUserActionComplete;
       
   147         if (aLength == ELongKeyPress)
       
   148             {
       
   149             ptiCommand = EPtiCommandUserActionAllComplete;
       
   150             }
       
   151         ptiEngine->HandleCommandL(ptiCommand);
       
   152         UpdateInlineEditingCharacterL();
       
   153         // OK-key or Enter-key shouldn't be consumed in Latin input.
       
   154         // Because OK-key or Enter-key might be used in application side.
       
   155         ret = EFalse;
       
   156         }
       
   157 
       
   158     return ret;
       
   159     }
       
   160 
       
   161 // End of file