3044 } |
3047 } |
3045 |
3048 |
3046 #endif // RD_MULTIPLE_DRIVE |
3049 #endif // RD_MULTIPLE_DRIVE |
3047 |
3050 |
3048 // ---------------------------------------------------------------------------- |
3051 // ---------------------------------------------------------------------------- |
3049 // CMPXDbHandler::AddAbstractAlbumItemL |
3052 // CMPXDbHandler::AddCategoryItemL |
3050 // ---------------------------------------------------------------------------- |
3053 // ---------------------------------------------------------------------------- |
3051 // |
3054 // |
3052 #ifdef ABSTRACTAUDIOALBUM_INCLUDED |
3055 TUint32 CMPXDbHandler::AddCategoryItemL( |
3053 TUint32 CMPXDbHandler::AddAbstractAlbumItemL( |
3056 TMPXGeneralCategory aCategory, |
3054 const TDesC& aName, |
3057 const TDesC& aName, |
3055 TInt aDriveId, |
3058 TInt aDriveId, |
3056 CMPXMessageArray* aItemChangedMessages, |
3059 CMPXMessageArray* aItemChangedMessages, |
3057 TBool& aItemExist, |
3060 TBool& aItemExist |
3058 const TDesC& aUri, |
3061 #ifdef ABSTRACTAUDIOALBUM_INCLUDED |
3059 const TDesC& aAlbumArtist |
3062 ,const TDesC& aUri |
|
3063 ,const TDesC& aAlbumArtist |
|
3064 #endif // ABSTRACTAUDIOALBUM_INCLUDED |
3060 ) |
3065 ) |
3061 { |
3066 { |
3062 MPX_FUNC("CMPXDbHandler::AddAbstractAlbumItemL()"); |
3067 MPX_FUNC("CMPXDbHandler::AddCategoryItemL()"); |
3063 |
3068 |
3064 MPX_PERF_START(CMPXDbHandler_AddAbstractAlbumItemL); |
3069 MPX_PERF_START(CMPXDbHandler_AddCategoryItemL); |
3065 |
3070 |
3066 TBool newRecord(EFalse); |
3071 TBool newRecord(EFalse); |
|
3072 #ifdef ABSTRACTAUDIOALBUM_INCLUDED |
3067 TUint32 id(0); |
3073 TUint32 id(0); |
3068 |
3074 //for AbstractAlbum, SetAbstractAlbum, associate songs with abstractalbum. |
3069 //AbstractAlbum is not case sensitive |
3075 //only called with newRecord as EFalse |
3070 id = iDbAbstractAlbum->AddItemL(aUri, aName, aAlbumArtist, aDriveId, newRecord, EFalse); |
3076 //increment songCount if id exist in AbstractAlbum table, otherwise do nothing. |
3071 MPX_PERF_END(CMPXDbHandler_AddAbstractAlbumItemL); |
3077 |
3072 |
3078 //only Genre, AbstractAlbum are not case sensitive |
3073 return id; |
3079 TBool caseSensitive = ETrue; |
3074 } |
3080 if ((aCategory == EMPXGenre) || (aCategory == EMPXAbstractAlbum)) |
3075 #endif |
3081 caseSensitive = EFalse; |
3076 |
3082 |
3077 // ---------------------------------------------------------------------------- |
3083 if (aCategory == EMPXAbstractAlbum) |
3078 // CMPXDbHandler::AddCategoryItemL |
3084 { |
3079 // ---------------------------------------------------------------------------- |
3085 id = iDbAbstractAlbum->AddItemL(aUri, aName, aAlbumArtist, aDriveId, newRecord, caseSensitive); |
3080 // |
3086 } |
3081 TUint32 CMPXDbHandler::AddCategoryItemL( |
3087 else |
3082 TMPXGeneralCategory aCategory, |
3088 { |
3083 const CMPXMedia& aMedia, |
3089 id = DbCategoryL(aCategory)->AddItemL(aName, aDriveId, newRecord, caseSensitive); |
3084 TInt aDriveId, |
3090 #else |
3085 CMPXMessageArray* aItemChangedMessages, |
3091 TUint32 id(DbCategoryL(aCategory)->AddItemL(aName, aDriveId, newRecord, (aCategory != EMPXGenre))); |
3086 TBool& aItemExist) |
3092 #endif // ABSTRACTAUDIOALBUM_INCLUDED |
3087 { |
|
3088 MPX_FUNC("CMPXDbHandler::AddCategoryItemL()"); |
|
3089 |
|
3090 MPX_PERF_START(CMPXDbHandler_AddCategoryItemL); |
|
3091 |
|
3092 ASSERT(aCategory != EMPXAbstractAlbum); |
|
3093 |
|
3094 TBool newRecord(EFalse); |
|
3095 |
|
3096 TUint32 id = DbCategoryL(aCategory)->AddItemL(aCategory, aMedia, aDriveId, newRecord, aCategory != EMPXGenre); |
|
3097 |
3093 |
3098 if (newRecord && aItemChangedMessages) |
3094 if (newRecord && aItemChangedMessages) |
3099 { |
3095 { |
3100 MPXDbCommonUtil::AddItemChangedMessageL(*aItemChangedMessages, id, EMPXItemInserted, |
3096 MPXDbCommonUtil::AddItemChangedMessageL(*aItemChangedMessages, id, EMPXItemInserted, |
3101 aCategory, KDBPluginUid); |
3097 aCategory, KDBPluginUid); |
3102 } |
3098 } |
3103 // when the added item's category is Genre, Composer or Artist, and it is NOT a new record, |
3099 // when the added item's category is Genre or Composer, |
|
3100 // and it is NOT a new record, |
3104 // we should send the item number changed message |
3101 // we should send the item number changed message |
3105 else if ( ( aCategory == EMPXGenre || aCategory == EMPXComposer || aCategory == EMPXArtist) && |
3102 else if ( ( aCategory == EMPXGenre || aCategory == EMPXComposer ) && |
3106 !newRecord && aItemChangedMessages ) |
3103 !newRecord && aItemChangedMessages ) |
3107 { |
3104 { |
3108 MPXDbCommonUtil::AddItemChangedMessageL(*aItemChangedMessages, id, EMPXItemModified, |
3105 MPXDbCommonUtil::AddItemChangedMessageL(*aItemChangedMessages, id, EMPXItemModified, |
3109 aCategory, KDBPluginUid); |
3106 aCategory, KDBPluginUid); |
3110 } |
3107 } |
3111 aItemExist = !newRecord; |
3108 aItemExist = !newRecord; |
|
3109 #ifdef ABSTRACTAUDIOALBUM_INCLUDED |
|
3110 } |
|
3111 #endif // ABSTRACTAUDIOALBUM_INCLUDED |
3112 MPX_PERF_END(CMPXDbHandler_AddCategoryItemL); |
3112 MPX_PERF_END(CMPXDbHandler_AddCategoryItemL); |
3113 |
3113 return id; |
3114 return id; |
3114 } |
3115 } |
3115 |
3116 |
3116 TUint32 CMPXDbHandler::AddCategoryItemL( |
3117 // ---------------------------------------------------------------------------- |
3117 TMPXGeneralCategory aCategory, |
3118 // CMPXDbHandler::UpdateCategoryItemL |
3118 const TDesC& aName, |
3119 // ---------------------------------------------------------------------------- |
3119 const TDesC& aArtistName, |
3120 // |
3120 const TDesC& aArt, |
|
3121 TInt aDriveId, |
|
3122 CMPXMessageArray* aItemChangedMessages, |
|
3123 TBool& aItemExist) |
|
3124 { |
|
3125 MPX_FUNC("CMPXDbHandler::AddCategoryItemL()"); |
|
3126 |
|
3127 MPX_PERF_START(CMPXDbHandler_AddCategoryItemL); |
|
3128 |
|
3129 TBool newRecord(EFalse); |
|
3130 |
|
3131 TUint32 id = 0; |
|
3132 if(aCategory == EMPXAlbum) |
|
3133 { |
|
3134 id = iDbAlbum->AddItemL(aName, aArtistName, aArt, aDriveId, newRecord, (aCategory != EMPXGenre)); |
|
3135 } |
|
3136 else |
|
3137 { |
|
3138 id = iDbArtist->AddItemL(aName, aArt, aDriveId, newRecord, (aCategory != EMPXGenre)); |
|
3139 } |
|
3140 |
|
3141 if (newRecord && aItemChangedMessages) |
|
3142 { |
|
3143 MPXDbCommonUtil::AddItemChangedMessageL(*aItemChangedMessages, id, EMPXItemInserted, |
|
3144 aCategory, KDBPluginUid); |
|
3145 } |
|
3146 // when the added item's category is Artist, and it is NOT a new record, |
|
3147 // we should send the item number changed message |
|
3148 else if ( aCategory == EMPXArtist && |
|
3149 !newRecord && aItemChangedMessages ) |
|
3150 { |
|
3151 MPXDbCommonUtil::AddItemChangedMessageL(*aItemChangedMessages, id, EMPXItemModified, |
|
3152 aCategory, KDBPluginUid); |
|
3153 } |
|
3154 aItemExist = !newRecord; |
|
3155 MPX_PERF_END(CMPXDbHandler_AddCategoryItemL); |
|
3156 |
|
3157 return id; |
|
3158 } |
|
3159 |
3121 void CMPXDbHandler::UpdateCategoryItemL( |
3160 void CMPXDbHandler::UpdateCategoryItemL( |
3122 TMPXGeneralCategory aCategory, |
3161 TMPXGeneralCategory aCategory, |
3123 TUint32 aCategoryId, |
3162 TUint32 aCategoryId, |
3124 const CMPXMedia& aMedia, |
3163 const CMPXMedia& aMedia, |
3125 TInt aDrive, |
3164 TInt aDrive, |
3126 CMPXMessageArray* aItemChangedMessages) |
3165 CMPXMessageArray* aItemChangedMessages) |
3127 { |
3166 { |
3128 DbCategoryL(aCategory)->UpdateItemL(aCategoryId, aMedia, aDrive, aItemChangedMessages); |
3167 switch(aCategory) |
3129 } |
3168 { |
3130 |
3169 case EMPXAlbum: |
|
3170 iDbAlbum->UpdateItemL(aCategoryId, aMedia, aDrive, aItemChangedMessages); |
|
3171 break; |
|
3172 |
|
3173 case EMPXArtist: |
|
3174 iDbArtist->UpdateItemL(aCategoryId, aMedia, aDrive, aItemChangedMessages); |
|
3175 break; |
|
3176 |
|
3177 default: |
|
3178 DbCategoryL(aCategory)->UpdateItemL(aCategoryId, aMedia, aDrive, aItemChangedMessages); |
|
3179 break; |
|
3180 } |
|
3181 } |
3131 // ---------------------------------------------------------------------------- |
3182 // ---------------------------------------------------------------------------- |
3132 // CMPXDbHandler::DeleteSongForCategoryL |
3183 // CMPXDbHandler::DeleteSongForCategoryL |
3133 // ---------------------------------------------------------------------------- |
3184 // ---------------------------------------------------------------------------- |
3134 // |
3185 // |
3135 void CMPXDbHandler::DeleteSongForCategoryL( |
3186 void CMPXDbHandler::DeleteSongForCategoryL( |
3136 TMPXGeneralCategory aCategory, |
3187 TMPXGeneralCategory aCategory, |
3137 TUint32 aCategoryId, |
3188 TUint32 aCategoryId, |
3138 TInt aDriveId, |
3189 TInt aDriveId, |
3139 CMPXMessageArray* aItemChangedMessages, |
3190 CMPXMessageArray* aItemChangedMessages, |
3140 TBool& aItemExist, |
3191 TBool& aItemExist) |
3141 const TDesC& aArt |
|
3142 ) |
|
3143 { |
3192 { |
3144 MPX_FUNC("CMPXDbHandler::DeleteSongForCategoryL"); |
3193 MPX_FUNC("CMPXDbHandler::DeleteSongForCategoryL"); |
3145 switch(aCategory) |
3194 DbCategoryL(aCategory)->DecrementSongsForCategoryL(aCategoryId, aDriveId, |
3146 { |
3195 aItemChangedMessages, aItemExist); |
3147 case EMPXAlbum: |
|
3148 iDbAlbum->DecrementSongsForAlbumL(aCategoryId, aDriveId, aItemChangedMessages, aItemExist, aArt); |
|
3149 break; |
|
3150 default: |
|
3151 DbCategoryL(aCategory)->DecrementSongsForCategoryL(aCategoryId, aDriveId, |
|
3152 aItemChangedMessages, aItemExist); |
|
3153 break; |
|
3154 } |
|
3155 } |
3196 } |
3156 |
3197 |
3157 // ---------------------------------------------------------------------------- |
3198 // ---------------------------------------------------------------------------- |
3158 // CMPXDbHandler::HandlePlayCountModifiedL |
3199 // CMPXDbHandler::HandlePlayCountModifiedL |
3159 // ---------------------------------------------------------------------------- |
3200 // ---------------------------------------------------------------------------- |
3235 |
3277 |
3236 CleanupStack::PopAndDestroy(mediaArray); |
3278 CleanupStack::PopAndDestroy(mediaArray); |
3237 CleanupStack::PopAndDestroy(&attributes); |
3279 CleanupStack::PopAndDestroy(&attributes); |
3238 } |
3280 } |
3239 |
3281 |
|
3282 TInt CMPXDbHandler::HandleGetAlbumsCountForArtistL(TUint32 aArtistId) |
|
3283 { |
|
3284 return iDbAlbum->GetAlbumsCountForArtistL(aArtistId); |
|
3285 } |
|
3286 |
|
3287 TBool CMPXDbHandler::HandleIsUnknownArtistL(TUint32 aArtistId) |
|
3288 { |
|
3289 return iDbArtist->IsUnknownArtistL(aArtistId); |
|
3290 } |
|
3291 |
|
3292 // --------------------------------------------------------------------------- |
|
3293 // CMPXDbHandler::HandleArtistForAlbumL |
|
3294 // --------------------------------------------------------------------------- |
|
3295 // |
|
3296 HBufC* CMPXDbHandler::HandleArtistForAlbumL(const TUint32 aAlbumId) |
|
3297 { |
|
3298 |
|
3299 TUint32 artistId = iDbMusic->ArtistForAlbumL(aAlbumId); |
|
3300 HBufC* artistname = GetNameMatchingIdL(artistId); |
|
3301 return artistname; |
|
3302 } |
|
3303 |
3240 // --------------------------------------------------------------------------- |
3304 // --------------------------------------------------------------------------- |
3241 // CMPXDbHandler::HandleAlbumartForAlbumL |
3305 // CMPXDbHandler::HandleAlbumartForAlbumL |
3242 // --------------------------------------------------------------------------- |
3306 // --------------------------------------------------------------------------- |
3243 // |
3307 // |
3244 HBufC* CMPXDbHandler::HandleAlbumartForAlbumL(const TUint32 aAlbumId, TPtrC aArt) |
3308 HBufC* CMPXDbHandler::HandleAlbumartForAlbumL(const TUint32 aAlbumId, TPtrC aArt) |
3245 { |
3309 { |
3246 return iDbMusic->AlbumartForAlbumL(aAlbumId, aArt); |
3310 return iDbMusic->AlbumartForAlbumL(aAlbumId, aArt); |
3247 } |
3311 } |
3248 |
|
3249 #ifdef ABSTRACTAUDIOALBUM_INCLUDED |
3312 #ifdef ABSTRACTAUDIOALBUM_INCLUDED |
3250 // ---------------------------------------------------------------------------------------------------------- |
3313 // ---------------------------------------------------------------------------------------------------------- |
3251 // CMPXDbHandler::HandleGetAlbumNameForSongL |
3314 // CMPXDbHandler::HandleGetAlbumNameForSongL |
3252 // ---------------------------------------------------------------------------------------------------------- |
3315 // ---------------------------------------------------------------------------------------------------------- |
3253 // |
3316 // |
3254 HBufC* CMPXDbHandler::HandleGetAlbumNameFromIdL(TUint32 aId) |
3317 HBufC* CMPXDbHandler::HandleGetAlbumNameFromIdL(TUint32 aId) |
3255 { |
3318 { |
3256 return iDbAbstractAlbum->GetUriL(aId); |
3319 return iDbAbstractAlbum->GetUriL(aId); |
3257 } |
3320 } |
3258 #endif // ABSTRACTAUDIOALBUM_INCLUDED |
3321 #endif // ABSTRACTAUDIOALBUM_INCLUDED |
3259 |
|
3260 // ---------------------------------------------------------------------------- |
|
3261 // CMPXDbHandler::DeleteAlbumForArtistL |
|
3262 // ---------------------------------------------------------------------------- |
|
3263 // |
|
3264 void CMPXDbHandler::DeleteAlbumForArtistL(TUint32 aCategoryId, |
|
3265 TInt aDrive, CMPXMessageArray* aItemChangedMessages) |
|
3266 { |
|
3267 MPX_FUNC("CMPXDbHandler::DeleteAlbumForArtistL"); |
|
3268 iDbArtist->DecrementAlbumsForArtistL(aCategoryId, aDrive, aItemChangedMessages); |
|
3269 } |
|
3270 |
|
3271 // ---------------------------------------------------------------------------- |
|
3272 // CMPXDbHandler::AddAlbumArtistL |
|
3273 // ---------------------------------------------------------------------------- |
|
3274 // |
|
3275 TUint32 CMPXDbHandler::AddAlbumArtistL(const TDesC& aName, const TDesC& aArt, TInt aDriveId) |
|
3276 { |
|
3277 MPX_FUNC("CMPXDbHandler::AddAlbumArtistL"); |
|
3278 return iDbArtist->AddAlbumArtistL(aName, aArt, aDriveId); |
|
3279 } |
|
3280 |
|
3281 // ---------------------------------------------------------------------------- |
|
3282 // CMPXDbHandler::GenerateUniqueIdForAlbumL |
|
3283 // ---------------------------------------------------------------------------- |
|
3284 // |
|
3285 TUint32 CMPXDbHandler::GenerateUniqueIdForAlbumL(const CMPXMedia& aMedia) |
|
3286 { |
|
3287 return iDbAlbum->GenerateUniqueIdL(aMedia); |
|
3288 } |
|
3289 |
|
3290 // ---------------------------------------------------------------------------- |
|
3291 // CMPXDbHandler::IsUnknownAlbumL |
|
3292 // ---------------------------------------------------------------------------- |
|
3293 // |
|
3294 TBool CMPXDbHandler::IsUnknownAlbumL(const TUint32 aId) |
|
3295 { |
|
3296 return iDbAlbum->IsUnknownAlbumL(aId); |
|
3297 } |
|
3298 // End of file |
3322 // End of file |