fep/aknfep/src/AknFepUiManagerKorean.cpp
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Thu, 19 Aug 2010 10:15:25 +0300
branchRCL_3
changeset 19 ac7e4d1d9209
parent 0 eb1f2e154e89
permissions -rw-r--r--
Revision: 201031 Kit: 201033

/*
* Copyright (c) 2002-2004 Nokia Corporation and/or its subsidiary(-ies). 
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0""
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description:            Provides the CAknFepUIManagerKorean Methods.
*
*/

// INCLUDE FILES
#include <e32svr.h> // RDebug stuff...
#include <e32keys.h>

#include "AknFepGlobalEnums.h"
#include "AknFepManagerUIInterface.h"
#include "AknFepManagerInterface.h"
#include "AknFepUIManagerStateInterface.h"
#include "AknFepUiManagerBase.h"
#include "AknFepUiManagerKorean.h"

// Western input
#include "AknFepUiInputStateInitialLatinMultitap.h"
#include "AknFepUiInputStateInitialNumber.h"

//Korean input
#include "AknFepUiInputStateInitialKoreanMultitap.h"
#include "AknFepUiInputStateQwertyKorean.h"
#include "AknFepPanic.h"

#include <AknIndicatorContainer.h>  // CAknIndicatorContainer::TIndicatorContext
#include <PtiEngine.h> 
#include <PtiDefs.h>

// CONSTANTS

/**
 *  CAknFepUIManagerKorean class.
 * 
 */

//============================ MEMBER FUNCTIONS ==============================


// ---------------------------------------------------------------------------
// CAknFepUIManagerKorean::NewL
// 
// 
// ---------------------------------------------------------------------------
//
CAknFepUIManagerKorean* CAknFepUIManagerKorean::NewL(MAknFepManagerUIInterface* aFepMan, CAknFepCaseManager* aCaseMan, TLanguage aLanguage)
    {   
    CAknFepUIManagerKorean* self = new(ELeave)CAknFepUIManagerKorean(aFepMan, aCaseMan);
    CleanupStack::PushL(self);
    self->ConstructL(aLanguage);
    CleanupStack::Pop();
    return self;
    }

// ---------------------------------------------------------------------------
// CAknFepUIManagerKorean::~CAknFepUIManagerKorean
// 
// 
// ---------------------------------------------------------------------------
//
CAknFepUIManagerKorean::~CAknFepUIManagerKorean()
    {
    }

// ---------------------------------------------------------------------------
// CAknFepUIManagerKorean::HandleKeyL
// 
// 
// ---------------------------------------------------------------------------
//
TBool CAknFepUIManagerKorean::HandleKeyL( TInt aKey, TKeyPressLength aLength,
		                                  TEventCode /*aEventCode*/ )
    {
    TUIState currentState = iFepUiState.State();
    if (aLength == EShortKeyPress)
        {
        iInitialFepUIState = currentState;
        }

    if(!iStatePtr->HandleKeyL(aKey, aLength))
        {       
        if(currentState != iStatePtr->State()) //Check to see if we've changed state.
            {
			return iStatePtr->HandleKeyL(aKey, aLength);                                     
            }
        return EFalse; // we've failed to handle it..       
        }
    return ETrue; //we're ok.
    }

// ---------------------------------------------------------------------------
// CAknFepUIManagerKorean::CloseUI
// 
// 
// ---------------------------------------------------------------------------
//
void CAknFepUIManagerKorean::CloseUI()
    {
    ChangeState(EInitial);
    }

// ---------------------------------------------------------------------------
// CAknFepUIManagerKorean::SupportLanguage
// 
// 
// ---------------------------------------------------------------------------
//
TInt CAknFepUIManagerKorean::SupportLanguage(TInt aMode) const
    {
    TInt lang = iLanguage;
    switch (aMode)
        {
        case ELatin:
            {
            lang = ELangEnglish;
            }
            break;
        case EHangul:
        case ENumeric:
        default:
            break;
        }
    return lang;
    }

// ---------------------------------------------------------------------------
// CAknFepUIManagerKorean::ActivateUI
// 
// 
// ---------------------------------------------------------------------------
//
void CAknFepUIManagerKorean::ActivateUI()
    {
    ChangeState(EEntry);
    }

// ---------------------------------------------------------------------------
// CAknFepUIManagerKorean::ChangeState
// 
// 
// ---------------------------------------------------------------------------
// MAknFepUIManagerStateInterface
TUIState CAknFepUIManagerKorean::ChangeState(TUIState aState)
    {
    switch(aState)
        {
        case EInitial:
            {
            switch(iMode)
                {
                case ELatin:
                    {
                    iFepUiState = TAknFepInputStateInitialLatinMultitap(this);
                    break;               
                    }
                case EHangul:
                	{
                    iFepUiState = TAknFepInputStateInitialKoreanMultitap(this);	         
                	break;
                	}
                case ENumber:
                case ENativeNumber:
                    {
                    //Map directly to the resources...
                    iFepUiState = TAknFepInputStateInitialNumber(this);
                    break;
                    }
                default:
                    AknFepPanic(EAknFepPanicBadInputState);
                    break;
                }
            break;
            }
        case EEntry:
            {
            switch(iMode)
                {
                default:
                    AknFepPanic(EAknFepPanicBadInputState);
                    break;
                }
            break;  
            }   	
        case ECandidate:
        	{
        	switch(iMode)
        		{
        		default:
                    AknFepPanic(EAknFepPanicBadInputState);
                    break;
        		}
        	break;
        	}
        	
        case EPredictiveCandidate:
        	{
        	switch(iMode)
        		{
        		default:
                    AknFepPanic(EAknFepPanicBadInputState);
                    break;
        		}
            break;
        	}
        	
        case EQwerty:
            {
            switch(iMode)
                {
                case EHangul:
                    iFepUiState = TAknFepInputStateQwertyKorean(this);
                    break;                
                case ELatin:
                case ENumber:
                case ENativeNumber:
                	iFepUiState = TAknFepInputStateQwerty(this);
                	break;
                default:
					AknFepPanic(EAknFepPanicBadInputState);	
					break;
                }
               break;
            }
            
        case EPredictiveInput:
            AknFepPanic(EAknFepPanicBadInputState);
            break;
            
        default:
            AknFepPanic(EAknFepPanicBadInputState);
         	break;   
        }
    
    iPtiEngine->SetObserver(&iFepUiState);
#ifdef _DEBUG
    RDebug::Print(_L("UI Manager: New State: %d"), iFepUiState.State());
#endif
    return iStatePtr->State();
    }

// ---------------------------------------------------------------------------
// CAknFepUIManagerKorean::CAknFepUIManagerKorean
// 
// 
// ---------------------------------------------------------------------------
//
CAknFepUIManagerKorean::CAknFepUIManagerKorean(MAknFepManagerUIInterface* aFepMan, CAknFepCaseManager* aCaseMan)
    : CAknFepUIManagerBase(aFepMan, aCaseMan),
      iFepUiState(NULL)

    {
    }

// ---------------------------------------------------------------------------
// CAknFepUIManagerKorean::ConstructL
// 
// 
// ---------------------------------------------------------------------------
//
void CAknFepUIManagerKorean::ConstructL(TLanguage aLanguage)
    {   
    CAknFepUIManagerBase::ConstructL(aLanguage);
    }

// ---------------------------------------------------------------------------
// CAknFepUIManagerKorean::FepUIState
// 
// 
// ---------------------------------------------------------------------------
//
TAknFepInputStateBase* CAknFepUIManagerKorean::FepUIState()
    {
    return &iFepUiState;
    }
    
// End of file