fep/aknfep/src/aknfepuifingeritutinputstategeneric.cpp
changeset 40 2cb9bae34d17
parent 31 f1bdd6b078d1
child 49 37f5d84451bd
equal deleted inserted replaced
31:f1bdd6b078d1 40:2cb9bae34d17
     1 /*
       
     2 * Copyright (c) 2002 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:            Provides the TAknFepInputStateInitialChineseGeneric methods.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 
       
    23 
       
    24 
       
    25 
       
    26 
       
    27 
       
    28 
       
    29 // INCLUDE FILES
       
    30 #include <PtiEngine.h>
       
    31 #include <e32keys.h>
       
    32 #include <PtiDefs.h>
       
    33 
       
    34 #include "aknfepuifingeritutinputstategeneric.h"
       
    35 #include "AknFepCaseManager.h"
       
    36 #include "AknFepUIManagerStateInterface.h"
       
    37 #include "AknFepManager.h"
       
    38 
       
    39 //============================ MEMBER FUNCTIONS ==============================
       
    40 
       
    41 // ---------------------------------------------------------------------------
       
    42 // C++ default constructor
       
    43 // ---------------------------------------------------------------------------
       
    44 //
       
    45 TAknFepUIFingerItutInputStateChineseGeneric::TAknFepUIFingerItutInputStateChineseGeneric(
       
    46     MAknFepUIManagerStateInterface* aOwner/*,
       
    47     MAknFepUICtrlContainerChinese* aUIContainer*/)
       
    48     :TAknFepInputStateBase(aOwner),//TAknFepInputStateInitialChineseMultitapBase(aOwner, aUIContainer),
       
    49     iPreObserver(NULL)
       
    50     {
       
    51     }
       
    52 
       
    53 // ---------------------------------------------------------------------------
       
    54 // Handle key event
       
    55 // ---------------------------------------------------------------------------
       
    56 //
       
    57 TBool TAknFepUIFingerItutInputStateChineseGeneric::HandleKeyL(TInt aKey, TKeyPressLength aLength)
       
    58     {
       
    59     MAknFepManagerUIInterface* fepMan = iOwner->FepMan();
       
    60     CPtiEngine* ptiengine = iOwner->PtiEngine();
       
    61     TBool ret = ETrue;
       
    62     
       
    63     if (aLength == ELongKeyPress &&
       
    64        (aKey >= EPtiKey0 && aKey <= EPtiKey9))
       
    65         {
       
    66         TChar ch(aKey);
       
    67         TBuf<1> buf;
       
    68         buf.Append(ch);
       
    69 	    fepMan->NewCharacterL(buf);
       
    70 	    fepMan->CommitInlineEditL();
       
    71 	    ptiengine->ClearCurrentWord();
       
    72         return ret;
       
    73         }
       
    74     
       
    75     if(iData && (iData != aKey))
       
    76         {
       
    77         fepMan->CommitInlineEditL();
       
    78         ptiengine->ClearCurrentWord();
       
    79         }
       
    80 
       
    81     //7,8,9 are not multitap in EStroke, so commit
       
    82     if ((fepMan->InputMode() == EStroke) &&
       
    83          (iData == EPtiKey7 || iData == EPtiKey8 || iData == EPtiKey9 ))
       
    84     	{
       
    85         fepMan->CommitInlineEditL();
       
    86         ptiengine->ClearCurrentWord();
       
    87     	}
       
    88 
       
    89     iData = aKey;
       
    90 
       
    91     switch(aKey)
       
    92         {
       
    93         case EPtiKey0:
       
    94         case EPtiKey1:
       
    95             {
       
    96             const TPtiTextCase oldCase = ptiengine->Case();
       
    97             if (fepMan->InputMode() == EStroke)
       
    98                 {
       
    99                 ptiengine->SetCase(EPtiCaseUpper);
       
   100                 }
       
   101             SetPreObserver(ptiengine->Observer());
       
   102             ptiengine->SetObserver(this);
       
   103             TPtrC retText = ptiengine->AppendKeyPress((TPtiKey)aKey);
       
   104             fepMan->NewCharacterL(retText);
       
   105             ptiengine->SetCase(oldCase);
       
   106             }
       
   107         break;
       
   108         case EPtiKey7:
       
   109         case EPtiKey8:
       
   110         case EPtiKey9:
       
   111            {
       
   112             if (fepMan->InputMode() == EStroke)
       
   113                 {
       
   114                 const TPtiTextCase oldCase = ptiengine->Case();
       
   115                 ptiengine->SetCase(EPtiCaseUpper);
       
   116                 
       
   117                 SetPreObserver(ptiengine->Observer());
       
   118                 ptiengine->SetObserver(this);
       
   119                 
       
   120                 TPtrC retText = ptiengine->AppendKeyPress((TPtiKey)aKey);
       
   121                 fepMan->NewCharacterL(retText);
       
   122                 ptiengine->SetCase(oldCase);
       
   123                 }
       
   124             }
       
   125         break;
       
   126         case EPtiKeyStar:
       
   127             {
       
   128             if (aLength == EShortKeyPress)
       
   129                 {
       
   130                 if (fepMan->EditSubmenuInUse())
       
   131                     {
       
   132                     fepMan->ClearCcpuFlag(CAknFepManager::ECcpuStateIgnoreStarUp);
       
   133                     }
       
   134                else if (fepMan->IsAbleToLaunchSCT())
       
   135                     {
       
   136                     fepMan->LaunchSpecialCharacterTableL();
       
   137                     }
       
   138                 }
       
   139             else
       
   140                 {
       
   141                 if (fepMan->EditSubmenuInUse())
       
   142                     {
       
   143                     fepMan->LaunchSpecialCharacterTableL();
       
   144                     }
       
   145                 }
       
   146             }
       
   147         break;
       
   148         case EStdKeyNull:
       
   149             {
       
   150             ret = EFalse; 
       
   151             }
       
   152         break;
       
   153         case EKeyOK:
       
   154         case EKeyBackspace:
       
   155         default:
       
   156             {
       
   157             ret = EFalse; 
       
   158             }
       
   159         }
       
   160 
       
   161     return ret;
       
   162     }
       
   163 
       
   164 // ---------------------------------------------------------------------------
       
   165 // Set Previous ptiengine observer
       
   166 // ---------------------------------------------------------------------------
       
   167 //
       
   168 void TAknFepUIFingerItutInputStateChineseGeneric::SetPreObserver(MPtiObserver* aPreObserver)
       
   169     {
       
   170     if (aPreObserver != this)
       
   171         {
       
   172     	  iPreObserver = aPreObserver; 
       
   173     	  }
       
   174     }
       
   175     
       
   176 // ---------------------------------------------------------------------------
       
   177 // Get Previous ptiengine observer
       
   178 // ---------------------------------------------------------------------------
       
   179 //
       
   180 MPtiObserver* TAknFepUIFingerItutInputStateChineseGeneric::PreObserver()
       
   181     {
       
   182     return iPreObserver;
       
   183     }
       
   184     
       
   185 // ---------------------------------------------------------------------------
       
   186 // Key timer expired called by ptiengine 
       
   187 // ---------------------------------------------------------------------------
       
   188 //
       
   189 void TAknFepUIFingerItutInputStateChineseGeneric::KeyTimerExpired()
       
   190     {
       
   191     if (iData)
       
   192         {
       
   193         MAknFepManagerUIInterface* fepMan = iOwner->FepMan();
       
   194         TRAP_IGNORE(fepMan->CommitInlineEditL());
       
   195 
       
   196         CPtiEngine* ptiengine = iOwner->PtiEngine();
       
   197         ptiengine->ClearCurrentWord();
       
   198 
       
   199         CAknFepCaseManager* caseMan = iOwner->CaseMan(); 
       
   200         caseMan->UpdateCase(ENullNaviEvent); 
       
   201 
       
   202         iData = 0;
       
   203         
       
   204         ptiengine->SetObserver(PreObserver());
       
   205         }
       
   206     }
       
   207 
       
   208 // End of file