phonebookui/Phonebook2/CommandsExtension/inc/CPbk2ThumbnailCmdBase.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 thumbnail commands set and remove.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #ifndef CPBK2THUMBNAILCMDBASE_H
       
    21 #define CPBK2THUMBNAILCMDBASE_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 
       
    40 // CLASS DECLARATION
       
    41 
       
    42 /**
       
    43  * Thumbnail command event handling class.
       
    44  */
       
    45 NONSHARABLE_CLASS(CPbk2ThumbnailCmdBase) : 
       
    46         public CBase,
       
    47         public MPbk2Command,
       
    48         public MVPbkContactObserver,        
       
    49         public MVPbkSingleContactOperationObserver,
       
    50         public MPbk2ContactRelocatorObserver
       
    51 
       
    52     {
       
    53     protected:  // Constructors and destructor
       
    54         /**
       
    55          * Destructor.
       
    56          */
       
    57         ~CPbk2ThumbnailCmdBase();
       
    58         
       
    59     protected: // Interface
       
    60         /**
       
    61          * Base constructor.
       
    62          */
       
    63         void BaseConstructL();
       
    64 
       
    65         /**
       
    66          * Dismisses process.
       
    67          *
       
    68          * @param aError    Error code.
       
    69          */
       
    70         void ProcessDismissed(
       
    71                 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 		/**
       
    94 		 * Will be called when the process is about to finish.
       
    95 		 * Default implementation does nothing if aError == KErrNone,
       
    96 		 * otherwise informs user about error.
       
    97          *
       
    98          * @param aError    Error code.
       
    99 		 */
       
   100         virtual void FilterErrors(
       
   101                 TInt aError );
       
   102 
       
   103     private: // From MVPbkContactObserver
       
   104     	void ContactOperationCompleted(
       
   105                 TContactOpResult aResult );
       
   106         void ContactOperationFailed(
       
   107                 TContactOp aOpCode,
       
   108                 TInt aErrorCode,
       
   109                 TBool aErrorNotified );
       
   110 
       
   111     private: // From MVPbkSingleContactOperationObserver
       
   112     	void VPbkSingleContactOperationComplete(
       
   113     		    MVPbkContactOperationBase& aOperation, 
       
   114     		    MVPbkStoreContact* aContact );
       
   115 		void VPbkSingleContactOperationFailed(
       
   116         	    MVPbkContactOperationBase& aOperation,
       
   117                 TInt aError );
       
   118         	
       
   119     private: // From MPbk2ContactRelocatorObserver
       
   120         void ContactRelocatedL(
       
   121                 MVPbkStoreContact* aRelocatedContact );
       
   122         void ContactRelocationFailed(
       
   123                 TInt aReason,
       
   124                 MVPbkStoreContact* aContact );
       
   125         void ContactsRelocationFailed(
       
   126                 TInt aReason,
       
   127                 CVPbkContactLinkArray* aContacts );
       
   128         void RelocationProcessComplete();
       
   129 
       
   130     protected: // Implementation
       
   131         CPbk2ThumbnailCmdBase(
       
   132                 MPbk2ContactUiControl& aUiControl );
       
   133         void ReadFieldTypeL();
       
   134         TBool RelocateContactL();
       
   135 
       
   136     protected: // Data
       
   137         /// Own: Retrieve operation
       
   138         MVPbkContactOperationBase* iRetrieveOperation;
       
   139         /// Own: Selected contacts from UI control
       
   140         MVPbkContactLink* iContactLink;
       
   141         /// Own: Thumbnail manager
       
   142         CPbk2ImageManager* iThumbnailManager;
       
   143     	/// Ref: UI control
       
   144         MPbk2ContactUiControl* iUiControl;
       
   145         /// Ref: Command observer
       
   146         MPbk2CommandObserver* iCommandObserver;
       
   147         /// Ref: Virtual Phonebook contact manager
       
   148         CVPbkContactManager* iContactManager;
       
   149         /// Own: Store contact
       
   150         MVPbkStoreContact* iStoreContact;
       
   151         /// Ref: Thumbnail field type
       
   152         const MVPbkFieldType* iFieldType;
       
   153         /// Own: Contact relocator
       
   154         CPbk2ContactRelocator* iContactRelocator;
       
   155         /// Own: Focused field index
       
   156         TInt iFocusedFieldIndex;
       
   157     };
       
   158 
       
   159 #endif // CPBK2THUMBNAILCMDBASE_H
       
   160             
       
   161 // End of File