uiservicetab/vimpstcmdprocess/src/cvimpstcmdaddtopbk.cpp
branchRCL_3
changeset 28 3104fc151679
parent 27 2b7283837edb
child 29 9a48e301e94b
equal deleted inserted replaced
27:2b7283837edb 28:3104fc151679
     1 /*
       
     2 * Copyright (c) 2008 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 for CVIMPSTCmdAddToPbk
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include "cvimpstcmdaddtopbk.h"
       
    21 #include "vimpstcmd.hrh"
       
    22 #include "mvimpstcmdobserver.h"
       
    23 
       
    24 #include "uiservicetabtracer.h"
       
    25 
       
    26 #include <e32def.h>
       
    27 #include <MVPbkStoreContact.h>
       
    28 #include "mvimpstengine.h"
       
    29 #include "mvimpststorageserviceview.h"
       
    30 #include "cvimpststoragemanagerfactory.h"
       
    31 
       
    32 // Constants
       
    33 
       
    34 // --------------------------------------------------------------------------
       
    35 // CVIMPSTCmdAddToPbk::CVIMPSTCmdAddToPbk
       
    36 // --------------------------------------------------------------------------
       
    37 //
       
    38 CVIMPSTCmdAddToPbk::CVIMPSTCmdAddToPbk( const TInt aCommandId ,
       
    39                                         const MVIMPSTStorageContact& aStoreContact,
       
    40                                         MVIMPSTEngine& aEngine) :            
       
    41                                         iCommandId( aCommandId ),
       
    42                                         iStoreContact( aStoreContact ),
       
    43                                         iEngine( aEngine )
       
    44     {
       
    45     }
       
    46 
       
    47 // --------------------------------------------------------------------------
       
    48 // CVIMPSTCmdAddToPbk::~CVIMPSTCmdAddToPbk
       
    49 // --------------------------------------------------------------------------
       
    50 //
       
    51 CVIMPSTCmdAddToPbk::~CVIMPSTCmdAddToPbk()
       
    52     {    
       
    53     
       
    54     }
       
    55 
       
    56 // --------------------------------------------------------------------------
       
    57 // CVIMPSTCmdAddToPbk::NewL
       
    58 // --------------------------------------------------------------------------
       
    59 //
       
    60 CVIMPSTCmdAddToPbk* CVIMPSTCmdAddToPbk::NewL( const TInt aCommandId,
       
    61                                               const MVIMPSTStorageContact& aStoreContact,
       
    62                                               MVIMPSTEngine& aEngine)
       
    63     {
       
    64     CVIMPSTCmdAddToPbk* self = new (ELeave ) CVIMPSTCmdAddToPbk( aCommandId, aStoreContact, aEngine);
       
    65     self->ConstructL(); //use contsurctL if necessary
       
    66     return self;
       
    67     }
       
    68 // --------------------------------------------------------------------------
       
    69 // CVIMPSTCmdAddToPbk::ConstructL
       
    70 // --------------------------------------------------------------------------
       
    71 //
       
    72 void CVIMPSTCmdAddToPbk::ConstructL()
       
    73     {    
       
    74     iError = KErrNone;
       
    75     }
       
    76 
       
    77 // --------------------------------------------------------------------------
       
    78 // CVIMPSTCmdAddToPbk::ExecuteLD
       
    79 // --------------------------------------------------------------------------
       
    80 //
       
    81 void CVIMPSTCmdAddToPbk::ExecuteLD()
       
    82     {
       
    83     TRACER_AUTO;
       
    84     //push to the cleanupstack
       
    85     CleanupStack::PushL( this );
       
    86     MVIMPSTStorageServiceView* storage = CVIMPSTStorageManagerFactory::ContactListInterfaceL(iEngine.ServiceId()) ;
       
    87     if(storage)
       
    88         {
       
    89         //storage->AddContactToPhoneBookL(iStoreContact);
       
    90         }
       
    91     else
       
    92         {
       
    93         iError = KErrGeneral;
       
    94         }
       
    95     if(iObserver)
       
    96         {
       
    97         iObserver->CommandFinishedL(*this);
       
    98         }
       
    99        
       
   100     CleanupStack::PopAndDestroy();  
       
   101     
       
   102     }
       
   103 
       
   104 
       
   105 // --------------------------------------------------------------------------
       
   106 // CVIMPSTCmdAddToPbk::AddObserver
       
   107 // --------------------------------------------------------------------------
       
   108 //
       
   109 void CVIMPSTCmdAddToPbk::AddObserver( MVIMPSTCmdObserver& aObserver )
       
   110     {
       
   111     // store the observer to notify the command completion
       
   112     iObserver = &aObserver;
       
   113     }
       
   114 
       
   115 
       
   116 // --------------------------------------------------------------------------
       
   117 // CVIMPSTCmdAddToPbk::CommandId
       
   118 // --------------------------------------------------------------------------
       
   119 //
       
   120 TInt CVIMPSTCmdAddToPbk::CommandId() const
       
   121     {
       
   122     return iCommandId;  
       
   123     }
       
   124 
       
   125 // --------------------------------------------------------------------------
       
   126 // CVIMPSTCmdAddToPbk::Result
       
   127 // --------------------------------------------------------------------------
       
   128 //
       
   129 TInt CVIMPSTCmdAddToPbk::Result() const
       
   130     {
       
   131     //return valid data regd the command operation
       
   132     return iError;
       
   133     }
       
   134 
       
   135 // End of File
       
   136