23 #include <mpxmedia.h> |
23 #include <mpxmedia.h> |
24 #include <mpxmediaarray.h> |
24 #include <mpxmediaarray.h> |
25 #include <mpxcollectionutility.h> |
25 #include <mpxcollectionutility.h> |
26 #include <mpxharvesterutility.h> |
26 #include <mpxharvesterutility.h> |
27 #include <mpxmediageneraldefs.h> |
27 #include <mpxmediageneraldefs.h> |
28 #include <mpxmediamusicdefs.h> |
|
29 #include <mpxmediacontainerdefs.h> |
28 #include <mpxmediacontainerdefs.h> |
30 #include <mpxuser.h> |
29 #include <mpxuser.h> |
31 #include <mpxcollectionplugin.hrh> |
30 #include <mpxcollectionplugin.hrh> |
32 #include <mpxcommandgeneraldefs.h> |
31 #include <mpxcommandgeneraldefs.h> |
33 #include <mpxcollectioncommanddefs.h> |
32 #include <mpxcollectioncommanddefs.h> |
44 // --------------------------------------------------------------------------- |
43 // --------------------------------------------------------------------------- |
45 // Constructor |
44 // Constructor |
46 // --------------------------------------------------------------------------- |
45 // --------------------------------------------------------------------------- |
47 // |
46 // |
48 CMPXCollectionHelperImp::CMPXCollectionHelperImp() |
47 CMPXCollectionHelperImp::CMPXCollectionHelperImp() |
49 : iTNManager(NULL) |
|
50 { |
48 { |
51 } |
49 } |
52 |
50 |
53 |
51 |
54 // --------------------------------------------------------------------------- |
52 // --------------------------------------------------------------------------- |
59 { |
57 { |
60 iHvsUtility = CMPXHarvesterFactory::NewL(); |
58 iHvsUtility = CMPXHarvesterFactory::NewL(); |
61 iCollectionUtil = MMPXCollectionUtility::NewL(); |
59 iCollectionUtil = MMPXCollectionUtility::NewL(); |
62 iMediator = CMPXCollectionMediator::NewL( iCollectionUtil->Collection(), |
60 iMediator = CMPXCollectionMediator::NewL( iCollectionUtil->Collection(), |
63 this ); |
61 this ); |
64 |
62 |
65 RArray<TUid> ary; |
63 RArray<TUid> ary; |
66 CleanupClosePushL( ary ); |
64 CleanupClosePushL( ary ); |
67 ary.AppendL( TUid::Uid(EMPXCollectionPluginMusic) ); |
65 ary.AppendL( TUid::Uid(EMPXCollectionPluginMusic) ); |
68 iMusicCollectionId = iCollectionUtil->CollectionIDL( ary.Array() ); |
66 iMusicCollectionId = iCollectionUtil->CollectionIDL( ary.Array() ); |
69 CleanupStack::PopAndDestroy( &ary ); |
67 CleanupStack::PopAndDestroy( &ary ); |
418 |
414 |
419 // find the media using the old URI |
415 // find the media using the old URI |
420 RArray<TMPXAttribute> attributes; |
416 RArray<TMPXAttribute> attributes; |
421 CleanupClosePushL( attributes ); |
417 CleanupClosePushL( attributes ); |
422 attributes.AppendL(KMPXMediaGeneralId); |
418 attributes.AppendL(KMPXMediaGeneralId); |
423 attributes.AppendL(KMPXMediaMusicAlbumArtFileName); |
|
424 |
419 |
425 CMPXMedia* media = GetL(aOldUri, attributes.Array(), aItemCat); |
420 CMPXMedia* media = GetL(aOldUri, attributes.Array(), aItemCat); |
426 CleanupStack::PopAndDestroy(&attributes); |
421 CleanupStack::PopAndDestroy(&attributes); |
427 CleanupStack::PushL(media); |
422 CleanupStack::PushL(media); |
428 |
|
429 const TDesC& fileName(media->ValueText(KMPXMediaMusicAlbumArtFileName)); |
|
430 |
|
431 // the songs have embedded albumart. |
|
432 if(fileName.CompareF(aOldUri) == 0) |
|
433 { |
|
434 // change the Art filename to the new Uri |
|
435 media->SetTextValueL(KMPXMediaMusicAlbumArtFileName, aNewUri); |
|
436 |
|
437 // Rename the thumbnail |
|
438 TRAPD(err, RenameThumbnailL(aOldUri, aNewUri)); |
|
439 if(KErrNone != err) |
|
440 { |
|
441 MPX_DEBUG2("Thumbnail renames failed. Err: %d", err); |
|
442 } |
|
443 } |
|
444 |
423 |
445 // change file path to the new file path |
424 // change file path to the new file path |
446 media->SetTextValueL(KMPXMediaGeneralUri, aNewUri); |
425 media->SetTextValueL(KMPXMediaGeneralUri, aNewUri); |
447 |
426 |
448 // ask harvester to rename the file if any of the following is true: |
427 // ask harvester to rename the file if any of the following is true: |
754 void CMPXCollectionHelperImp::Close() |
733 void CMPXCollectionHelperImp::Close() |
755 { |
734 { |
756 delete this; |
735 delete this; |
757 } |
736 } |
758 |
737 |
759 // --------------------------------------------------------------------------- |
|
760 // Rename the thumbnail through TNM |
|
761 // --------------------------------------------------------------------------- |
|
762 // |
|
763 void CMPXCollectionHelperImp::RenameThumbnailL( const TDesC& aOldUri, |
|
764 const TDesC& aNewUri ) |
|
765 { |
|
766 MPX_FUNC("CMPXCollectionHelperImp::RenameThumbnailL"); |
|
767 |
|
768 // Create Thumbnail Manager instance when use first time. |
|
769 if(NULL == iTNManager) |
|
770 { |
|
771 iTNManager = CThumbnailManager::NewL( *this ); |
|
772 } |
|
773 |
|
774 // Rename thumbnail |
|
775 iTNManager->RenameThumbnailsL(aOldUri, aNewUri, 0); |
|
776 } |
|
777 |
|
778 // --------------------------------------------------------------------------- |
|
779 // CMPXDbAbstractAlbum::ThumbnailReady |
|
780 // Callback but not used here |
|
781 // --------------------------------------------------------------------------- |
|
782 void CMPXCollectionHelperImp::ThumbnailPreviewReady( |
|
783 MThumbnailData& /*aThumbnail*/, TThumbnailRequestId /*aId*/ ) |
|
784 { |
|
785 } |
|
786 |
|
787 |
|
788 // --------------------------------------------------------------------------- |
|
789 // CMPXDbAbstractAlbum::ThumbnailReady |
|
790 // Callback but not used here |
|
791 // --------------------------------------------------------------------------- |
|
792 void CMPXCollectionHelperImp::ThumbnailReady( TInt /*aError*/, |
|
793 MThumbnailData& /*aThumbnail*/, TThumbnailRequestId /*aId*/ ) |
|
794 { |
|
795 } |
|
796 // End of file |
738 // End of file |