mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/src/cmoveobject.cpp
branchGCC_SURGE
changeset 47 f3d2589f22d6
parent 35 2ee890d2f7e7
child 50 762d760dcfdf
equal deleted inserted replaced
36:3b7506f63335 47:f3d2589f22d6
   103 // -----------------------------------------------------------------------------
   103 // -----------------------------------------------------------------------------
   104 //
   104 //
   105 EXPORT_C void CMoveObject::ConstructL()
   105 EXPORT_C void CMoveObject::ConstructL()
   106     {
   106     {
   107     iPropertyList = CMTPTypeObjectPropList::NewL();
   107     iPropertyList = CMTPTypeObjectPropList::NewL();
   108 
       
   109     // Set the CenRep value of MTP status,
       
   110     // also need to do in other processors which related to MPX
       
   111     SetPSStatus();
       
   112     }
   108     }
   113 
   109 
   114 // -----------------------------------------------------------------------------
   110 // -----------------------------------------------------------------------------
   115 // CMoveObject::ServiceL
   111 // CMoveObject::ServiceL
   116 // MoveObject request handler
   112 // MoveObject request handler
   117 // -----------------------------------------------------------------------------
   113 // -----------------------------------------------------------------------------
   118 //
   114 //
   119 EXPORT_C void CMoveObject::ServiceL()
   115 EXPORT_C void CMoveObject::ServiceL()
   120     {
   116     {
   121     PRINT( _L( "MM MTP => CMoveObject::ServiceL" ) );
   117     PRINT( _L( "MM MTP => CMoveObject::ServiceL" ) );
   122 
   118     
       
   119     MmMtpDpUtility::SetPSStatus(EMtpPSStatusActive);
   123     MoveObjectL();
   120     MoveObjectL();
   124 
   121 
   125     PRINT( _L( "MM MTP <= CMoveObject::ServiceL" ) );
   122     PRINT( _L( "MM MTP <= CMoveObject::ServiceL" ) );
   126     }
   123     }
   127 
   124 
   280 // A helper function of MoveObjectL
   277 // A helper function of MoveObjectL
   281 // -----------------------------------------------------------------------------
   278 // -----------------------------------------------------------------------------
   282 //
   279 //
   283 void CMoveObject::MoveFileL( const TDesC& aNewFileName )
   280 void CMoveObject::MoveFileL( const TDesC& aNewFileName )
   284     {
   281     {
   285     TFileName oldFileName = iObjectInfo->DesC( CMTPObjectMetaData::ESuid );
   282     HBufC* oldFileName = iObjectInfo->DesC( CMTPObjectMetaData::ESuid ).AllocLC(); // + oldFileName
   286     PRINT2( _L( "MM MTP => CMoveObject::MoveFileL old name = %S, aNewFileName = %S" ),
   283     PRINT2( _L( "MM MTP => CMoveObject::MoveFileL old name = %S, aNewFileName = %S" ),
   287         &oldFileName,
   284         oldFileName,
   288         &aNewFileName );
   285         &aNewFileName );
   289 
   286 
   290     if ( iStorageId == iObjectInfo->Uint( CMTPObjectMetaData::EStorageId ) )
   287     if ( iStorageId == iObjectInfo->Uint( CMTPObjectMetaData::EStorageId ) )
   291         iSameStorage = ETrue;
   288         iSameStorage = ETrue;
   292     else
   289     else
   296     // Already trapped inside
   293     // Already trapped inside
   297     GetPreviousPropertiesL( *iObjectInfo );
   294     GetPreviousPropertiesL( *iObjectInfo );
   298     TRAPD( err, SetPropertiesL( aNewFileName ) );
   295     TRAPD( err, SetPropertiesL( aNewFileName ) );
   299 
   296 
   300     CFileMan* fileMan = CFileMan::NewL( iFramework.Fs() );
   297     CFileMan* fileMan = CFileMan::NewL( iFramework.Fs() );
   301     err = fileMan->Move( oldFileName, aNewFileName );
   298     err = fileMan->Move( *oldFileName, aNewFileName );
       
   299 	
       
   300 	CleanupStack::PopAndDestroy( oldFileName );     // - oldFileName
   302 
   301 
   303     if ( err != KErrNone )
   302     if ( err != KErrNone )
   304         PRINT1( _L( "MM MTP <> CMoveObject::MoveFileL err = %d" ), err );
   303         PRINT1( _L( "MM MTP <> CMoveObject::MoveFileL err = %d" ), err );
   305 
   304 
   306     PRINT( _L( "MM MTP <= CMoveObject::MoveFileL" ) );
   305     PRINT( _L( "MM MTP <= CMoveObject::MoveFileL" ) );
   513         iObjectInfo->SetDesCL( CMTPObjectMetaData::ESuid, aNewFileName );
   512         iObjectInfo->SetDesCL( CMTPObjectMetaData::ESuid, aNewFileName );
   514         iObjectInfo->SetUint( CMTPObjectMetaData::EStorageId, iStorageId );
   513         iObjectInfo->SetUint( CMTPObjectMetaData::EStorageId, iStorageId );
   515         iObjectInfo->SetUint( CMTPObjectMetaData::EParentHandle, iNewParentHandle );
   514         iObjectInfo->SetUint( CMTPObjectMetaData::EParentHandle, iNewParentHandle );
   516         iFramework.ObjectMgr().ModifyObjectL(*iObjectInfo);
   515         iFramework.ObjectMgr().ModifyObjectL(*iObjectInfo);
   517 
   516 
   518         iDpConfig.GetWrapperL().SetStorageRootL( aNewFileName );
       
   519         iDpConfig.GetWrapperL().AddObjectL( *iObjectInfo );
   517         iDpConfig.GetWrapperL().AddObjectL( *iObjectInfo );
   520 
   518 
   521         if ( formatCode == EMTPFormatCodeAbstractAudioVideoPlaylist
   519         if ( formatCode == EMTPFormatCodeAbstractAudioVideoPlaylist
   522             || formatCode == EMTPFormatCodeAbstractAudioAlbum )
   520             || formatCode == EMTPFormatCodeAbstractAudioAlbum )
   523             {
   521             {