phonebookui/Phonebook2/CommandsExtension/inc/CPbk2AssignDefaultsCmd.h
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:  Phonebook 2 assign defaults command.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CPBK2ASSIGNDEFAULTSCMD_H
       
    20 #define CPBK2ASSIGNDEFAULTSCMD_H
       
    21 
       
    22 // INCLUDES
       
    23 #include <e32base.h>
       
    24 #include <MPbk2Command.h>
       
    25 #include <MVPbkSingleContactOperationObserver.h>
       
    26 #include <MVPbkContactObserver.h>
       
    27 #include <MVPbkBatchOperationObserver.h>
       
    28 #include <MPbk2ContactRelocatorObserver.h>
       
    29 
       
    30 // FORWARD DECLARATIONS
       
    31 class CVPbkContactManager;
       
    32 class CAknProgressDialog;
       
    33 class CEikProgressInfo;
       
    34 class MPbk2ContactUiControl;
       
    35 class MVPbkContactLink;
       
    36 class MVPbkStoreContact;
       
    37 class MPbk2ContactNameFormatter;
       
    38 class MVPbkContactLinkArray;
       
    39 class CPbk2ContactRelocator;
       
    40 class CPbk2ApplicationServices;
       
    41 
       
    42 // CLASS DECLARATION
       
    43 
       
    44 /**
       
    45  * Phonebook 2 assign defaults command.
       
    46  */
       
    47 NONSHARABLE_CLASS(CPbk2AssignDefaultsCmd) :
       
    48         public CBase,
       
    49         public MPbk2Command,
       
    50         public MVPbkSingleContactOperationObserver,
       
    51         public MVPbkContactObserver,
       
    52         public MPbk2ContactRelocatorObserver
       
    53     {
       
    54     public: // Construction and destruction
       
    55         /**
       
    56          * Creates a new instance of this class.
       
    57          *
       
    58          * @param aUiControl    UI control.
       
    59          * @return  A new instance of this class.
       
    60          */
       
    61         static CPbk2AssignDefaultsCmd* NewL(
       
    62                 MPbk2ContactUiControl& aUiControl );
       
    63 
       
    64         /**
       
    65          * Destructor.
       
    66          */
       
    67         ~CPbk2AssignDefaultsCmd();
       
    68 
       
    69     public: // From MPbk2Command
       
    70         void ExecuteLD();
       
    71         void AddObserver(MPbk2CommandObserver& aObserver );
       
    72         void ResetUiControl(MPbk2ContactUiControl& aUiControl);
       
    73 
       
    74     private: // From MVPbkSingleContactOperationObserver
       
    75         void VPbkSingleContactOperationComplete(
       
    76                 MVPbkContactOperationBase& aOperation,
       
    77                 MVPbkStoreContact* aContact );
       
    78         void VPbkSingleContactOperationFailed(
       
    79                 MVPbkContactOperationBase& aOperation,
       
    80                 TInt aError );
       
    81 
       
    82     private: // From MVPbkContactObserver
       
    83         void ContactOperationCompleted(
       
    84                 TContactOpResult aResult );
       
    85         void ContactOperationFailed(
       
    86                 TContactOp aOpCode,
       
    87                 TInt aErrorCode,
       
    88                 TBool aErrorNotified );
       
    89 
       
    90     private: // From MPbk2ContactRelocatorObserver
       
    91         void ContactRelocatedL(
       
    92                 MVPbkStoreContact* aRelocatedContact );
       
    93         void ContactRelocationFailed(
       
    94                 TInt aReason,
       
    95                 MVPbkStoreContact* aContact );
       
    96         void ContactsRelocationFailed(
       
    97                 TInt aReason,
       
    98                 CVPbkContactLinkArray* aContacts );
       
    99         void RelocationProcessComplete();
       
   100 
       
   101     private: // Implementation
       
   102         CPbk2AssignDefaultsCmd(
       
   103                 MPbk2ContactUiControl& aUiControl );
       
   104         void ConstructL();
       
   105         void LockContactL();
       
   106         void LaunchAssignDialogL();
       
   107         TBool RelocateContactL();
       
   108         void ProcessFinished(
       
   109                 TInt aError );
       
   110 
       
   111     private:  // Data
       
   112         /// Ref: UI control
       
   113         MPbk2ContactUiControl* iUiControl;
       
   114         /// Own: Array of contacts
       
   115         MVPbkContactLinkArray* iContactLinkArray;
       
   116         /// Ref: Command observer
       
   117         MPbk2CommandObserver* iCommandObserver;
       
   118         /// Own: An operation to get a contact from the link
       
   119         MVPbkContactOperationBase* iContactRetriever;
       
   120         /// Own: Retrieved contact
       
   121         MVPbkStoreContact* iContact;
       
   122         /// Own: Contact relocator
       
   123         CPbk2ContactRelocator* iContactRelocator;
       
   124         /// Own: Application Services pointer
       
   125         CPbk2ApplicationServices* iAppServices;
       
   126     };
       
   127 
       
   128 #endif // CPBK2ASSIGNDEFAULTSCMD_H
       
   129 
       
   130 // End of File