fep/aknfep/src/AknFepUiInputStateStrokeFindQwerty.cpp
changeset 36 a7632c26d895
parent 35 0f326f2e628e
child 42 b3eaa440ab06
equal deleted inserted replaced
35:0f326f2e628e 36:a7632c26d895
     1 /*
       
     2 * Copyright (c) 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:           
       
    15 *       Provides the TAknFepInputStateStrokeFindQwerty methods.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 
       
    23 
       
    24 
       
    25 
       
    26 
       
    27 
       
    28 
       
    29 
       
    30 #include "AknFepUiInputStatelStrokeFindQwerty.h"
       
    31 #include "AknFepUIManagerStateInterface.h"
       
    32 #include "AknFepManagerUIInterface.h"
       
    33 
       
    34 #include <e32keys.h>
       
    35 #include <PtiEngine.h>
       
    36 #include <PtiDefs.h>                //keys
       
    37 
       
    38 TAknFepInputStateStrokeFindQwerty::TAknFepInputStateStrokeFindQwerty(
       
    39                                 MAknFepUIManagerStateInterface* aOwner,
       
    40                                 MAknFepUICtrlContainerChinese* aUIContainer)
       
    41     :TAknFepInputStateChineseFindQwerty(aOwner, aUIContainer)
       
    42     {
       
    43     iOwner->PtiEngine()->SetInputMode(EPtiEngineStrokeQwerty);
       
    44     }
       
    45                                 
       
    46 
       
    47 #ifdef RD_INTELLIGENT_TEXT_INPUT
       
    48 TAknFepInputStateStrokeFindMiniQwerty::TAknFepInputStateStrokeFindMiniQwerty(
       
    49         MAknFepUIManagerStateInterface* aOwner, TInt aMode) :
       
    50     TAknFepInputStateInitialChineseGenericQwerty(aOwner, aMode)
       
    51     {
       
    52     iOwner->PtiEngine()->SetInputMode(EPtiEngineStrokePhraseQwerty);
       
    53 
       
    54     iOwner->PtiEngine()->SetKeyboardType(iOwner->FepMan()->KeyboardLayout());
       
    55 
       
    56     }
       
    57 
       
    58 TBool TAknFepInputStateStrokeFindMiniQwerty::HandleKeyL(TInt aKey,
       
    59         TKeyPressLength aLength)
       
    60     {
       
    61     MAknFepManagerUIInterface* fepMan = iOwner->FepMan();
       
    62     CPtiEngine* ptiengine = iOwner->PtiEngine();
       
    63     CAknFepFnKeyManager::TFnKeyState fnKeyState  = fepMan->FnKeyState();
       
    64     TBool ret = EFalse;
       
    65 
       
    66     if (aLength == EShortKeyPress && CAknFepFnKeyManager::EFnKeyNone
       
    67             == iOwner->FepMan()->FnKeyState()
       
    68             && iOwner->IsValidChineseInputKeyQwerty(aKey))
       
    69         {
       
    70         HandleCaseChange(aKey, ETrue);
       
    71         ptiengine->AppendKeyPress((TPtiKey)aKey);
       
    72         TPtrC text = ptiengine->GetPhoneticSpelling(1);
       
    73 
       
    74         if (text.Length())
       
    75             {
       
    76             fepMan->NewCharacterL(text);
       
    77             fepMan->CommitInlineEditL();
       
    78             ptiengine->ClearCurrentWord();
       
    79             ret = ETrue;
       
    80             }
       
    81         }
       
    82     else if ( CAknFepFnKeyManager::EFnKeyNone == fnKeyState 
       
    83     		&& (aLength == EShortKeyPress && aKey >=EPtiKeyQwertyA && aKey <= EPtiKeyQwertyZ ))
       
    84     	{
       
    85     	ret = ETrue;
       
    86     	}
       
    87     else if ( fnKeyState != CAknFepFnKeyManager::EFnKeyNone 
       
    88     		&& aKey >=EPtiKeyQwertyA 
       
    89     		&& aKey <= EPtiKeyQwertyZ )
       
    90     	{
       
    91     	ret = TAknFepInputStateQwerty::HandleKeyL( aKey, aLength );
       
    92     	}
       
    93     else
       
    94         {
       
    95         return TAknFepInputStateInitialChineseGenericQwerty::HandleKeyL(aKey,
       
    96                 aLength);
       
    97         }
       
    98     return ret;
       
    99     } 
       
   100 
       
   101 
       
   102 
       
   103 #ifdef __HALF_QWERTY_KEYPAD
       
   104 TAknFepInputStateStrokeFindHalfQwerty::TAknFepInputStateStrokeFindHalfQwerty(
       
   105         MAknFepUIManagerStateInterface* aOwner, TInt aMode) :
       
   106     TAknFepInputStateInitialChineseGenericHalfQwerty(aOwner, aMode)
       
   107     {
       
   108     iOwner->PtiEngine()->SetInputMode(EPtiEngineStrokePhraseHalfQwerty);
       
   109 
       
   110     iOwner->PtiEngine()->SetKeyboardType(iOwner->FepMan()->KeyboardLayout());
       
   111 
       
   112     }
       
   113 
       
   114 TBool TAknFepInputStateStrokeFindHalfQwerty::HandleKeyL(TInt aKey,
       
   115         TKeyPressLength aLength)
       
   116     {
       
   117     MAknFepManagerUIInterface* fepMan = iOwner->FepMan();
       
   118     CPtiEngine* ptiengine = iOwner->PtiEngine();
       
   119     TBool ret = EFalse;
       
   120 
       
   121     if (iOwner->IsValidChineseInputKeyQwerty(aKey)
       
   122             && CAknFepFnKeyManager::EFnKeyNone == iOwner->FepMan()->FnKeyState() && aLength == EShortKeyPress)
       
   123         {
       
   124 
       
   125         ptiengine->SetCase(EPtiCaseLower);
       
   126         ptiengine->SetInputMode(EPtiEngineStrokePhraseHalfQwerty);
       
   127 
       
   128         ptiengine->AppendKeyPress((TPtiKey)aKey);
       
   129         TPtrC text = ptiengine->GetPhoneticSpelling(1);
       
   130 
       
   131         if (text.Length())
       
   132             {
       
   133 			fepMan->StartInlineEditL();
       
   134 			fepMan->UpdateInlineEditL(text,0);
       
   135 			fepMan->CommitInlineEditL();
       
   136 //            fepMan->NewCharacterL(aText);
       
   137 //            fepMan->CommitInlineEditL();
       
   138 //            ptiengine->ClearCurrentWord();
       
   139             ret = ETrue;
       
   140             }
       
   141         }
       
   142     else if( iOwner->IsValidChineseInputKeyQwerty(aKey) && aLength == ELongKeyPress )
       
   143     	{   	
       
   144     	TPtrC text;
       
   145         TBuf<5> allFnMappedCharacters;
       
   146         ptiengine->MappingDataForKey((TPtiKey)aKey, allFnMappedCharacters, EPtiCaseFnLower);
       
   147         text.Set(allFnMappedCharacters);
       
   148         if (text.Length())
       
   149         	{
       
   150         	TBuf<1> chr;   
       
   151             chr.Append( text[0] );
       
   152             fepMan->RemovePreviousCharacterL();
       
   153             fepMan->NewCharacterL(chr);
       
   154             fepMan->CommitInlineEditL();      
       
   155             ptiengine->ClearCurrentWord();                
       
   156             iData = 0;
       
   157         	}                                 
       
   158         ret = ETrue;
       
   159     	}
       
   160     else
       
   161         {
       
   162         TPtiTextCase caseMode = ptiengine->Case();
       
   163         if (ptiengine->InputMode()!=EPtiEngineHalfQwerty)
       
   164             {
       
   165             ptiengine->ClearCurrentWord();
       
   166             ptiengine->SetInputMode(EPtiEngineHalfQwerty);
       
   167             }
       
   168         ptiengine->SetCase(caseMode);
       
   169         
       
   170         return TAknFepInputStateInitialChineseGenericHalfQwerty::HandleKeyL(
       
   171                 aKey, aLength);
       
   172                 
       
   173                 
       
   174         /*if (fepMan->FnKeyState() == CAknFepFnKeyManager::EFnKeyNext)
       
   175                     fepMan->SetFnKeyState(CAknFepFnKeyManager::EFnKeyNone);*/
       
   176         }
       
   177 
       
   178     return ret;
       
   179     }
       
   180 #endif
       
   181 
       
   182 #endif 
       
   183 // End of file