14 * Description: Implement opeartion SetObjectPropValue |
14 * Description: Implement opeartion SetObjectPropValue |
15 * |
15 * |
16 */ |
16 */ |
17 |
17 |
18 |
18 |
19 #include <mtp/mmtpdataproviderframework.h> |
|
20 #include <mtp/cmtptypestring.h> |
19 #include <mtp/cmtptypestring.h> |
21 #include <mtp/cmtptypearray.h> |
20 #include <mtp/cmtptypearray.h> |
22 #include <mtp/mmtpobjectmgr.h> |
21 #include <mtp/mmtpobjectmgr.h> |
23 |
22 |
24 #include "csetobjectpropvalue.h" |
23 #include "csetobjectpropvalue.h" |
229 break; |
228 break; |
230 |
229 |
231 // Get Data for String objects |
230 // Get Data for String objects |
232 case EMTPObjectPropCodeObjectFileName: // 0xDC07 |
231 case EMTPObjectPropCodeObjectFileName: // 0xDC07 |
233 case EMTPObjectPropCodeName: // 0xDC44 |
232 case EMTPObjectPropCodeName: // 0xDC44 |
|
233 case EMTPObjectPropCodeAlbumArtist: |
234 { |
234 { |
235 delete iMTPTypeString; |
235 delete iMTPTypeString; |
236 iMTPTypeString = NULL; |
236 iMTPTypeString = NULL; |
237 iMTPTypeString = CMTPTypeString::NewL(); |
237 iMTPTypeString = CMTPTypeString::NewL(); |
238 ReceiveDataL( *iMTPTypeString ); |
238 ReceiveDataL( *iMTPTypeString ); |
278 PRINT2( _L( "MM MTP <> old name = %S, new name = %S" ), &suid, &newSuid ); |
278 PRINT2( _L( "MM MTP <> old name = %S, new name = %S" ), &suid, &newSuid ); |
279 TInt err = KErrNone; |
279 TInt err = KErrNone; |
280 err = MmMtpDpUtility::UpdateObjectFileName( iFramework.Fs(), |
280 err = MmMtpDpUtility::UpdateObjectFileName( iFramework.Fs(), |
281 suid, |
281 suid, |
282 newSuid ); |
282 newSuid ); |
|
283 // TODO: if the new name is the same with old name |
283 PRINT1( _L( "MM MTP <> Update object file name err = %d" ), err ); |
284 PRINT1( _L( "MM MTP <> Update object file name err = %d" ), err ); |
284 if ( KErrOverflow == err ) // full path name is too long |
285 if ( KErrOverflow == err ) // full path name is too long |
285 { |
286 { |
286 responseCode = EMTPRespCodeInvalidDataset; |
287 responseCode = EMTPRespCodeInvalidDataset; |
287 } |
288 } |
288 else if ( ( KErrNone == err ) || ( KErrAlreadyExists == err ) ) |
289 else if ( KErrNone == err ) |
289 { |
290 { |
290 TRAP( err, iDpConfig.GetWrapperL().RenameObjectL( suid, newSuid ) ); //Update MPX DB |
291 TRAP( err, iDpConfig.GetWrapperL().RenameObjectL( *iObjectInfo, newSuid ) ); //Update MPX DB |
291 PRINT1( _L( "MM MTP <> Rename MPX object file name err = %d" ), err ); |
292 PRINT1( _L( "MM MTP <> Rename MPX object file name err = %d" ), err ); |
292 // it is ok if file is not found in DB, following S60 solution |
293 // it is ok if file is not found in DB, following S60 solution |
293 if ( KErrNotFound == err ) |
294 if ( KErrNotFound == err ) |
294 { |
295 { |
295 TUint formatCode = iObjectInfo->Uint( CMTPObjectMetaData::EFormatCode ); |
296 TRAP( err, iDpConfig.GetWrapperL().AddObjectL( *iObjectInfo ) ); |
296 TUint subFormatCode = iObjectInfo->Uint( CMTPObjectMetaData::EFormatSubCode ); |
|
297 TRAP( err, iDpConfig.GetWrapperL().AddObjectL( newSuid, formatCode, subFormatCode ) ); |
|
298 PRINT1( _L( "MM MTP <> Add MPX object file name err = %d" ), err ); |
297 PRINT1( _L( "MM MTP <> Add MPX object file name err = %d" ), err ); |
299 } |
298 } |
300 if ( KErrNone == err ) |
299 |
301 { |
300 iObjectInfo->SetDesCL( CMTPObjectMetaData::ESuid, newSuid ); |
302 iObjectInfo->SetDesCL( CMTPObjectMetaData::ESuid, newSuid ); |
301 iFramework.ObjectMgr().ModifyObjectL( *iObjectInfo ); |
303 iFramework.ObjectMgr().ModifyObjectL( *iObjectInfo ); |
302 } |
304 } |
303 else |
305 else |
304 { |
306 { |
305 responseCode = EMTPRespCodeGeneralError; |
307 responseCode = EMTPRespCodeGeneralError; |
|
308 } |
|
309 } |
306 } |
310 } |
307 } |
311 } |
308 } |
312 break; |
309 break; |
313 |
310 |
314 case EMTPObjectPropCodeName: // 0xDC44 |
311 case EMTPObjectPropCodeName: // 0xDC44 |
|
312 case EMTPObjectPropCodeAlbumArtist: |
315 { |
313 { |
316 responseCode = ServiceMetaDataToWrapperL( iPropCode, |
314 responseCode = ServiceMetaDataToWrapperL( iPropCode, |
317 *iMTPTypeString, |
315 *iMTPTypeString, |
318 *iObjectInfo ); |
316 *iObjectInfo ); |
319 } |
317 } |