diff -r cbb1bfb7ebfb -r edd273b3192a mmappcomponents/mmmtpdataprovider/src/cmmmtpdpmetadataaccesswrapper.cpp --- a/mmappcomponents/mmmtpdataprovider/src/cmmmtpdpmetadataaccesswrapper.cpp Fri May 14 16:21:14 2010 +0300 +++ b/mmappcomponents/mmmtpdataprovider/src/cmmmtpdpmetadataaccesswrapper.cpp Thu May 27 13:19:19 2010 +0300 @@ -25,6 +25,7 @@ #include #include +#include "mmmtpdp_variant.hrh" #include "cmmmtpdpmetadataaccesswrapper.h" #include "cmmmtpdpmetadatampxaccess.h" #include "cmmmtpdpmetadatavideoaccess.h" @@ -76,6 +77,12 @@ KKeyReadPolicy, KKeyWritePolicy); +#ifdef MMMTPDP_RESET_STATUS_CLOSESESSION + MmMtpDpUtility::SetPSStatus(EMtpPSStatusUninitialized); +#else + MmMtpDpUtility::SetPSStatus(EMtpPSStatusReadyToSync); +#endif // MMMTPDP_RESET_STATUS_CLOSESESSION + PRINT( _L( "MM MTP <= CMmMtpDpMetadataAccessWrapper::ConstructL" ) ); } @@ -95,9 +102,8 @@ delete iMmMtpDpMetadataMpxAccess; // unblock MPX - RProperty::Set( KMtpPSUid, - KMtpPSStatus, - EMtpPSStatusUninitialized ); + MmMtpDpUtility::SetPSStatus(EMtpPSStatusUninitialized); + PRINT( _L( "MM MTP <= CMmMtpDpMetadataAccessWrapper::~CMmMtpDpMetadataAccessWrapper" ) ); } @@ -291,21 +297,6 @@ PRINT( _L( "MM MTP <= CMmMtpDpMetadataAccessWrapper::DeleteObjectL" ) ); } -// --------------------------------------------------------------------------- -// CMmMtpDpMetadataAccessWrapper::SetStorageRootL -// Sets current Drive info -// --------------------------------------------------------------------------- -// -void CMmMtpDpMetadataAccessWrapper::SetStorageRootL( const TDesC& aStorageRoot ) - { - PRINT( _L( "MM MTP => CMmMtpDpMetadataAccessWrapper::SetStorageRootL" ) ); - - iMmMtpDpMetadataVideoAccess->SetStorageRootL( aStorageRoot ); - iMmMtpDpMetadataMpxAccess->SetStorageRootL( aStorageRoot ); - - PRINT( _L( "MM MTP <= CMmMtpDpMetadataAccessWrapper::SetStorageRootL" ) ); - } - // ----------------------------------------------------------------------------- // CMmMtpDpMetadataMpxAccess::SetImageObjPropL // set image specific properties specific to videos @@ -352,6 +343,11 @@ void CMmMtpDpMetadataAccessWrapper::OpenSessionL() { iOpenCount++; + +#ifdef MMMTPDP_RESET_STATUS_CLOSESESSION + if (iOpenCount == 1) + MmMtpDpUtility::SetPSStatus(EMtpPSStatusReadyToSync); +#endif // MMMTPDP_RESET_STATUS_CLOSESESSION } // ----------------------------------------------------------------------------- @@ -370,8 +366,12 @@ if ( iOpenCount == 0 ) { PRINT( _L( "MM MTP <> CMmMtpDpMetadataAccessWrapper::CloseSessionL close" ) ); - iMmMtpDpMetadataMpxAccess->CloseSession(); + iMmMtpDpMetadataMpxAccess->CloseSession(); // trigger close and flush CollectionHelper iMmMtpDpMetadataVideoAccess->CloseSessionL(); + +#ifdef MMMTPDP_RESET_STATUS_CLOSESESSION + MmMtpDpUtility::SetPSStatus(EMtpPSStatusUninitialized); +#endif // MMMTPDP_RESET_STATUS_CLOSESESSION } } else @@ -583,8 +583,6 @@ // TBool CMmMtpDpMetadataAccessWrapper::IsExistL( const TDesC& aSuid ) { - TParsePtrC parse( aSuid ); - iMmMtpDpMetadataMpxAccess->SetStorageRootL( parse.Drive() ); return iMmMtpDpMetadataMpxAccess->IsExistL( aSuid ); } @@ -627,26 +625,22 @@ { PRINT1( _L( "MM MTP => CMmMtpDpMetadataAccessWrapper::CreateDummyFile, filename = %S" ), &aPlaylistName ); - if ( MmMtpDpUtility::FormatFromFilename( aPlaylistName ) == - EMTPFormatCodeAbstractAudioVideoPlaylist ) + RFile newfile; + TInt err = newfile.Replace( iFs, aPlaylistName, EFileWrite ); + + if ( err != KErrNone ) { - RFile newfile; - TInt err = newfile.Replace( iFs, aPlaylistName, EFileWrite ); - + newfile.Close(); + PRINT1( _L( "MM MTP <> CMmMtpDpMetadataAccessWrapper::CreateDummyFile err = %d" ), err ); + } + else // File created OK + { + err = newfile.Flush(); + newfile.Close(); + err = iFs.SetAtt( aPlaylistName, KEntryAttSystem | KEntryAttHidden, + KEntryAttReadOnly | KEntryAttNormal ); if ( err != KErrNone ) - { - newfile.Close(); - PRINT1( _L( "MM MTP <> CMmMtpDpMetadataAccessWrapper::CreateDummyFile err = %d" ), err ); - } - else // File created OK - { - err = newfile.Flush(); - newfile.Close(); - err = iFs.SetAtt( aPlaylistName, KEntryAttSystem | KEntryAttHidden, - KEntryAttReadOnly | KEntryAttNormal ); - if ( err != KErrNone ) - PRINT1( _L( "MM MTP <> CMmMtpDpMetadataAccessWrapper::CreateDummyFile Dummy Playlist file created. err = %d" ), err ); - } + PRINT1( _L( "MM MTP <> CMmMtpDpMetadataAccessWrapper::CreateDummyFile Dummy Playlist file created. err = %d" ), err ); } } @@ -685,7 +679,7 @@ PRINT3( _L( "MM MTP <> CMmMtpDpMetadataAccessWrapper::RemoveDummyFile filename = %S, err %d, entry.iSize = %d" ), &fileName, err, entry.iSize ); } - else if ( format != EMTPFormatCodeM3UPlaylist ) + else { TInt err = iFs.Delete( fileName ); @@ -693,11 +687,6 @@ &fileName, err ); } - else - { - // leave the Imported playlist in the file system - PRINT1( _L( "MM MTP <> CMmMtpDpMetadataAccessWrapper::RemoveDummyFile, Don't delete m3u file [%S]" ), &fileName ); - } } PRINT( _L( "MM MTP <= CMmMtpDpMetadataAccessWrapper::RemoveDummyFiles" ) ); } @@ -707,8 +696,9 @@ // Update Music collection // --------------------------------------------------------------------------- // -EXPORT_C void CMmMtpDpMetadataAccessWrapper::UpdateMusicCollectionL() +EXPORT_C void CMmMtpDpMetadataAccessWrapper::UpdateMusicCollectionL( const TDesC& aStorageRoot ) { + iMmMtpDpMetadataMpxAccess->SetStorageRootL( aStorageRoot ); iMmMtpDpMetadataMpxAccess->UpdateMusicCollectionL( ); }