phonebookengines/VirtualPhonebook/VPbkEng/src/CVPbkEmptySingleContactOperation.cpp
changeset 0 e686773b3f54
equal deleted inserted replaced
-1:000000000000 0:e686773b3f54
       
     1 /*
       
     2 * Copyright (c) 2005-2007 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:  Virtual Phonebook Empty single contact operation.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "CVPbkEmptySingleContactOperation.h"
       
    20 #include <MVPbkSingleContactOperationObserver.h>
       
    21 
       
    22 CVPbkEmptySingleContactOperation::CVPbkEmptySingleContactOperation(
       
    23         MVPbkSingleContactOperationObserver& aObserver, TInt aErrorCode) :
       
    24     CActive(CActive::EPriorityIdle),
       
    25     iObserver(aObserver),
       
    26     iErrorCode( aErrorCode )
       
    27     {
       
    28     CActiveScheduler::Add(this);
       
    29     }
       
    30 
       
    31 CVPbkEmptySingleContactOperation::~CVPbkEmptySingleContactOperation()
       
    32     {
       
    33     Cancel();
       
    34     }
       
    35 
       
    36 CVPbkEmptySingleContactOperation* CVPbkEmptySingleContactOperation::NewL(
       
    37         MVPbkSingleContactOperationObserver& aObserver, TInt aErrorCode)
       
    38     {
       
    39     CVPbkEmptySingleContactOperation* self = 
       
    40         new(ELeave) CVPbkEmptySingleContactOperation( aObserver, aErrorCode );
       
    41     return self;
       
    42 	}
       
    43 
       
    44 void CVPbkEmptySingleContactOperation::StartL()
       
    45     {
       
    46     IssueRequest();
       
    47     }
       
    48 
       
    49 void CVPbkEmptySingleContactOperation::Cancel()
       
    50     {
       
    51     CActive::Cancel();
       
    52     }
       
    53 
       
    54 void CVPbkEmptySingleContactOperation::RunL()
       
    55     {
       
    56     if ( iErrorCode == KErrNone )
       
    57         {
       
    58         iObserver.VPbkSingleContactOperationComplete( *this, NULL );
       
    59         }
       
    60     else
       
    61         {
       
    62         iObserver.VPbkSingleContactOperationFailed( *this, iErrorCode );
       
    63         }
       
    64     }
       
    65 
       
    66 void CVPbkEmptySingleContactOperation::DoCancel()
       
    67     {
       
    68     }
       
    69 
       
    70 void CVPbkEmptySingleContactOperation::IssueRequest()
       
    71     {
       
    72     TRequestStatus* status = &iStatus;
       
    73     User::RequestComplete(status, KErrNone);
       
    74     SetActive();
       
    75     }
       
    76 
       
    77 
       
    78 // End of File