harvester/composerplugins/imagecomposer/inc/imagepresentobserver.h
changeset 0 c53acadfccc6
child 1 acef663c1218
equal deleted inserted replaced
-1:000000000000 0:c53acadfccc6
       
     1 /*
       
     2 * Copyright (c) 2006-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:  image composer listener for setting pending image objects present
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef IMAGEPRESENTOBSERVER_H_
       
    20 #define IMAGEPRESENTOBSERVER_H_
       
    21 
       
    22 #include "mdeharvestersession.h"
       
    23 
       
    24 // forward declarations
       
    25 class CMdENamespaceDef;
       
    26 class CComposerImagePlugin;
       
    27 
       
    28 /**
       
    29  *  CImagePresentObserver
       
    30  * 
       
    31  */
       
    32 class CImagePresentObserver : public CActive, public MMdEObjectPresentObserver
       
    33 	{
       
    34 public:
       
    35 
       
    36 	enum TRequest
       
    37 		{
       
    38 		ERequestIdle,
       
    39 		ERequestWaitPendingCount,
       
    40 		ERequestWaitPending,
       
    41 		ERequestProcess
       
    42 		} 
       
    43 	;
       
    44 	/**
       
    45 	 * Destructor.
       
    46 	 */
       
    47 	~CImagePresentObserver();
       
    48 
       
    49 	/**
       
    50 	 * Two-phased constructor.
       
    51 	 */
       
    52 	static CImagePresentObserver* NewL( CMdESession* aSession, CComposerImagePlugin* aComposer, 
       
    53 			CMdEHarvesterSession* aMdEHarvesterSession );
       
    54 
       
    55     /**
       
    56      * Set next request (=state) of this active object.
       
    57      * @param aRequest  State enumeration.
       
    58      */       
       
    59     void SetNextRequest( TRequest aRequest );	
       
    60 	
       
    61     /**
       
    62      * Standard RunL-method.
       
    63      * From CActive.
       
    64      */       
       
    65     void RunL();
       
    66 
       
    67     /**
       
    68      * From CActive.
       
    69      */       
       
    70     void DoCancel();
       
    71 
       
    72     /**
       
    73      * From CActive.
       
    74      * @param aError  Leave error code.
       
    75      * @return Always KErrNone.
       
    76      */       
       
    77     TInt RunError( TInt aError );
       
    78 		
       
    79 	
       
    80 protected:
       
    81 
       
    82 	/**
       
    83 	 * Called to notify the observer that objects has been set
       
    84 	 * to present or not present state in the metadata engine database.
       
    85 	 *
       
    86 	 * @param aSession session
       
    87 	 * @param aPresent state: ETrue - present or  EFales - not present
       
    88 	 * @param aObjectIdArray object IDs which are set to present state
       
    89 	 */
       
    90 	void HandleObjectPresentNotification(CMdESession& aSession, 
       
    91 			TBool aPresent, const RArray<TItemId>& aObjectIdArray);
       
    92 	
       
    93 private:
       
    94 
       
    95 	/**
       
    96 	 * Constructor for performing 1st stage construction
       
    97 	 */
       
    98 	CImagePresentObserver();
       
    99 
       
   100 	/**
       
   101 	 * EPOC default constructor for performing 2nd stage construction
       
   102 	 */
       
   103 	void ConstructL( CMdESession* aSession, CComposerImagePlugin* aComposer, CMdEHarvesterSession* aMdEHarvesterSession );
       
   104 	
       
   105 	void CleanUp();
       
   106 	
       
   107 
       
   108 	
       
   109 private:
       
   110 
       
   111 	/**
       
   112 	 * Pointer to default Mde namespace.
       
   113 	 */
       
   114 	CMdENamespaceDef* iDefaultNamespace;
       
   115 
       
   116 	/**
       
   117 	 * Pointer to Mde session.
       
   118 	 */
       
   119 	CMdESession* iSession;
       
   120 	
       
   121 	CMdEHarvesterSession* iMdEHarvesterSession;
       
   122 
       
   123 	/**
       
   124 	 * Pointer to a composer.
       
   125 	 */
       
   126 	CComposerImagePlugin* iComposer;	
       
   127 	
       
   128 	TGetPendingPgckWrapper* iPendingPckWrapper;
       
   129 	
       
   130 	RArray<TItemId> iPresentObjectIds;
       
   131 	RArray<TItemId> iPendingObjectIds;
       
   132 	RArray<TItemId> iComposeObjectIds;
       
   133 	
       
   134     TRequest iNextRequest;
       
   135     
       
   136     TInt iPendingCount;
       
   137     
       
   138     CMdCSerializationBuffer* iPendingBuffer;
       
   139     TBool iStarted;
       
   140 	
       
   141 	};
       
   142 
       
   143 #endif /*IMAGEPRESENTOBSERVER_H_*/
       
   144