fep/aknfep/src/AknFepUiInputStateInitialChineseGeneric.cpp
changeset 36 a7632c26d895
parent 35 0f326f2e628e
child 42 b3eaa440ab06
equal deleted inserted replaced
35:0f326f2e628e 36:a7632c26d895
     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:           
       
    15 *       Provides the TAknFepInputStateInitialChineseGeneric methods.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 
       
    23 
       
    24 
       
    25 
       
    26 
       
    27 
       
    28 
       
    29 
       
    30 #include "AknFepUiInputStateInitialChineseGeneric.h"
       
    31 #include "AknFepUIManagerStateInterface.h"
       
    32 #include "AknFepManagerUIInterface.h"
       
    33 #include "AknFepUiCtrlContainerChinese.h"
       
    34 #include "AknFepUICtrlCandidatePane.h"
       
    35 #include "AknFepUICtrlPinyinPopup.h"
       
    36 #include "AknFepManager.h"
       
    37 
       
    38 #include <PtiEngine.h>
       
    39 #include <e32keys.h>
       
    40 #include <PtiDefs.h>                //keys
       
    41 #include <uikon.hrh>
       
    42 
       
    43 TAknFepInputStateInitialChineseGeneric::TAknFepInputStateInitialChineseGeneric(
       
    44                                 MAknFepUIManagerStateInterface* aOwner,
       
    45                                 MAknFepUICtrlContainerChinese* aUIContainer)
       
    46     :TAknFepInputStateInitialChineseMultitapBase(aOwner, aUIContainer)
       
    47     {
       
    48     }
       
    49 
       
    50 TBool TAknFepInputStateInitialChineseGeneric::HandleKeyL(TInt aKey, TKeyPressLength aLength)
       
    51     {
       
    52     MAknFepManagerUIInterface* fepMan = iOwner->FepMan();
       
    53     CPtiEngine* ptiengine = iOwner->PtiEngine();
       
    54 
       
    55     TBool ret = ETrue;
       
    56 
       
    57     if(iData && (iData != aKey))
       
    58         {
       
    59         fepMan->CommitInlineEditL();
       
    60         ptiengine->ClearCurrentWord();
       
    61         }
       
    62     
       
    63     //7,8,9 are not multitap in EStroke, so commit
       
    64     if ((fepMan->InputMode() == EStroke) &&
       
    65          (iData == EPtiKey7 || iData == EPtiKey8 || iData == EPtiKey9 ))
       
    66     	{
       
    67         fepMan->CommitInlineEditL();
       
    68         ptiengine->ClearCurrentWord();
       
    69     	}
       
    70     
       
    71     iData = aKey;
       
    72 
       
    73     if(iOwner->IsValidChineseInputKey(aKey))
       
    74         {
       
    75         if ( aLength == EShortKeyPress )
       
    76         	{
       
    77             ptiengine->ClearCurrentWord();
       
    78             ptiengine->ResetToneMark();
       
    79 
       
    80             if(iOwner->ChangeState(EEntry) == EEntry)
       
    81                 {
       
    82                 iOwner->FepMan()->SendUIActivatedNotification();
       
    83                 }
       
    84             ret = EFalse; //indicate we can't handle the key...
       
    85         	}
       
    86         else
       
    87         	{
       
    88         	return ETrue;
       
    89         	}
       
    90 
       
    91         }
       
    92     else if(aKey == EPtiKey0 || aKey == EPtiKey1) // do multitap on zero key...
       
    93         {
       
    94         if(aLength == EShortKeyPress)
       
    95             {
       
    96             const TPtiTextCase oldCase = ptiengine->Case();
       
    97             if (fepMan->InputMode() == EStroke)
       
    98             	{
       
    99             	ptiengine->SetCase(EPtiCaseUpper);
       
   100             	}
       
   101             TPtrC aText = ptiengine->AppendKeyPress((TPtiKey)aKey);
       
   102             fepMan->NewCharacterL(aText);
       
   103             ptiengine->SetCase(oldCase);
       
   104             }
       
   105         else
       
   106             {
       
   107             //don't want long keypresses to result in numbers as this would be inconsistent in
       
   108             //Chinese modes, so commit the current character
       
   109             fepMan->CommitInlineEditL();
       
   110             ptiengine->ClearCurrentWord();
       
   111             }
       
   112         }
       
   113     //do multitap on 7-9 key
       
   114     else if ((fepMan->InputMode() == EStroke) &&
       
   115              (aKey == EPtiKey7 || aKey == EPtiKey8 ||
       
   116               aKey == EPtiKey9 ))    		   
       
   117     	{
       
   118     	if(aLength == EShortKeyPress)
       
   119             {
       
   120             const TPtiTextCase oldCase = ptiengine->Case();
       
   121             ptiengine->SetCase(EPtiCaseUpper);            
       
   122             
       
   123             TPtrC text = ptiengine->AppendKeyPress((TPtiKey)aKey);
       
   124             fepMan->NewCharacterL(text);
       
   125             ptiengine->SetCase(oldCase);
       
   126             }
       
   127         else
       
   128             {
       
   129             //don't want long keypresses to result in numbers as this would be inconsistent in
       
   130             //Chinese modes, so commit the current character
       
   131             fepMan->CommitInlineEditL();
       
   132             ptiengine->ClearCurrentWord();
       
   133             }
       
   134     	}
       
   135     else if (aKey == EPtiKeyStar)
       
   136         {
       
   137         if (aLength == EShortKeyPress)
       
   138         	{
       
   139        		if (fepMan->EditSubmenuInUse())
       
   140         		{
       
   141 				fepMan->ClearCcpuFlag(CAknFepManager::ECcpuStateIgnoreStarUp);
       
   142         		return ret;
       
   143         		}                        
       
   144             else if (fepMan->IsAbleToLaunchSCT())
       
   145                 {
       
   146                 fepMan->LaunchSpecialCharacterTableL();
       
   147                 }    	
       
   148         	}
       
   149         else
       
   150         	{
       
   151        		if (fepMan->EditSubmenuInUse())
       
   152             	{
       
   153        			fepMan->LaunchSpecialCharacterTableL();                
       
   154         	    }        	
       
   155             }
       
   156         }
       
   157     else if (aKey == EKeyOK)
       
   158         {
       
   159         ret = EFalse;   //don't consume OK key in initial state 
       
   160         }
       
   161 
       
   162     return ret;
       
   163     }
       
   164 
       
   165 // End of file