uiservicetab/vimpstcmdprocess/src/cvimpstcmdhandler.cpp
author Pat Downey <patd@symbian.org>
Wed, 01 Sep 2010 12:33:36 +0100
branchRCL_3
changeset 23 9a48e301e94b
parent 0 5e5d6b214f4f
permissions -rw-r--r--
Revert incorrect RCL_3 drop: Revision: 201033 Kit: 201035

/*
* Copyright (c) 2008 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: implementation for CVIMPSTCmdHandler  
*
*/


// INCLUDE FILES
#include "cvimpstcmdhandler.h"
#include "cvimpstcmdfactory.h"

#include "mvimpstcmd.h"
#include "mvimpstengine.h"


// --------------------------------------------------------------------------
// CVIMPSTCmdHandler::CVIMPSTCmdHandler
// --------------------------------------------------------------------------
//
CVIMPSTCmdHandler::CVIMPSTCmdHandler()
    {
    }

// --------------------------------------------------------------------------
// CVIMPSTCmdHandler::~CVIMPSTCmdHandler
// --------------------------------------------------------------------------
//
CVIMPSTCmdHandler::~CVIMPSTCmdHandler()
    {
    delete iCommandFactory;
    }

// --------------------------------------------------------------------------
// CVIMPSTCmdHandler::NewL
// --------------------------------------------------------------------------
//
EXPORT_C CVIMPSTCmdHandler* CVIMPSTCmdHandler::NewL(MVIMPSTEngine& aEngine)
    {
    CVIMPSTCmdHandler* self = new(ELeave) CVIMPSTCmdHandler();
    CleanupStack::PushL(self);
    self->ConstructL(aEngine);
    CleanupStack::Pop(self);
    return self;
    }

// --------------------------------------------------------------------------
// CVIMPSTCmdHandler::ConstructL
// --------------------------------------------------------------------------
//
inline void CVIMPSTCmdHandler::ConstructL(MVIMPSTEngine& aEngine)
    {
    iCommandFactory = CVIMPSTCmdFactory::NewL(aEngine);
    }

// --------------------------------------------------------------------------
// CVIMPSTCmdHandler::HandleCommandL
// --------------------------------------------------------------------------
//
TBool CVIMPSTCmdHandler::HandleCommandL
        ( const TImCommandId aCommandId, MVIMPSTCmdObserver* aObserver, 
          TAny* aData )
    {
    TBool ret = EFalse;

	//use the variable aData to set the command related data
    MVIMPSTCmd* cmd = iCommandFactory->CreateCommandForIdL(
            aCommandId,aData);
    
    if (cmd)
	    {
	    cmd->AddObserver(*aObserver);
	    TRAPD (err, cmd->ExecuteLD());
	    User::LeaveIfError(err);
	    ret = ETrue;
	    }

    return ret;
    }
 // --------------------------------------------------------------------------
// CVIMPSTCmdHandler::RegisterEventObserver
// --------------------------------------------------------------------------
//
void CVIMPSTCmdHandler::RegisterEventObserverL( MVIMPSTCmdObserver* aObserver ) 
	{
	iCommandFactory->AddObserverL(aObserver);
	
	}
// --------------------------------------------------------------------------
// CVIMPSTCmdHandler::UnRegisterEventObserver
// --------------------------------------------------------------------------
//
void CVIMPSTCmdHandler::UnRegisterEventObserver( MVIMPSTCmdObserver* aObserver ) 
	{
	iCommandFactory->RemoveObserver(aObserver);
	}
// --------------------------------------------------------------------------
// CVIMPSTCmdHandler::GetProcessInterface
// --------------------------------------------------------------------------
//
MVIMPSTProcessArray& CVIMPSTCmdHandler::GetProcessInterface() 
	{
	return iCommandFactory->GetProcessInterface(); 	
	}
	
	
// End of File