mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/src/cmoveobject.cpp
changeset 50 762d760dcfdf
parent 35 2ee890d2f7e7
equal deleted inserted replaced
48:b7b49303d0c0 50:762d760dcfdf
   290         iSameStorage = EFalse;
   290         iSameStorage = EFalse;
   291 
   291 
   292     // Move the file first no matter if it will fail in Get/SetPreviousPropertiesL
   292     // Move the file first no matter if it will fail in Get/SetPreviousPropertiesL
   293     // Already trapped inside
   293     // Already trapped inside
   294     GetPreviousPropertiesL( *iObjectInfo );
   294     GetPreviousPropertiesL( *iObjectInfo );
   295     TRAPD( err, SetPropertiesL( aNewFileName ) );
   295     TRAP_IGNORE( SetPropertiesL( aNewFileName ) );
   296 
   296 
   297     CFileMan* fileMan = CFileMan::NewL( iFramework.Fs() );
   297     CFileMan* fileMan = CFileMan::NewL( iFramework.Fs() );
   298     err = fileMan->Move( *oldFileName, aNewFileName );
   298     CleanupStack::PushL( fileMan ); // + fileMan
   299 	
   299     TInt err = fileMan->Move( *oldFileName, aNewFileName );
   300 	CleanupStack::PopAndDestroy( oldFileName );     // - oldFileName
   300     PRINT1( _L( "MM MTP <> CMoveObject::MoveFileL err = %d" ), err );
   301 
   301     User::LeaveIfError( err );
   302     if ( err != KErrNone )
   302     CleanupStack::PopAndDestroy( fileMan ); // - fileMan
   303         PRINT1( _L( "MM MTP <> CMoveObject::MoveFileL err = %d" ), err );
   303     CleanupStack::PopAndDestroy( oldFileName );     // - oldFileName
   304 
   304 
   305     PRINT( _L( "MM MTP <= CMoveObject::MoveFileL" ) );
   305     PRINT( _L( "MM MTP <= CMoveObject::MoveFileL" ) );
   306     }
   306     }
   307 
   307 
   308 // -----------------------------------------------------------------------------
   308 // -----------------------------------------------------------------------------
   311 // -----------------------------------------------------------------------------
   311 // -----------------------------------------------------------------------------
   312 //
   312 //
   313 void CMoveObject::GetPreviousPropertiesL( const CMTPObjectMetaData& aObject )
   313 void CMoveObject::GetPreviousPropertiesL( const CMTPObjectMetaData& aObject )
   314     {
   314     {
   315     PRINT( _L( "MM MTP => CMoveObject::GetPreviousPropertiesL" ) );
   315     PRINT( _L( "MM MTP => CMoveObject::GetPreviousPropertiesL" ) );
   316 
       
   317     const TDesC& suid( aObject.DesC( CMTPObjectMetaData::ESuid ) );
       
   318 
   316 
   319     // same storage, not necessary to get the properties
   317     // same storage, not necessary to get the properties
   320     if ( iSameStorage )
   318     if ( iSameStorage )
   321         return;
   319         return;
   322 
   320 
   405 // -----------------------------------------------------------------------------
   403 // -----------------------------------------------------------------------------
   406 //
   404 //
   407 void CMoveObject::SetPreviousPropertiesL()
   405 void CMoveObject::SetPreviousPropertiesL()
   408     {
   406     {
   409     PRINT( _L( "MM MTP => CMoveObject::SetPreviousPropertiesL" ) );
   407     PRINT( _L( "MM MTP => CMoveObject::SetPreviousPropertiesL" ) );
   410 
       
   411     TMTPResponseCode respcode = EMTPRespCodeOK;
       
   412 
   408 
   413     iPropertyList->ResetCursor();
   409     iPropertyList->ResetCursor();
   414     const TInt count = iPropertyList->NumberOfElements();
   410     const TInt count = iPropertyList->NumberOfElements();
   415     for ( TInt i = 0; i < count; i++ )
   411     for ( TInt i = 0; i < count; i++ )
   416         {
   412         {
   447             case EMTPObjectPropCodeName:
   443             case EMTPObjectPropCodeName:
   448             case EMTPObjectPropCodeAlbumArtist:
   444             case EMTPObjectPropCodeAlbumArtist:
   449                 {
   445                 {
   450                 CMTPTypeString *stringData = CMTPTypeString::NewLC( element.StringL( CMTPTypeObjectPropListElement::EValue ) ); // + stringData
   446                 CMTPTypeString *stringData = CMTPTypeString::NewLC( element.StringL( CMTPTypeObjectPropListElement::EValue ) ); // + stringData
   451 
   447 
   452                 respcode = iDpConfig.PropSettingUtility()->SetMetaDataToWrapper( iDpConfig,
   448                 iDpConfig.PropSettingUtility()->SetMetaDataToWrapper( iDpConfig,
   453                     propertyCode,
   449                     propertyCode,
   454                     *stringData,
   450                     *stringData,
   455                     *iObjectInfo );
   451                     *iObjectInfo );
   456 
   452 
   457                 CleanupStack::PopAndDestroy( stringData ); // - stringData
   453                 CleanupStack::PopAndDestroy( stringData ); // - stringData
   458                 }
   454                 }
   459                 break;
   455                 break;
   460 
   456 
   461             default:
   457             default:
   462                 {
   458                 {
   463                 respcode = iDpConfig.PropSettingUtility()->SetSpecificObjectPropertyL( iDpConfig,
   459                 iDpConfig.PropSettingUtility()->SetSpecificObjectPropertyL( iDpConfig,
   464                     propertyCode,
   460                     propertyCode,
   465                     *iObjectInfo,
   461                     *iObjectInfo,
   466                     element );
   462                     element );
   467                 }
   463                 }
   468                 break;
   464                 break;
   469             }
   465             }
   470         } // end of for loop
   466         } // end of for loop
   471 
   467 
   472     // ignore errors
   468     PRINT( _L( "MM MTP <= CMoveObject::SetPreviousPropertiesL" ) );
   473     if ( respcode == EMTPRespCodeOK )
       
   474         {
       
   475         // do nothing, just to get rid of build warning
       
   476         }
       
   477 
       
   478     PRINT1( _L( "MM MTP <= CMoveObject::SetPreviousPropertiesL respcode = 0x%x" ), respcode );
       
   479     }
   469     }
   480 
   470 
   481 // -----------------------------------------------------------------------------
   471 // -----------------------------------------------------------------------------
   482 // CMoveObject::SetPropertiesL
   472 // CMoveObject::SetPropertiesL
   483 // Set the object properties in the object property store.
   473 // Set the object properties in the object property store.