diff -r c54d95799c80 -r a1247965635c mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/inc/mpxdbabstractalbum.h --- a/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/inc/mpxdbabstractalbum.h Wed Apr 14 15:54:18 2010 +0300 +++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/inc/mpxdbabstractalbum.h Tue Apr 27 16:34:37 2010 +0300 @@ -50,7 +50,7 @@ * @return New CMPXDbCategory instance. */ static CMPXDbAbstractAlbum* NewL(CMPXDbManager& aDbManager, - TMPXGeneralCategory aCategory); + TMPXGeneralCategory aCategory, RFs& aFs); /** * Two-phased constructor. @@ -59,7 +59,7 @@ * @return New CMPXDbCategory instance on the cleanup stack. */ static CMPXDbAbstractAlbum* NewLC(CMPXDbManager& aDbManager, - TMPXGeneralCategory aCategory); + TMPXGeneralCategory aCategory, RFs& aFs); /** * Destructor @@ -84,9 +84,17 @@ * into consideration when generating the unique row id * @return The unique id of the row added. */ - TUint32 AddItemL( const TDesC& aName, const TDesC& aAlbumArtist, const TDesC& aGenre, TInt aDriveId, TBool& aNewRecord, - TBool aCaseSensitive = ETrue); - + TUint32 AddItemL( const TDesC& aUri, const TDesC& aName, const TDesC& aAlbumArtist, TInt aDriveId, TBool& aNewRecord, + TBool aCaseSensitive = EFalse); + + /** + * Add existing item to table with same entry fields values except new Uri. + * @param aOldId: existing item Id + * @param newUri: new Uri + * @return The unique id of the row added. + */ + TUint32 AddUpdatedItemL(TUint32 aOldId, const TDesC& newUri); + /** * Decrement the number of songs for the item. If the count gets to 0, remove * the item. @@ -103,13 +111,17 @@ */ void DecrementSongsForCategoryL(TUint32 aId, TInt aDriveId, CMPXMessageArray* aItemChangedMessages, TBool& aItemExist, TBool aMtpInUse); - + /** - * Remove a abstractalbum and return its URI - * @param aAbstractAlbumId identifies the abstractalbum - * @return HBufC containing the URI. Ownership is transferred. + * Remove a abstractalbum, remove entry from AbstractAlbum table, + * Thumbnail table, corresponding alb from file system + * @param aAbstractAlbumId ID of the abstractalbum to remove + * @param aItemChangedMessages a list of change events as a result of the + * abstractalbum removal + * @param aFileDeleted indicate if alb file already deleted from file system */ - HBufC* DeleteAbstractAlbumL(TUint32 aAbstractAlbumId, TInt aDriveId = 0); + void RemoveAbstractAlbumL(TUint32 aAbstractalbumId, + CMPXMessageArray& aItemChangedMessages, TBool aFileDeleted); /** * Update a category item. @@ -120,6 +132,29 @@ * category was updated */ void UpdateItemL(TUint32 aId, const CMPXMedia& aMedia, TInt aDriveId, CMPXMessageArray* aItemChangedMessages); + + /** + * Delete or Rename Thumbnail from TN DB by calling Thumbnail manager + * Rename Thumbnail if aNewPath is not NULL, otherwise Delete Thumbnail + * @param aOldPath: old Uri + * @param aNewPath: new Uri + * @param aPriority: priority pass to Thumbnail manager + */ + void HandleTNL( const TDesC& aOldPath, const TDesC& aNewPath = KNullDesC, TInt aPriority =0 ); + + /** + * Get the uri field for a given ID. + * @param aId identifies the abstractalbum item + * @return uri that matches aId. Ownership is abandoned. + */ + HBufC* GetUriL(TUint32 aId); + + /** + * Get Ids of albstractalbum with no song associated. + * Rename Thumbnail if aNewPath is not NULL, otherwise Delete Thumbnail + * @param aItemsIds: array of Ids for abstractalbums which have no song associated. + */ + void GetAllItemsWithNoSongL(RArray& aItemsIds); private: @@ -142,35 +177,37 @@ */ void GenerateAbstractAlbumFieldsValuesL(const CMPXMedia& aMedia, CDesCArray& aFields, CDesCArray& aValues); - + + /** + * Remove a abstractalbum from AbstractAlbum table + * @param aAbstractAlbumId identifies the abstractalbum + * @param aDriveId drive Id + */ + void DeleteAbstractAlbumEntryL(TUint32 aAbstractAlbumId, TInt aDriveId = 0); + /** * @see MMPXTable */ virtual void CreateTableL(RSqlDatabase& aDatabase, TBool aCorruptTable); - - /** * @see MMPXTable */ virtual TBool CheckTableL(RSqlDatabase& aDatabase); - - - + /** * C++ constructor. * @param aDbManager database manager to use for database interactions * @param aCategory identifies the category */ - CMPXDbAbstractAlbum(CMPXDbManager& aDbManager, TMPXGeneralCategory aCategory); + CMPXDbAbstractAlbum(CMPXDbManager& aDbManager, TMPXGeneralCategory aCategory, RFs& aFs); /** * Second phase constructor. */ void ConstructL(); - - + /** * MThumbnailManagerObserver */ @@ -180,7 +217,7 @@ * MThumbnailManagerObserver */ void ThumbnailReady( - TInt aError, + TInt aError, MThumbnailData& aThumbnail, TThumbnailRequestId aId ); public: @@ -191,9 +228,9 @@ enum TAbstractAlbumColumns { EAbstractAlbumUniqueId = KMPXTableDefaultIndex, + EAbstractAlbumUri, EAbstractAlbumName, EAbstractAlbumArtist, - EAbstractAlbumGenre, EAbstractAlbumSongCount, EAbstractAlbumVolumeId, EAbstractAlbumFieldCount @@ -201,6 +238,8 @@ private: // Data CThumbnailManager* iTNManager; + TBool iRenameTN; + RFs& iFs; }; #endif // MPXDBAbstractAlbum_H