fep/aknfep/src/AknFepUiInputStateInitialMultitapBase.cpp
changeset 0 eb1f2e154e89
equal deleted inserted replaced
-1:000000000000 0:eb1f2e154e89
       
     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 TAknFepInputStateInitialMultitapBase methods.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 
       
    23 
       
    24 
       
    25 
       
    26 
       
    27 
       
    28 
       
    29 
       
    30 #include "AknFepUiInputStateInitialMultitapBase.h"
       
    31 #include "AknFepUIManagerStateInterface.h"      //MAknFepUIManagerStateInterface
       
    32 #include "AknFepManagerUIInterface.h"           //MAknFepManagerUIInterface
       
    33 #include "AknFepCaseManager.h"
       
    34 #include "AknFepUiIndicInputManager.h"
       
    35 
       
    36 #include <PtiEngine.h>
       
    37 #include <PtiDefs.h>
       
    38 
       
    39 TAknFepInputStateInitialMultitapBase::
       
    40 TAknFepInputStateInitialMultitapBase(MAknFepUIManagerStateInterface* aOwner)
       
    41     :TAknFepInputStateBase(aOwner)
       
    42     {
       
    43     iState = EInitial;
       
    44     CPtiEngine* ptiengine = iOwner->PtiEngine();
       
    45 
       
    46     TPtiTextCase caseMode = ptiengine->Case();
       
    47 #ifdef RD_INTELLIGENT_TEXT_INPUT  
       
    48     // This part of code TSW error fixing  
       
    49     // In case of ITU-T, whenever word is displaying along with autocompletion
       
    50     // part and if some how editor will lose focus [example: launch candidate list, 
       
    51     // launch option menu] word along with auto completion part get locked and come to inline editing.
       
    52     MAknFepManagerUIInterface* fepMan = iOwner->FepMan();
       
    53     TBool clearCurrentword(ETrue);
       
    54     TRAP_IGNORE(    
       
    55 	if( fepMan->WesternPredictive() )
       
    56 		{
       
    57 		TInt tailLength = 0;
       
    58 		ptiengine->HandleCommandL( EPtiCommandGetAutoCompletionTailLength, &tailLength );
       
    59 		 if( tailLength > 0 )
       
    60 			 {
       
    61 			 clearCurrentword = EFalse;
       
    62 			 }
       
    63 		});
       
    64 
       
    65 	if( clearCurrentword )
       
    66 		{
       
    67 #endif	
       
    68     ptiengine->ClearCurrentWord();
       
    69 
       
    70 #ifdef RD_INTELLIGENT_TEXT_INPUT 
       
    71     	}
       
    72 #endif	
       
    73     ptiengine->SetInputMode(EPtiEngineMultitapping);
       
    74 
       
    75     ptiengine->SetCase(caseMode);
       
    76     }
       
    77 
       
    78 TBool TAknFepInputStateInitialMultitapBase::HandleKeyL(TInt aKey, TKeyPressLength aLength)
       
    79     {
       
    80     MAknFepManagerUIInterface* fepMan = iOwner->FepMan();
       
    81     CPtiEngine* ptiengine = iOwner->PtiEngine();
       
    82     TBool ret = ETrue;
       
    83 
       
    84     if(iData && (iData != aKey))
       
    85         {
       
    86         fepMan->CommitInlineEditL();
       
    87         ptiengine->ClearCurrentWord();
       
    88         }
       
    89 
       
    90     iData = aKey;
       
    91     if(aLength == EShortKeyPress)
       
    92         {
       
    93         if (aKey == EPtiKeyStar)
       
    94             {
       
    95  			if (fepMan->EditSubmenuInUse())
       
    96         		{
       
    97         		return ret;
       
    98         		}                        
       
    99             else if (fepMan->IsAbleToLaunchSCT())
       
   100                 {
       
   101                 fepMan->LaunchSpecialCharacterTableL();
       
   102                 }
       
   103             }
       
   104         else
       
   105             {
       
   106             TPtrC text = ptiengine->AppendKeyPress((TPtiKey)aKey);
       
   107 
       
   108             if( aKey == EPtiKey0 && text.Length())
       
   109             	{
       
   110             	MPtiLanguage* ptilang = ptiengine->CurrentLanguage();
       
   111         		TInt currentPtiLang = ( ptilang )? ptilang->LanguageCode() : 0;
       
   112             	if( TAknFepUiIndicInputManager::IsCharLigature( text[0], 
       
   113                                                             ( TLanguage )currentPtiLang ) )
       
   114             		{
       
   115             		ptiengine->ClearCurrentWord();
       
   116             		text.Set( ptiengine->AppendKeyPress( ( TPtiKey )aKey ) );
       
   117             		}
       
   118             	}
       
   119 
       
   120             if (text.Length())
       
   121                 {
       
   122                 fepMan->NewCharacterL(text);
       
   123                 }
       
   124             }
       
   125         }
       
   126     else // long keypress
       
   127         {
       
   128 #ifdef RD_INTELLIGENT_TEXT_INPUT
       
   129         if (aKey == EPtiKeyStar)
       
   130             {
       
   131             if(fepMan->EditSubmenuInUse() && fepMan->IsAbleToLaunchSCT())
       
   132                 {
       
   133                 fepMan->LaunchSpecialCharacterTableL();
       
   134                 }
       
   135             }
       
   136 #else
       
   137         if (aKey == EPtiKeyStar && fepMan->EditSubmenuInUse())
       
   138             {
       
   139             fepMan->LaunchSpecialCharacterTableL();                
       
   140             }    
       
   141 #endif
       
   142 		else
       
   143 			{			                  
       
   144         	if (aKey != EKeyBackspace)
       
   145         		{
       
   146                 TChar ch(aKey);
       
   147 
       
   148                 TBuf<1> buf;
       
   149                 buf.Append(ch);
       
   150         	    fepMan->NewCharacterL(buf);
       
   151         	    fepMan->CommitInlineEditL();
       
   152         	    ptiengine->ClearCurrentWord();
       
   153         		}
       
   154         	else
       
   155         		{
       
   156         		ret = EFalse;
       
   157         		}
       
   158 			}
       
   159         }
       
   160 
       
   161     return ret;
       
   162     }
       
   163 
       
   164 // Functions from MPtiObserver interface
       
   165 void TAknFepInputStateInitialMultitapBase::KeyTimerExpired()
       
   166     {
       
   167     if (iData)
       
   168         {
       
   169         MAknFepManagerUIInterface* fepMan = iOwner->FepMan();
       
   170         TRAP_IGNORE(fepMan->CommitInlineEditL())
       
   171 
       
   172         CPtiEngine* ptiengine = iOwner->PtiEngine();
       
   173         ptiengine->ClearCurrentWord();
       
   174 
       
   175         iData = 0;
       
   176         }
       
   177     }
       
   178 
       
   179 // Set the Star Key flag.    
       
   180 void TAknFepInputStateInitialMultitapBase::SetStarKeyFlag( TBool aSet)
       
   181 	{
       
   182 	TAknFepInputStateBase::SetStarKeyFlag( aSet );
       
   183 	}
       
   184 // End of file