48 * @param aDbManager database manager to use for database interactions |
48 * @param aDbManager database manager to use for database interactions |
49 * @param aCategory identifies the category |
49 * @param aCategory identifies the category |
50 * @return New CMPXDbCategory instance. |
50 * @return New CMPXDbCategory instance. |
51 */ |
51 */ |
52 static CMPXDbAbstractAlbum* NewL(CMPXDbManager& aDbManager, |
52 static CMPXDbAbstractAlbum* NewL(CMPXDbManager& aDbManager, |
53 TMPXGeneralCategory aCategory); |
53 TMPXGeneralCategory aCategory, RFs& aFs); |
54 |
54 |
55 /** |
55 /** |
56 * Two-phased constructor. |
56 * Two-phased constructor. |
57 * @param aDbManager database manager to use for database interactions |
57 * @param aDbManager database manager to use for database interactions |
58 * @param aCategory identifies the category |
58 * @param aCategory identifies the category |
59 * @return New CMPXDbCategory instance on the cleanup stack. |
59 * @return New CMPXDbCategory instance on the cleanup stack. |
60 */ |
60 */ |
61 static CMPXDbAbstractAlbum* NewLC(CMPXDbManager& aDbManager, |
61 static CMPXDbAbstractAlbum* NewLC(CMPXDbManager& aDbManager, |
62 TMPXGeneralCategory aCategory); |
62 TMPXGeneralCategory aCategory, RFs& aFs); |
63 |
63 |
64 /** |
64 /** |
65 * Destructor |
65 * Destructor |
66 */ |
66 */ |
67 virtual ~CMPXDbAbstractAlbum(); |
67 virtual ~CMPXDbAbstractAlbum(); |
82 * ETrue if a new row is created in the table; otherwise EFalse. |
82 * ETrue if a new row is created in the table; otherwise EFalse. |
83 * @param aCaseSensitive indicates whether case sensitivity should be taken |
83 * @param aCaseSensitive indicates whether case sensitivity should be taken |
84 * into consideration when generating the unique row id |
84 * into consideration when generating the unique row id |
85 * @return The unique id of the row added. |
85 * @return The unique id of the row added. |
86 */ |
86 */ |
87 TUint32 AddItemL( const TDesC& aName, const TDesC& aAlbumArtist, const TDesC& aGenre, TInt aDriveId, TBool& aNewRecord, |
87 TUint32 AddItemL( const TDesC& aUri, const TDesC& aName, const TDesC& aAlbumArtist, TInt aDriveId, TBool& aNewRecord, |
88 TBool aCaseSensitive = ETrue); |
88 TBool aCaseSensitive = EFalse); |
89 |
89 |
|
90 /** |
|
91 * Add existing item to table with same entry fields values except new Uri. |
|
92 * @param aOldId: existing item Id |
|
93 * @param newUri: new Uri |
|
94 * @return The unique id of the row added. |
|
95 */ |
|
96 TUint32 AddUpdatedItemL(TUint32 aOldId, const TDesC& newUri); |
|
97 |
90 /** |
98 /** |
91 * Decrement the number of songs for the item. If the count gets to 0, remove |
99 * Decrement the number of songs for the item. If the count gets to 0, remove |
92 * the item. |
100 * the item. |
93 * @param aId: The ID of the category to delete. |
101 * @param aId: The ID of the category to delete. |
94 * @param aDriveId: The drive Id the name (category) belongs to. Songs on different |
102 * @param aDriveId: The drive Id the name (category) belongs to. Songs on different |
101 * @param aItemExist Out parameter, ETrue if the category is not deleted after the delete, |
109 * @param aItemExist Out parameter, ETrue if the category is not deleted after the delete, |
102 * EFalse otherwise |
110 * EFalse otherwise |
103 */ |
111 */ |
104 void DecrementSongsForCategoryL(TUint32 aId, TInt aDriveId, |
112 void DecrementSongsForCategoryL(TUint32 aId, TInt aDriveId, |
105 CMPXMessageArray* aItemChangedMessages, TBool& aItemExist, TBool aMtpInUse); |
113 CMPXMessageArray* aItemChangedMessages, TBool& aItemExist, TBool aMtpInUse); |
106 |
114 |
107 /** |
115 /** |
108 * Remove a abstractalbum and return its URI |
116 * Remove a abstractalbum, remove entry from AbstractAlbum table, |
109 * @param aAbstractAlbumId identifies the abstractalbum |
117 * Thumbnail table, corresponding alb from file system |
110 * @return HBufC containing the URI. Ownership is transferred. |
118 * @param aAbstractAlbumId ID of the abstractalbum to remove |
111 */ |
119 * @param aItemChangedMessages a list of change events as a result of the |
112 HBufC* DeleteAbstractAlbumL(TUint32 aAbstractAlbumId, TInt aDriveId = 0); |
120 * abstractalbum removal |
|
121 * @param aFileDeleted indicate if alb file already deleted from file system |
|
122 */ |
|
123 void RemoveAbstractAlbumL(TUint32 aAbstractalbumId, |
|
124 CMPXMessageArray& aItemChangedMessages, TBool aFileDeleted); |
113 |
125 |
114 /** |
126 /** |
115 * Update a category item. |
127 * Update a category item. |
116 * @param aId: The ID of the category to update |
128 * @param aId: The ID of the category to update |
117 * @param aMedia: The media data |
129 * @param aMedia: The media data |
118 * @param aDriveId: The Drive Id the name (category) belongs |
130 * @param aDriveId: The Drive Id the name (category) belongs |
119 * @param aItemChangedMessages: if valid on return contains a updated message if the |
131 * @param aItemChangedMessages: if valid on return contains a updated message if the |
120 * category was updated |
132 * category was updated |
121 */ |
133 */ |
122 void UpdateItemL(TUint32 aId, const CMPXMedia& aMedia, TInt aDriveId, CMPXMessageArray* aItemChangedMessages); |
134 void UpdateItemL(TUint32 aId, const CMPXMedia& aMedia, TInt aDriveId, CMPXMessageArray* aItemChangedMessages); |
|
135 |
|
136 /** |
|
137 * Delete or Rename Thumbnail from TN DB by calling Thumbnail manager |
|
138 * Rename Thumbnail if aNewPath is not NULL, otherwise Delete Thumbnail |
|
139 * @param aOldPath: old Uri |
|
140 * @param aNewPath: new Uri |
|
141 * @param aPriority: priority pass to Thumbnail manager |
|
142 */ |
|
143 void HandleTNL( const TDesC& aOldPath, const TDesC& aNewPath = KNullDesC, TInt aPriority =0 ); |
|
144 |
|
145 /** |
|
146 * Get the uri field for a given ID. |
|
147 * @param aId identifies the abstractalbum item |
|
148 * @return uri that matches aId. Ownership is abandoned. |
|
149 */ |
|
150 HBufC* GetUriL(TUint32 aId); |
|
151 |
|
152 /** |
|
153 * Get Ids of albstractalbum with no song associated. |
|
154 * Rename Thumbnail if aNewPath is not NULL, otherwise Delete Thumbnail |
|
155 * @param aItemsIds: array of Ids for abstractalbums which have no song associated. |
|
156 */ |
|
157 void GetAllItemsWithNoSongL(RArray<TUint32>& aItemsIds); |
123 |
158 |
124 private: |
159 private: |
125 |
160 |
126 |
161 |
127 /** |
162 /** |
140 * @param aValues values of each field of Album table |
175 * @param aValues values of each field of Album table |
141 * @return a string containing the selection criteria. The ownership is passed to the caller. |
176 * @return a string containing the selection criteria. The ownership is passed to the caller. |
142 */ |
177 */ |
143 void GenerateAbstractAlbumFieldsValuesL(const CMPXMedia& aMedia, |
178 void GenerateAbstractAlbumFieldsValuesL(const CMPXMedia& aMedia, |
144 CDesCArray& aFields, CDesCArray& aValues); |
179 CDesCArray& aFields, CDesCArray& aValues); |
145 |
180 |
|
181 /** |
|
182 * Remove a abstractalbum from AbstractAlbum table |
|
183 * @param aAbstractAlbumId identifies the abstractalbum |
|
184 * @param aDriveId drive Id |
|
185 */ |
|
186 void DeleteAbstractAlbumEntryL(TUint32 aAbstractAlbumId, TInt aDriveId = 0); |
|
187 |
146 |
188 |
147 /** |
189 /** |
148 * @see MMPXTable |
190 * @see MMPXTable |
149 */ |
191 */ |
150 virtual void CreateTableL(RSqlDatabase& aDatabase, TBool aCorruptTable); |
192 virtual void CreateTableL(RSqlDatabase& aDatabase, TBool aCorruptTable); |
151 |
193 |
152 |
|
153 |
|
154 /** |
194 /** |
155 * @see MMPXTable |
195 * @see MMPXTable |
156 */ |
196 */ |
157 virtual TBool CheckTableL(RSqlDatabase& aDatabase); |
197 virtual TBool CheckTableL(RSqlDatabase& aDatabase); |
158 |
198 |
159 |
|
160 |
|
161 /** |
199 /** |
162 * C++ constructor. |
200 * C++ constructor. |
163 * @param aDbManager database manager to use for database interactions |
201 * @param aDbManager database manager to use for database interactions |
164 * @param aCategory identifies the category |
202 * @param aCategory identifies the category |
165 */ |
203 */ |
166 CMPXDbAbstractAlbum(CMPXDbManager& aDbManager, TMPXGeneralCategory aCategory); |
204 CMPXDbAbstractAlbum(CMPXDbManager& aDbManager, TMPXGeneralCategory aCategory, RFs& aFs); |
167 |
205 |
168 /** |
206 /** |
169 * Second phase constructor. |
207 * Second phase constructor. |
170 */ |
208 */ |
171 void ConstructL(); |
209 void ConstructL(); |
172 |
210 |
173 |
|
174 /** |
211 /** |
175 * MThumbnailManagerObserver |
212 * MThumbnailManagerObserver |
176 */ |
213 */ |
177 void ThumbnailPreviewReady( |
214 void ThumbnailPreviewReady( |
178 MThumbnailData& aThumbnail, TThumbnailRequestId aId ); |
215 MThumbnailData& aThumbnail, TThumbnailRequestId aId ); |
179 /** |
216 /** |
180 * MThumbnailManagerObserver |
217 * MThumbnailManagerObserver |
181 */ |
218 */ |
182 void ThumbnailReady( |
219 void ThumbnailReady( |
183 TInt aError, |
220 TInt aError, |
184 MThumbnailData& aThumbnail, TThumbnailRequestId aId ); |
221 MThumbnailData& aThumbnail, TThumbnailRequestId aId ); |
185 |
222 |
186 public: |
223 public: |
187 |
224 |
188 /** |
225 /** |
189 * Column indexes in the category tables |
226 * Column indexes in the category tables |
190 */ |
227 */ |
191 enum TAbstractAlbumColumns |
228 enum TAbstractAlbumColumns |
192 { |
229 { |
193 EAbstractAlbumUniqueId = KMPXTableDefaultIndex, |
230 EAbstractAlbumUniqueId = KMPXTableDefaultIndex, |
|
231 EAbstractAlbumUri, |
194 EAbstractAlbumName, |
232 EAbstractAlbumName, |
195 EAbstractAlbumArtist, |
233 EAbstractAlbumArtist, |
196 EAbstractAlbumGenre, |
|
197 EAbstractAlbumSongCount, |
234 EAbstractAlbumSongCount, |
198 EAbstractAlbumVolumeId, |
235 EAbstractAlbumVolumeId, |
199 EAbstractAlbumFieldCount |
236 EAbstractAlbumFieldCount |
200 }; |
237 }; |
201 |
238 |
202 private: // Data |
239 private: // Data |
203 CThumbnailManager* iTNManager; |
240 CThumbnailManager* iTNManager; |
|
241 TBool iRenameTN; |
|
242 RFs& iFs; |
204 |
243 |
205 }; |
244 }; |
206 #endif // MPXDBAbstractAlbum_H |
245 #endif // MPXDBAbstractAlbum_H |
207 |
246 |
208 // End of File |
247 // End of File |