author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Tue, 14 Sep 2010 21:14:08 +0300 | |
branch | RCL_3 |
changeset 27 | 2cbbefa9af78 |
parent 26 | 3de6c4cf6b67 |
permissions | -rw-r--r-- |
26 | 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: This class provides the functions to manipulate the music collection |
|
15 |
* database. |
|
16 |
* |
|
17 |
*/ |
|
18 |
||
19 |
||
20 |
#ifndef MPXDBHANDLER_H |
|
21 |
#define MPXDBHANDLER_H |
|
22 |
||
23 |
// INCLUDES |
|
24 |
#include <e32base.h> |
|
25 |
#include <f32file.h> |
|
26 |
||
27 |
#include <mpxattribute.h> |
|
28 |
#include <mpxmessage2.h> |
|
29 |
#include <mpxmediageneraldefs.h> |
|
30 |
#include <mpxcollectionframeworkdefs.h> |
|
31 |
#include <mpxmessagegeneraldefs.h> |
|
32 |
#include <mpxcollectionmessagedefs.h> |
|
33 |
||
34 |
#include "mpxcollectiondbstd.h" |
|
35 |
#include "mpxcollectiondb.hrh" |
|
36 |
#include "mpxdbactivetask.h" |
|
37 |
#include "mpxdbmusic.h" // for MMPXDbMusicObserver |
|
38 |
#include "mpxdbartist.h" // for MMPXDbArtistObserver |
|
39 |
#include "mpxdbalbum.h" // for MMPXDbAlbumObserver |
|
40 |
#include "mpxdbplaylist.h" // for MMPXDbPlaylistObserver |
|
41 |
#ifdef ABSTRACTAUDIOALBUM_INCLUDED |
|
42 |
#include "mpxdbabstractalbum.h" |
|
43 |
#endif // ABSTRACTAUDIOALBUM_INCLUDED |
|
44 |
||
45 |
// FORWARD DECLARATIONS |
|
46 |
class CMPXMedia; |
|
47 |
class CMPXMediaArray; |
|
48 |
class CMPXCollectionDbManager; |
|
49 |
class CMPXDbPlaylist; |
|
50 |
class CMPXDbCategory; |
|
51 |
class CMPXDbAuxiliary; |
|
52 |
class CMPXDbAutoPlaylist; |
|
53 |
class CMPXDbArtist; |
|
54 |
class CMPXDbAlbum; |
|
55 |
class CMPXDbGenre; |
|
56 |
class CMPXDbComposer; |
|
57 |
||
58 |
// CLASS DECLARATION |
|
59 |
||
60 |
/** |
|
61 |
* Music collection database handler |
|
62 |
* |
|
63 |
* @lib MPXDbPlugin.lib |
|
64 |
*/ |
|
65 |
class CMPXDbHandler : |
|
66 |
public CBase, |
|
67 |
public MMPXDbMusicObserver, |
|
68 |
public MMPXDbAlbumObserver, |
|
69 |
public MMPXDbPlaylistObserver |
|
70 |
{ |
|
71 |
public: // Constructors and destructor |
|
72 |
||
73 |
/** |
|
74 |
* Two-phased constructor. |
|
75 |
* @param aFs file server session |
|
76 |
* @return a new CMPXDbHandler instance |
|
77 |
*/ |
|
78 |
static CMPXDbHandler* NewL(RFs& aFs, CMPXResource& aResource); |
|
79 |
||
80 |
/** |
|
81 |
* Two-phased constructor. |
|
82 |
* @param aFs file server session |
|
83 |
* @return a new CMPXDbHandler instance |
|
84 |
*/ |
|
85 |
static CMPXDbHandler* NewLC(RFs& aFs, CMPXResource& aResource); |
|
86 |
||
87 |
/** |
|
88 |
* Destructor. |
|
89 |
*/ |
|
90 |
virtual ~CMPXDbHandler(); |
|
91 |
||
92 |
public: |
|
93 |
||
94 |
/** |
|
95 |
* Add a song to the music collection database |
|
96 |
* @param aMedia media object which contains file path, |
|
97 |
* artist, composer, name(title), track, etc... |
|
98 |
* @param aMessageArray change event message to notify client of the changes |
|
99 |
* @return TUint32 id of the item added |
|
100 |
*/ |
|
101 |
TUint32 AddSongL(const CMPXMedia& aMedia, CMPXMessageArray* aMessageArray=NULL); |
|
102 |
||
103 |
/** |
|
104 |
* Add a song to the music collection without a database transaction; it |
|
105 |
* is assumed the transaction is created at a higher leve |
|
106 |
* @param aMedia media object which contains file path, |
|
107 |
* artist, composer, name(title), track, etc... |
|
108 |
* @param aMessageArray change event message to notify client of the changes |
|
109 |
* @return TUint32 id of the item added |
|
110 |
*/ |
|
111 |
TUint32 AddSongWithNoTransactionL(const CMPXMedia& aMedia, CMPXMessageArray* aMessageArray=NULL); |
|
112 |
||
113 |
/** |
|
114 |
* Add a playlist to the collection |
|
115 |
* @param aMedia playlist media object with title and URI of the playlist. |
|
116 |
* @return playlist Id of the playlist created |
|
117 |
*/ |
|
118 |
TUint32 AddPlaylistL(const CMPXMedia& aMedia); |
|
119 |
||
120 |
/** |
|
121 |
* Add songs to the specified playlist |
|
122 |
* @param aMedia playlist media object with playlist Id. |
|
123 |
* @return playlist Id of the playlist |
|
124 |
*/ |
|
125 |
TUint32 AddSongToPlaylistL(const CMPXMedia& aMedia); |
|
126 |
#ifdef ABSTRACTAUDIOALBUM_INCLUDED |
|
127 |
/** |
|
128 |
* Add an abstractalbum to the collection |
|
129 |
* @param aMedia abstractalbum media object with URI of the abstractalbum. |
|
130 |
* @param aMessageArray change event message to notify client of the changes |
|
131 |
* @return abstractalbum Id of the abstractalbum created |
|
132 |
*/ |
|
133 |
TUint32 AddAbstractAlbumL(const CMPXMedia& aMedia, CMPXMessageArray* aMessageArray=NULL); |
|
134 |
#endif // ABSTRACTAUDIOALBUM_INCLUDED |
|
135 |
/** |
|
136 |
* Update song info for a song in the music collection database |
|
137 |
* @param aMedia songDetails object which contains file path, |
|
138 |
* artist, composer, name(title), track, etc... |
|
139 |
* @param aItemChangedMessages a list of change events as a result of the |
|
140 |
* song update |
|
141 |
* @return ETrue if UI visible change else EFalse |
|
142 |
*/ |
|
143 |
CMPXDbActiveTask::TChangeVisibility UpdateSongL(const CMPXMedia& aMedia, |
|
144 |
CMPXMessageArray& aItemChangedMessages); |
|
145 |
#ifdef ABSTRACTAUDIOALBUM_INCLUDED |
|
146 |
/** |
|
147 |
* Update abstractalbum info to AbstractAlbum table and Songs associated with abstractalbum |
|
148 |
* in the music collection database |
|
149 |
* @param aMedia media object |
|
150 |
* @param aItemChangedMessages a list of change events as a result of the |
|
151 |
* song update |
|
152 |
* @return ETrue if UI visible change else EFalse |
|
153 |
*/ |
|
154 |
CMPXDbActiveTask::TChangeVisibility UpdateAbstractAlbumL(const CMPXMedia& aMedia, |
|
155 |
CMPXMessageArray& aItemChangedMessages); |
|
156 |
||
157 |
/** |
|
158 |
* Update all songs which associate with AbstractAlbum to new AbstractAlbum info |
|
159 |
* in the collection |
|
160 |
* @param aMedia media object which contains file path, |
|
161 |
* artist, composer, name(title), track, etc... |
|
162 |
* @param aItemChangedMessages a list of change events as a result of the |
|
163 |
* song update |
|
164 |
* @return ETrue if UI visible change else EFalse |
|
165 |
*/ |
|
166 |
CMPXDbActiveTask::TChangeVisibility UpdateSongsAbstractAlbumInfoL(const CMPXMedia& aMedia, |
|
167 |
CMPXMessageArray& aItemChangedMessages); |
|
168 |
#endif // ABSTRACTAUDIOALBUM_INCLUDED |
|
169 |
/** |
|
170 |
* Update playlist info in the music collection database |
|
171 |
* @param aMedia playlist details object which contains file path, |
|
172 |
* timestamps etc. |
|
173 |
* @param aMessageArray change event messages for the playlist update |
|
174 |
*/ |
|
175 |
void UpdatePlaylistL(const CMPXMedia& aMedia, CMPXMessageArray& aMessageArray); |
|
176 |
||
177 |
/** |
|
178 |
* Update the songs for a playlist in the music collection database |
|
179 |
* @param aMedia playlist details object which contains the playlist songs. |
|
180 |
* @param aMessage change event message for the playlist update |
|
181 |
*/ |
|
182 |
void UpdatePlaylistSongsL(const CMPXMedia& aMedia, CMPXMessage& aMessage); |
|
183 |
||
184 |
/** |
|
185 |
* Reorder the specified song in the specified playlist |
|
186 |
* @param aPlaylistId id of the playlist which contains the song to be reordered |
|
187 |
* @param aSongId id of the song to be reordered |
|
188 |
* @param aOriginalOrdinal the original ordinal of the song within the playlist. |
|
189 |
* Ordinal starts from 0. |
|
190 |
* @param aNewOrdinal the new ordinal of the song within the playlist. Ordinal |
|
191 |
* starts from 0. |
|
192 |
* @param aMessage change event message for the playlist update |
|
193 |
*/ |
|
194 |
void ReorderPlaylistL(const TMPXItemId& aPlaylistId, const TMPXItemId& aSongId, |
|
195 |
TUint aOriginalOrdinal, TUint aNewOrdinal, CMPXMessage& aMessage); |
|
196 |
||
197 |
/** |
|
198 |
* Remove all songs within music collection database |
|
199 |
*/ |
|
200 |
void RemoveEntireCollectionL(); |
|
201 |
||
202 |
/** |
|
203 |
* Remove a song from the music collection database |
|
204 |
* @param aSongId ID of the song to be removed |
|
205 |
* @param aUriArray a descriptor array to contain the URI of the deleted file |
|
206 |
* @param aItemChangedMessages a list of change events as a result of the song removal |
|
207 |
* @param aDeleteRecord indicates whether the client has explictly requested |
|
208 |
* to delete the records from the database. If ETrue, records |
|
209 |
* associated with the media will be deleted from the database; |
|
210 |
* if EFalse, whether to mark the records as deleted or to delete |
|
211 |
* the records will be based on other deciding factors. |
|
212 |
*/ |
|
213 |
void RemoveSongL(TUint32 aSongId, CDesCArray& aUriArray, |
|
214 |
CMPXMessageArray& aItemChangedMessages, TBool aDeleteRecord = EFalse); |
|
215 |
||
216 |
/** |
|
217 |
* Removes a category of songs from the music collection, and its |
|
218 |
* corresponding category in the lookup table |
|
219 |
* @param aCategory the category to remove |
|
220 |
* @param aCategoryId ID of the category to remove |
|
221 |
* @param aUriArray a descriptor array to contain the URI of the deleted songs |
|
222 |
* @param aItemChangedMessages a list of change events as a result of the song removal |
|
223 |
*/ |
|
224 |
void RemoveSongsMatchingCategoryL(TMPXGeneralCategory aCategory, TUint32 aCategoryId, |
|
225 |
CDesCArray& aUriArray, CMPXMessageArray& aItemChangedMessages); |
|
226 |
||
227 |
/** |
|
228 |
* Removes songs from the music collection belonging to the |
|
229 |
* specified artist and album as well as the actual category |
|
230 |
* in the lookup table |
|
231 |
* @param aArtistId id of the artist |
|
232 |
* @param aAlbumId id of the album |
|
233 |
* @param aUriArray a descriptor array to contain the URI of the deleted file(s) |
|
234 |
* @param aItemChangedMessages a list of change events as a result of the song removal |
|
235 |
*/ |
|
236 |
void RemoveSongsMatchingArtistAndAlbumL(TUint32 aArtistId, TUint32 aAlbumId, |
|
237 |
CDesCArray& aUriArray, CMPXMessageArray& aItemChangedMessages); |
|
238 |
||
239 |
/** |
|
240 |
* Remove all playlists from the collection |
|
241 |
*/ |
|
242 |
void RemoveAllPlaylistsL(); |
|
243 |
||
244 |
/** |
|
245 |
* Remove a playlist This will remove all the songs from the playlist |
|
246 |
* @param aPlaylistId ID of the playlist to remove |
|
247 |
* @param aUriArray a descriptor array to contain the URI of the deleted file |
|
248 |
* @param aItemChangedMessages a list of change events as a result of the |
|
249 |
* playlist removal |
|
250 |
*/ |
|
251 |
void RemovePlaylistL(TUint32 aPlaylistId, CDesCArray& aUriArray, |
|
252 |
CMPXMessageArray& aItemChangedMessages); |
|
253 |
#ifdef ABSTRACTAUDIOALBUM_INCLUDED |
|
254 |
/** |
|
255 |
* Remove a abstractalbum, remove entry from AbstractAlbum table, |
|
256 |
* Thumbnail table, corresponding alb from file system |
|
257 |
* @param aAbstractAlbumId ID of the abstractalbum to remove |
|
258 |
* @param aItemChangedMessages a list of change events as a result of the |
|
259 |
* abstractalbum removal |
|
260 |
* @param aFileDeleted indicate if alb file already deleted from file system |
|
261 |
*/ |
|
262 |
void RemoveAbstractAlbumL(TUint32 aAbstractAlbumId, |
|
263 |
CMPXMessageArray& aItemChangedMessages, TBool aFileDeleted); |
|
264 |
#endif // ABSTRACTAUDIOALBUM_INCLUDED |
|
265 |
||
266 |
/** |
|
267 |
* Remove a song from the specified playlist. |
|
268 |
* @param aPlaylistId ID of the playlist to remove the song from |
|
269 |
* @param aSongId Id of the song in the playlist to be removed |
|
270 |
* @param aOrdinal the ordinal of the song in the playlist. This uniquely |
|
271 |
* identifies which song in the playlist to be removed; whereas song |
|
272 |
* Id doesn't because duplicate tracks in the playlist are allowed. |
|
273 |
* The position is relative to zero, i.e. zero implies that the song |
|
274 |
* at the beginning of the playlist is to be removed. |
|
275 |
* @param aItemChangedMessages a list of change events as a result of the |
|
276 |
* song removal |
|
277 |
*/ |
|
278 |
void RemoveSongFromPlaylistL(TUint32 aPlaylist, const TMPXItemId& aSongId, |
|
279 |
TInt aOrdinal, CMPXMessageArray& aItemChangedMessages); |
|
280 |
||
281 |
/** |
|
282 |
* Delete records in all databases which have been marked as deleted |
|
283 |
*/ |
|
284 |
void CleanupDeletedRecordsL(); |
|
285 |
||
286 |
/** |
|
287 |
* Get all songs from the music collection databasee |
|
288 |
* @param aMediaArray Array to place all the songs' required info |
|
289 |
* @param aAttrs required attributes |
|
290 |
*/ |
|
291 |
void GetAllSongsL(CMPXMediaArray* aMediaArray, |
|
292 |
const TArray<TMPXAttribute>& aAttrs); |
|
293 |
||
294 |
/** |
|
295 |
* Get a limited number of songs from the music collection databasee |
|
296 |
* @param aMediaArray Array to place all the songs' required info |
|
297 |
* @param aAttrs required attributes |
|
298 |
* @param aLimit maximum number of songs to retrieve |
|
299 |
*/ |
|
300 |
void GetAllSongsLimitedL(const TArray<TMPXAttribute>& aAttrs, |
|
301 |
CMPXMediaArray& aMediaArray, TInt aLimit); |
|
302 |
||
303 |
/** |
|
304 |
* Get songs from the music collection database incrementally |
|
305 |
* @param aMediaArray Array to place all the songs' required info |
|
306 |
* @param aAttrs required attributes |
|
307 |
* @param aTitle title to use as a key |
|
308 |
* @param aNumOfSongs number of songs to read |
|
309 |
* @param aAsc ascending or descending data read |
|
310 |
*/ |
|
311 |
void GetSongsInBlockL(CMPXMediaArray* aMediaArray, |
|
312 |
const TArray<TMPXAttribute>& aAttrs, |
|
313 |
TPtrC aTitle, |
|
314 |
TUint aNumOfSongs, |
|
315 |
TBool aAsc); |
|
316 |
||
317 |
||
318 |
/** |
|
319 |
* Get songs from the music collection starting at a particular offset |
|
320 |
* ONLY use this as the first query to locate particular item. Should use |
|
321 |
* GetSongsInBlockL() to fetch in blocks with a particular index |
|
322 |
* @param aMediaArray Array to store the results |
|
323 |
* @param aAttrs attributes to fetch |
|
324 |
* @param aOffset offset to start reading |
|
325 |
* @param aCount number of items to get |
|
326 |
*/ |
|
327 |
void GetSongsAtOffsetL( CMPXMediaArray* aMediaArray, |
|
328 |
const TArray<TMPXAttribute>& aAttrs, |
|
329 |
TInt aOffset, |
|
330 |
TInt aCount ); |
|
331 |
||
332 |
/** |
|
333 |
* Get all the songs that match the given artist ID |
|
334 |
* @param aArtistId ID of the artist to match |
|
335 |
* @param aAttrs required attributes |
|
336 |
* @param aMediaArray Array to place all the matching songs' required |
|
337 |
* attributes |
|
338 |
*/ |
|
339 |
void GetSongsMatchingArtistL(TUint aArtistId, |
|
340 |
const TArray<TMPXAttribute>& aAttrs, CMPXMediaArray* aMediaArray); |
|
341 |
||
342 |
/** |
|
343 |
* Get all the songs that match the given album ID |
|
344 |
* @param aAlbumId ID of the album to match |
|
345 |
* @param aAttrs required attributes |
|
346 |
* @param aMediaArray Array to place all the matching songs' required info |
|
347 |
*/ |
|
348 |
void GetSongsMatchingAlbumL(TUint aAlbumId, |
|
349 |
const TArray<TMPXAttribute>& aAttrs, CMPXMediaArray* aMediaArray); |
|
350 |
||
351 |
/** |
|
352 |
* Get all the songs that match the given artist and album ID |
|
353 |
* @param aArtistId ID of the artist to match |
|
354 |
* @param aAlbumId ID of the album to match |
|
355 |
* @param aAttrs required attributes |
|
356 |
* @param aMediaArray Array to place all the matching songs' required info |
|
357 |
*/ |
|
358 |
void GetSongsMatchingArtistAndAlbumL(TUint aArtistId, TUint aAlbumId, |
|
359 |
const TArray<TMPXAttribute>& aAttrs, CMPXMediaArray* aMediaArray); |
|
360 |
||
361 |
/** |
|
362 |
* Get all the songs that match the given genre ID |
|
363 |
* @param aGenreId ID of the genre to match |
|
364 |
* @param aAttrs required attributes |
|
365 |
* @param aMediaArray Array to place all the matching songs' required info |
|
366 |
*/ |
|
367 |
void GetSongsMatchingGenreL(TUint aGenreId, |
|
368 |
const TArray<TMPXAttribute>& aAttrs, CMPXMediaArray* aMediaArray); |
|
369 |
||
370 |
/** |
|
371 |
* Get all the songs that match the given composer ID |
|
372 |
* @param aComposerId ID of the composer to match |
|
373 |
* @param aAttrs required attributes |
|
374 |
* @param aMediaArray Array to place all the matching songs' required info |
|
375 |
*/ |
|
376 |
void GetSongsMatchingComposerL(TUint aComposerId, |
|
377 |
const TArray<TMPXAttribute>& aAttrs, CMPXMediaArray* aMediaArray); |
|
378 |
||
379 |
/** |
|
380 |
* Get all the songs that match the given playlist ID |
|
381 |
* @param aPlaylistId ID of the playlist to match |
|
382 |
* @param aAttrs required attributes |
|
383 |
* @param aMediaArray Array to place all the required song info |
|
384 |
*/ |
|
385 |
void GetSongsMatchingPlaylistL(TUint aPlaylistId, |
|
386 |
const TArray<TMPXAttribute>& aAttrs, CMPXMediaArray* aMediaArray); |
|
387 |
||
388 |
/** |
|
389 |
* Get the song info that matches the given song ID from Songs table. |
|
390 |
* @param aSongId ID of the song |
|
391 |
* @param aAttrs required attributes |
|
392 |
* @param aMedia returns the song info |
|
393 |
*/ |
|
394 |
void GetSongL(TUint32 aSongId, const TArray<TMPXAttribute>& aAttrs, |
|
395 |
CMPXMedia& aMedia); |
|
396 |
||
397 |
/** |
|
398 |
* Appends the media object with the song information to the specified array. |
|
399 |
* @param aSongId ID of the song |
|
400 |
* @param aAttrs required attributes |
|
401 |
* @param aMediaArray on return the song info is appended to this array |
|
402 |
*/ |
|
403 |
void GetSongL(TUint32 aSongId, const TArray<TMPXAttribute>& aAttrs, |
|
404 |
CMPXMediaArray& aMediaArray); |
|
405 |
||
406 |
/** |
|
407 |
* Get the song info that matches the given song ID from Songs table. |
|
408 |
* The song info will first be populated from Playlist table and |
|
409 |
* if the Songs table exists in the drive where the song is located, |
|
410 |
* song info will be overwritten from Songs table. This enables the |
|
411 |
* support for displaying song title in a playlist when the drive |
|
412 |
* where the song is located is not present. |
|
413 |
* @aSongId ID of the song |
|
414 |
* @aPlaylistId ID of the playlist the song belongs to. |
|
415 |
* @param aAttrs required attributes |
|
416 |
* @param aMediaArray Array to place all the required song info |
|
417 |
* @leave KErrNotFound if the song could not be found in the |
|
418 |
* PlaylistSongs table |
|
419 |
*/ |
|
420 |
void GetPlaylistSongL(TUint32 aSongId, TUint32 aPlaylistId, |
|
421 |
const TArray<TMPXAttribute>& aAttrs, CMPXMedia& aMedia); |
|
422 |
||
423 |
/** |
|
424 |
* Appends the a media object with the song information to the specified array. |
|
425 |
* @param aSongId ID of the song |
|
426 |
* @param aPlaylistId ID of the playlist |
|
427 |
* @param aAttrs required attributes |
|
428 |
* @param aMediaArray on return the song info is appended to this array |
|
429 |
*/ |
|
430 |
void GetPlaylistSongL(TUint32 aSongId, TUint32 aPlaylistId, |
|
431 |
const TArray<TMPXAttribute>& aAttrs, CMPXMediaArray& aMediaArray); |
|
432 |
||
433 |
/** |
|
434 |
* Get the song ID of the song that matches the given URI |
|
435 |
* @param aUri URI to match |
|
436 |
* @return song ID |
|
437 |
*/ |
|
438 |
TUint32 GetSongIdMatchingUriL(const TDesC& aUri); |
|
439 |
||
440 |
#ifdef ABSTRACTAUDIOALBUM_INCLUDED |
|
441 |
/** |
|
442 |
* Get the abstractalbum ID of the abstractalbum that matches the given URI |
|
443 |
* @param aUri URI to match |
|
444 |
* @return abstractalbum ID |
|
445 |
*/ |
|
446 |
TUint32 GetAbstractAlbumIdMatchingUriL(const TDesC& aUri); |
|
447 |
#endif // ABSTRACTAUDIOALBUM_INCLUDED |
|
448 |
/** |
|
449 |
* Get all the artist names from the music collection database sorted by name. |
|
450 |
* @param aAttrs required attributes |
|
451 |
* @param aMediaArray Array to place all the artists' required info |
|
452 |
*/ |
|
453 |
void GetAllArtistsL(const TArray<TMPXAttribute>& aAttrs, |
|
454 |
CMPXMediaArray* aMediaArray); |
|
455 |
||
456 |
/** |
|
457 |
* Get all the album names from the music collection database sorted by name. |
|
458 |
* @param aAttrs required attributes |
|
459 |
* @param aMediaArray Array to place all the albums' required info |
|
460 |
*/ |
|
461 |
void GetAllAlbumsL(const TArray<TMPXAttribute>& aAttrs, |
|
462 |
CMPXMediaArray* aMediaArray); |
|
463 |
||
464 |
/** |
|
465 |
* Get all the albums that match the given artist ID sorted by name. |
|
466 |
* @param aArtistId ID of the artist to match |
|
467 |
* @param aAttrs required attributes |
|
468 |
* @param aMediaArray Array to place all the matching albums' required info |
|
469 |
*/ |
|
470 |
void GetAlbumsMatchingArtistL(TUint aArtistId, |
|
471 |
const TArray<TMPXAttribute>& aAttrs, CMPXMediaArray& aMediaArray); |
|
472 |
||
473 |
/** |
|
474 |
* Get all the genre names from the collection |
|
475 |
* @param aAttrs required attributes |
|
476 |
* @param aMediaArray Array to place all the genres' required info |
|
477 |
*/ |
|
478 |
void GetAllGenresL(const TArray<TMPXAttribute>& aAttrs, |
|
479 |
CMPXMediaArray* aMediaArray); |
|
480 |
||
481 |
/** |
|
482 |
* Get all the composer names from the collection |
|
483 |
* @param aAttrs required attributes |
|
484 |
* @param aMediaArray Array to place all the composers' required info |
|
485 |
*/ |
|
486 |
void GetAllComposersL(const TArray<TMPXAttribute>& aAttrs, |
|
487 |
CMPXMediaArray* aMediaArray); |
|
488 |
||
489 |
/** |
|
490 |
* Get the playlist ID of the playlist that matches the given URI |
|
491 |
* @param aUri URI to match |
|
492 |
* @return playlist ID to return |
|
493 |
*/ |
|
494 |
TUint32 GetPlaylistIdMatchingUriL(const TDesC& aUri); |
|
495 |
||
496 |
/** |
|
497 |
* Checks if the specified ID corresponds to an auto playlist. |
|
498 |
* @param aPlaylistId ID to be checked |
|
499 |
* @return ETrue if it corresponds to an auto playlist, EFalse otherwise |
|
500 |
*/ |
|
501 |
TBool IsAutoPlaylistL(TUint32 aPlaylistId); |
|
502 |
||
503 |
/** |
|
504 |
* Get all the playlist names from the collection |
|
505 |
* @param aMediaArray Array to place all the playlists' required info |
|
506 |
* @param aAttrs required attributes |
|
507 |
*/ |
|
508 |
void GetAllPlaylistsL(CMPXMediaArray* aMediaArray, |
|
509 |
const TArray<TMPXAttribute>& aAttrs); |
|
510 |
||
511 |
/** |
|
512 |
* Get all the system playlist names from the collection |
|
513 |
* @param aMediaArray Array to place all the system playlists' required info |
|
514 |
*/ |
|
515 |
void GetAllSystemPlaylistNamesL(CMPXMediaArray* aMediaArray); |
|
516 |
||
517 |
/** |
|
518 |
* Get title from the Id |
|
519 |
* @param Id to search for |
|
520 |
* @return name matching the ID |
|
521 |
*/ |
|
522 |
HBufC* GetNameMatchingIdL(const TUint32 aId) const; |
|
523 |
||
524 |
/** |
|
525 |
* Get URI from the Id |
|
526 |
* @param Id to search for |
|
527 |
* @return URI matching the ID |
|
528 |
* @leave KErrNotSupported if the ID refers to an invalid category |
|
529 |
*/ |
|
530 |
HBufC* GetUriMatchingIdL(const TUint32 aId) const; |
|
531 |
||
532 |
/** |
|
533 |
* Retrieve category record with information as specified in the given |
|
534 |
* attributes |
|
535 |
* @param aCategoryId Id of the record to be retrieved |
|
536 |
* @param aCategory category type |
|
537 |
* @param aAttrs information to return about the specified category |
|
538 |
* @param aMedia returns the category information |
|
539 |
*/ |
|
540 |
void GetCategoryL(const TUint32 aCategoryId, TMPXGeneralCategory aCategory, |
|
541 |
const TArray<TMPXAttribute>& aAttrs, CMPXMedia* aMedia); |
|
542 |
||
543 |
/** |
|
544 |
* Get the duration for all songs |
|
545 |
* @return duration |
|
546 |
*/ |
|
547 |
TInt GetAllSongsDurationL(); |
|
548 |
||
549 |
/** |
|
550 |
* Get the duration for all songs for a specified artist |
|
551 |
* @param aArtistId identifies the artist |
|
552 |
* @return duration |
|
553 |
*/ |
|
554 |
TInt GetArtistDurationL(TInt aArtistId); |
|
555 |
||
556 |
/** |
|
557 |
* Get the duration for all songs in a specified album |
|
558 |
* @param aAlbumId identifies the album |
|
559 |
* @return duration |
|
560 |
*/ |
|
561 |
TInt GetAlbumDurationL(TInt aAlbumId); |
|
562 |
||
563 |
/** |
|
564 |
* Get the duration for all songs for a specified artist and album |
|
565 |
* @param aArtistId identifies the artist |
|
566 |
* @param aAlbumId identifies the album |
|
567 |
* @return duration |
|
568 |
*/ |
|
569 |
TInt GetArtistAlbumDurationL(TInt aArtistId, TInt aAlbumId); |
|
570 |
||
571 |
/** |
|
572 |
* Get the duration for all songs for a specified composer |
|
573 |
* @param aComposerId identifies the composer |
|
574 |
* @return duration |
|
575 |
*/ |
|
576 |
TInt GetComposerDurationL(TInt aComposerId); |
|
577 |
||
578 |
/** |
|
579 |
* Get the duration for all songs for a specified genre |
|
580 |
* @param aGenreId identifies the genre |
|
581 |
* @return duration |
|
582 |
*/ |
|
583 |
TInt GetGenreDurationL(TInt aGenreId); |
|
584 |
||
585 |
/** |
|
586 |
* Get the duration for all songs in a user playlist |
|
587 |
* @param aPlaylistId identifies the playlist |
|
588 |
* @return duration |
|
589 |
*/ |
|
590 |
TInt GetUserPlaylistDurationL(TInt aPlaylistId); |
|
591 |
||
592 |
/** |
|
593 |
* Get the duration for all songs for a specified playlist |
|
594 |
* @param aPlaylistId identifies the playlist |
|
595 |
* @return duration |
|
596 |
*/ |
|
597 |
TInt GetPlaylistDurationL(TInt aPlaylistId); |
|
598 |
||
599 |
/** |
|
600 |
* Fetch the total number of items in the specified category |
|
601 |
* @param aCategory category to be queried |
|
602 |
* @return number of items. |
|
603 |
*/ |
|
604 |
TInt NumberOfItemsL(TMPXGeneralCategory aCategory); |
|
605 |
||
606 |
/** |
|
607 |
* Find media(s) from the collection |
|
608 |
* @param aCriteria selection criteria |
|
609 |
* @param aAttrs attributes for the matching media |
|
610 |
* @return matching media. Ownership is transferred. |
|
611 |
* @leave KErrArgument if the criteria do not include a type |
|
612 |
* or category |
|
613 |
*/ |
|
614 |
CMPXMedia* FindAllLC(const CMPXMedia& aCriteria, |
|
615 |
const TArray<TMPXAttribute>& aAttrs); |
|
616 |
||
617 |
/** |
|
618 |
* Set the last refreshed time |
|
619 |
* @param aTime the updated last refresh time |
|
620 |
*/ |
|
621 |
void SetLastRefreshedTimeL(TTime aTime); |
|
622 |
||
623 |
/** |
|
624 |
* Get the last refreshed time |
|
625 |
* @return last refreshed time |
|
626 |
*/ |
|
627 |
TTime GetLastRefreshedTimeL(); |
|
628 |
||
629 |
/** |
|
630 |
* Set the db corrupted bit in the aux table for all drives |
|
631 |
* @param aCorrupted flag indicating whether or not the db is corrupted |
|
632 |
*/ |
|
633 |
void SetDBCorruptedL(TBool aCorrupted); |
|
634 |
||
635 |
/** |
|
636 |
* Get the db corrupted bit in the aux table ( or of all drives ) |
|
637 |
* @return ETrue if database is corrupted, else EFalse |
|
638 |
*/ |
|
639 |
TBool IsDBCorruptedL(); |
|
640 |
||
641 |
/** |
|
642 |
* Checks if the database has been created |
|
643 |
* @return ETrue if file has been created |
|
644 |
*/ |
|
645 |
TBool DatabaseCreated(); |
|
646 |
||
647 |
/** |
|
648 |
* Close and re-open the music collection database stored on the |
|
649 |
* specified drive |
|
650 |
* @param aDrive drive containing the music collection database to re-open |
|
651 |
*/ |
|
652 |
void OpenDatabaseL(TInt aDrive); |
|
653 |
||
654 |
/** |
|
655 |
* Close a database for a particular drive |
|
656 |
* @param aDrive drive to close |
|
657 |
*/ |
|
658 |
void CloseDatabaseL(TInt aDrive); |
|
659 |
||
660 |
/** |
|
661 |
* Recreate all databases. |
|
662 |
*/ |
|
663 |
void ReCreateDatabasesL(); |
|
664 |
||
665 |
/** |
|
666 |
* Starts a refresh operation. |
|
667 |
*/ |
|
668 |
void RefreshStartL(); |
|
669 |
||
670 |
/** |
|
671 |
* Ends a refresh operation. |
|
672 |
*/ |
|
673 |
void RefreshEndL(); |
|
674 |
||
675 |
/** |
|
676 |
* Notification of mtp start |
|
677 |
*/ |
|
678 |
void MtpStartL(); |
|
679 |
||
680 |
/** |
|
681 |
* Notification of mtp end |
|
682 |
*/ |
|
683 |
void MtpEndL(); |
|
684 |
/** |
|
685 |
* Get total record count for music in db |
|
686 |
* @param aDrive, specifies drive number for db selection |
|
687 |
* @return count |
|
688 |
*/ |
|
689 |
TUint GetMusicCountL(TInt aDrive); |
|
690 |
||
691 |
/** |
|
692 |
* Get total record count for playlists in db |
|
693 |
* @param aDrive, specifies drive number for db selection |
|
694 |
* @return count |
|
695 |
*/ |
|
696 |
TUint GetPlaylistCountL(TInt aDrive); |
|
697 |
||
698 |
/** |
|
699 |
* Get total record count for music and playlists in db |
|
700 |
* @param aDrive, specifies drive number for db selection |
|
701 |
* @return count |
|
702 |
*/ |
|
703 |
TUint GetTotalCountL(TInt aDrive); |
|
704 |
||
705 |
/** |
|
706 |
* Get URIs for a given amount of songs |
|
707 |
* @param aDrive, specifies drive number for db selection |
|
708 |
* @param aFromID, specifies unique ID of last record retrieved |
|
709 |
* @param aRecords, specifies the number of records to get |
|
710 |
* @param aUriArr, will contain all URIs on return |
|
711 |
* @param aLastID, will contain unique ID of a last record in the array |
|
712 |
*/ |
|
713 |
void GetMusicUriArrayL(TInt aDrive, TInt aFromID, TInt aRecords, |
|
714 |
CDesCArray& aUriArr, TInt& aLastID); |
|
715 |
||
716 |
/** |
|
717 |
* Get URIs for a given amount of playlists |
|
718 |
* @param aDrive, specifies drive number for db selection |
|
719 |
* @param aFromID, specifies unique ID of last record retrieved |
|
720 |
* @param aRecords, specifies the number of records to get |
|
721 |
* @param aUriArr, will contain all URIs on return |
|
722 |
* @param aLastID, will contain unique ID of a last record in the array |
|
723 |
*/ |
|
724 |
void GetPlaylistUriArrayL(TInt aDrive, TInt aFromID, TInt aRecords, |
|
725 |
CDesCArray& aUriArr, TInt& aLastID); |
|
726 |
||
727 |
/** |
|
728 |
* Starts a transaction on all open databases. |
|
729 |
*/ |
|
730 |
void BeginTransactionL(); |
|
731 |
||
732 |
/** |
|
733 |
* Commits or rolls back a transaction. |
|
734 |
* @param aError if error then rolls back the transaction and leaves |
|
735 |
* if KErrNone it commits the transaction |
|
736 |
*/ |
|
737 |
void EndTransactionL(TInt aError); |
|
738 |
||
739 |
/** |
|
740 |
* Checks if the database is currently in a transaction. |
|
741 |
* |
|
742 |
* @return ETrue if database is currently in a transaction, EFalse otherwise |
|
743 |
*/ |
|
744 |
TBool InTransaction(); |
|
745 |
||
746 |
/** |
|
747 |
* Notifies the handler that the collection will be closed. |
|
748 |
* It is called before closing the collection. |
|
749 |
*/ |
|
750 |
void PreCloseCollectionL(); |
|
751 |
||
752 |
/** |
|
753 |
* Checks if the spefified drive is a remove drive |
|
754 |
*/ |
|
755 |
TBool IsRemoteDrive(TDriveNumber aDrive); |
|
756 |
||
757 |
/** |
|
758 |
* Checks if there is a drive that has a low disk space |
|
759 |
* @leave KErrDiskFull if the space on one of the drives is below the |
|
760 |
* critical level |
|
761 |
*/ |
|
762 |
void CheckDiskSpaceOnDrivesL(); |
|
763 |
||
764 |
private: |
|
765 |
||
766 |
/** |
|
767 |
* Add a song to the music collection database |
|
768 |
* @param aMedia: media object which contains file path, |
|
769 |
* artist, composer, name(title), track, etc... |
|
770 |
* @param aMessage change event message to notify client of the changes |
|
771 |
* @return Id of the song added |
|
772 |
* @leave KErrArgument if the media doe snot include the song URI |
|
773 |
*/ |
|
774 |
TUint32 DoAddSongL(const CMPXMedia& aMedia, CMPXMessageArray* aMessageArray); |
|
775 |
||
776 |
/** |
|
777 |
* Add a playlist to the collection |
|
778 |
* @param aMedia playlist media object with title and URI of the playlist. |
|
779 |
* @return ID of the playlist created |
|
780 |
*/ |
|
781 |
TUint32 DoAddPlaylistL(const CMPXMedia& aMedia); |
|
782 |
||
783 |
/** |
|
784 |
* Add songs to the specified playlist |
|
785 |
* @param aMedia playlist media object with playlist Id. |
|
786 |
* @return playlist Id of the playlist |
|
787 |
*/ |
|
788 |
TUint32 DoAddSongToPlaylistL(const CMPXMedia& aMedia); |
|
789 |
||
790 |
/** |
|
791 |
* Update song info for a song in the music collection database |
|
792 |
* @param aMedia songDetails object which contains file path, |
|
793 |
* artist, composer, name(title), track, etc... |
|
794 |
* @param aItemChangedMessages a list of items changed |
|
795 |
* @return ETrue if UI visible change |
|
796 |
* @leave KErrNotSupported if the song ID could not be constructed |
|
797 |
*/ |
|
798 |
CMPXDbActiveTask::TChangeVisibility DoUpdateSongL(const CMPXMedia& aMedia, |
|
799 |
CMPXMessageArray& aItemChangedMessages); |
|
800 |
||
801 |
/** |
|
802 |
* Update playlist info in the music collection database |
|
803 |
* @param aMedia playlist details object which contains file path, |
|
804 |
* timestamps etc... |
|
805 |
* @param aMessage change event message for the playlist update |
|
806 |
*/ |
|
807 |
void DoUpdatePlaylistL(const CMPXMedia& aMedia, CMPXMessageArray& aMessageArray); |
|
808 |
||
809 |
/** |
|
810 |
* Replace all songs for a playlist. This method is called when harvester |
|
811 |
* scans an updated playlist. This will also be called if MTP wants to |
|
812 |
* replace the contents of an existing playlist. The implementation deleted the |
|
813 |
* existing songs first and then inserts the new ones. |
|
814 |
* @param aMedia playlist and songs details object which contains file path, |
|
815 |
* timestamps etc... |
|
816 |
* @param aMessage change event message for the playlist update |
|
817 |
*/ |
|
818 |
void DoUpdatePlaylistSongsL(const CMPXMedia& aMedia, CMPXMessage& aMessage); |
|
819 |
||
820 |
/** |
|
821 |
* Reorder the specified song in the specified playlist |
|
822 |
* @param aPlaylistId id of the playlist which contains the song to be reordered |
|
823 |
* @param aSongId id of the song to be reordered |
|
824 |
* @param aOriginalOrdinal the original ordinal of the song within the playlist. |
|
825 |
* Ordinal starts from 0. |
|
826 |
* @param aNewOrdinal the new ordinal of the song within the playlist. Ordinal |
|
827 |
* starts from 0. |
|
828 |
* @param aMessage change event message for the playlist update |
|
829 |
*/ |
|
830 |
void DoReorderPlaylistL(const TMPXItemId& aPlaylistId, const TMPXItemId& aSongId, |
|
831 |
TUint aOriginalOrdinal, TUint aNewOrdinal, CMPXMessage& aMessage); |
|
832 |
||
833 |
/** |
|
834 |
* Deletes a song. In addition to deleting the song record from the music |
|
835 |
* table takes care of updating the category and playlist tables. |
|
836 |
* @param aSongId song to be deleted |
|
837 |
* @param aUriArray on return contains the URIs of the song deleted. |
|
838 |
* @param aItemChangedMessages on return contains changed messages for all |
|
839 |
* affected items |
|
840 |
* @param aDeleteRecord ETrue if the record is to be deleted, EFalse if it is |
|
841 |
* to be marked as deleted. |
|
842 |
*/ |
|
843 |
void DoRemoveSongL(TUint32 aSongId, CDesCArray& aUriArray, |
|
844 |
CMPXMessageArray& aItemChangedMessages, TBool aDeleteRecord); |
|
845 |
||
846 |
/** |
|
847 |
* Deletes the song from the playlist tables |
|
848 |
* @param aSongId song to be deleted |
|
849 |
* @param aItemChangedMessages on return contains changed messages for all |
|
850 |
* affected items |
|
851 |
*/ |
|
852 |
void DoRemoveSongFromPlaylistL(TUint32 aSongId,CMPXMessageArray& aItemChangedMessages); |
|
853 |
||
854 |
/** |
|
855 |
* Deletes all the songs for a given category. The implementation uses |
|
856 |
* DoRemoveSongL for the business logic. |
|
857 |
* @param aCategory category type (artist/album/genre/composer) |
|
858 |
* @param aCategoryId identifies the category item |
|
859 |
* @param aUriArray on return contains the URIs of the songs deleted. |
|
860 |
* @param aItemChangedMessages on return contains changed messages for all |
|
861 |
* affected items |
|
862 |
* @leave KErrNotSupported if invalid category |
|
863 |
*/ |
|
864 |
void DoRemoveSongsMatchingCategoryL(TMPXGeneralCategory aCategory, |
|
865 |
TUint32 aCategoryId, CDesCArray& aUriArray, |
|
866 |
CMPXMessageArray& aItemChangedMessages); |
|
867 |
||
868 |
/** |
|
869 |
* Deletes all the songs for a given artist and album. |
|
870 |
* The implementation uses DoRemoveSongL for the business logic. |
|
871 |
* @param aArtistId identifies the artist |
|
872 |
* @param aAlbumId identifies the album |
|
873 |
* @param aUriArray on return contains the URIs of the songs deleted. |
|
874 |
* @param aItemChangedMessages on return contains changed messages for all affected items |
|
875 |
*/ |
|
876 |
void DoRemoveSongsMatchingArtistAndAlbumL(TUint32 aArtistId, TUint32 aAlbumId, |
|
877 |
CDesCArray& aUriArray, CMPXMessageArray& aItemChangedMessages); |
|
878 |
||
879 |
/** |
|
880 |
* Deletes all the playlists in all databases. Note that the songs are not affected. |
|
881 |
*/ |
|
882 |
void DoRemoveAllPlaylistsL(); |
|
883 |
||
884 |
/** |
|
885 |
* Deletes a specified playlist. |
|
886 |
* @param aPlaylistId the playlist to be deleted. |
|
887 |
* @param aUriArray on return contains the URIs of the items deleted. |
|
888 |
* @param aItemChangedMessages on return contains changed messages for all |
|
889 |
* affected items |
|
890 |
*/ |
|
891 |
void DoRemovePlaylistL(TUint32 aPlaylistId, CDesCArray& aUriArray, |
|
892 |
CMPXMessageArray& aItemChangedMessages); |
|
893 |
||
894 |
||
895 |
/** |
|
896 |
* Deletes a song from a playlist. |
|
897 |
* @param aPlaylistId identifies the playlist. |
|
898 |
* @param aSongId song to be deleted. |
|
899 |
* @param aOrdinal song ordinal in case there are multiple instances of the same |
|
900 |
* song in the playlist. |
|
901 |
* @param aItemChangedMessages on return contains changed messages for all |
|
902 |
* affected items |
|
903 |
*/ |
|
904 |
void DoRemoveSongFromPlaylistL(TUint32 aPlaylistId, const TMPXItemId& aSongId, |
|
905 |
TInt aOrdinal, CMPXMessageArray& aItemChangedMessages); |
|
906 |
||
907 |
||
908 |
||
909 |
/** |
|
910 |
* Deletes all song records marked as deleted. |
|
911 |
*/ |
|
912 |
void DoCleanupDeletedRecordsL(); |
|
913 |
||
914 |
/** |
|
915 |
* Find items in the collection |
|
916 |
* @param aCriteria selection criteria |
|
917 |
* @param aAttrs attributes for the matching media |
|
918 |
* @param aMediaArray returns the matching entries |
|
919 |
*/ |
|
920 |
void FindAllL(const CMPXMedia& aCriteria, const TArray<TMPXAttribute>& aAttrs, |
|
921 |
CMPXMediaArray* aMediaArray); |
|
922 |
||
923 |
/** |
|
924 |
* Find a song. |
|
925 |
* @param aCriteria selection criteria |
|
926 |
* @param aAttrs attributes for the matching media |
|
927 |
* @param aMediaArray returns the matching entries |
|
928 |
*/ |
|
929 |
void FindSongL(const CMPXMedia& aCriteria, const TArray<TMPXAttribute>& aAttrs, |
|
930 |
CMPXMediaArray& aMediaArray); |
|
931 |
||
932 |
/** |
|
933 |
* Gets the songs for a specified playlist |
|
934 |
* @param aPlaylistId identifies the playlist |
|
935 |
* @param aAttrs attributes to be returned |
|
936 |
* @param aMediaArray returns the matching entries |
|
937 |
*/ |
|
938 |
void GetPlaylistSongsL(TUint32 aPlaylistId, const TArray<TMPXAttribute>& aAttrs, |
|
939 |
CMPXMediaArray& aMediaArray); |
|
940 |
||
941 |
/** |
|
942 |
* Find an album |
|
943 |
* @param aCriteria selection criteria |
|
944 |
* @param aAttrs attributes to be returned |
|
945 |
* @param aMediaArray returns the matching entries |
|
946 |
*/ |
|
947 |
void FindAlbumL(const CMPXMedia& aCriteria, const TArray<TMPXAttribute>& aAttrs, |
|
948 |
CMPXMediaArray& aMediaArray); |
|
949 |
||
950 |
/** |
|
951 |
* Extracts the playlist ID and drive ID from the media object. |
|
952 |
* @param aMedia playlist information |
|
953 |
* @param aPlaylistId returns the playlist ID |
|
954 |
* @param aPlaylistDriveId returns the drive ID |
|
955 |
* @leave KErrArgument if the media does not include the ID and URI |
|
956 |
*/ |
|
957 |
void ProcessPlaylistMediaL(CMPXMedia& aMedia, TUint32& aPlaylistId, |
|
958 |
TInt& aPlaylistDriveId); |
|
959 |
||
960 |
/** |
|
961 |
* Updates all the song entries in the playlist media with extra |
|
962 |
* information from the music table. |
|
963 |
* @param aMedia inout, contains the playlist/songs information |
|
964 |
* @leave KErrArgument if the song does not exist in the music table and |
|
965 |
* the media does not include a URI |
|
966 |
*/ |
|
967 |
void UpdatePlaylistSongInfoL(CMPXMedia& aMedia); |
|
968 |
||
969 |
/** |
|
970 |
* Makes sure all the folders specified in the array parameter are created, |
|
971 |
* otherwise it tries to create them. Updates the iDbDrives member variable |
|
972 |
* with the drives corresponding to the folders. |
|
973 |
* @param aFolders contains all the folders to be processed |
|
974 |
*/ |
|
975 |
void ProcessMusicFoldersL(const CDesCArray& aFolders); |
|
976 |
||
977 |
/** |
|
978 |
* Returns the CMPXDbCategory instance associated with the specified |
|
979 |
* category type |
|
980 |
* @param aCategory category type |
|
981 |
* @return corresponding CMPXDbCategory instance |
|
982 |
* @leave KErrNotSupported if invalid category |
|
983 |
*/ |
|
984 |
CMPXDbCategory* DbCategoryL(TMPXGeneralCategory aCategory) const; |
|
985 |
||
986 |
/** |
|
987 |
* Verify the volume id for the databases |
|
988 |
*/ |
|
989 |
void VerifyVolumeIdL( TInt aDrive ); |
|
990 |
void VerifyVolumeIdL(); |
|
991 |
||
992 |
||
993 |
#if defined (__MTP_PROTOCOL_SUPPORT) |
|
994 |
/** |
|
995 |
* Reads the "save deleted records" MTP flag from CenRep and returns |
|
996 |
* the value. |
|
997 |
* @return value of the "save deleted records" MTP flag |
|
998 |
*/ |
|
999 |
TBool SaveDeletedSongs(); |
|
1000 |
#endif |
|
1001 |
||
1002 |
#ifdef RD_MULTIPLE_DRIVE |
|
1003 |
/** |
|
1004 |
* Retrieve all visible music folder locations. |
|
1005 |
*/ |
|
1006 |
CDesCArrayFlat* GetMusicFoldersL(); |
|
1007 |
#endif // RD_MULTIPLE_DRIVE |
|
1008 |
||
1009 |
private: // From MMPXDbMusicObserver |
|
1010 |
||
1011 |
/** |
|
1012 |
* @see MMPXDbMusicObserver |
|
1013 |
*/ |
|
27
2cbbefa9af78
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
1014 |
#ifdef ABSTRACTAUDIOALBUM_INCLUDED |
2cbbefa9af78
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
1015 |
virtual TUint32 AddAbstractAlbumItemL(const TDesC& aName, |
2cbbefa9af78
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
1016 |
TInt aDriveId, CMPXMessageArray* aItemChangedMessages, TBool& aItemExist, |
2cbbefa9af78
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
1017 |
const TDesC& aUri, const TDesC& aAlbumArtist=KNullDesC); |
2cbbefa9af78
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
1018 |
#endif // ABSTRACTAUDIOALBUM_INCLUDED |
2cbbefa9af78
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
1019 |
|
2cbbefa9af78
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
1020 |
virtual TUint32 AddCategoryItemL(TMPXGeneralCategory aCategory, const CMPXMedia& aMedia, |
2cbbefa9af78
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
1021 |
TInt aDrive, CMPXMessageArray* aItemChangedMessages, TBool& aItemExist); |
2cbbefa9af78
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
1022 |
|
2cbbefa9af78
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
1023 |
virtual void UpdateCategoryItemL(TMPXGeneralCategory aCategory, TUint32 aCategoryId, |
2cbbefa9af78
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
1024 |
const CMPXMedia& aMedia, TInt aDrive, CMPXMessageArray* aItemChangedMessages); |
2cbbefa9af78
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
1025 |
|
2cbbefa9af78
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
1026 |
virtual TUint32 GenerateUniqueIdForAlbumL(const CMPXMedia& aMedia); |
2cbbefa9af78
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
1027 |
|
2cbbefa9af78
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
1028 |
virtual TBool IsUnknownAlbumL(const TUint32 aId); |
26 | 1029 |
|
1030 |
/** |
|
1031 |
* @see MMPXDbMusicObserver |
|
1032 |
*/ |
|
27
2cbbefa9af78
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
1033 |
virtual void DeleteSongForCategoryL(TMPXGeneralCategory aCategory, TUint32 aCategoryId, |
2cbbefa9af78
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
1034 |
TInt aDrive, CMPXMessageArray* aItemChangedMessages, TBool& aItemExist, const TDesC& aArt = KNullDesC); |
26 | 1035 |
|
1036 |
/** |
|
1037 |
* @see MMPXDbMusicObserver |
|
1038 |
*/ |
|
1039 |
virtual void HandlePlayCountModifiedL(CMPXMessageArray& aItemChangedMessages); |
|
1040 |
||
1041 |
/** |
|
1042 |
* @see MMPXDbMusicObserver |
|
1043 |
*/ |
|
1044 |
virtual void HandlePlaybackTimeModifiedL(CMPXMessageArray& aItemChangedMessages); |
|
1045 |
#ifdef ABSTRACTAUDIOALBUM_INCLUDED |
|
1046 |
/** |
|
1047 |
* @see MMPXDbMusicObserver |
|
1048 |
*/ |
|
1049 |
virtual HBufC* HandleGetAlbumNameFromIdL(TUint32 aId); |
|
1050 |
#endif // ABSTRACTAUDIOALBUM_INCLUDED |
|
27
2cbbefa9af78
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
1051 |
|
2cbbefa9af78
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
1052 |
private: // From MMPXDbAlbumObserver |
2cbbefa9af78
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
1053 |
/** |
2cbbefa9af78
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
1054 |
* Get the Albumart of song which belongs to the specified Album. |
2cbbefa9af78
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
1055 |
* @param aId, The Album ID. |
2cbbefa9af78
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
1056 |
* @param aArt, the AlbumArt uri. |
2cbbefa9af78
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
1057 |
* @returns alternative albumart retrieved in the specified Album. |
2cbbefa9af78
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
1058 |
*/ |
2cbbefa9af78
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
1059 |
virtual HBufC* HandleAlbumartForAlbumL(const TUint32 aAlbumId, TPtrC aArt); |
2cbbefa9af78
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
1060 |
|
2cbbefa9af78
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
1061 |
/** |
2cbbefa9af78
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
1062 |
* @see MMPXDbAlbumObserver |
2cbbefa9af78
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
1063 |
*/ |
2cbbefa9af78
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
1064 |
virtual void DeleteAlbumForArtistL(TUint32 aCategoryId, |
2cbbefa9af78
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
1065 |
TInt aDrive, CMPXMessageArray* aItemChangedMessages); |
26 | 1066 |
|
27
2cbbefa9af78
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
1067 |
/** |
2cbbefa9af78
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
1068 |
* @see MMPXDbAlbumObserver |
2cbbefa9af78
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
1069 |
*/ |
2cbbefa9af78
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
1070 |
virtual TUint32 AddAlbumArtistL(const TDesC& aName, const TDesC& aArt, TInt aDriveId); |
26 | 1071 |
|
1072 |
private: // From MMPXDbPlaylistObserver |
|
27
2cbbefa9af78
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
1073 |
/** |
2cbbefa9af78
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
1074 |
* @see MMPXDbPlaylistObserver |
2cbbefa9af78
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
26
diff
changeset
|
1075 |
*/ |
26 | 1076 |
virtual TInt HandlePlaylistDurationL(TUint32 aPlaylistId); |
1077 |
virtual void HandlePlaylistInfoL(TUint32 aPlaylistId, TInt& aCount, TInt& aDuration); |
|
1078 |
||
1079 |
private: |
|
1080 |
/** |
|
1081 |
* C++ constructor. |
|
1082 |
* @param file session |
|
1083 |
*/ |
|
1084 |
CMPXDbHandler(RFs& aFs, CMPXResource& aResource); |
|
1085 |
||
1086 |
/** |
|
1087 |
* Symbian 2nd phase constructor.. |
|
1088 |
*/ |
|
1089 |
void ConstructL(); |
|
1090 |
||
1091 |
private: // Data |
|
1092 |
||
1093 |
// owned member variables |
|
1094 |
CMPXCollectionDbManager* iDbManager; |
|
1095 |
CMPXDbMusic* iDbMusic; |
|
1096 |
CMPXDbPlaylist* iDbPlaylist; |
|
1097 |
#ifdef ABSTRACTAUDIOALBUM_INCLUDED |
|
1098 |
CMPXDbAbstractAlbum* iDbAbstractAlbum; |
|
1099 |
#endif // ABSTRACTAUDIOALBUM_INCLUDED |
|
1100 |
CMPXDbArtist* iDbArtist; |
|
1101 |
CMPXDbAlbum* iDbAlbum; |
|
1102 |
CMPXDbGenre* iDbGenre; |
|
1103 |
CMPXDbComposer* iDbComposer; |
|
1104 |
CMPXDbAuxiliary* iDbAuxiliary; |
|
1105 |
||
1106 |
CMPXDbAutoPlaylist* iAutoPlaylist; |
|
1107 |
||
1108 |
CDesCArrayFlat* iMimeTypes; // MIME types supported |
|
1109 |
CDesCArrayFlat* iExtensions; // file extensions supported |
|
1110 |
CDesCArrayFlat* iExtensionsMime; // file extensions to check MIME |
|
1111 |
CDesCArrayFlat* iExtensionsDrm; // file extensions to check DRM type |
|
1112 |
RArray<TInt> iDbDrives; |
|
1113 |
||
1114 |
// not owned member variables |
|
1115 |
RFs& iFs; |
|
1116 |
CMPXResource& iResource; |
|
1117 |
TBool iOutOfDisk; // Are we in out of disk mode? |
|
1118 |
TBool iRefresh; // Refresh operation currently performed |
|
1119 |
TBool iMtpInUse; // Flag for MTP operation |
|
1120 |
TInt iOpOnDbCount; // Count to provide a min op amount in one transaction |
|
1121 |
}; |
|
1122 |
||
1123 |
#endif // MPXDBHANDLER_H |
|
1124 |
||
1125 |
// End of File |