phonebookui/Phonebook2/CommandsExtension/inc/CPbk2AssignSpeedDialCmd.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 speed dial command object.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CPBK2ASSIGNSPEEDDIALCMD_H
       
    20 #define CPBK2ASSIGNSPEEDDIALCMD_H
       
    21 
       
    22 // INCLUDES
       
    23 #include <e32base.h>
       
    24 #include <MPbk2Command.h>
       
    25 #include <MVPbkContactObserver.h>
       
    26 #include <MVPbkSingleContactOperationObserver.h>
       
    27 #include <MPbk2ContactRelocatorObserver.h>
       
    28 
       
    29 // FORWARD DECLARATIONS
       
    30 class MPbk2ContactUiControl;
       
    31 class MPbk2CommandObserver;
       
    32 class CVPbkContactIdConverter;
       
    33 class MVPbkStoreContact;
       
    34 class CPbk2ContactRelocator;
       
    35 class MVPbkStoreContactField;
       
    36 class CPbk2ApplicationServices;
       
    37 
       
    38 // CLASS DECLARATION
       
    39 
       
    40 /**
       
    41  * Phonebook 2 assign speed dial command object.
       
    42  * Responsible for assigning a speed dial to a contact.
       
    43  */
       
    44 NONSHARABLE_CLASS(CPbk2AssignSpeedDialCmd) :
       
    45         public CBase,
       
    46         public MPbk2Command,
       
    47         public MVPbkContactObserver,
       
    48         public MVPbkSingleContactOperationObserver,
       
    49         public MPbk2ContactRelocatorObserver
       
    50     {
       
    51     public: // Construction and destruction
       
    52 
       
    53         /**
       
    54          * Creates a new instance of this class.
       
    55          *
       
    56          * @param aUiControl    UI control.
       
    57          * @return  A new instance of this class.
       
    58          */
       
    59         static CPbk2AssignSpeedDialCmd* NewL(
       
    60                 MPbk2ContactUiControl& aUiControl );
       
    61 
       
    62         /**
       
    63          * Destructor.
       
    64          */
       
    65         ~CPbk2AssignSpeedDialCmd();
       
    66 
       
    67     public:  // From MPbk2Command
       
    68         void ExecuteLD();
       
    69         void AddObserver(
       
    70                 MPbk2CommandObserver& aObserver );
       
    71         void ResetUiControl(
       
    72                 MPbk2ContactUiControl& aUiControl );
       
    73 
       
    74     public: // From MVPbkContactObserver
       
    75         void ContactOperationCompleted(
       
    76                 TContactOpResult aResult );
       
    77         void ContactOperationFailed(
       
    78                 TContactOp aOpCode,
       
    79                 TInt aErrorCode,
       
    80                 TBool aErrorNotified );
       
    81 
       
    82     public: // From MVPbkSingleContactOperationObserver
       
    83         void VPbkSingleContactOperationComplete(
       
    84                 MVPbkContactOperationBase& aOperation,
       
    85                 MVPbkStoreContact* aContact );
       
    86         void VPbkSingleContactOperationFailed(
       
    87                 MVPbkContactOperationBase& aOperation,
       
    88                 TInt aError );
       
    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         CPbk2AssignSpeedDialCmd(
       
   103                 MPbk2ContactUiControl& aUiControl );
       
   104         void ConstructL();
       
   105         void FinishCommand(
       
   106                 TInt aError );
       
   107         TBool RelocateContactL();
       
   108         void AssignSpeedDialL();
       
   109         MVPbkStoreContactField* FocusedFieldLC(
       
   110                 MVPbkStoreContact& aStoreContact );
       
   111 
       
   112     private: // Data
       
   113         /// Ref: UI control
       
   114         MPbk2ContactUiControl* iUiControl;
       
   115         /// Ref: Command observer
       
   116         MPbk2CommandObserver* iCommandObserver;
       
   117         /// Own: Contact id converter
       
   118         CVPbkContactIdConverter* iIdConverter;
       
   119         /// Own: Store contact to assign a speed dial
       
   120         MVPbkStoreContact* iStoreContact;
       
   121         /// Own: Retrieve operation
       
   122         MVPbkContactOperationBase* iOperation;
       
   123         /// Own: Contact relocator
       
   124         CPbk2ContactRelocator* iContactRelocator;
       
   125         /// Own: Application Services pointer
       
   126         CPbk2ApplicationServices* iAppServices;
       
   127     };
       
   128 
       
   129 #endif // CPBK2ASSIGNSPEEDDIALCMD_H
       
   130 
       
   131 // End of File