phonebookui/Phonebook2/CommandsExtension/inc/CPbk2ImageCmdBase.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: 
       
    15 *     Base class for image commands set and remove.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #ifndef CPBK2IMAGECMDBASE_H
       
    21 #define CPBK2IMAGECMDBASE_H
       
    22 
       
    23 //  INCLUDES
       
    24 #include <e32base.h>    // CBase
       
    25 #include <MPbk2Command.h>
       
    26 #include <MVPbkSingleContactOperationObserver.h>
       
    27 #include <MVPbkContactObserver.h>
       
    28 #include <MPbk2ContactRelocatorObserver.h>
       
    29 
       
    30 // FORWARD DECLARATIONS
       
    31 class CEikMenuPane;
       
    32 class MPbk2ContactUiControl;
       
    33 class CVPbkContactManager;
       
    34 class CPbk2ImageManager;
       
    35 class MVPbkStoreContact;
       
    36 class MVPbkFieldType;
       
    37 class MVPbkContactLink;
       
    38 class CPbk2ContactRelocator;
       
    39 class CPbk2FieldFocusHelper;
       
    40 
       
    41 // CLASS DECLARATION
       
    42 
       
    43 /**
       
    44  * Image command event handling class.
       
    45  */
       
    46 NONSHARABLE_CLASS(CPbk2ImageCmdBase) :
       
    47         public CBase,
       
    48         public MPbk2Command,
       
    49         public MVPbkContactObserver,
       
    50         public MVPbkSingleContactOperationObserver,
       
    51         public MPbk2ContactRelocatorObserver
       
    52 
       
    53     {
       
    54     protected:  // Constructors and destructor
       
    55         /**
       
    56          * Destructor.
       
    57          */
       
    58         ~CPbk2ImageCmdBase();
       
    59 
       
    60     protected: // Interface
       
    61         /**
       
    62          * Base constructor.
       
    63          */
       
    64         void BaseConstructL();
       
    65 
       
    66         /**
       
    67          * Dismisses process.
       
    68          *
       
    69          * @param aError    Error code.
       
    70          */
       
    71         void ProcessDismissed( TInt aError );
       
    72 
       
    73 	public: // From MPbk2Command
       
    74         void ExecuteLD();
       
    75         void AddObserver(MPbk2CommandObserver& aObserver );
       
    76         void ResetUiControl(MPbk2ContactUiControl& aUiControl);
       
    77 
       
    78     protected: // Interface
       
    79     	/**
       
    80     	 * Function will be called after the contact has retrieved
       
    81     	 * successfully.
       
    82     	 * If process should be end returns EFalse.
       
    83     	 * If process will be ended elsewhere (e.g. after some
       
    84     	 * async operation) returns ETrue.
       
    85     	 * Default implementation does nothing and returns EFalse.
       
    86          *
       
    87          * @return EFalse if process should ended right now,
       
    88          *         ETrue otherwise.
       
    89     	 */
       
    90     	virtual TBool ExecuteCommandL()
       
    91                 { return EFalse; }
       
    92 
       
    93     private: // From MVPbkContactObserver
       
    94     	void ContactOperationCompleted(
       
    95                 TContactOpResult aResult );
       
    96         void ContactOperationFailed(
       
    97                 TContactOp aOpCode,
       
    98                 TInt aErrorCode,
       
    99                 TBool aErrorNotified );
       
   100 
       
   101     private: // From MVPbkSingleContactOperationObserver
       
   102     	void VPbkSingleContactOperationComplete(
       
   103     		    MVPbkContactOperationBase& aOperation,
       
   104     		    MVPbkStoreContact* aContact );
       
   105 		void VPbkSingleContactOperationFailed(
       
   106         	    MVPbkContactOperationBase& aOperation,
       
   107                 TInt aError );
       
   108 
       
   109     private: // From MPbk2ContactRelocatorObserver
       
   110         void ContactRelocatedL(
       
   111                 MVPbkStoreContact* aRelocatedContact );
       
   112         void ContactRelocationFailed(
       
   113                 TInt aReason,
       
   114                 MVPbkStoreContact* aContact );
       
   115         void ContactsRelocationFailed(
       
   116                 TInt aReason,
       
   117                 CVPbkContactLinkArray* aContacts );
       
   118         void RelocationProcessComplete();
       
   119 
       
   120     protected: // Implementation
       
   121         CPbk2ImageCmdBase(
       
   122                 MPbk2ContactUiControl& aUiControl );
       
   123         TBool RelocateContactL();
       
   124         void ReadFieldTypesL();
       
   125         TInt FindFieldIndex(
       
   126                 const MVPbkFieldType& aFieldType);
       
   127 
       
   128     protected: // Data
       
   129         /// Own: Retrieve operation
       
   130         MVPbkContactOperationBase* iRetrieveOperation;
       
   131         /// Own: Selected contacts from UI control
       
   132         MVPbkContactLink* iContactLink;
       
   133         /// Own: Image manager
       
   134         CPbk2ImageManager* iImageManager;
       
   135     	/// Ref: UI control
       
   136         MPbk2ContactUiControl* iUiControl;
       
   137         /// Ref: Command observer
       
   138         MPbk2CommandObserver* iCommandObserver;
       
   139         /// Ref: Virtual Phonebook contact manager
       
   140         CVPbkContactManager* iContactManager;
       
   141         /// Own: Store contact
       
   142         MVPbkStoreContact* iStoreContact;
       
   143         /// Ref: Image data field type
       
   144         const MVPbkFieldType* iThumbnailFieldType;
       
   145         /// Ref: Image reference field type
       
   146         const MVPbkFieldType* iImageFieldType;
       
   147         /// Own: Contact relocator
       
   148         CPbk2ContactRelocator* iContactRelocator;
       
   149         /// Own: Command helper
       
   150         CPbk2FieldFocusHelper* iFieldFocusHelper;
       
   151     };
       
   152 
       
   153 #endif // CPBK2IMAGECMDBASE_H
       
   154 
       
   155 // End of File