diff -r 000000000000 -r c53acadfccc6 harvester/composerplugins/imagecomposer/inc/imagepresentobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/harvester/composerplugins/imagecomposer/inc/imagepresentobserver.h Mon Jan 18 20:34:07 2010 +0200 @@ -0,0 +1,144 @@ +/* +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: image composer listener for setting pending image objects present + * +*/ + + +#ifndef IMAGEPRESENTOBSERVER_H_ +#define IMAGEPRESENTOBSERVER_H_ + +#include "mdeharvestersession.h" + +// forward declarations +class CMdENamespaceDef; +class CComposerImagePlugin; + +/** + * CImagePresentObserver + * + */ +class CImagePresentObserver : public CActive, public MMdEObjectPresentObserver + { +public: + + enum TRequest + { + ERequestIdle, + ERequestWaitPendingCount, + ERequestWaitPending, + ERequestProcess + } + ; + /** + * Destructor. + */ + ~CImagePresentObserver(); + + /** + * Two-phased constructor. + */ + static CImagePresentObserver* NewL( CMdESession* aSession, CComposerImagePlugin* aComposer, + CMdEHarvesterSession* aMdEHarvesterSession ); + + /** + * Set next request (=state) of this active object. + * @param aRequest State enumeration. + */ + void SetNextRequest( TRequest aRequest ); + + /** + * Standard RunL-method. + * From CActive. + */ + void RunL(); + + /** + * From CActive. + */ + void DoCancel(); + + /** + * From CActive. + * @param aError Leave error code. + * @return Always KErrNone. + */ + TInt RunError( TInt aError ); + + +protected: + + /** + * Called to notify the observer that objects has been set + * to present or not present state in the metadata engine database. + * + * @param aSession session + * @param aPresent state: ETrue - present or EFales - not present + * @param aObjectIdArray object IDs which are set to present state + */ + void HandleObjectPresentNotification(CMdESession& aSession, + TBool aPresent, const RArray& aObjectIdArray); + +private: + + /** + * Constructor for performing 1st stage construction + */ + CImagePresentObserver(); + + /** + * EPOC default constructor for performing 2nd stage construction + */ + void ConstructL( CMdESession* aSession, CComposerImagePlugin* aComposer, CMdEHarvesterSession* aMdEHarvesterSession ); + + void CleanUp(); + + + +private: + + /** + * Pointer to default Mde namespace. + */ + CMdENamespaceDef* iDefaultNamespace; + + /** + * Pointer to Mde session. + */ + CMdESession* iSession; + + CMdEHarvesterSession* iMdEHarvesterSession; + + /** + * Pointer to a composer. + */ + CComposerImagePlugin* iComposer; + + TGetPendingPgckWrapper* iPendingPckWrapper; + + RArray iPresentObjectIds; + RArray iPendingObjectIds; + RArray iComposeObjectIds; + + TRequest iNextRequest; + + TInt iPendingCount; + + CMdCSerializationBuffer* iPendingBuffer; + TBool iStarted; + + }; + +#endif /*IMAGEPRESENTOBSERVER_H_*/ +