mmappcomponents/mmmtpdataprovider/mmmtpdprequestprocessor/src/cmoveobject.cpp
branchRCL_3
changeset 53 e42293e811d8
parent 34 e257e2b6459d
child 55 6c1dfe4da5dd
equal deleted inserted replaced
52:b034b1c214c2 53:e42293e811d8
   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 // -----------------------------------------------------------------------------
   405 // -----------------------------------------------------------------------------
   405 // -----------------------------------------------------------------------------
   406 //
   406 //
   407 void CMoveObject::SetPreviousPropertiesL()
   407 void CMoveObject::SetPreviousPropertiesL()
   408     {
   408     {
   409     PRINT( _L( "MM MTP => CMoveObject::SetPreviousPropertiesL" ) );
   409     PRINT( _L( "MM MTP => CMoveObject::SetPreviousPropertiesL" ) );
   410 
       
   411     TMTPResponseCode respcode = EMTPRespCodeOK;
       
   412 
   410 
   413     iPropertyList->ResetCursor();
   411     iPropertyList->ResetCursor();
   414     const TInt count = iPropertyList->NumberOfElements();
   412     const TInt count = iPropertyList->NumberOfElements();
   415     for ( TInt i = 0; i < count; i++ )
   413     for ( TInt i = 0; i < count; i++ )
   416         {
   414         {
   447             case EMTPObjectPropCodeName:
   445             case EMTPObjectPropCodeName:
   448             case EMTPObjectPropCodeAlbumArtist:
   446             case EMTPObjectPropCodeAlbumArtist:
   449                 {
   447                 {
   450                 CMTPTypeString *stringData = CMTPTypeString::NewLC( element.StringL( CMTPTypeObjectPropListElement::EValue ) ); // + stringData
   448                 CMTPTypeString *stringData = CMTPTypeString::NewLC( element.StringL( CMTPTypeObjectPropListElement::EValue ) ); // + stringData
   451 
   449 
   452                 respcode = iDpConfig.PropSettingUtility()->SetMetaDataToWrapper( iDpConfig,
   450                 iDpConfig.PropSettingUtility()->SetMetaDataToWrapper( iDpConfig,
   453                     propertyCode,
   451                     propertyCode,
   454                     *stringData,
   452                     *stringData,
   455                     *iObjectInfo );
   453                     *iObjectInfo );
   456 
   454 
   457                 CleanupStack::PopAndDestroy( stringData ); // - stringData
   455                 CleanupStack::PopAndDestroy( stringData ); // - stringData
   458                 }
   456                 }
   459                 break;
   457                 break;
   460 
   458 
   461             default:
   459             default:
   462                 {
   460                 {
   463                 respcode = iDpConfig.PropSettingUtility()->SetSpecificObjectPropertyL( iDpConfig,
   461                 iDpConfig.PropSettingUtility()->SetSpecificObjectPropertyL( iDpConfig,
   464                     propertyCode,
   462                     propertyCode,
   465                     *iObjectInfo,
   463                     *iObjectInfo,
   466                     element );
   464                     element );
   467                 }
   465                 }
   468                 break;
   466                 break;
   469             }
   467             }
   470         } // end of for loop
   468         } // end of for loop
   471 
   469 
   472     // ignore errors
   470     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     }
   471     }
   480 
   472 
   481 // -----------------------------------------------------------------------------
   473 // -----------------------------------------------------------------------------
   482 // CMoveObject::SetPropertiesL
   474 // CMoveObject::SetPropertiesL
   483 // Set the object properties in the object property store.
   475 // Set the object properties in the object property store.