150 |
150 |
151 TUint32 objectHandle = Request().Uint32( TMTPTypeRequest::ERequestParameter1 ); |
151 TUint32 objectHandle = Request().Uint32( TMTPTypeRequest::ERequestParameter1 ); |
152 CMTPObjectMetaData* objectInfo = iRequestChecker->GetObjectInfo( objectHandle ); |
152 CMTPObjectMetaData* objectInfo = iRequestChecker->GetObjectInfo( objectHandle ); |
153 if ( objectInfo == NULL ) |
153 if ( objectInfo == NULL ) |
154 { |
154 { |
155 PRINT( _L("MM MTP <> CGetObjectPropValue::CheckRequestL, objectInfo is NULL" ) ); |
155 PRINT( _L("MM MTP <> CSetObjectPropValue::CheckRequestL, objectInfo is NULL" ) ); |
156 return EMTPRespCodeInvalidObjectHandle; |
156 return EMTPRespCodeInvalidObjectHandle; |
157 } |
157 } |
158 |
158 |
159 TFileName fileName = objectInfo->DesC( CMTPObjectMetaData::ESuid ); |
159 TFileName fileName = objectInfo->DesC( CMTPObjectMetaData::ESuid ); |
160 TUint32 formatCode = objectInfo->Uint( CMTPObjectMetaData::EFormatCode ); |
160 TUint32 formatCode = objectInfo->Uint( CMTPObjectMetaData::EFormatCode ); |
161 PRINT3( _L( "MM MTP <> CGetObjectPropValue::CheckRequestL, handle = 0x%x, filename = %S, formatCode = 0x%x" ), |
161 PRINT3( _L( "MM MTP <> CSetObjectPropValue::CheckRequestL, handle = 0x%x, filename = %S, formatCode = 0x%x" ), |
162 objectHandle, |
162 objectHandle, |
163 &fileName, |
163 &fileName, |
164 formatCode ); |
164 formatCode ); |
165 const RArray<TUint>* properties = iDpConfig.GetSupportedPropertiesL( formatCode ); |
165 const RArray<TUint>* properties = iDpConfig.GetSupportedPropertiesL( formatCode ); |
166 TInt count = properties->Count(); |
166 TInt count = properties->Count(); |
267 break; |
267 break; |
268 |
268 |
269 case EMTPObjectPropCodeObjectFileName: |
269 case EMTPObjectPropCodeObjectFileName: |
270 { |
270 { |
271 TPtrC suid( iObjectInfo->DesC( CMTPObjectMetaData::ESuid ) ); |
271 TPtrC suid( iObjectInfo->DesC( CMTPObjectMetaData::ESuid ) ); |
272 TBuf<KMaxFileName> newSuid( iMTPTypeString->StringChars() ); |
272 TPtrC ptr ( iMTPTypeString->StringChars() ); |
273 PRINT2( _L( "MM MTP <> old name = %S, new name = %S" ), &suid, &newSuid ); |
273 if ( KMaxFileName < ptr.Length() ) |
274 TInt err = KErrNone; |
274 responseCode = EMTPRespCodeInvalidDataset; |
275 err = MmMtpDpUtility::UpdateObjectFileName( iFramework.Fs(), |
275 else |
276 suid, |
|
277 newSuid ); |
|
278 PRINT1( _L( "MM MTP <> Update object file name err = %d" ), err ); |
|
279 if ( KErrOverflow == err ) // full path name is too long |
|
280 { |
276 { |
281 responseCode = EMTPRespCodeInvalidDataset; |
277 TFileName newSuid( ptr ); |
282 } |
278 PRINT2( _L( "MM MTP <> old name = %S, new name = %S" ), &suid, &newSuid ); |
283 else if ( ( KErrNone == err ) || ( KErrAlreadyExists == err ) ) |
279 TInt err = KErrNone; |
284 { |
280 err = MmMtpDpUtility::UpdateObjectFileName( iFramework.Fs(), |
285 TRAP( err, iDpConfig.GetWrapperL().RenameObjectL( suid, newSuid ) ); //Update MPX DB |
281 suid, |
286 PRINT1( _L( "MM MTP <> Rename MPX object file name err = %d" ), err ); |
282 newSuid ); |
287 // it is ok if file is not found in DB, following S60 solution |
283 PRINT1( _L( "MM MTP <> Update object file name err = %d" ), err ); |
288 if ( KErrNotFound == err ) |
284 if ( KErrOverflow == err ) // full path name is too long |
289 { |
285 { |
290 TUint formatCode = iObjectInfo->Uint( CMTPObjectMetaData::EFormatCode ); |
286 responseCode = EMTPRespCodeInvalidDataset; |
291 TUint subFormatCode = iObjectInfo->Uint( CMTPObjectMetaData::EFormatSubCode ); |
|
292 TRAP( err, iDpConfig.GetWrapperL().AddObjectL( newSuid, formatCode, subFormatCode ) ); |
|
293 PRINT1( _L( "MM MTP <> Add MPX object file name err = %d" ), err ); |
|
294 } |
287 } |
295 |
288 else if ( ( KErrNone == err ) || ( KErrAlreadyExists == err ) ) |
296 if ( KErrNone == err ) |
|
297 { |
289 { |
298 iObjectInfo->SetDesCL( CMTPObjectMetaData::ESuid, newSuid ); |
290 TRAP( err, iDpConfig.GetWrapperL().RenameObjectL( suid, newSuid ) ); //Update MPX DB |
299 iFramework.ObjectMgr().ModifyObjectL( *iObjectInfo ); |
291 PRINT1( _L( "MM MTP <> Rename MPX object file name err = %d" ), err ); |
300 } |
292 // it is ok if file is not found in DB, following S60 solution |
301 else |
293 if ( KErrNotFound == err ) |
302 { |
294 { |
303 responseCode = EMTPRespCodeGeneralError; |
295 TUint formatCode = iObjectInfo->Uint( CMTPObjectMetaData::EFormatCode ); |
|
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 ); |
|
299 } |
|
300 if ( KErrNone == err ) |
|
301 { |
|
302 iObjectInfo->SetDesCL( CMTPObjectMetaData::ESuid, newSuid ); |
|
303 iFramework.ObjectMgr().ModifyObjectL( *iObjectInfo ); |
|
304 } |
|
305 else |
|
306 { |
|
307 responseCode = EMTPRespCodeGeneralError; |
|
308 } |
304 } |
309 } |
305 } |
310 } |
306 } |
311 } |
307 break; |
312 break; |
308 |
313 |