|
1 /* |
|
2 * Copyright (c) 2008-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: This is the base class for Gallery Collection Plugins |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 #ifndef C_GLXCOLLECTIONPLUGINBASE_H |
|
23 #define C_GLXCOLLECTIONPLUGINBASE_H |
|
24 |
|
25 // INCLUDES |
|
26 #include <e32cmn.h> |
|
27 #include <mpxcollectionplugin.h> |
|
28 #include <glxcollectiongeneraldefs.h> |
|
29 #include <glxfilterproperties.h> |
|
30 #include <glxmediaid.h> |
|
31 |
|
32 #include "glxrequest.h" |
|
33 #include "mglxdatasourcerequestobserver.h" |
|
34 #include "mglxdatasourceupdateobserver.h" |
|
35 |
|
36 // FORWARD DECLARATIONS |
|
37 class MGlxDataSource; |
|
38 class CGlxStringCache; |
|
39 |
|
40 // CONSTANTS |
|
41 const TInt KGlxCollectionRootLevel = 1; |
|
42 const TUid KGlxDefaultDataSourceUid = {0x20000A10}; // KGlxDataSourceMdeImplementationUid |
|
43 |
|
44 // CLASS DECLARATION |
|
45 |
|
46 /** |
|
47 * CGlxCollectionPluginBase class |
|
48 * |
|
49 * Plug-in base. |
|
50 * @ingroup collection_component_design |
|
51 * @internal reviewed 11/07/2007 by Dave Schofield |
|
52 */ |
|
53 class CGlxCollectionPluginBase : public CMPXCollectionPlugin, |
|
54 public MGlxDataSourceRequestObserver, |
|
55 public MGlxDataSourceUpdateObserver |
|
56 { |
|
57 public: // Constructors and destructor |
|
58 |
|
59 /** |
|
60 * Constructor |
|
61 */ |
|
62 IMPORT_C CGlxCollectionPluginBase(); |
|
63 |
|
64 /** |
|
65 * Destructor |
|
66 */ |
|
67 IMPORT_C virtual ~CGlxCollectionPluginBase(); |
|
68 |
|
69 private: // Functions from base classes |
|
70 // from CMPXCollectionPlugin |
|
71 /** |
|
72 * DEPRECATED, Executes a command on the selected collection |
|
73 * |
|
74 * @param aCmd a command |
|
75 * @param aArg optional argument |
|
76 */ |
|
77 IMPORT_C void CommandL(TMPXCollectionCommand aCmd, TInt aArg = 0); |
|
78 |
|
79 /** |
|
80 * Executes a command |
|
81 * |
|
82 * @param aCmd a command |
|
83 */ |
|
84 IMPORT_C void CommandL(CMPXCommand& aCmd); |
|
85 /** |
|
86 * Navigates to the given path |
|
87 * |
|
88 * @param aPath a path |
|
89 * @param aAttrs, attributes requested |
|
90 * @param aFilter, filter to apply or NULL if none |
|
91 */ |
|
92 IMPORT_C void OpenL(const CMPXCollectionPath& aPath, |
|
93 const TArray<TMPXAttribute>& aAttrs, |
|
94 CMPXFilter* aFilter); |
|
95 /** |
|
96 * Media properties of the current file (async) |
|
97 * Note: if selection is set in aPath, HandleMedia will return an array of |
|
98 * media properties of current selected items. |
|
99 * if no selection is set in aPath, HandleMedia will return media |
|
100 * properities of current item. |
|
101 * |
|
102 * @param aPath path for the media file |
|
103 * @param aAttr attributes requested |
|
104 * @param aCaps platsec capabilities of client requesting media; plug-in should also |
|
105 * verify its process capabilities |
|
106 * @aParam aSpecs, specifications for attributes |
|
107 */ |
|
108 IMPORT_C void MediaL(const CMPXCollectionPath& aPath, |
|
109 const TArray<TMPXAttribute>& aAttrs, |
|
110 const TArray<TCapability>& aCaps, |
|
111 CMPXAttributeSpecs* aSpecs); |
|
112 /** |
|
113 * Cancel outstanding request |
|
114 */ |
|
115 IMPORT_C void CancelRequest(); |
|
116 /** |
|
117 * Adds an item or items to the collection |
|
118 * |
|
119 * @param aNewProperties, Properties of the item |
|
120 */ |
|
121 IMPORT_C void AddL(const CMPXMedia& aNewMedia); |
|
122 |
|
123 /** |
|
124 * Remove a collection path |
|
125 * Note that the selection indicies are hidden within the path |
|
126 * @param aPath, path to remove |
|
127 * |
|
128 */ |
|
129 IMPORT_C void RemoveL(const CMPXCollectionPath& aPath ); |
|
130 |
|
131 /** |
|
132 * Remove an item or items from the collection |
|
133 * |
|
134 * @param aProperties, Properties of the item. It may cantain URI only |
|
135 * or meta data, all of items matched properties |
|
136 * will be removed. |
|
137 */ |
|
138 IMPORT_C void RemoveL(const CMPXMedia& aMedia); |
|
139 /** |
|
140 * Sets/updates the media for the item |
|
141 * specified in the path |
|
142 * |
|
143 * @param aMedia, new value |
|
144 */ |
|
145 IMPORT_C void SetL(const CMPXMedia& aMedia); |
|
146 |
|
147 /** |
|
148 * Find a list of items matched (async) |
|
149 * |
|
150 * @param aCriteria, properties to be searched |
|
151 * @param aAttrs, attributes to return |
|
152 */ |
|
153 IMPORT_C void FindAllL(const CMPXSearchCriteria& aCriteria, |
|
154 const TArray<TMPXAttribute>& aAttrs); |
|
155 |
|
156 /** |
|
157 * Find a list of items matched (sync) |
|
158 * |
|
159 * @param aCriteria, properties to be searched |
|
160 * @param aAttrs, attributes to return |
|
161 * @return results of the search |
|
162 */ |
|
163 IMPORT_C CMPXMedia* FindAllSyncL(const CMPXSearchCriteria& aCriteria, |
|
164 const TArray<TMPXAttribute>& aAttrs); |
|
165 |
|
166 /** |
|
167 * Get the list of supported capabilities |
|
168 * @return TCollectionCapability, bitmask of supported capabilities |
|
169 */ |
|
170 IMPORT_C TCollectionCapability GetCapabilities(); |
|
171 |
|
172 private: |
|
173 // from MGlxDataSourceRequestObserver |
|
174 /** |
|
175 * Asynchronous call to retrieve |
|
176 * |
|
177 * @param aListId list for this query relates to |
|
178 * @return error code |
|
179 */ |
|
180 IMPORT_C virtual void HandleResponse(CMPXMedia* aResponse, CGlxRequest* aRequest, const TInt& aError); |
|
181 |
|
182 private: |
|
183 // from MGlxDataSourceUpdateObserver |
|
184 /** |
|
185 * Notification that new items have been found in the data source (file |
|
186 * system, etc.) |
|
187 * |
|
188 * @param aItems ids of the items that were been found. |
|
189 */ |
|
190 IMPORT_C virtual void HandleMessage(CMPXMessage& aMessage); |
|
191 |
|
192 protected: |
|
193 CGlxRequest* GetRequestFactoryL(const CMPXCollectionPath& aPath, const TArray<TMPXAttribute>& aAttrs); |
|
194 |
|
195 /** |
|
196 * Checks to see if any additional attributes are required to construct required |
|
197 * CPI specific attribute |
|
198 * |
|
199 * @param aCpiAttribute CPI specific attribute to be constructed later |
|
200 * @param aAttributeArray modifiable list of attributes to be retrieved from data source |
|
201 */ |
|
202 IMPORT_C virtual void CpiAttributeAdditionalAttributes(const TMPXAttribute& aCpiAttribute, RArray<TMPXAttribute>& aAttributeArray); |
|
203 |
|
204 /** |
|
205 * Modifies the response to include all requested CPI specific attributes or Leaves. |
|
206 * |
|
207 * @param aResponse Data Source constructed response to which CPI specific attributes should be added (also contains any required data) |
|
208 * @param aCpiAttributes list of CPI specific attributes to be constructed |
|
209 * @param aMediaIds list of CPI specific media Ids |
|
210 */ |
|
211 IMPORT_C virtual void HandleCpiAttributeResponseL(CMPXMedia* aResponse, TArray<TMPXAttribute> aCpiAttributes, TArray<TGlxMediaId> aMediaIds); |
|
212 |
|
213 IMPORT_C virtual TBool IsUpdateMessageIgnored(CMPXMessage& aMessage); |
|
214 |
|
215 /** |
|
216 * Loads a string from a resurce file |
|
217 * |
|
218 * @param aResourceFile - name of the resource file (does not contain the path). |
|
219 * @param aResourceId - Id of the string to be loaded |
|
220 * @return HBufC* containing the required string. |
|
221 */ |
|
222 IMPORT_C HBufC* LoadLocalizedStringLC(const TDesC& aResourceFile, const TInt aResourceId); |
|
223 |
|
224 IMPORT_C virtual TGlxFilterProperties DefaultFilter(TInt aLevel); |
|
225 |
|
226 protected: |
|
227 /** |
|
228 * Datasouce (owned) |
|
229 */ |
|
230 MGlxDataSource* iDataSource; |
|
231 |
|
232 /** |
|
233 * collection plugin path (owned) |
|
234 */ |
|
235 CMPXCollectionPath* iPath; |
|
236 |
|
237 private: |
|
238 /** |
|
239 * String Cache |
|
240 */ |
|
241 CGlxStringCache* iStringCache; |
|
242 }; |
|
243 |
|
244 #endif // C_GLXCOLLECTIONPLUGINBASE_H |
|
245 |