60
|
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: Data Source Task MDS Command Class
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
#ifndef _C_GLXDATASOURCETASKMDSCOMMAND_H_
|
|
22 |
#define _C_GLXDATASOURCETASKMDSCOMMAND_H_
|
|
23 |
|
|
24 |
/**
|
|
25 |
* @internal reviewed 10/07/2007 by M Byrne
|
|
26 |
*/
|
|
27 |
|
|
28 |
|
|
29 |
// INCLUDES
|
|
30 |
#include <e32cmn.h>
|
|
31 |
#include <glxcommandparser.h>
|
|
32 |
#include <mdequery.h>
|
|
33 |
#include <mdeitem.h>
|
|
34 |
#include <mglxtnthumbnailcreatorclient.h>
|
|
35 |
#include <glxcommandrequest.h>
|
|
36 |
#include "glxdatasourcetaskmds.h"
|
|
37 |
|
|
38 |
// FORWARD DECLARATIONS
|
|
39 |
class CGlxDataSourceMde;
|
|
40 |
class CGlxRequest;
|
|
41 |
class CGlxStringCache;
|
|
42 |
class CMdENamespaceDef;
|
|
43 |
class CMdEObjectDef;
|
|
44 |
class CMdEObjectQuery;
|
|
45 |
class CMdERelationDef;
|
|
46 |
class CMdERelationQuery;
|
|
47 |
class CMdESession;
|
|
48 |
|
|
49 |
// CONSTANTS
|
|
50 |
|
|
51 |
// CLASS DECLARATION
|
|
52 |
|
|
53 |
/**
|
|
54 |
* CGlxDataSourceTaskMdeCommand class
|
|
55 |
*
|
|
56 |
*/
|
|
57 |
NONSHARABLE_CLASS( CGlxDataSourceTaskMdeCommand ) : public CGlxDataSourceTaskMde,
|
|
58 |
public MGlxCommandParserCallback
|
|
59 |
|
|
60 |
{
|
|
61 |
public: // Constructors / Destructors
|
|
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 |
CGlxDataSourceTaskMdeCommand(CGlxCommandRequest* aRequest,
|
|
69 |
MGlxDataSourceRequestObserver& aObserver,
|
|
70 |
CGlxDataSource* aDataSource);
|
|
71 |
|
|
72 |
/**
|
|
73 |
* Symbian 2nd stage constructor
|
|
74 |
* See @ref CGlxDataSourceTaskMde::ConstructL
|
|
75 |
*/
|
|
76 |
void ConstructL();
|
|
77 |
|
|
78 |
/**
|
|
79 |
* Destructor
|
|
80 |
*/
|
|
81 |
~CGlxDataSourceTaskMdeCommand();
|
|
82 |
|
|
83 |
private: // From MGlxCommandParserCallback
|
|
84 |
|
|
85 |
/**
|
|
86 |
* See @ref MGlxCommandParserCallback::AddContainerL
|
|
87 |
*/
|
|
88 |
void AddContainerL(const TDesC& aContainerName);
|
|
89 |
|
|
90 |
/**
|
|
91 |
* See @ref MGlxCommandParserCallback::AddToContainerL
|
|
92 |
*/
|
|
93 |
void AddToContainerL(const RArray<TGlxMediaId>& aSourceIds,
|
|
94 |
const RArray<TGlxMediaId>& aTargetContainers);
|
|
95 |
|
|
96 |
/**
|
|
97 |
* See @ref MGlxCommandParserCallback::AddToContainerL
|
|
98 |
*/
|
|
99 |
void AddToContainerL(const TDesC& aSourceUri,
|
|
100 |
const RArray<TGlxMediaId>& aTargetContainers);
|
|
101 |
|
|
102 |
/**
|
|
103 |
* See @ref MGlxCommandParserCallback::CopyL
|
|
104 |
*/
|
|
105 |
void CopyL(const RArray<TGlxMediaId>& aSourceIds, const TDesC& aDrive);
|
|
106 |
|
|
107 |
/**
|
|
108 |
* See @ref MGlxCommandParserCallback::MoveL
|
|
109 |
*/
|
|
110 |
void MoveL(const RArray<TGlxMediaId>& aSourceIds, const TDesC& aDrive);
|
|
111 |
|
|
112 |
/**
|
|
113 |
* See @ref MGlxCommandParserCallback::RemoveFromContainerL
|
|
114 |
*/
|
|
115 |
void RemoveFromContainerL(const RArray<TGlxMediaId>& aItemIds,
|
|
116 |
const TGlxMediaId& aContainerId);
|
|
117 |
|
|
118 |
/**
|
|
119 |
* See @ref MGlxCommandParserCallback::DeleteL
|
|
120 |
*/
|
|
121 |
void DeleteL(const RArray<TGlxMediaId>& aItemIds);
|
|
122 |
|
|
123 |
/**
|
|
124 |
* See @ref MGlxCommandParserCallback::RenameL
|
|
125 |
*/
|
|
126 |
void RenameL(const TGlxMediaId& aSourceItemId, const TDesC& aTitle);
|
|
127 |
|
|
128 |
/**
|
|
129 |
* See @ref MGlxCommandParserCallback::SetDescriptionL
|
|
130 |
*/
|
|
131 |
void SetDescriptionL(const RArray<TGlxMediaId>& aItemIds,
|
|
132 |
const TDesC& aDescription);
|
|
133 |
|
|
134 |
/**
|
|
135 |
* See @ref MGlxCommandParserCallback::SetCaptureLocationL
|
|
136 |
*/
|
|
137 |
void SetCaptureLocationL(const RArray<TGlxMediaId>& aItemIds,
|
|
138 |
const TCoordinate& aCoordinate);
|
|
139 |
|
|
140 |
/**
|
|
141 |
* See @ref MGlxCommandParserCallback::ThumbnailCleanupL
|
|
142 |
*/
|
|
143 |
void ThumbnailCleanupL();
|
|
144 |
|
|
145 |
private: // from CGlxDataSourceTaskMde
|
|
146 |
|
|
147 |
/**
|
|
148 |
* See @ref CGlxDataSourceTaskMde::DoHandleQueryCompletedL
|
|
149 |
*/
|
|
150 |
void DoHandleQueryCompletedL(CMdEQuery& aQuery);
|
|
151 |
|
|
152 |
/**
|
|
153 |
* See @ref CGlxDataSourceTaskMde::DoNextQueryL
|
|
154 |
*/
|
|
155 |
void DoNextQueryL();
|
|
156 |
|
|
157 |
private:
|
|
158 |
|
|
159 |
/**
|
|
160 |
* Enumeration to describe file operations
|
|
161 |
* (Copy or Move)
|
|
162 |
*/
|
|
163 |
enum TFileOperation
|
|
164 |
{
|
|
165 |
ECopy,
|
|
166 |
EMove
|
|
167 |
};
|
|
168 |
|
|
169 |
/**
|
|
170 |
* Perform a file operation (copy or move).
|
|
171 |
* @param aSourceIds an array of media ids to copy or move.
|
|
172 |
* @param aDrive destination drive.
|
|
173 |
* @param aFileOperation file operation to perform (either a copy or a move)
|
|
174 |
*/
|
|
175 |
void FileOperationL(const TArray<TGlxMediaId>& aSourceIds,
|
|
176 |
const TDesC& aDrive, TFileOperation aFileOperation);
|
|
177 |
|
|
178 |
/**
|
|
179 |
* Gets the container id for a given media id.
|
|
180 |
* If aMedia id is KGlxCollectionRootId (0) then container id
|
|
181 |
* is determined using the collection id. E.g. if the aMediaId
|
|
182 |
* is KGlxCollectionRootId and the collection uid is
|
|
183 |
* KGlxCollectionPluginCameraImplementationUid
|
|
184 |
* then the camera album id is returned by the method.
|
|
185 |
* When aMedia id is not equal to KGlxCollectionRootId, (the
|
|
186 |
* vast majority of cases) the container id returned by the method
|
|
187 |
* will be the same as the media id passed in.
|
|
188 |
*
|
|
189 |
* @param aMediaId should be either a valid container id or KGlxCollectionRootId
|
|
190 |
* @return a container id.
|
|
191 |
*/
|
|
192 |
TItemId ContainerItemId(const TGlxMediaId& aMediaId);
|
|
193 |
|
|
194 |
/**
|
|
195 |
* Uses the PathInfo class to determine the 'root' path for
|
|
196 |
* a given drive. The 'root' path is C:\data for the C drive and
|
|
197 |
* x:\ for all other drives (where x is a drive letter)
|
|
198 |
* @param aDrive the drive for which the root path is required.
|
|
199 |
* @param aRootPath on return contains the root path.
|
|
200 |
*/
|
|
201 |
void RootPath(const TDesC& aDrive, TDes& aRootPath);
|
|
202 |
|
|
203 |
#if 0
|
|
204 |
/**
|
|
205 |
* Copies items from a TGlxMedia array to a TItemId array.
|
|
206 |
* @param aDestArray destination array. (It is the callers responsibility to ensure that aDestArray is on
|
|
207 |
* the cleanup stack should this be required)
|
|
208 |
* @param aSourceArray source array.
|
|
209 |
*/
|
|
210 |
void CopyArrayL(RArray<TItemId>& aDestArray, const RArray<TGlxMediaId>& aSourceArray);
|
|
211 |
#endif
|
|
212 |
|
|
213 |
/**
|
|
214 |
* Sends progress messages to the client
|
|
215 |
* @param aCurrentStep number of currently completed steps.
|
|
216 |
* @param aStepCount number of total steps to completion.
|
|
217 |
*/
|
|
218 |
void SendProgressMessageL(TInt aCurrentStep, TInt aStepCount);
|
|
219 |
|
|
220 |
/**
|
|
221 |
* Returns the container object definition (either album or tag)
|
|
222 |
* the container object definition is calculated based on the
|
|
223 |
* collection plug-in id associated with the task.
|
|
224 |
* @param aContainerObjectDef a pointer to the container object
|
|
225 |
* definition associated with the collection plugin if the
|
|
226 |
* function completes with out error. The caller does not take
|
|
227 |
* ownership of the pointer.
|
|
228 |
* @return KErrNone if the collection plug-in has a container
|
|
229 |
* object definition associated with it or a system wide
|
|
230 |
* error code.
|
|
231 |
*/
|
|
232 |
TInt ContainerObjectDef(CMdEObjectDef*& aContainerObjectDef);
|
|
233 |
|
|
234 |
/**
|
|
235 |
* Handle the completion of a 'add to container' query.
|
|
236 |
* @param aQuery Query that has been completed.
|
|
237 |
*/
|
|
238 |
void DoHandleAddToContainerQueryCompletedL(CMdEQuery& aQuery);
|
|
239 |
|
|
240 |
/**
|
|
241 |
* Handle the completion of a 'add container' query.
|
|
242 |
* @param aQuery Query that has been completed.
|
|
243 |
*/
|
|
244 |
void DoHandleAddContainerQueryCompletedL(CMdEQuery& aQuery);
|
|
245 |
|
|
246 |
/**
|
|
247 |
* Handle the completion of a 'delete containers' query.
|
|
248 |
* @param aQuery Query that has been completed.
|
|
249 |
*/
|
|
250 |
void DoHandleDeleteContainersQueryCompletedL(CMdEQuery& aQuery);
|
|
251 |
|
|
252 |
/**
|
|
253 |
* Handle the completion of a 'delete items' query.
|
|
254 |
* @param aQuery Query that has been completed.
|
|
255 |
*/
|
|
256 |
void DoHandleDeleteItemsQueryCompletedL(CMdEQuery& aQuery);
|
|
257 |
|
|
258 |
|
|
259 |
/**
|
|
260 |
* Handle the completion of a 'rename' query.
|
|
261 |
* @param aQuery Query that has been completed.
|
|
262 |
*/
|
|
263 |
void DoHandleRenameQueryCompletedL(CMdEQuery& aQuery);
|
|
264 |
|
|
265 |
/**
|
|
266 |
* Handle the completion of a 'rename container' query.
|
|
267 |
* @param aQuery Query that has been completed.
|
|
268 |
*/
|
|
269 |
void DoHandleRenameConainerQueryCompletedL(CMdEQuery& aQuery);
|
|
270 |
|
|
271 |
/**
|
|
272 |
* Appends a query to the query queue that determines the number
|
|
273 |
* of container objects that have the title aTitle. This
|
|
274 |
* method is used to check to see if a container with a
|
|
275 |
* specific title exists. The container type is determined
|
|
276 |
* using the ContainerObjectDef() method
|
|
277 |
* @aQueryType the query type.
|
|
278 |
* @aTitle title to search for.
|
|
279 |
*/
|
|
280 |
void AppendContainerTitleCountQueryL(const TGlxQueryType& aQueryType, const TDesC& aTitle);
|
|
281 |
|
|
282 |
private: // from CGlxDataSourceTask
|
|
283 |
/**
|
|
284 |
* See @ref CGlxDataSourceTask::ExecuteRequestL
|
|
285 |
*/
|
|
286 |
void ExecuteRequestL();
|
|
287 |
|
|
288 |
/**
|
|
289 |
* Matches the given resource ID with the title(user defined new album)
|
|
290 |
*/
|
|
291 |
|
|
292 |
TInt SearchStringL(TInt aResourceId);
|
|
293 |
|
|
294 |
/**
|
|
295 |
* Timer callback to stop scheduler wait
|
|
296 |
* @param aPtr Pointer to object that started the timer
|
|
297 |
* @return 0 to signal that further callbacks are unnecessary, 1 otherwise
|
|
298 |
*/
|
|
299 |
static TInt SchedulerStopCallback(TAny* aPtr);
|
|
300 |
|
|
301 |
/**
|
|
302 |
* Starts the scheduler wait timer. When complete, Scheduler is stopped
|
|
303 |
*/
|
|
304 |
void SchedulerStopComplete();
|
|
305 |
|
|
306 |
private:
|
|
307 |
/**
|
|
308 |
* Default name space definition.
|
|
309 |
*/
|
|
310 |
CMdENamespaceDef* iDefaultNameSpaceDef;
|
|
311 |
|
|
312 |
/**
|
|
313 |
* Collection uid.
|
|
314 |
*/
|
|
315 |
TUid iCollectionUid;
|
|
316 |
|
|
317 |
/**
|
|
318 |
* Before new relations are added to the database, a check must be made to see if
|
|
319 |
* identical relations already exist. This is done asynchronously so they need to
|
|
320 |
* be stored temporarily as a member variable.
|
|
321 |
*/
|
|
322 |
RArray<TItemId> iLeftIds;
|
|
323 |
|
|
324 |
/**
|
|
325 |
* Before new relations are added to the database, a check must be made to see if
|
|
326 |
* identical relations already exist. This is done asynchronously so they need to
|
|
327 |
* be stored temporarily as a member variable.
|
|
328 |
*/
|
|
329 |
RArray<TItemId> iRightIds;
|
|
330 |
|
|
331 |
/**
|
|
332 |
* Used to store object titles while asynchronous operations are in progress.
|
|
333 |
* (owned)
|
|
334 |
*/
|
|
335 |
HBufC* iTitle;
|
|
336 |
|
|
337 |
/**
|
|
338 |
* Used to store the object to rename while asynchronous operations are in progress.
|
|
339 |
* (owned)
|
|
340 |
*/
|
|
341 |
CMdEObject* iObjectToRename;
|
|
342 |
|
|
343 |
/**
|
|
344 |
* Used to get the localized string from the cache
|
|
345 |
*
|
|
346 |
*/
|
|
347 |
CGlxStringCache* iStringCache;
|
|
348 |
|
|
349 |
/**
|
|
350 |
* Timer that checks if scheduler wait needs to be cancelled
|
|
351 |
*/
|
|
352 |
CPeriodic* iTimer;
|
|
353 |
|
|
354 |
/**
|
|
355 |
* Active scheduler wait object. (Owned)
|
|
356 |
*/
|
|
357 |
CActiveSchedulerWait* iSchedulerWait;
|
|
358 |
};
|
|
359 |
|
|
360 |
#endif //_C_GLXDATASOURCETASKMDSCOMMAND_H_
|