14 * Description: Implement the operation: SetObjectPropList |
14 * Description: Implement the operation: SetObjectPropList |
15 * |
15 * |
16 */ |
16 */ |
17 |
17 |
18 |
18 |
19 #include <mtp/mmtpdataproviderframework.h> |
|
20 #include <mtp/cmtptypeobjectproplist.h> |
19 #include <mtp/cmtptypeobjectproplist.h> |
21 #include <mtp/mmtpobjectmgr.h> |
20 #include <mtp/mmtpobjectmgr.h> |
22 #include <mtp/cmtptypestring.h> |
21 #include <mtp/cmtptypestring.h> |
23 #include <mtp/cmtptypearray.h> |
22 #include <mtp/cmtptypearray.h> |
24 |
23 |
229 PRINT1( _L( "MM MTP <> Update object file name err = %d" ), err ); |
228 PRINT1( _L( "MM MTP <> Update object file name err = %d" ), err ); |
230 if ( KErrOverflow == err ) // full path name is too long |
229 if ( KErrOverflow == err ) // full path name is too long |
231 { |
230 { |
232 responseCode = EMTPRespCodeInvalidDataset; |
231 responseCode = EMTPRespCodeInvalidDataset; |
233 } |
232 } |
234 else if ( ( KErrNone == err ) || ( KErrAlreadyExists == err ) ) |
233 else if ( KErrNone == err ) // TODO: ( KErrAlreadyExists == err ) |
235 { |
234 { |
236 TRAP( err, iDpConfig.GetWrapperL().RenameObjectL( suid, newSuid ) ); //Update MPX DB |
235 TRAP( err, iDpConfig.GetWrapperL().RenameObjectL( *object, newSuid ) ); //Update MPX DB |
237 PRINT1( _L( "MM MTP <> Rename Object err = %d" ), err ); |
236 |
|
237 PRINT1( _L( "MM MTP <> Rename MPX object file name err = %d" ), err ); |
238 // it is ok if file is not found in DB, following S60 solution |
238 // it is ok if file is not found in DB, following S60 solution |
239 if ( KErrNotFound == err ) |
239 if ( KErrNotFound == err ) |
240 { |
240 { |
241 TUint formatCode = object->Uint( CMTPObjectMetaData::EFormatCode ); |
241 TRAP( err, iDpConfig.GetWrapperL().AddObjectL( *object ) ); |
242 TUint subFormatCode = object->Uint( CMTPObjectMetaData::EFormatSubCode ); |
242 PRINT1( _L( "MM MTP <> Add MPX object file name err = %d" ), err ); |
243 TRAP( err, iDpConfig.GetWrapperL().AddObjectL( newSuid, formatCode, subFormatCode ) ); |
|
244 PRINT1( _L( "MM MTP <> Add Object err = %d" ), err ); |
|
245 } |
243 } |
246 |
244 |
247 if ( KErrNone == err ) |
245 object->SetDesCL( CMTPObjectMetaData::ESuid, newSuid ); |
248 { |
246 iFramework.ObjectMgr().ModifyObjectL( *object ); |
249 object->SetDesCL( CMTPObjectMetaData::ESuid, newSuid ); |
247 } |
250 iFramework.ObjectMgr().ModifyObjectL( *object ); |
248 else |
251 } |
249 { |
252 else |
250 responseCode = EMTPRespCodeGeneralError; |
253 { |
|
254 responseCode = EMTPRespCodeGeneralError; |
|
255 } |
|
256 } |
251 } |
257 } |
252 } |
258 } |
253 } |
259 break; |
254 break; |
260 |
255 |
261 case EMTPObjectPropCodeName: |
256 case EMTPObjectPropCodeName: |
|
257 case EMTPObjectPropCodeAlbumArtist: |
262 { |
258 { |
263 CMTPTypeString* stringData = CMTPTypeString::NewLC( |
259 CMTPTypeString* stringData = CMTPTypeString::NewLC( |
264 aPropListElement.StringL( CMTPTypeObjectPropListElement::EValue ) );// + stringData |
260 aPropListElement.StringL( CMTPTypeObjectPropListElement::EValue ) );// + stringData |
265 |
261 |
266 responseCode = iDpConfig.PropSettingUtility()->SetMetaDataToWrapper( iDpConfig, |
262 responseCode = iDpConfig.PropSettingUtility()->SetMetaDataToWrapper( iDpConfig, |