uiservicetab/vimpstcmdprocess/src/cvimpstcmdaddtopbk.cpp
changeset 0 5e5d6b214f4f
child 14 9fdee5e1da30
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/uiservicetab/vimpstcmdprocess/src/cvimpstcmdaddtopbk.cpp	Tue Feb 02 10:12:18 2010 +0200
@@ -0,0 +1,135 @@
+/*
+* 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 CVIMPSTCmdAddToPbk
+*
+*/
+
+
+// INCLUDE FILES
+#include "cvimpstcmdaddtopbk.h"
+#include "vimpstcmd.hrh"
+#include "mvimpstcmdobserver.h"
+#include "vimpstdebugprint.h" 
+
+#include <e32def.h>
+#include <MVPbkStoreContact.h>
+#include "mvimpstengine.h"
+#include "mvimpststorageserviceview.h"
+#include "cvimpststoragemanagerfactory.h"
+
+// Constants
+
+// --------------------------------------------------------------------------
+// CVIMPSTCmdAddToPbk::CVIMPSTCmdAddToPbk
+// --------------------------------------------------------------------------
+//
+CVIMPSTCmdAddToPbk::CVIMPSTCmdAddToPbk( const TInt aCommandId ,
+                                        const MVIMPSTStorageContact& aStoreContact,
+                                        MVIMPSTEngine& aEngine) :            
+                                        iCommandId( aCommandId ),
+                                        iStoreContact( aStoreContact ),
+                                        iEngine( aEngine )
+    {
+    }
+
+// --------------------------------------------------------------------------
+// CVIMPSTCmdAddToPbk::~CVIMPSTCmdAddToPbk
+// --------------------------------------------------------------------------
+//
+CVIMPSTCmdAddToPbk::~CVIMPSTCmdAddToPbk()
+    {    
+    
+    }
+
+// --------------------------------------------------------------------------
+// CVIMPSTCmdAddToPbk::NewL
+// --------------------------------------------------------------------------
+//
+CVIMPSTCmdAddToPbk* CVIMPSTCmdAddToPbk::NewL( const TInt aCommandId,
+                                              const MVIMPSTStorageContact& aStoreContact,
+                                              MVIMPSTEngine& aEngine)
+    {
+    CVIMPSTCmdAddToPbk* self = new (ELeave ) CVIMPSTCmdAddToPbk( aCommandId, aStoreContact, aEngine);
+    self->ConstructL(); //use contsurctL if necessary
+    return self;
+    }
+// --------------------------------------------------------------------------
+// CVIMPSTCmdAddToPbk::ConstructL
+// --------------------------------------------------------------------------
+//
+void CVIMPSTCmdAddToPbk::ConstructL()
+    {    
+    iError = KErrNone;
+    }
+
+// --------------------------------------------------------------------------
+// CVIMPSTCmdAddToPbk::ExecuteLD
+// --------------------------------------------------------------------------
+//
+void CVIMPSTCmdAddToPbk::ExecuteLD()
+    {
+    CHAT_DP_FUNC_ENTER("CVIMPSTCmdAddToPbk::ExecuteLD");
+    //push to the cleanupstack
+    CleanupStack::PushL( this );
+    MVIMPSTStorageServiceView* storage = CVIMPSTStorageManagerFactory::ContactListInterfaceL(iEngine.ServiceId()) ;
+    if(storage)
+        {
+        //storage->AddContactToPhoneBookL(iStoreContact);
+        }
+    else
+        {
+        iError = KErrGeneral;
+        }
+    if(iObserver)
+        {
+        iObserver->CommandFinishedL(*this);
+        }
+    CHAT_DP_FUNC_ENTER("CVIMPSTCmdAddToPbk:: CommandFinished");    
+    CleanupStack::PopAndDestroy();  
+    CHAT_DP_FUNC_DONE("CVIMPSTCmdAddToPbk::ExecuteLD");    
+    }
+
+
+// --------------------------------------------------------------------------
+// CVIMPSTCmdAddToPbk::AddObserver
+// --------------------------------------------------------------------------
+//
+void CVIMPSTCmdAddToPbk::AddObserver( MVIMPSTCmdObserver& aObserver )
+    {
+    // store the observer to notify the command completion
+    iObserver = &aObserver;
+    }
+
+
+// --------------------------------------------------------------------------
+// CVIMPSTCmdAddToPbk::CommandId
+// --------------------------------------------------------------------------
+//
+TInt CVIMPSTCmdAddToPbk::CommandId() const
+    {
+    return iCommandId;  
+    }
+
+// --------------------------------------------------------------------------
+// CVIMPSTCmdAddToPbk::Result
+// --------------------------------------------------------------------------
+//
+TInt CVIMPSTCmdAddToPbk::Result() const
+    {
+    //return valid data regd the command operation
+    return iError;
+    }
+
+// End of File
+