mpserviceplugins/mpxsqlitedbhgplugin/inc/mpxdbhandler.h
changeset 34 2c5162224003
parent 22 ecf06a08d4d9
child 29 8192e5b5c935
equal deleted inserted replaced
22:ecf06a08d4d9 34:2c5162224003
   108         *           artist, composer, name(title), track, etc...
   108         *           artist, composer, name(title), track, etc...
   109         * @param aMessageArray change event message to notify client of the changes
   109         * @param aMessageArray change event message to notify client of the changes
   110         * @return TUint32 id of the item added
   110         * @return TUint32 id of the item added
   111         */
   111         */
   112         TUint32 AddSongWithNoTransactionL(const CMPXMedia& aMedia, CMPXMessageArray* aMessageArray=NULL);
   112         TUint32 AddSongWithNoTransactionL(const CMPXMedia& aMedia, CMPXMessageArray* aMessageArray=NULL);
   113         
   113 
   114         /**
   114         /**
   115         * Add a playlist to the collection
   115         * Add a playlist to the collection
   116         * @param aMedia playlist media object with title and URI of the playlist.
   116         * @param aMedia playlist media object with title and URI of the playlist.
   117         * @return playlist Id of the playlist created
   117         * @return playlist Id of the playlist created
   118         */
   118         */
   122         * Add songs to the specified playlist
   122         * Add songs to the specified playlist
   123         * @param aMedia playlist media object with playlist Id.
   123         * @param aMedia playlist media object with playlist Id.
   124         * @return playlist Id of the playlist
   124         * @return playlist Id of the playlist
   125         */
   125         */
   126         TUint32 AddSongToPlaylistL(const CMPXMedia& aMedia);
   126         TUint32 AddSongToPlaylistL(const CMPXMedia& aMedia);
   127 #ifdef ABSTRACTAUDIOALBUM_INCLUDED        
   127 #ifdef ABSTRACTAUDIOALBUM_INCLUDED
   128         /**
   128         /**
   129         * Add an abstractalbum to the collection
   129         * Add an abstractalbum to the collection
   130         * @param aMedia abstractalbum media object with URI of the abstractalbum.
   130         * @param aMedia abstractalbum media object with URI of the abstractalbum.
       
   131         * @param aMessageArray change event message to notify client of the changes
   131         * @return abstractalbum Id of the abstractalbum created
   132         * @return abstractalbum Id of the abstractalbum created
   132         */  
   133         */
   133         TUint32 AddAbstractAlbumL(const CMPXMedia& aMedia, CMPXMessageArray* aMessageArray=NULL);
   134         TUint32 AddAbstractAlbumL(const CMPXMedia& aMedia, CMPXMessageArray* aMessageArray=NULL);
   134 #endif // ABSTRACTAUDIOALBUM_INCLUDED
   135 #endif // ABSTRACTAUDIOALBUM_INCLUDED
   135         /**
   136         /**
   136         * Update song info for a song in the music collection database
   137         * Update song info for a song in the music collection database
   137         * @param aMedia songDetails object  which contains file path,
   138         * @param aMedia songDetails object  which contains file path,
   140         *           song update
   141         *           song update
   141         * @return ETrue if UI visible change else EFalse
   142         * @return ETrue if UI visible change else EFalse
   142         */
   143         */
   143         CMPXDbActiveTask::TChangeVisibility UpdateSongL(const CMPXMedia& aMedia,
   144         CMPXDbActiveTask::TChangeVisibility UpdateSongL(const CMPXMedia& aMedia,
   144             CMPXMessageArray& aItemChangedMessages);
   145             CMPXMessageArray& aItemChangedMessages);
   145 #ifdef ABSTRACTAUDIOALBUM_INCLUDED        
   146 #ifdef ABSTRACTAUDIOALBUM_INCLUDED
   146         /**
   147         /**
   147         * Update songs info for songs associated with abstractalbum
   148         * Update abstractalbum info to AbstractAlbum table and Songs associated with abstractalbum
   148         *           in the music collection database
   149         *           in the music collection database
   149         * @param aMedia songDetails object  which contains file path,
   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,
   150         *           artist, composer, name(title), track, etc...
   162         *           artist, composer, name(title), track, etc...
   151         * @param aItemChangedMessages a list of change events as a result of the
   163         * @param aItemChangedMessages a list of change events as a result of the
   152         *           song update
   164         *           song update
   153         * @return ETrue if UI visible change else EFalse
   165         * @return ETrue if UI visible change else EFalse
   154         */       
   166         */
   155         CMPXDbActiveTask::TChangeVisibility UpdateAbstractAlbumSongsL(const CMPXMedia& aMedia,
   167         CMPXDbActiveTask::TChangeVisibility UpdateSongsAbstractAlbumInfoL(const CMPXMedia& aMedia,
   156             CMPXMessageArray& aItemChangedMessages);
   168             CMPXMessageArray& aItemChangedMessages);
   157 #endif // ABSTRACTAUDIOALBUM_INCLUDED      
   169 #endif // ABSTRACTAUDIOALBUM_INCLUDED
   158         /**
   170         /**
   159         * Update playlist info in the music collection database
   171         * Update playlist info in the music collection database
   160         * @param aMedia playlist details object which contains file path,
   172         * @param aMedia playlist details object which contains file path,
   161         *           timestamps etc.
   173         *           timestamps etc.
   162         * @param aMessageArray change event messages for the playlist update
   174         * @param aMessageArray change event messages for the playlist update
   239         */
   251         */
   240         void RemovePlaylistL(TUint32 aPlaylistId, CDesCArray& aUriArray,
   252         void RemovePlaylistL(TUint32 aPlaylistId, CDesCArray& aUriArray,
   241             CMPXMessageArray& aItemChangedMessages);
   253             CMPXMessageArray& aItemChangedMessages);
   242 #ifdef ABSTRACTAUDIOALBUM_INCLUDED
   254 #ifdef ABSTRACTAUDIOALBUM_INCLUDED
   243         /**
   255         /**
   244         * Remove a abstractalbum This will remove all the songs from the abstractalbum
   256         * Remove a abstractalbum, remove entry from AbstractAlbum table, 
       
   257         * Thumbnail table, corresponding alb from file system
   245         * @param aAbstractAlbumId ID of the abstractalbum to remove
   258         * @param aAbstractAlbumId ID of the abstractalbum to remove
   246         * @param aUriArray a descriptor array to contain the URI of the deleted file
       
   247         * @param aItemChangedMessages a list of change events as a result of the
   259         * @param aItemChangedMessages a list of change events as a result of the
   248         *        abstractalbum removal
   260         *        abstractalbum removal
   249         */
   261         * @param aFileDeleted indicate if alb file already deleted from file system
   250         void RemoveAbstractAlbumL(TUint32 aAbstractAlbumId, CDesCArray& aUriArray,
   262         */
   251             CMPXMessageArray& aItemChangedMessages);
   263         void RemoveAbstractAlbumL(TUint32 aAbstractAlbumId,
   252 #endif // ABSTRACTAUDIOALBUM_INCLUDED         
   264             CMPXMessageArray& aItemChangedMessages, TBool aFileDeleted); 
       
   265 #endif // ABSTRACTAUDIOALBUM_INCLUDED
   253 
   266 
   254         /**
   267         /**
   255         * Remove a song from the specified playlist.
   268         * Remove a song from the specified playlist.
   256         * @param aPlaylistId ID of the playlist to remove the song from
   269         * @param aPlaylistId ID of the playlist to remove the song from
   257         * @param aSongId Id of the song in the playlist to be removed
   270         * @param aSongId Id of the song in the playlist to be removed
   657 
   670 
   658         /**
   671         /**
   659         * Ends a refresh operation.
   672         * Ends a refresh operation.
   660         */
   673         */
   661         void RefreshEndL();
   674         void RefreshEndL();
   662         
   675 
   663         /**
   676         /**
   664         * Notification of mtp start
   677         * Notification of mtp start
   665         */
   678         */
   666         void MtpStartL();
   679         void MtpStartL();
   667 
   680 
   735          * Notifies the handler that the collection will be closed.
   748          * Notifies the handler that the collection will be closed.
   736          * It is called before closing the collection.
   749          * It is called before closing the collection.
   737          */
   750          */
   738         void PreCloseCollectionL();
   751         void PreCloseCollectionL();
   739 
   752 
   740         /**
       
   741          * Notifies the handler that the collection was closed.
       
   742          */
       
   743          void CollectionClosed();
       
   744 
       
   745          /**
       
   746          * Notifies the handler that the collection was opened.
       
   747          */
       
   748          void CollectionOpenedL();
       
   749          
       
   750          /**
   753          /**
   751           * Checks if the spefified drive is a remove drive
   754           * Checks if the spefified drive is a remove drive
   752           */      
   755           */
   753          TBool IsRemoteDrive(TDriveNumber aDrive);
   756          TBool IsRemoteDrive(TDriveNumber aDrive);
   754          
   757 
   755          /**
   758          /**
   756           * Checks if there is a drive that has a low disk space
   759           * Checks if there is a drive that has a low disk space
   757           * @leave KErrDiskFull if the space on one of the drives is below the
   760           * @leave KErrDiskFull if the space on one of the drives is below the
   758           *         critical level
   761           *         critical level
   759           */
   762           */
   886         * @param aItemChangedMessages on return contains changed messages for all
   889         * @param aItemChangedMessages on return contains changed messages for all
   887         *        affected items
   890         *        affected items
   888         */
   891         */
   889         void DoRemovePlaylistL(TUint32 aPlaylistId, CDesCArray& aUriArray,
   892         void DoRemovePlaylistL(TUint32 aPlaylistId, CDesCArray& aUriArray,
   890             CMPXMessageArray& aItemChangedMessages);
   893             CMPXMessageArray& aItemChangedMessages);
   891 #ifdef ABSTRACTAUDIOALBUM_INCLUDED        
   894 
   892         /**
   895 
   893         * Deletes a specified abstractalbum.
       
   894         * @param aAbstractAlbumId the abstractalbum to be deleted.
       
   895         * @param aUriArray on return contains the URIs of the items deleted.
       
   896         * @param aItemChangedMessages on return contains changed messages for all
       
   897         *        affected items
       
   898         */
       
   899         void DoRemoveAbstractAlbumL(TUint32 aAbstractalbumId, CDesCArray& aUriArray,
       
   900             CMPXMessageArray& aItemChangedMessages);
       
   901 #endif // ABSTRACTAUDIOALBUM_INCLUDED
       
   902         /**
   896         /**
   903         * Deletes a song from a playlist.
   897         * Deletes a song from a playlist.
   904         * @param aPlaylistId identifies the playlist.
   898         * @param aPlaylistId identifies the playlist.
   905         * @param aSongId song to be deleted.
   899         * @param aSongId song to be deleted.
   906         * @param aOrdinal song ordinal in case there are multiple instances of the same
   900         * @param aOrdinal song ordinal in case there are multiple instances of the same
   909         *        affected items
   903         *        affected items
   910         */
   904         */
   911         void DoRemoveSongFromPlaylistL(TUint32 aPlaylistId, const TMPXItemId& aSongId,
   905         void DoRemoveSongFromPlaylistL(TUint32 aPlaylistId, const TMPXItemId& aSongId,
   912             TInt aOrdinal, CMPXMessageArray& aItemChangedMessages);
   906             TInt aOrdinal, CMPXMessageArray& aItemChangedMessages);
   913 
   907 
       
   908 #ifdef ABSTRACTAUDIOALBUM_INCLUDED  
       
   909         /**
       
   910         * Remove all abstractalbum items with no songs associated,
       
   911         * TN and .alb files also removed.
       
   912         *
       
   913         */
       
   914         void RemoveAbstractAlbumsWithNoSongL();
       
   915         
       
   916           /**
       
   917         /* When refresh library, Remove .alb entry from AbstractAlnum table, TN table if .alb files deleted 
       
   918         /* from file manager 
       
   919         */
       
   920         void AbstractAlbumCleanUpL();
       
   921        
       
   922 #endif // ABSTRACTAUDIOALBUM_INCLUDED
       
   923 
   914         /**
   924         /**
   915         * Deletes all song records marked as deleted.
   925         * Deletes all song records marked as deleted.
   916         */
   926         */
   917         void DoCleanupDeletedRecordsL();
   927         void DoCleanupDeletedRecordsL();
   918 
   928 
  1016 #ifdef ABSTRACTAUDIOALBUM_INCLUDED
  1026 #ifdef ABSTRACTAUDIOALBUM_INCLUDED
  1017         /**
  1027         /**
  1018         * @see MMPXDbMusicObserver
  1028         * @see MMPXDbMusicObserver
  1019         */
  1029         */
  1020         virtual TUint32 AddCategoryItemL(TMPXGeneralCategory aCategory,
  1030         virtual TUint32 AddCategoryItemL(TMPXGeneralCategory aCategory,
  1021             const TDesC& aName, TInt aDriveId,
  1031             const TDesC& aName,
       
  1032             TInt aDriveId,
  1022             CMPXMessageArray* aItemChangedMessages, TBool& aItemExist,
  1033             CMPXMessageArray* aItemChangedMessages, TBool& aItemExist,
  1023             const TDesC& aAlbumArtist=KNullDesC,
  1034             const TDesC& aUri,
  1024             const TDesC& aGenre=KNullDesC);
  1035             const TDesC& aAlbumArtist=KNullDesC);
  1025 #else
  1036 #else
  1026 
  1037 
  1027         /**
  1038         /**
  1028         * @see MMPXDbMusicObserver
  1039         * @see MMPXDbMusicObserver
  1029         */
  1040         */
  1030         virtual TUint32 AddCategoryItemL(TMPXGeneralCategory aCategory,
  1041         virtual TUint32 AddCategoryItemL(TMPXGeneralCategory aCategory,
  1031             const TDesC& aName, TInt aDriveId,
  1042             const TDesC& aName, TInt aDriveId,
  1032             CMPXMessageArray* aItemChangedMessages, TBool& aItemExist);
  1043             CMPXMessageArray* aItemChangedMessages, TBool& aItemExist);
  1033 #endif // ABSTRACTAUDIOALBUM_INCLUDED
  1044 #endif // ABSTRACTAUDIOALBUM_INCLUDED
  1034 
  1045 
  1035 		virtual TUint32 AddCategoryItemL(TMPXGeneralCategory aCategory, const TDesC& aName,
  1046        virtual TUint32 AddCategoryItemL(TMPXGeneralCategory aCategory, const TDesC& aName,
  1036 			TUint32 aArtist, const TDesC& aArt,
  1047             TUint32 aArtist, const TDesC& aArt,
  1037 			TInt aDrive, CMPXMessageArray* aItemChangedMessages, TBool& aItemExist);
  1048             TInt aDrive, CMPXMessageArray* aItemChangedMessages, TBool& aItemExist);
  1038 
  1049 
  1039 		virtual void UpdateCategoryItemL(TMPXGeneralCategory aCategory, TUint32 aCategoryId, 
  1050        virtual void UpdateCategoryItemL(TMPXGeneralCategory aCategory, TUint32 aCategoryId,
  1040 			const CMPXMedia& aMedia, TInt aDrive, CMPXMessageArray* aItemChangedMessages);
  1051             const CMPXMedia& aMedia, TInt aDrive, CMPXMessageArray* aItemChangedMessages);
  1041 			
  1052 
  1042         /**
  1053         /**
  1043         * @see MMPXDbMusicObserver
  1054         * @see MMPXDbMusicObserver
  1044         */
  1055         */
  1045         virtual void DeleteSongForCategoryL(TMPXGeneralCategory aCategory,
  1056         virtual void DeleteSongForCategoryL(TMPXGeneralCategory aCategory,
  1046             TUint32 aCategoryId, TInt aDriveId, CMPXMessageArray* aItemChangedMessages,
  1057             TUint32 aCategoryId, TInt aDriveId, CMPXMessageArray* aItemChangedMessages,
  1053 
  1064 
  1054         /**
  1065         /**
  1055         * @see MMPXDbMusicObserver
  1066         * @see MMPXDbMusicObserver
  1056         */
  1067         */
  1057         virtual void HandlePlaybackTimeModifiedL(CMPXMessageArray& aItemChangedMessages);
  1068         virtual void HandlePlaybackTimeModifiedL(CMPXMessageArray& aItemChangedMessages);
  1058 #ifdef ABSTRACTAUDIOALBUM_INCLUDED      
  1069 #ifdef ABSTRACTAUDIOALBUM_INCLUDED
  1059         /**
  1070         /**
  1060         * @see MMPXDbMusicObserver
  1071         * @see MMPXDbMusicObserver
  1061         */
  1072         */
  1062         virtual HBufC* HandleGetAlbumNameFromIdL(TUint32 aId);
  1073         virtual HBufC* HandleGetAlbumNameFromIdL(TUint32 aId);
  1063 #endif // ABSTRACTAUDIOALBUM_INCLUDED
  1074 #endif // ABSTRACTAUDIOALBUM_INCLUDED
  1071     /**
  1082     /**
  1072     * @see MMPXDbAlbumObserver
  1083     * @see MMPXDbAlbumObserver
  1073     */
  1084     */
  1074         virtual TBool HandleIsUnknownArtistL(TUint32 aArtistId);
  1085         virtual TBool HandleIsUnknownArtistL(TUint32 aArtistId);
  1075         virtual TUint32 HandleArtistForAlbumL(const TUint32 aAlbumId);
  1086         virtual TUint32 HandleArtistForAlbumL(const TUint32 aAlbumId);
  1076         
  1087 
  1077     private:	// From MMPXDbPlaylistObserver
  1088     private:	// From MMPXDbPlaylistObserver
  1078 	/**
  1089 	/**
  1079 	* @see MMPXDbPlaylistObserver
  1090 	* @see MMPXDbPlaylistObserver
  1080 	*/
  1091 	*/
  1081 		virtual TInt HandlePlaylistDurationL(TUint32 aPlaylistId);
  1092 		virtual TInt HandlePlaylistDurationL(TUint32 aPlaylistId);
  1119 
  1130 
  1120         // not owned member variables
  1131         // not owned member variables
  1121         RFs& iFs;
  1132         RFs& iFs;
  1122         CMPXResource& iResource;
  1133         CMPXResource& iResource;
  1123         TBool iOutOfDisk;                   // Are we in out of disk mode?
  1134         TBool iOutOfDisk;                   // Are we in out of disk mode?
  1124         TBool iSynchronizeBasicTable;       // Basic music table was not updated during last refresh
       
  1125         TBool iCollectionOpen;              // Databases opened
       
  1126         TBool iRefresh;                     // Refresh operation currently performed
  1135         TBool iRefresh;                     // Refresh operation currently performed
  1127         TBool iMtpInUse;                    // Flag for MTP operation
  1136         TBool iMtpInUse;                    // Flag for MTP operation
  1128         TInt  iOpOnDbCount;                 // Count to provide a min op amount in one transaction
  1137         TInt  iOpOnDbCount;                 // Count to provide a min op amount in one transaction
  1129     };
  1138     };
  1130 
  1139