phonebookui/Phonebook2/NamesListExtension/inc/cpbk2deletemycardcmd.h
branchRCL_3
changeset 20 f4a778e096c2
equal deleted inserted replaced
19:5b6f26637ad3 20:f4a778e096c2
       
     1 /*
       
     2 * Copyright (c) 2009 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:  Phonebook 2 delete mycard command.
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef CPBK2DELETEMYCARDCMD_H
       
    19 #define CPBK2DELETEMYCARDCMD_H
       
    20 
       
    21 // INCLUDES
       
    22 #include <e32base.h>
       
    23 #include <MPbk2Command.h>
       
    24 #include <MVPbkBatchOperationObserver.h>
       
    25 
       
    26 // FORWARD DECLARATIONS
       
    27 class MPbk2ContactUiControl;
       
    28 class MVPbkContactLink;
       
    29 class MVPbkStoreContact;
       
    30 class CVPbkContactLinkArray;
       
    31 class CPbk2ApplicationServices;
       
    32 
       
    33 // CLASS DECLARATION
       
    34 
       
    35 /**
       
    36  * Phonebook 2 delete mycard command.
       
    37  */
       
    38 NONSHARABLE_CLASS( CPbk2DeleteMyCardCmd ) :
       
    39     public CActive,
       
    40     public MPbk2Command,
       
    41     public MVPbkBatchOperationObserver
       
    42     {
       
    43 public: // Construction and destruction
       
    44 
       
    45     /**
       
    46      * Creates a new instance of this class.
       
    47      *
       
    48      * @param aUiControl    UI control.
       
    49      * @param aLink Contact to be deleted
       
    50      * @return  A new instance of this class.
       
    51      */
       
    52     static CPbk2DeleteMyCardCmd* NewL(
       
    53             MPbk2ContactUiControl& aUiControl,
       
    54             const MVPbkContactLink& aLink );
       
    55 
       
    56     /**
       
    57      * Destructor.
       
    58      */
       
    59     ~CPbk2DeleteMyCardCmd();
       
    60 
       
    61 public: // From MPbk2Command
       
    62     
       
    63     void ExecuteLD();
       
    64     void AddObserver( MPbk2CommandObserver& aObserver );
       
    65     void ResetUiControl(MPbk2ContactUiControl& aUiControl);
       
    66 
       
    67 private: // From CActive
       
    68     
       
    69     void DoCancel();
       
    70     void RunL();
       
    71     TInt RunError( TInt aError );
       
    72 
       
    73 private: // From MVPbkBatchOperationObserver
       
    74     
       
    75     void StepComplete( 
       
    76         MVPbkContactOperationBase& aOperation,
       
    77         TInt aStepSize );
       
    78     TBool StepFailed( 
       
    79         MVPbkContactOperationBase& aOperation,
       
    80         TInt aStepSize, TInt aError );
       
    81     void OperationComplete( 
       
    82         MVPbkContactOperationBase& aOperation );
       
    83 
       
    84 private: // Data structures
       
    85     /// Process states
       
    86     enum TProcessState
       
    87         {
       
    88         EConfirming,
       
    89         EStarting,
       
    90         EDeleting,
       
    91         EStopping,
       
    92         ECanceling
       
    93         };
       
    94 
       
    95 private: // Implementation
       
    96     
       
    97     /**
       
    98      * Constructor
       
    99      * 
       
   100      * @param aUiControl Active UI control  
       
   101      */
       
   102     CPbk2DeleteMyCardCmd( MPbk2ContactUiControl& aUiControl );
       
   103 
       
   104     /**
       
   105      * Constructor
       
   106      * 
       
   107      * @param aLink Contact to be deleted
       
   108      */
       
   109     void ConstructL( const MVPbkContactLink& aLink );
       
   110 
       
   111     /**
       
   112      * Issue asynchronous request to move into state
       
   113      * 
       
   114      * @param aState next state
       
   115      */
       
   116     void IssueRequest( TProcessState aState );
       
   117     
       
   118     /**
       
   119      * Complete the command process
       
   120      * 
       
   121      * @param aCancelCode result of the command process
       
   122      */
       
   123     void ProcessDismissed( TInt aCancelCode );
       
   124 
       
   125     /**
       
   126      * Delete contact that was given in the construction
       
   127      */
       
   128     void DeleteContactL();
       
   129     
       
   130     /**
       
   131      * Show confirmation query for delete operation
       
   132      */
       
   133     void ConfirmDeletionL();
       
   134 
       
   135 private: // Data
       
   136     /// Ref: UI control
       
   137     MPbk2ContactUiControl* iUiControl;
       
   138     /// Ref: Command observer
       
   139     MPbk2CommandObserver* iCommandObserver;
       
   140     
       
   141     /// Own: Current state of process
       
   142     TProcessState iState;
       
   143     /// Own: Delete operation
       
   144     MVPbkContactOperationBase* iDeleteOperation;
       
   145     /// Own: Contact to be deleted (only one contact)
       
   146     CVPbkContactLinkArray* iContactsArray;
       
   147     /// Own: Application Services instance
       
   148     CPbk2ApplicationServices* iAppServices;
       
   149     };
       
   150 
       
   151 #endif // CPBK2DELETEMYCARDCMD_H
       
   152 
       
   153 // End of File