uiservicetab/vimpstcmdprocess/src/cvimpstcmdhandler.cpp
branchRCL_3
changeset 23 9a48e301e94b
parent 0 5e5d6b214f4f
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/uiservicetab/vimpstcmdprocess/src/cvimpstcmdhandler.cpp	Wed Sep 01 12:33:36 2010 +0100
@@ -0,0 +1,117 @@
+/*
+* 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