textinput/peninputvkbcn/src/peninputvkbuistatestandbycn.cpp
changeset 0 eb1f2e154e89
equal deleted inserted replaced
-1:000000000000 0:eb1f2e154e89
       
     1 /*
       
     2 * Copyright (c) 2002-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:  Implementation of the vkb ui state machine (Chinese Standby State)
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // user includes
       
    20 #include "peninputvkbuistatestandbycn.h"
       
    21 #include "peninputvkbevent.h"
       
    22 
       
    23 // ======== MEMBER FUNCTIONS ========
       
    24 
       
    25 // Implementation of Class CAknFepVkbUiStateStandbycn
       
    26 
       
    27 // -----------------------------------------------------------------------------
       
    28 // CAknFepVkbUiStateStandbycn::CAknFepVkbUiStateStandbycn
       
    29 // (other items were commented in a header).
       
    30 // -----------------------------------------------------------------------------
       
    31 //
       
    32 CAknFepVkbUiStateStandbycn::CAknFepVkbUiStateStandbycn(MAknFepVkbUiStateMgr* aUiStateMgr, 
       
    33                                                        MAknFepVkbLayoutContext* aContext)
       
    34     :CAknFepVkbUiState(aUiStateMgr,aContext)
       
    35     {
       
    36     }
       
    37        
       
    38 // -----------------------------------------------------------------------------
       
    39 // CAknFepVkbUiStateStandbycn::NewL
       
    40 // (other items were commented in a header).
       
    41 // -----------------------------------------------------------------------------
       
    42 //
       
    43 CAknFepVkbUiStateStandbycn* CAknFepVkbUiStateStandbycn::NewL(MAknFepVkbUiStateMgr* aUiStateMgr, 
       
    44                                                              MAknFepVkbLayoutContext* aContext)
       
    45     {
       
    46     CAknFepVkbUiStateStandbycn* self = 
       
    47                                   new ( ELeave ) CAknFepVkbUiStateStandbycn(aUiStateMgr,aContext);
       
    48     CleanupStack::PushL(self);
       
    49     self->ConstructL(); 
       
    50     CleanupStack::Pop();
       
    51     return self;
       
    52     }  
       
    53       
       
    54 // -----------------------------------------------------------------------------
       
    55 // CAknFepVkbUiStateStandbycn::~CAknFepVkbUiStateStandbycn
       
    56 // (other items were commented in a header).
       
    57 // -----------------------------------------------------------------------------
       
    58 //
       
    59 CAknFepVkbUiStateStandbycn::~CAknFepVkbUiStateStandbycn()
       
    60     {
       
    61     }
       
    62 
       
    63 // -----------------------------------------------------------------------------
       
    64 // CAknFepVkbUiStateStandbycn::HandleKeyEventL
       
    65 // (other items were commented in a header).
       
    66 // -----------------------------------------------------------------------------
       
    67 //
       
    68 TBool CAknFepVkbUiStateStandbycn::HandleKeyEventL(const TRawEvent& /*aData*/)     
       
    69     {
       
    70     return EFalse;
       
    71     }
       
    72 
       
    73 // -----------------------------------------------------------------------------
       
    74 // CAknFepVkbUiStateStandbycn::HandleVkbEvent
       
    75 // (other items were commented in a header).
       
    76 // -----------------------------------------------------------------------------
       
    77 //
       
    78 TBool CAknFepVkbUiStateStandbycn::HandleVkbEvent(TInt /*aEventType*/,
       
    79                                                  const TDesC& aEventData)
       
    80     {
       
    81     TKeyEvent* event = (TKeyEvent*) aEventData.Ptr();      
       
    82     if ( IsFilterUnicode(event->iScanCode) )
       
    83         {
       
    84         iContext->ClearTriggerString();
       
    85         iContext->SendEventToVkbControl(EVkbEventClearContent,NULL);
       
    86         return SendKey(aEventData);
       
    87         }
       
    88     else
       
    89         {
       
    90         iContext->SendEventToVkbControl(EVkbEventStandby2Composition,NULL); 
       
    91         iContext->ForceEditGainFocus(ECompotisionFieldGetFocus);       
       
    92         iUiStateMgr->SetCurrentUiState( iUiStateMgr->UiStateCompositionWithChars() ); 
       
    93         return EFalse;                
       
    94         }
       
    95     
       
    96     }
       
    97     
       
    98 // -----------------------------------------------------------------------------
       
    99 // CAknFepVkbUiStateStandbycn::HandleBackEvent
       
   100 // (other items were commented in a header).
       
   101 // -----------------------------------------------------------------------------
       
   102 //
       
   103 TBool CAknFepVkbUiStateStandbycn::HandleBackEvent(TInt /*aEventType*/,
       
   104                                                   const TDesC& aEventData)
       
   105     {
       
   106     TInt candidateCount = iContext->RequestData(EAknFepDataTypeCandidateCount);
       
   107     if(candidateCount)
       
   108         {
       
   109         TRAP_IGNORE(iContext->GetCandidatesL(aEventData,ETrue));
       
   110         }
       
   111     candidateCount = iContext->RequestData(EAknFepDataTypeCandidateCount);
       
   112     if ( candidateCount == 0 )
       
   113         {
       
   114         iContext->SendEventToVkbControl(EVkbEventClearContent,NULL);
       
   115         }
       
   116 
       
   117     return SendKey(aEventData);  
       
   118     }
       
   119     
       
   120 // -----------------------------------------------------------------------------
       
   121 // CAknFepVkbUiStateStandbycn::HandleEnterSpaceEvent
       
   122 // (other items were commented in a header).
       
   123 // -----------------------------------------------------------------------------
       
   124 //
       
   125 TBool CAknFepVkbUiStateStandbycn::HandleEnterSpaceEvent(TInt /*aEventType*/,
       
   126                                                            const TDesC& aEventData)  
       
   127     {
       
   128     iContext->ClearTriggerString();
       
   129     iContext->SendEventToVkbControl(EVkbEventClearContent,NULL);
       
   130     return SendKey(aEventData);
       
   131     }
       
   132     
       
   133 // -----------------------------------------------------------------------------
       
   134 // CAknFepVkbUiStateStandbycn::HandleEnterSpaceEvent
       
   135 // (other items were commented in a header).
       
   136 // -----------------------------------------------------------------------------
       
   137 //
       
   138 TBool CAknFepVkbUiStateStandbycn::HandleTabEvent(TInt /*aEventType*/,
       
   139                                                            const TDesC& aEventData)  
       
   140     {
       
   141     return SendKey(aEventData);
       
   142     }
       
   143     
       
   144 // -----------------------------------------------------------------------------
       
   145 // CAknFepVkbUiStateStandby::HandleArrowKeyEvent
       
   146 // (other items were commented in a header).
       
   147 // -----------------------------------------------------------------------------
       
   148 //
       
   149 TBool CAknFepVkbUiStateStandbycn::HandleArrowKeyEvent(TInt /*aEventType*/, const TDesC& aEventData)
       
   150     {
       
   151     iContext->ClearTriggerString();//new added
       
   152     iContext->SendEventToVkbControl(EVkbEventClearContent,NULL); //new added
       
   153     return SendKey(aEventData);
       
   154     }
       
   155     
       
   156 TBool CAknFepVkbUiStateStandbycn::HandleControlEvent(TInt aEventType, const TDesC& aEventData)
       
   157 	{
       
   158 	if( aEventType == EEventSetAppCursorSelection && 
       
   159 		iUiStateMgr->CurrentUiState() == iUiStateMgr->UiStateStandbycn() )	
       
   160 		{
       
   161 		// clear condidate list when cursor moves
       
   162 	    iContext->ClearTriggerString();
       
   163 	    iContext->SendEventToVkbControl(EVkbEventClearContent,NULL);
       
   164 		return true;		
       
   165 		}
       
   166 	else
       
   167 		return CAknFepVkbUiState::HandleControlEvent( aEventType, aEventData );	
       
   168 	}
       
   169 // End Of File