mmappcomponents/mmmtpdataprovider/src/cmmmtpdpmetadataaccesswrapper.cpp
branchRCL_3
changeset 28 f56ec6ce2732
parent 23 4740b34b83ce
child 30 6f9f6e99a23e
equal deleted inserted replaced
23:4740b34b83ce 28:f56ec6ce2732
   287             PRINT( _L( "MM MTP <> CMmMtpDpMetadataAccessWrapper::DeleteObjectL default" ) );
   287             PRINT( _L( "MM MTP <> CMmMtpDpMetadataAccessWrapper::DeleteObjectL default" ) );
   288             break;
   288             break;
   289         }
   289         }
   290 
   290 
   291     PRINT( _L( "MM MTP <= CMmMtpDpMetadataAccessWrapper::DeleteObjectL" ) );
   291     PRINT( _L( "MM MTP <= CMmMtpDpMetadataAccessWrapper::DeleteObjectL" ) );
   292     }
       
   293 
       
   294 // ---------------------------------------------------------------------------
       
   295 // CMmMtpDpMetadataAccessWrapper::SetStorageRootL
       
   296 // Sets current Drive info
       
   297 // ---------------------------------------------------------------------------
       
   298 //
       
   299 void CMmMtpDpMetadataAccessWrapper::SetStorageRootL( const TDesC& aStorageRoot )
       
   300     {
       
   301     PRINT( _L( "MM MTP => CMmMtpDpMetadataAccessWrapper::SetStorageRootL" ) );
       
   302 
       
   303     iMmMtpDpMetadataVideoAccess->SetStorageRootL( aStorageRoot );
       
   304     iMmMtpDpMetadataMpxAccess->SetStorageRootL( aStorageRoot );
       
   305 
       
   306     PRINT( _L( "MM MTP <= CMmMtpDpMetadataAccessWrapper::SetStorageRootL" ) );
       
   307     }
   292     }
   308 
   293 
   309 // -----------------------------------------------------------------------------
   294 // -----------------------------------------------------------------------------
   310 // CMmMtpDpMetadataMpxAccess::SetImageObjPropL
   295 // CMmMtpDpMetadataMpxAccess::SetImageObjPropL
   311 // set image specific properties specific to videos
   296 // set image specific properties specific to videos
   581 // if the playlsit exist in the MPX DB
   566 // if the playlsit exist in the MPX DB
   582 // ---------------------------------------------------------------------------
   567 // ---------------------------------------------------------------------------
   583 //
   568 //
   584 TBool CMmMtpDpMetadataAccessWrapper::IsExistL( const TDesC& aSuid )
   569 TBool CMmMtpDpMetadataAccessWrapper::IsExistL( const TDesC& aSuid )
   585     {
   570     {
   586     TParsePtrC parse( aSuid );
       
   587     iMmMtpDpMetadataMpxAccess->SetStorageRootL( parse.Drive() );
       
   588     return iMmMtpDpMetadataMpxAccess->IsExistL( aSuid );
   571     return iMmMtpDpMetadataMpxAccess->IsExistL( aSuid );
   589     }
   572     }
   590 
   573 
   591 // -----------------------------------------------------------------------------
   574 // -----------------------------------------------------------------------------
   592 // CMmMtpDpMetadataAccessWrapper::AddDummyFile
   575 // CMmMtpDpMetadataAccessWrapper::AddDummyFile
   625 //
   608 //
   626 EXPORT_C void CMmMtpDpMetadataAccessWrapper::CreateDummyFile( const TDesC& aPlaylistName )
   609 EXPORT_C void CMmMtpDpMetadataAccessWrapper::CreateDummyFile( const TDesC& aPlaylistName )
   627     {
   610     {
   628     PRINT1( _L( "MM MTP => CMmMtpDpMetadataAccessWrapper::CreateDummyFile, filename = %S" ), &aPlaylistName );
   611     PRINT1( _L( "MM MTP => CMmMtpDpMetadataAccessWrapper::CreateDummyFile, filename = %S" ), &aPlaylistName );
   629 
   612 
   630     if ( MmMtpDpUtility::FormatFromFilename( aPlaylistName ) ==
   613     RFile newfile;
   631         EMTPFormatCodeAbstractAudioVideoPlaylist )
   614     TInt err = newfile.Replace( iFs, aPlaylistName, EFileWrite );
   632         {
   615 
   633         RFile newfile;
   616     if ( err != KErrNone )
   634         TInt err = newfile.Replace( iFs, aPlaylistName, EFileWrite );
   617         {
   635 
   618         newfile.Close();
       
   619         PRINT1( _L( "MM MTP <> CMmMtpDpMetadataAccessWrapper::CreateDummyFile err =  %d" ), err );
       
   620         }
       
   621     else // File created OK
       
   622         {
       
   623         err = newfile.Flush();
       
   624         newfile.Close();
       
   625         err = iFs.SetAtt( aPlaylistName, KEntryAttSystem | KEntryAttHidden,
       
   626             KEntryAttReadOnly | KEntryAttNormal );
   636         if ( err != KErrNone )
   627         if ( err != KErrNone )
   637             {
   628             PRINT1( _L( "MM MTP <> CMmMtpDpMetadataAccessWrapper::CreateDummyFile Dummy Playlist file created. err = %d" ), err );
   638             newfile.Close();
       
   639             PRINT1( _L( "MM MTP <> CMmMtpDpMetadataAccessWrapper::CreateDummyFile err =  %d" ), err );
       
   640             }
       
   641         else // File created OK
       
   642             {
       
   643             err = newfile.Flush();
       
   644             newfile.Close();
       
   645             err = iFs.SetAtt( aPlaylistName, KEntryAttSystem | KEntryAttHidden,
       
   646                 KEntryAttReadOnly | KEntryAttNormal );
       
   647             if ( err != KErrNone )
       
   648                 PRINT1( _L( "MM MTP <> CMmMtpDpMetadataAccessWrapper::CreateDummyFile Dummy Playlist file created. err = %d" ), err );
       
   649             }
       
   650         }
   629         }
   651     }
   630     }
   652 
   631 
   653 // -----------------------------------------------------------------------------
   632 // -----------------------------------------------------------------------------
   654 // CMmMtpDpMetadataAccessWrapper::RemoveDummyFiles
   633 // CMmMtpDpMetadataAccessWrapper::RemoveDummyFiles
   683                     }
   662                     }
   684                 }
   663                 }
   685             PRINT3( _L( "MM MTP <> CMmMtpDpMetadataAccessWrapper::RemoveDummyFile filename = %S, err %d, entry.iSize = %d" ),
   664             PRINT3( _L( "MM MTP <> CMmMtpDpMetadataAccessWrapper::RemoveDummyFile filename = %S, err %d, entry.iSize = %d" ),
   686                 &fileName, err, entry.iSize );
   665                 &fileName, err, entry.iSize );
   687             }
   666             }
   688         else if ( format != EMTPFormatCodeM3UPlaylist )
   667         else
   689             {
   668             {
   690             TInt err = iFs.Delete( fileName );
   669             TInt err = iFs.Delete( fileName );
   691 
   670 
   692             PRINT2( _L( "MM MTP <> CMmMtpDpMetadataAccessWrapper::RemoveDummyFile filename = %S, err %d" ),
   671             PRINT2( _L( "MM MTP <> CMmMtpDpMetadataAccessWrapper::RemoveDummyFile filename = %S, err %d" ),
   693                 &fileName,
   672                 &fileName,
   694                 err );
   673                 err );
   695             }
   674             }
   696         else
       
   697             {
       
   698             // leave the Imported playlist in the file system
       
   699             PRINT1( _L( "MM MTP <> CMmMtpDpMetadataAccessWrapper::RemoveDummyFile, Don't delete m3u file [%S]" ), &fileName );
       
   700             }
       
   701         }
   675         }
   702     PRINT( _L( "MM MTP <= CMmMtpDpMetadataAccessWrapper::RemoveDummyFiles" ) );
   676     PRINT( _L( "MM MTP <= CMmMtpDpMetadataAccessWrapper::RemoveDummyFiles" ) );
   703     }
   677     }
   704 
   678 
   705 // ---------------------------------------------------------------------------
   679 // ---------------------------------------------------------------------------
   706 // CMmMtpDpMetadataAccessWrapper::UpdateMusicCollectionL
   680 // CMmMtpDpMetadataAccessWrapper::UpdateMusicCollectionL
   707 // Update Music collection
   681 // Update Music collection
   708 // ---------------------------------------------------------------------------
   682 // ---------------------------------------------------------------------------
   709 //
   683 //
   710 EXPORT_C void CMmMtpDpMetadataAccessWrapper::UpdateMusicCollectionL()
   684 EXPORT_C void CMmMtpDpMetadataAccessWrapper::UpdateMusicCollectionL( const TDesC& aStorageRoot )
   711     {
   685     {
       
   686     iMmMtpDpMetadataMpxAccess->SetStorageRootL( aStorageRoot );
   712     iMmMtpDpMetadataMpxAccess->UpdateMusicCollectionL( );
   687     iMmMtpDpMetadataMpxAccess->UpdateMusicCollectionL( );
   713     }
   688     }
   714 
   689 
   715 // end of file
   690 // end of file