photosgallery/collectionframework/datasource/plugins/glxdatasourcemde/inc/glxdatasourcetaskmdeattribute.h
changeset 0 4e91876724a2
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/photosgallery/collectionframework/datasource/plugins/glxdatasourcemde/inc/glxdatasourcetaskmdeattribute.h	Thu Dec 17 08:45:44 2009 +0200
@@ -0,0 +1,163 @@
+/*
+* Copyright (c) 2006 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:    Data Source Task MDS Attribute Class
+*
+*/
+
+
+
+
+#ifndef _C_GLXDATASOURCETASKMDEATTRIBUTETASK_H_
+#define _C_GLXDATASOURCETASKMDEATTRIBUTETASK_H_
+
+/**
+ * @author Simon Brooks, Alex Birkett
+ */
+
+#include <e32std.h>
+#include "glxdatasourcetaskmde.h"
+
+
+// CLASS DECLARATION
+
+class CGlxGetRequest;    
+
+NONSHARABLE_CLASS(TGlxQueryAttribute)
+    {
+public:
+    TGlxQueryAttribute(
+        TMPXAttribute aAttribute,
+        CMPXMedia* aMedia,
+        TGlxFilterProperties aFilterProperties
+        ) : 
+        iAttribute(aAttribute),
+        iMedia(aMedia),
+        iFilterProperties(aFilterProperties)
+            {
+            
+            };
+public:
+    TMPXAttribute iAttribute;
+    CMPXMedia* iMedia;
+    TGlxFilterProperties iFilterProperties;
+    };
+
+/**
+ * Attribute retrieval task.
+ */
+NONSHARABLE_CLASS(CGlxDataSourceTaskMdeAttribute) : public CGlxDataSourceTaskMde
+	{
+public:
+    /**
+     * Constructor.
+     * @param aRequest request to be executed.
+     * @param aObserver observer to be informed when task has completed.
+     * @param aDataSource data source to be used by this object.
+     */
+	CGlxDataSourceTaskMdeAttribute(CGlxGetRequest* aRequest, MGlxDataSourceRequestObserver& aObserver, CGlxDataSource* aDataSource);
+	
+    /**
+     * Destructor.
+     */
+    ~CGlxDataSourceTaskMdeAttribute();
+	
+private: // From CGlxDataSourceTask     
+    /**
+     * See @ref CGlxDataSourceTask::ExecuteRequestL
+     */ 
+    void ExecuteRequestL();
+	
+private: // From CGlxDataSourceTaskMde
+    /**
+     * See @ref CGlxDataSourceTaskMde::DoHandleQueryCompletedL
+     */ 
+    void DoHandleQueryCompletedL(CMdEQuery& aQuery);
+
+    /**
+     * See @ref CGlxDataSourceTaskMde::DoNextQueryL
+     */ 
+    void DoNextQueryL();
+    
+private:	
+
+	void AddAttributesL(CMdEObject& aObject, CMPXMedia* aEntry);
+
+	void AddCollectionAttributesL(CMPXMedia* aEntry);
+	
+	void AddContainerAttributesL(CMPXMedia* aEntry, CMdEObject* aContainer, CGlxDataSource::TContainerType aType);
+	
+	void AddItemAttributesL(CMPXMedia* aEntry, CMdEObject* aItem, CGlxDataSource::TItemType aType);
+	
+    /**
+     * Add location information to a media object from MDS.
+     * @param aLocationId the id of a location object.
+     * @param aMedia media object to add a location attribute to.
+     */
+    void AddLocationAttributeToMediaL(CMPXMedia& aMedia, const TItemId& aLocationId);
+        
+
+    void DoHandleAttributeQueryCompletedL();
+    
+    /**
+	 * Handles the completion of a query of type ELocationQuery.
+	 */
+	void DoHandleLocationQueryCompletedL();
+	
+
+	void DoHandleImageVideoQueryCompletedL();
+		
+    /**
+     * Creates a location query and adds it to the queue of queries.
+     */
+    void QueueLocaitonQueryL();
+
+    /**
+     * @param aObjectDef object definition which defines objects which will be queried
+     * @param aIsContent If ETrue, the definition of the objects being queried is set by the item type filter property, if EFalse, the definition
+     * of the object being queried is provided by the aObjectDef parameter
+     *  
+     */
+    void QueueObjectQueryL(CMdEObjectDef& aObjectDef, TBool aIsContent, TGlxQueryType aQueryType, TQueryResultMode aResultMode, 
+                          const TGlxMediaId& aContainerId, TMPXAttribute aAttribute, CMPXMedia* aEntry, 
+                          const TGlxFilterProperties& aFilterProperties);
+    
+
+	void DoHandleAttributeResponseCompleteL();
+
+	
+    /**
+     * Determines if the request contains the KGlxMediaGeneralLocation attribtue.
+     * @return ETrue if the the KGlxMediaGeneralLocation attribute is requrested else EFalse
+     */
+    TBool LocationAttributeRequested();
+    
+    /**
+     * Executes the next query in the queue of queries.
+     */
+    void ExecuteQueryL(); 
+
+private:
+    /**
+     * Results media array (owned)
+     */
+    CMPXMediaArray* iMediaArray;
+    
+    /**
+     * Attributes associated with outstanding queries
+     */
+    RArray< TGlxQueryAttribute > iQueryAttributes;
+	};
+
+
+#endif // _C_GLXDATASOURCETASKMDEATTRIBUTETASK_H_