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