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