|
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: Implementation of Podcast Collection Database Plugin interface |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef MPXPODCASTDBPLUGIN_H |
|
20 #define MPXPODCASTDBPLUGIN_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <badesca.h> |
|
24 |
|
25 #include <mpxcommonframeworkdefs.h> |
|
26 #include <mpxcollectionframeworkdefs.h> |
|
27 #include <mpxcollectionplugin.h> |
|
28 #include <mpxcollectionpath.h> |
|
29 #include <mpxmediageneraldefs.h> |
|
30 #include <mpxpodcastdefs.h> |
|
31 #include <mpxmessage2.h> |
|
32 |
|
33 #include "mpxdbactivetask.h" |
|
34 #include "mpxpodcastcollectiondb.hrh" |
|
35 |
|
36 // FORWARD DECLARATIONS |
|
37 class CMPXMedia; |
|
38 class CMPXPodcastDbHandler; |
|
39 class CMPXDrmMediaUtility; |
|
40 class CMPXMediaArray; |
|
41 class CMPXResource; |
|
42 |
|
43 // CONSTANTS |
|
44 |
|
45 // CLASS DECLARATION |
|
46 |
|
47 /** |
|
48 * Plug-in provides access to podcast collection. |
|
49 * |
|
50 * @lib mpxpodcastdbplugin.lib |
|
51 */ |
|
52 NONSHARABLE_CLASS(CMPXPodcastDbPlugin) : |
|
53 public CMPXCollectionPlugin, |
|
54 public MMPXDbActiveTaskObserver |
|
55 { |
|
56 public: // Constructors and destructor |
|
57 |
|
58 /** |
|
59 * Two-phased constructor |
|
60 * @param aInitParams: initialization parameters |
|
61 * @return object constructed |
|
62 */ |
|
63 static CMPXPodcastDbPlugin* NewL (TAny* aInitParams); |
|
64 |
|
65 /** |
|
66 * Destructor |
|
67 */ |
|
68 virtual ~CMPXPodcastDbPlugin(); |
|
69 |
|
70 public: // from base clase |
|
71 /** |
|
72 * From CMPXCollectionPlugin |
|
73 * Navigates to the given path. This method is serviced |
|
74 * asynchronously and HandleOpenL is called upon completion |
|
75 * @param aPath a path |
|
76 * @param aAttrs attributes requested |
|
77 * @param aFilter filter to apply or NULL if none |
|
78 */ |
|
79 void OpenL(const CMPXCollectionPath& aPath, |
|
80 const TArray<TMPXAttribute>& aAttrs, |
|
81 CMPXFilter* aFilter); |
|
82 |
|
83 /** |
|
84 * From CMPXCollectionPlugin |
|
85 * Get the extended properties of the item referred to by the |
|
86 * specified collection path. This method is serviced asynchronously and |
|
87 * HandleMediaL is called upon completion |
|
88 * @param aPath a collection path referring to the item to retrieve the |
|
89 * extended properties for |
|
90 * @param aAttr: array of attributes requested |
|
91 * @param aCaps platsec capabilities of client requesting media; plug-in |
|
92 * should also verify its process capabilities (not yet supported) |
|
93 * @aParam aSpecs specifications for attributes (not yet supported) |
|
94 */ |
|
95 void MediaL(const CMPXCollectionPath& aPath, |
|
96 const TArray<TMPXAttribute>& aAttrs, |
|
97 const TArray<TCapability>& aCaps, |
|
98 CMPXAttributeSpecs* aSpecs); |
|
99 |
|
100 /** |
|
101 * From CMPXCollectionPlugin |
|
102 * Cancel outstanding request. Note*** CancelRequest is not currently |
|
103 * implemented because all requests are processed synchronously |
|
104 */ |
|
105 void CancelRequest(); |
|
106 |
|
107 /** |
|
108 * From CMPXCollectionPlugin |
|
109 * Executes the given TMPXCollectionCommand command on the collection |
|
110 * @param aCmd a command |
|
111 * @param aArg an argument |
|
112 */ |
|
113 void CommandL(TMPXCollectionCommand aCmd, TInt aArg = 0); |
|
114 |
|
115 /** |
|
116 * From CMPXCollectionPlugin |
|
117 * Executes the given CMPXCommand command on the collection |
|
118 * @param aCmd a command |
|
119 */ |
|
120 void CommandL(CMPXCommand& aCmd); |
|
121 |
|
122 /** |
|
123 * From CMPXCollectionPlugin |
|
124 * Adds an episode to the collection |
|
125 * @param aMedia Properties of the item |
|
126 */ |
|
127 void AddL(const CMPXMedia& aMedia); |
|
128 |
|
129 /** |
|
130 * From CMPXCollectionPlugin |
|
131 * Remove an item(s) from the collection database using the given path |
|
132 * Note that the selection indices are hidden within the path |
|
133 * @param aPath: path to the item to be removed |
|
134 * |
|
135 */ |
|
136 void RemoveL(const CMPXCollectionPath& aPath); |
|
137 |
|
138 /** |
|
139 * Remove item(s) from the collection database using the given media properties |
|
140 * @param aMedia Properties of the item(s) to be removed. May cantain a URI |
|
141 * or metadata. All item(s) matching the specified properties |
|
142 * will be removed. |
|
143 */ |
|
144 void RemoveL(const CMPXMedia& aMedia); |
|
145 |
|
146 /** |
|
147 * Sets/updates the specified media for an item in the collection. Media |
|
148 * is identified by specifying an ID or URI. |
|
149 * @param aMedia: new property values for the item |
|
150 */ |
|
151 void SetL(const CMPXMedia& aMedia); |
|
152 |
|
153 /** |
|
154 * From CMPXCollectionPlugin |
|
155 * Find the items matching the media specifications. This method is serviced |
|
156 * asynchronously and HandleFindAllL is called upon completion |
|
157 * @param aCriteria Properties of the item that is to be found |
|
158 * @param aAttrs Requested attributes to return |
|
159 */ |
|
160 void FindAllL(const CMPXMedia& aCriteria, const TArray<TMPXAttribute>& aAttrs); |
|
161 |
|
162 /** |
|
163 * From CMPXCollectionPlugin |
|
164 * Find the items matching the media specifications |
|
165 * @param aCriteria Properties of the item that is to be found |
|
166 * @param aAttrs Requested attributes to return |
|
167 * @return results of the search. Method abandons ownership of results. |
|
168 */ |
|
169 CMPXMedia* FindAllSyncL(const CMPXMedia& aCriteria, |
|
170 const TArray<TMPXAttribute>& aAttrs); |
|
171 |
|
172 /** |
|
173 * Get the list of supported capabilities |
|
174 * @return TCollectionCapability, bitmask of supported capabilities |
|
175 */ |
|
176 TCollectionCapability GetCapabilities(); |
|
177 |
|
178 /** |
|
179 * From MMPXDbActiveTaskObserver |
|
180 */ |
|
181 TBool HandleStepL(); |
|
182 |
|
183 /** |
|
184 * From MMPXDbActiveTaskObserver |
|
185 */ |
|
186 void HandleOperationCompleted( TInt aErr ); |
|
187 |
|
188 private: |
|
189 /** |
|
190 * Constructor |
|
191 */ |
|
192 CMPXPodcastDbPlugin (); |
|
193 |
|
194 /** |
|
195 * Symbian 2nd phase constructor. |
|
196 */ |
|
197 void ConstructL (); |
|
198 |
|
199 /** |
|
200 * Process the OpenL command |
|
201 * @param aPath a path |
|
202 * @param aAttrs Requested attributes to return |
|
203 * @param aEntries (Output parameter) collection items containing media properties |
|
204 * of all items, returned if opening a group of items |
|
205 * @param aFlagToSignalToBePlayed: signals that item is opened to be played if type == episode |
|
206 * @return ETrue if the open is for a episode, EFalse otherwise |
|
207 */ |
|
208 TBool DoOpenL(const CMPXCollectionPath& aPath, |
|
209 const TArray<TMPXAttribute>& aAttrs, |
|
210 CMPXMedia& aEntries, |
|
211 TBool aFlagToSignalToBePlayed); |
|
212 |
|
213 /** |
|
214 * Process the OpenL(EBrowseAll) command |
|
215 * @param aPath Path |
|
216 * @param aAttrs Requested attributes to return |
|
217 * @param aEntries (Output parameter) collection items containing media properties |
|
218 * of all items, returned if opening a group of items |
|
219 * @param aArray (Output parameter) collection items |
|
220 * @return ETrue if the open is for an episode, EFalse otherwise |
|
221 */ |
|
222 TBool DoOpenBrowseAllL(const CMPXCollectionPath& aPath, const TArray<TMPXAttribute>& aAttrs, |
|
223 CMPXMedia& aEntries, CMPXMediaArray& aArray); |
|
224 |
|
225 /** |
|
226 * Process the OpenL(EBrowsePubDate) command |
|
227 * @param aPath Path |
|
228 * @param aAttrs Requested attributes to return |
|
229 * @param aEntries (Output parameter) collection items containing media properties |
|
230 * of all items, returned if opening a group of items |
|
231 * @param aArray (Output parameter) collection items |
|
232 * @return ETrue if the open is for an episode, EFalse otherwise |
|
233 */ |
|
234 TBool DoOpenBrowsePubDateL(const CMPXCollectionPath& aPath, const TArray<TMPXAttribute>& aAttrs, |
|
235 CMPXMedia& aEntries, CMPXMediaArray& aArray); |
|
236 |
|
237 /** |
|
238 * Process the OpenL(EBrowseTitle) command |
|
239 * @param aPath Path |
|
240 * @param aAttrs Requested attributes to return |
|
241 * @param aEntries (Output parameter) collection items containing media properties |
|
242 * of all items, returned if opening a group of items |
|
243 * @param aArray (Output parameter) collection items |
|
244 * @return ETrue if the open is for an episode, EFalse otherwise |
|
245 */ |
|
246 TBool DoOpenBrowseTitleL(const CMPXCollectionPath& aPath, const TArray<TMPXAttribute>& aAttrs, |
|
247 CMPXMedia& aEntries, CMPXMediaArray& aArray); |
|
248 |
|
249 /** |
|
250 * Process the OpenL(EBrowseRecentlyAdded) command |
|
251 * @param aPath Path |
|
252 * @param aAttrs Requested attributes to return |
|
253 * @param aEntries (Output parameter) collection items containing media properties |
|
254 * of all items, returned if opening a group of items |
|
255 * @param aArray (Output parameter) collection items |
|
256 * @return ETrue if the open is for an episode, EFalse otherwise |
|
257 */ |
|
258 TBool DoOpenBrowseRecentlyAddedL(const CMPXCollectionPath& aPath, |
|
259 const TArray<TMPXAttribute>& aAttrs, CMPXMedia& aEntries, CMPXMediaArray& aArray); |
|
260 |
|
261 /** |
|
262 * Process the OpenL(EBrowseNotPlayed) command |
|
263 * @param aPath Path |
|
264 * @param aAttrs Requested attributes to return |
|
265 * @param aEntries (Output parameter) collection items containing media properties |
|
266 * of all items, returned if opening a group of items |
|
267 * @param aArray (Output parameter) collection items |
|
268 * @return ETrue if the open is for an episode, EFalse otherwise |
|
269 */ |
|
270 TBool DoOpenBrowseNotPlayedL(const CMPXCollectionPath& aPath, const TArray<TMPXAttribute>& aAttrs, |
|
271 CMPXMedia& aEntries, CMPXMediaArray& aArray); |
|
272 |
|
273 /** |
|
274 * Process an OpenL command with a EMPXOpenPlaylistOnly open mode |
|
275 * @param aPath path that we want to open |
|
276 * @param aAttrs default attributes to fetch |
|
277 * @param aFlagToSignalToBePlayed: signals that item is opened to be played if type == episode |
|
278 * @return CMPXCollectionPath* which is the new valid browse path |
|
279 * Method abandons ownership. |
|
280 */ |
|
281 CMPXCollectionPath* DoOpenPlaylistL( const CMPXCollectionPath& aPath, |
|
282 const TArray<TMPXAttribute>& aAttrs, |
|
283 TBool aFlagToSignalToBePlayed); |
|
284 |
|
285 /** |
|
286 * Process the MediaL command |
|
287 * @param aPath a path |
|
288 * @param aAttrs Requested attributes to return |
|
289 * @param aEntries collection items containing media properties |
|
290 * of all items, returned if opening a group of items |
|
291 */ |
|
292 void DoMediaL(const CMPXCollectionPath& aPath, |
|
293 const TArray<TMPXAttribute>& aAttrs, |
|
294 CMPXMedia& aEntries); |
|
295 |
|
296 /** |
|
297 * Get the plugin title, subtitle, icons for this plugin |
|
298 * @param aAttrs attributes to find |
|
299 * @param aMedia media object |
|
300 */ |
|
301 void DoRootMediaL(const TArray<TMPXAttribute>& aAttrs, CMPXMedia& aMedia); |
|
302 |
|
303 /** |
|
304 * Get the media under ALL EPISODES category |
|
305 * @param aPath path that leads to a media under ALL EPISODES |
|
306 * @param aAttrs attributes of media to find |
|
307 * @param aEntries the media referred by the path |
|
308 * @param aMediaArray media entries contained in the media referred by the path |
|
309 */ |
|
310 void DoAllEpisodesMediaL(const CMPXCollectionPath& aPath, |
|
311 const TArray<TMPXAttribute>& aAttrs, |
|
312 CMPXMedia& aEntries, |
|
313 CMPXMediaArray& aMediaArray); |
|
314 |
|
315 /** |
|
316 * Find the collection media for by publish date category |
|
317 * @param aPath path that leads to a media under BY PUBLISH DATE |
|
318 * @param aAttrs attributes of media to find |
|
319 * @param aEntries the media referred by the path |
|
320 * @param aMediaArray media entries contained in the media referred by the path |
|
321 */ |
|
322 void DoByPublishDateMediaL(const CMPXCollectionPath& aPath, |
|
323 const TArray<TMPXAttribute>& aAttrs, |
|
324 CMPXMedia& aEntries, |
|
325 CMPXMediaArray& aMediaArray); |
|
326 |
|
327 /** |
|
328 * Find the collection media for by titles category |
|
329 * @param aPath path that leads to a media under TITLES |
|
330 * @param aAttrs attributes of media to find |
|
331 * @param aEntries the media referred by the path |
|
332 * @param aMediaArray media entries contained in the media referred by the path |
|
333 */ |
|
334 void DoTitlesMediaL(const CMPXCollectionPath& aPath, |
|
335 const TArray<TMPXAttribute>& aAttrs, |
|
336 CMPXMedia& aEntries, |
|
337 CMPXMediaArray& aMediaArray); |
|
338 |
|
339 /** |
|
340 * Find the collection media for by recently added category |
|
341 * @param aPath path that leads to a media under RECENTLY ADDED |
|
342 * @param aAttrs attributes of media to find |
|
343 * @param aEntries the media referred by the path |
|
344 * @param aMediaArray medias contained in the media referred by the path |
|
345 */ |
|
346 void DoRecentlyAddedMediaL(const CMPXCollectionPath& aPath, |
|
347 const TArray<TMPXAttribute>& aAttrs, |
|
348 CMPXMedia& aEntries, |
|
349 CMPXMediaArray& aMediaArray); |
|
350 |
|
351 |
|
352 /** |
|
353 * Find the collection media for by not yet played category |
|
354 * @param aPath path that leads to a media under NOT YET PLAYED |
|
355 * @param aAttrs attributes of media to find |
|
356 * @param aEntries the media referred by the path |
|
357 * @param aMediaArray medias contained in the media referred by the path |
|
358 */ |
|
359 void DoNotYetPlayedMediaL(const CMPXCollectionPath& aPath, |
|
360 const TArray<TMPXAttribute>& aAttrs, |
|
361 CMPXMedia& aEntries, |
|
362 CMPXMediaArray& aMediaArray); |
|
363 |
|
364 /** |
|
365 * Get the root media. |
|
366 * @param aAttrs attributes of media to find |
|
367 * @param aRootCategoryId Id of the root media in the category, i.e. all albums, |
|
368 * ...etc. |
|
369 * @param aCategory specifies the category. |
|
370 * @param aEntries the media referred by the path |
|
371 */ |
|
372 void DoRootCategoryMediaL(const TArray<TMPXAttribute>& aAttrs, |
|
373 TMPXItemId aRootCategoryId, |
|
374 TMPXPodcastCategory aCategory, |
|
375 CMPXMedia& aEntries); |
|
376 |
|
377 /** |
|
378 * Set all the attributes in CMPXMedia corresponding to KMPXMediaIdDrm |
|
379 * @param aMedia, media to update |
|
380 * @param aDrmAttributes, bitwise or of the flags we want |
|
381 * @param aLocation, full file path including filename |
|
382 */ |
|
383 void DoSetMediaDrmL(CMPXMedia& aMedia, TUint aDrmAttributes, const TDesC& aLocation); |
|
384 |
|
385 /** |
|
386 * Add media objects to the array with attributes from episode details |
|
387 * @param aPath a path |
|
388 * @param aAttrs requested attributes |
|
389 * @param aEntry media to contain information about the container if it contains |
|
390 * than one entry |
|
391 * @param aMediaArray array to contain all the media objects added |
|
392 */ |
|
393 void GetEpisodeInfoL(const CMPXCollectionPath& aPath, const TArray<TMPXAttribute>& aAttrs, |
|
394 CMPXMedia& aEntry, CMPXMediaArray& aMediaArray); |
|
395 |
|
396 /** |
|
397 * Add media objects to the array with attributes from episode details |
|
398 * @param aAttrs requested attributes |
|
399 * @param aEntryId episode ID |
|
400 * @param aEntry media to contain information about the container if it contains |
|
401 * than one entry |
|
402 */ |
|
403 void DoGetEpisodeInfoL(const TArray<TMPXAttribute>& aAttrs, TInt aEntryId, CMPXMedia& aEntry); |
|
404 |
|
405 /** |
|
406 * Get the collection details from the db |
|
407 * @param aAttrs attributes to find |
|
408 * @param aPath path to be set if required |
|
409 * @param aMedia media object |
|
410 */ |
|
411 void DoHandleOtherMediaAttributesL(const TArray<TMPXAttribute>& aAttrs, |
|
412 const CMPXCollectionPath& aPath, CMPXMedia& aMedia); |
|
413 |
|
414 /** |
|
415 * Remove an item from the collection database using the given path |
|
416 * Note that the selection indices are hidden within the path |
|
417 * @param aPath path to the item to be removed |
|
418 * @param aChangeMsgArray array to store change messages |
|
419 * @return an array of files associated with the removed media entries |
|
420 */ |
|
421 CDesCArray* DoRemoveL(const CMPXCollectionPath& aPath, |
|
422 CMPXMessageArray& aChangeMsgArray); |
|
423 |
|
424 /** |
|
425 * Remove an item/items from the collection database using the given media properties |
|
426 * @param aMedia Properties of the item that is to be removed. It may cantain URI only |
|
427 * or meta data, all of items matched properties will be removed. |
|
428 * @param aDeleteRecord indicates whether the client has explictly requested |
|
429 * to delete the records from the database. If ETrue, records |
|
430 * associated with the media will be deleted from the database; |
|
431 * if EFalse, whether to mark the records as deleted or to delete |
|
432 * the records will be based on other deciding factors. |
|
433 */ |
|
434 void DoRemoveL(const CMPXMedia& aMedia, TBool aDeleteRecord); |
|
435 |
|
436 /** |
|
437 * Remove an item from the collection database using a command |
|
438 * @param aCmd remove command which contains collection path to the media entries to be |
|
439 * removed. This method should be called until all the selected items are |
|
440 * removed. When that happens, EMPXCommandCompleted flag is set to ETrue. |
|
441 */ |
|
442 void DoRemovePathL(CMPXCommand& aCmd); |
|
443 |
|
444 /** |
|
445 * Remove a media entry/entries from the collection database using a command |
|
446 * @param aCmd remove command which contains the media(s) to be removed. This |
|
447 * will delete the records from the database rather than marking them |
|
448 * as deleted. Designated caller is MTP. |
|
449 */ |
|
450 void DoRemoveMediaL(CMPXCommand& aCmd); |
|
451 |
|
452 /** |
|
453 * Remove a media entry/entries from all episodes view |
|
454 * @param aPath collection path that points to the media entry/entries to be removed |
|
455 * @param aSelections multiple media items selected. This array contains the id |
|
456 * of the selected media. |
|
457 * @param aUriArray a descriptor array containing the URI(s) of the deleted file(s) |
|
458 * @param aItemChangedMessages a list of change events as a result of the |
|
459 * episode removals |
|
460 */ |
|
461 void DoRemoveFromAllEpisodesL(const CMPXCollectionPath& aPath, |
|
462 const TArray<TMPXItemId>& aSelections, |
|
463 CDesCArray& aUriArray, |
|
464 CMPXMessageArray& aItemChangedMessages); |
|
465 |
|
466 /** |
|
467 * Remove media from Publish Date view |
|
468 * @param aPath collection path that points to the media entry/entries to be removed |
|
469 * @param aSelections multiple media entry/entries selected. This array contains the id |
|
470 * of the selected media. |
|
471 * @param aUriArray a descriptor array to contain the URI(s) of the deleted file(s) |
|
472 * @param aItemChangedMessages a list of change events as a result of the |
|
473 * episode removals |
|
474 */ |
|
475 void DoRemoveFromPublishDateL(const CMPXCollectionPath& aPath, |
|
476 const TArray<TMPXItemId>& aSelections, |
|
477 CDesCArray& aUriArray, |
|
478 CMPXMessageArray& aItemChangedMessages); |
|
479 |
|
480 /** |
|
481 * Remove a media item from Publish Date view |
|
482 * @param aPath collection path that points to the media entry/entries to be removed |
|
483 * @param aItemId ID of the item to be removed |
|
484 * @param aUriArray a descriptor array to contain the URI(s) of the deleted file(s) |
|
485 * @param aItemChangedMessages a list of change events as a result of the |
|
486 * episode removals |
|
487 */ |
|
488 void RemoveFromPublishDateL(const CMPXCollectionPath& aPath, TInt aItemId, |
|
489 CDesCArray& aUriArray, CMPXMessageArray& aItemChangedMessages); |
|
490 |
|
491 /** |
|
492 * Remove a media/medias from albums/genres/composers view |
|
493 * @param aPath collection path that points to the media(s) to be removed |
|
494 * @param aSelections multiple medias selected. This array contains the id |
|
495 * of the selected media. |
|
496 * @param aCategory indicates one of the 3 categories, EMPXAlbum, EMPXGenre, or |
|
497 * EMPXComposer |
|
498 * @param aUriArray a descriptor array to contain the URI of the deleted file |
|
499 * @param aItemChangedMessages a list of change events as a result of the |
|
500 * episode removals |
|
501 */ |
|
502 void DoRemoveFromCategoriesL(const CMPXCollectionPath& aPath, |
|
503 const TArray<TMPXItemId>& aSelections, |
|
504 TMPXGeneralCategory aCategory, |
|
505 CDesCArray& aUriArray, |
|
506 CMPXMessageArray& aItemChangedMessages); |
|
507 |
|
508 /** |
|
509 * Remove a media item from albums/genres/composers view |
|
510 * @param aPath collection path that points to the media entry/entries to be removed |
|
511 * @param aItemId ID of the item to be removed |
|
512 * @param aCategory indicates one of the 3 categories, EMPXAlbum, EMPXGenre, or |
|
513 * EMPXComposer |
|
514 * @param aUriArray a descriptor array to contain the URI(s) of the deleted file(s) |
|
515 * @param aItemChangedMessages a list of change events as a result of the |
|
516 * episode removals |
|
517 */ |
|
518 void RemoveFromCategoriesL(const CMPXCollectionPath& aPath, TInt aItemId, |
|
519 TMPXGeneralCategory aCategory, CDesCArray& aUriArray, |
|
520 CMPXMessageArray& aItemChangedMessages); |
|
521 |
|
522 /** |
|
523 * Fetch the duration for a specific category |
|
524 * @param aMedia a media object of which EMPXMediaGeneralDuration is to be |
|
525 * populated with the duration calculated in this method |
|
526 * @param aCategory category of the ID |
|
527 * @param aId id for identifying which category to calculate the duration for |
|
528 */ |
|
529 TInt DoDurationL(CMPXMedia& aMedia, TMPXPodcastCategory aCategory, TMPXItemId aId = 0); |
|
530 |
|
531 /** |
|
532 * Retrieves URIs associated with the path for file deletion |
|
533 * @param aCmd command to retrieve associated URIs for the given path. If |
|
534 * path ends with a particular artist/album/genre/composer, the path |
|
535 * will be updated to include all episodes in that category. If path |
|
536 * ends with one or more medias in a particular playlist, an array |
|
537 * of 0 elements will be returned to avoid client deleting them from |
|
538 * the file system |
|
539 */ |
|
540 void DoRetrieveUriForDeletionL(CMPXCommand& aCmd); |
|
541 |
|
542 /** |
|
543 * Deletes records which have been marked as deleted from the collection |
|
544 * @param aCmd command to cleanup deleted medias. |
|
545 * see KMPXCommandIdCollectionCleanupDeletedMedias defined in |
|
546 * mpxcollectioncommanddefs.h |
|
547 */ |
|
548 void CleanupDeletedRecordsL(CMPXCommand& aCmd); |
|
549 |
|
550 /** |
|
551 * Append a collection level to the collection path |
|
552 * @param aPath path to append the level to |
|
553 * @param aMedia media to extract media ids from |
|
554 * @note: Selection will be put on the first episode in the collection path |
|
555 */ |
|
556 TInt DoAppendLevelL(CMPXCollectionPath& aPath, CMPXMedia& aMedia); |
|
557 |
|
558 /* Append a collection level to the collection path with all episodes under the |
|
559 * selected category/categories (e.g. artist/artist-album/album/genre/composer). |
|
560 * Once the level is appended, all episodes under the selected category/categories |
|
561 * are selected. |
|
562 * @param aPath path to append the level to. Path remains unchanged if it's not |
|
563 * one of the following: |
|
564 * 1) path ends at an artist or selected artists |
|
565 * 2) path ends at an album of an artist or selected albums of an artist |
|
566 * 3) path ends at an album or selected albums |
|
567 * 4) path ends at a genre or selected genres |
|
568 * 5) path ends at a composer or selected composers |
|
569 */ |
|
570 void DoAppendLevelL(CMPXCollectionPath& aPath); |
|
571 |
|
572 /** |
|
573 * Execute a task step for an asynchronous add |
|
574 * @return ETrue if done |
|
575 */ |
|
576 TBool DoAddAsyncL(); |
|
577 |
|
578 /** |
|
579 * Add a media object to the collection |
|
580 * @param aMedia media to add |
|
581 * @return TUint32 item id of the item added |
|
582 */ |
|
583 TUint32 DoAddL(const CMPXMedia& aMedia); |
|
584 |
|
585 /** |
|
586 * Add an item into the collection |
|
587 * @param aMedia media to add |
|
588 * @param aMessageArray change message array |
|
589 * @return TUint32 item id of the item added |
|
590 */ |
|
591 TUint32 DoAddItemL(const CMPXMedia& aMedia, CMPXMessageArray& aMessageArray); |
|
592 |
|
593 /** |
|
594 * Set a media object to update the collection |
|
595 * @param aMedia media can be an item or a list. The item is treated as a list |
|
596 * if it contains a media array |
|
597 */ |
|
598 void DoSetL(const CMPXMedia& aMedia); |
|
599 |
|
600 /** |
|
601 * Execute a task step for an asynchronous set |
|
602 */ |
|
603 TBool DoSetAsyncL(); |
|
604 |
|
605 /** |
|
606 * Send a change message |
|
607 * @param aMessage a change message to be sent |
|
608 */ |
|
609 void HandleChangeL(const CMPXMessage& aMessage); |
|
610 |
|
611 /** |
|
612 * Construct a CMPXMedia from the array parameter and call HandleChange |
|
613 * @param aItemChangedMessages array in the change message to be sent |
|
614 */ |
|
615 void DoHandleChangeL(CMPXMessageArray* aItemChangedMessages); |
|
616 |
|
617 /** |
|
618 * Generates and calls back an out of disk CMPXMessage |
|
619 * This function will callback to the client context to |
|
620 * broadcast an out of disk event |
|
621 */ |
|
622 void HandleOutOfDiskMessageL(); |
|
623 |
|
624 /** |
|
625 * Leaving function to handle async op completion |
|
626 * @param aErr error code |
|
627 */ |
|
628 void DoHandleOperationCompletedL(TInt aErr); |
|
629 |
|
630 /** |
|
631 * Complete a delete operation |
|
632 * Sends out change messages and compacts the database |
|
633 */ |
|
634 void DoHandleDeleteCompleteL(CMPXCommand& aCmd); |
|
635 |
|
636 /** |
|
637 * Returns the category for a given browse type. |
|
638 * @param aBrowseType browse type |
|
639 * @return Category ID |
|
640 */ |
|
641 TMPXPodcastCategory CategoryForBrowseType(TMCBrowseType aBrowseType); |
|
642 |
|
643 /** |
|
644 * Returns the browse type for a given category ID. |
|
645 * @param aCategory category ID |
|
646 * @return Browse type |
|
647 */ |
|
648 TMCBrowseType BrowseTypeForCategory(TMPXPodcastCategory aCategory); |
|
649 |
|
650 /** |
|
651 * Sets the type, category and title attributes in the specified media. |
|
652 * @param aMedia media instance to be updated |
|
653 * @param aGeneralType general type attribute value |
|
654 * @param aType podcast type attribute value |
|
655 * @param aCategory category attribute value |
|
656 * @param aTitle title attribute value |
|
657 * @param aCount general count attribute value |
|
658 */ |
|
659 void SetMediaGeneralAttributesL(CMPXMedia& aMedia, TMPXGeneralType aGeneralType, |
|
660 TMPXPodcastType aType, TMPXPodcastCategory aCategory, const TDesC& aTitle, |
|
661 TInt aCount = -1); |
|
662 |
|
663 /** |
|
664 * Sets the type, category and title attributes in the specified media. |
|
665 * @param aMedia media instance to be updated |
|
666 * @param aGeneralType general type attribute value |
|
667 * @param aType type attribute value |
|
668 * @param aCategory category attribute value |
|
669 * @param aId ID of the item to the title from |
|
670 * @param aCount general count attribute value |
|
671 */ |
|
672 void SetMediaGeneralAttributesL(CMPXMedia& aMedia, TMPXGeneralType aGeneralType, |
|
673 TMPXPodcastType aType, TMPXPodcastCategory aCategory, TInt aId, TInt aCount = -1); |
|
674 |
|
675 /** |
|
676 * Get total podcasts count |
|
677 * @param aCmd command to return count |
|
678 * see KMPXCommandCollectionGetCount defined in |
|
679 * mpxcollectioncommanddefs.h |
|
680 */ |
|
681 void DoGetCollectionCountL( const CMPXCommand& aCmd ); |
|
682 |
|
683 /** |
|
684 * Get an array of URIs for all podcasts in a given db |
|
685 * @param aCmd command to return CDesCArray |
|
686 * see KMPXCommandCollectionGetURIs defined in |
|
687 * mpxcollectioncommanddefs.h |
|
688 */ |
|
689 void DoGetCollectionUriL( const CMPXCommand& aCmd ); |
|
690 |
|
691 /** |
|
692 * Set the attribute list according to current path |
|
693 * @param aPath a path |
|
694 * @param aAttrs attributes array to be filled |
|
695 * @param aSupportedIds array of supported content IDs to be filled |
|
696 */ |
|
697 void SetAttributesL( const CMPXCollectionPath& aPath, RArray<TMPXAttribute>& aAttrs, |
|
698 RArray<TInt>& aSupportedIds ); |
|
699 |
|
700 #ifdef _DEBUG |
|
701 /** |
|
702 * Prints messages for debugging |
|
703 * @param aMessage message(s) to be printed |
|
704 */ |
|
705 void PrintMessagesL(const CMPXMessage& aMessage); |
|
706 |
|
707 /** |
|
708 * Prints a single message for debugging |
|
709 * @param aMessage a message to be printed |
|
710 */ |
|
711 void PrintMessage(const CMPXMessage& aMessage); |
|
712 #endif |
|
713 |
|
714 private: |
|
715 |
|
716 RFs iFs; |
|
717 CMPXResource* iResource; |
|
718 CMPXPodcastDbHandler*iDbHandler; |
|
719 CMPXDrmMediaUtility* iDrmMediaUtility; |
|
720 CDesCArrayFlat* iPodcastLibraryTitles; // podcast library view titles |
|
721 CDesCArrayFlat* iPodcastLibraryMainMenuItemTitles; // podcast library item menu item titles |
|
722 RArray<TInt> iPodcastLibraryMainMenuItemIds; // podcast library item menu IDs |
|
723 CDesCArrayFlat* iPodcastTitlePublishDateCat; // publish date view menu titles |
|
724 RArray<TInt> iPodcastPublishDateIds; // publish date view menu IDs |
|
725 CDesCArrayFlat* iPodcastEpisodeViewPublishDateTitle; // episodes view publish date titles |
|
726 RArray<TInt> iPodcastEpisodeViewPublishDateIds; // episodes view publish date title IDs |
|
727 |
|
728 HBufC* iTitleMyPodcast; // podcast menu view title string |
|
729 HBufC* iTitleAllEpisodes; // All Episodes title string |
|
730 HBufC* iTitlePubDate; // Published Date title string |
|
731 HBufC* iTitleTitles; // Titles title string |
|
732 HBufC* iTitleAdded; // Recently Added title string |
|
733 HBufC* iTitleUnplayed; // Not Yet played title string |
|
734 |
|
735 TInt iStateChangedDrive; // drive number of the media has just opened/close |
|
736 TInt iStateChangedOldMaster; |
|
737 TBool iStateChangedOpen; |
|
738 TBool iMtpInUse; |
|
739 TBool iRefreshing; |
|
740 |
|
741 TInt iNumberOfEpisodesInCurrentPublishDateCategory; |
|
742 |
|
743 CMPXDbActiveTask* iActiveTask; |
|
744 RArray<TMPXItemId> iSelections; //selected items in the path |
|
745 TBool iFirstDeleteStep; |
|
746 |
|
747 }; |
|
748 |
|
749 #endif // MPXPODCASTDBPLUGIN_H |
|
750 |
|
751 |