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