photosgallery/collectionframework/datasource/plugins/glxdatasourcemde/inc/glxdatasourcetaskmdeattribute.h
changeset 0 4e91876724a2
equal deleted inserted replaced
-1:000000000000 0:4e91876724a2
       
     1 /*
       
     2 * Copyright (c) 2006 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:    Data Source Task MDS Attribute Class
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 #ifndef _C_GLXDATASOURCETASKMDEATTRIBUTETASK_H_
       
    22 #define _C_GLXDATASOURCETASKMDEATTRIBUTETASK_H_
       
    23 
       
    24 /**
       
    25  * @author Simon Brooks, Alex Birkett
       
    26  */
       
    27 
       
    28 #include <e32std.h>
       
    29 #include "glxdatasourcetaskmde.h"
       
    30 
       
    31 
       
    32 // CLASS DECLARATION
       
    33 
       
    34 class CGlxGetRequest;    
       
    35 
       
    36 NONSHARABLE_CLASS(TGlxQueryAttribute)
       
    37     {
       
    38 public:
       
    39     TGlxQueryAttribute(
       
    40         TMPXAttribute aAttribute,
       
    41         CMPXMedia* aMedia,
       
    42         TGlxFilterProperties aFilterProperties
       
    43         ) : 
       
    44         iAttribute(aAttribute),
       
    45         iMedia(aMedia),
       
    46         iFilterProperties(aFilterProperties)
       
    47             {
       
    48             
       
    49             };
       
    50 public:
       
    51     TMPXAttribute iAttribute;
       
    52     CMPXMedia* iMedia;
       
    53     TGlxFilterProperties iFilterProperties;
       
    54     };
       
    55 
       
    56 /**
       
    57  * Attribute retrieval task.
       
    58  */
       
    59 NONSHARABLE_CLASS(CGlxDataSourceTaskMdeAttribute) : public CGlxDataSourceTaskMde
       
    60 	{
       
    61 public:
       
    62     /**
       
    63      * Constructor.
       
    64      * @param aRequest request to be executed.
       
    65      * @param aObserver observer to be informed when task has completed.
       
    66      * @param aDataSource data source to be used by this object.
       
    67      */
       
    68 	CGlxDataSourceTaskMdeAttribute(CGlxGetRequest* aRequest, MGlxDataSourceRequestObserver& aObserver, CGlxDataSource* aDataSource);
       
    69 	
       
    70     /**
       
    71      * Destructor.
       
    72      */
       
    73     ~CGlxDataSourceTaskMdeAttribute();
       
    74 	
       
    75 private: // From CGlxDataSourceTask     
       
    76     /**
       
    77      * See @ref CGlxDataSourceTask::ExecuteRequestL
       
    78      */ 
       
    79     void ExecuteRequestL();
       
    80 	
       
    81 private: // From CGlxDataSourceTaskMde
       
    82     /**
       
    83      * See @ref CGlxDataSourceTaskMde::DoHandleQueryCompletedL
       
    84      */ 
       
    85     void DoHandleQueryCompletedL(CMdEQuery& aQuery);
       
    86 
       
    87     /**
       
    88      * See @ref CGlxDataSourceTaskMde::DoNextQueryL
       
    89      */ 
       
    90     void DoNextQueryL();
       
    91     
       
    92 private:	
       
    93 
       
    94 	void AddAttributesL(CMdEObject& aObject, CMPXMedia* aEntry);
       
    95 
       
    96 	void AddCollectionAttributesL(CMPXMedia* aEntry);
       
    97 	
       
    98 	void AddContainerAttributesL(CMPXMedia* aEntry, CMdEObject* aContainer, CGlxDataSource::TContainerType aType);
       
    99 	
       
   100 	void AddItemAttributesL(CMPXMedia* aEntry, CMdEObject* aItem, CGlxDataSource::TItemType aType);
       
   101 	
       
   102     /**
       
   103      * Add location information to a media object from MDS.
       
   104      * @param aLocationId the id of a location object.
       
   105      * @param aMedia media object to add a location attribute to.
       
   106      */
       
   107     void AddLocationAttributeToMediaL(CMPXMedia& aMedia, const TItemId& aLocationId);
       
   108         
       
   109 
       
   110     void DoHandleAttributeQueryCompletedL();
       
   111     
       
   112     /**
       
   113 	 * Handles the completion of a query of type ELocationQuery.
       
   114 	 */
       
   115 	void DoHandleLocationQueryCompletedL();
       
   116 	
       
   117 
       
   118 	void DoHandleImageVideoQueryCompletedL();
       
   119 		
       
   120     /**
       
   121      * Creates a location query and adds it to the queue of queries.
       
   122      */
       
   123     void QueueLocaitonQueryL();
       
   124 
       
   125     /**
       
   126      * @param aObjectDef object definition which defines objects which will be queried
       
   127      * @param aIsContent If ETrue, the definition of the objects being queried is set by the item type filter property, if EFalse, the definition
       
   128      * of the object being queried is provided by the aObjectDef parameter
       
   129      *  
       
   130      */
       
   131     void QueueObjectQueryL(CMdEObjectDef& aObjectDef, TBool aIsContent, TGlxQueryType aQueryType, TQueryResultMode aResultMode, 
       
   132                           const TGlxMediaId& aContainerId, TMPXAttribute aAttribute, CMPXMedia* aEntry, 
       
   133                           const TGlxFilterProperties& aFilterProperties);
       
   134     
       
   135 
       
   136 	void DoHandleAttributeResponseCompleteL();
       
   137 
       
   138 	
       
   139     /**
       
   140      * Determines if the request contains the KGlxMediaGeneralLocation attribtue.
       
   141      * @return ETrue if the the KGlxMediaGeneralLocation attribute is requrested else EFalse
       
   142      */
       
   143     TBool LocationAttributeRequested();
       
   144     
       
   145     /**
       
   146      * Executes the next query in the queue of queries.
       
   147      */
       
   148     void ExecuteQueryL(); 
       
   149 
       
   150 private:
       
   151     /**
       
   152      * Results media array (owned)
       
   153      */
       
   154     CMPXMediaArray* iMediaArray;
       
   155     
       
   156     /**
       
   157      * Attributes associated with outstanding queries
       
   158      */
       
   159     RArray< TGlxQueryAttribute > iQueryAttributes;
       
   160 	};
       
   161 
       
   162 
       
   163 #endif // _C_GLXDATASOURCETASKMDEATTRIBUTETASK_H_