77 EXPORT_C CMoveObject::~CMoveObject() |
70 EXPORT_C CMoveObject::~CMoveObject() |
78 { |
71 { |
79 Cancel(); |
72 Cancel(); |
80 |
73 |
81 delete iDest; |
74 delete iDest; |
82 delete iFileMan; |
75 |
83 delete iPathToMove; |
|
84 delete iNewRootFolder; |
|
85 iObjectHandles.Close(); |
|
86 if ( iPropertyElement ) |
76 if ( iPropertyElement ) |
87 delete iPropertyElement; |
77 delete iPropertyElement; |
|
78 |
88 delete iPropertyList; |
79 delete iPropertyList; |
89 } |
80 } |
90 |
81 |
91 // ----------------------------------------------------------------------------- |
82 // ----------------------------------------------------------------------------- |
92 // CMoveObject::CMoveObject |
83 // CMoveObject::CMoveObject |
93 // Standard c++ constructor |
84 // Standard c++ constructor |
94 // ----------------------------------------------------------------------------- |
85 // ----------------------------------------------------------------------------- |
95 // |
86 // |
96 EXPORT_C CMoveObject::CMoveObject( MMTPDataProviderFramework& aFramework, |
87 EXPORT_C CMoveObject::CMoveObject( MMTPDataProviderFramework& aFramework, |
97 MMTPConnection& aConnection, |
88 MMTPConnection& aConnection, |
98 MMmMtpDpConfig& aDpConfig) : |
89 MMmMtpDpConfig& aDpConfig ) : |
99 CRequestProcessor( aFramework, aConnection, sizeof( KMTPMoveObjectPolicy ) |
90 CRequestProcessor( aFramework, |
100 /sizeof( TMTPRequestElementInfo ), KMTPMoveObjectPolicy), |
91 aConnection, |
101 iDpConfig( aDpConfig ), |
92 sizeof( KMTPMoveObjectPolicy ) / sizeof( TMTPRequestElementInfo ), |
102 iObjectHandles( KMmMtpRArrayGranularity ), |
93 KMTPMoveObjectPolicy ), |
103 iMoveObjectIndex( 0 ) |
94 iDpConfig( aDpConfig ) |
104 { |
95 { |
105 PRINT( _L( "Operation: MoveObject(0x1019)" ) ); |
96 PRINT( _L( "Operation: MoveObject(0x1019)" ) ); |
|
97 } |
|
98 |
|
99 // ----------------------------------------------------------------------------- |
|
100 // CMoveObject::ConstructL |
|
101 // Second phase constructor |
|
102 // ----------------------------------------------------------------------------- |
|
103 // |
|
104 EXPORT_C void CMoveObject::ConstructL() |
|
105 { |
|
106 iPropertyList = CMTPTypeObjectPropList::NewL(); |
|
107 |
|
108 // Set the CenRep value of MTP status, |
|
109 // also need to do in other processors which related to MPX |
|
110 SetPSStatus(); |
106 } |
111 } |
107 |
112 |
108 // ----------------------------------------------------------------------------- |
113 // ----------------------------------------------------------------------------- |
109 // CMoveObject::ServiceL |
114 // CMoveObject::ServiceL |
110 // MoveObject request handler |
115 // MoveObject request handler |
111 // ----------------------------------------------------------------------------- |
116 // ----------------------------------------------------------------------------- |
112 // |
117 // |
113 EXPORT_C void CMoveObject::ServiceL() |
118 EXPORT_C void CMoveObject::ServiceL() |
114 { |
119 { |
115 PRINT( _L( "MM MTP => CMoveObject::ServiceL" ) ); |
120 PRINT( _L( "MM MTP => CMoveObject::ServiceL" ) ); |
116 TMTPResponseCode ret = MoveObjectL(); |
121 |
117 PRINT1( _L( "MM MTP <> CMoveObject::ServiceL ret = 0x%x" ), ret ); |
122 MoveObjectL(); |
118 if ( EMTPRespCodeOK != ret ) |
123 |
119 { |
|
120 SendResponseL( ret ); |
|
121 } |
|
122 PRINT( _L( "MM MTP <= CMoveObject::ServiceL" ) ); |
124 PRINT( _L( "MM MTP <= CMoveObject::ServiceL" ) ); |
123 } |
125 } |
124 |
126 |
125 // ----------------------------------------------------------------------------- |
127 // ----------------------------------------------------------------------------- |
126 // CMoveObject::ConstructL |
|
127 // Second phase constructor |
|
128 // ----------------------------------------------------------------------------- |
|
129 // |
|
130 EXPORT_C void CMoveObject::ConstructL() |
|
131 { |
|
132 CActiveScheduler::Add( this ); |
|
133 |
|
134 iPropertyList = CMTPTypeObjectPropList::NewL(); |
|
135 SetPSStatus(); |
|
136 } |
|
137 |
|
138 // ----------------------------------------------------------------------------- |
|
139 // CMoveObject::RunL |
|
140 // |
|
141 // ----------------------------------------------------------------------------- |
|
142 // |
|
143 EXPORT_C void CMoveObject::RunL() |
|
144 { |
|
145 PRINT( _L( "MM MTP => CMoveObject::RunL" ) ); |
|
146 if ( MoveOwnedObjectsL() ) |
|
147 { |
|
148 // Reset iMoveObjectIndex count since move completed |
|
149 iMoveObjectIndex = 0; |
|
150 |
|
151 TMTPResponseCode ret = EMTPRespCodeOK; |
|
152 // Delete the original folders in the device dp. |
|
153 if ( iObjectInfo->Uint( CMTPObjectMetaData::EDataProviderId ) |
|
154 == iFramework.DataProviderId() ) |
|
155 { |
|
156 ret = FinalPhaseMove(); |
|
157 } |
|
158 PRINT1( _L("MM MTP <> CMoveObject::RunL ret = 0x%x"), ret ); |
|
159 SendResponseL( ret ); |
|
160 } |
|
161 PRINT( _L( "MM MTP <= CMoveObject::RunL" ) ); |
|
162 } |
|
163 |
|
164 // ----------------------------------------------------------------------------- |
|
165 // CMoveObject::RunError |
|
166 // |
|
167 // ----------------------------------------------------------------------------- |
|
168 // |
|
169 EXPORT_C TInt CMoveObject::RunError( TInt aError ) |
|
170 { |
|
171 if ( aError != KErrNone ) |
|
172 PRINT1( _L( "MM MTP <> CMoveObject::RunError aError = %d" ), aError ); |
|
173 TRAP_IGNORE( SendResponseL( EMTPRespCodeGeneralError ) ); |
|
174 return KErrNone; |
|
175 } |
|
176 |
|
177 // ----------------------------------------------------------------------------- |
|
178 // CMoveObject::MoveFileL |
|
179 // A helper function of MoveObjectL |
|
180 // ----------------------------------------------------------------------------- |
|
181 // |
|
182 void CMoveObject::MoveFileL( const TDesC& aNewFileName ) |
|
183 { |
|
184 PRINT1( _L( "MM MTP => CMoveObject::MoveFileL aNewFileName = %S" ), &aNewFileName ); |
|
185 const TDesC& suid( iObjectInfo->DesC( CMTPObjectMetaData::ESuid ) ); |
|
186 TFileName oldFileName( suid ); // save the old file name, the suid will be modified |
|
187 PRINT1( _L( "MM MTP <> CMoveObject::MoveFileL oldFileName = %S" ), &suid ); |
|
188 |
|
189 if ( iStorageId == iObjectInfo->Uint( CMTPObjectMetaData::EStorageId ) ) |
|
190 iSameStorage = ETrue; |
|
191 else |
|
192 iSameStorage = EFalse; |
|
193 GetPreviousPropertiesL( *iObjectInfo ); |
|
194 User::LeaveIfError( iFileMan->Move( suid, aNewFileName ) ); // iDest just Folder |
|
195 User::LeaveIfError( iFramework.Fs().SetModified( aNewFileName, iPreviousModifiedTime ) ); |
|
196 |
|
197 iObjectInfo->SetDesCL( CMTPObjectMetaData::ESuid, aNewFileName ); |
|
198 iObjectInfo->SetUint( CMTPObjectMetaData::EStorageId, iStorageId ); |
|
199 iObjectInfo->SetUint( CMTPObjectMetaData::EParentHandle, iNewParentHandle ); |
|
200 iFramework.ObjectMgr().ModifyObjectL( *iObjectInfo ); |
|
201 SetPropertiesL( oldFileName, aNewFileName, *iObjectInfo ); |
|
202 PRINT( _L( "MM MTP <= CMoveObject::MoveFileL" ) ); |
|
203 } |
|
204 |
|
205 // ----------------------------------------------------------------------------- |
|
206 // CMoveObject::MoveOwnedObjectsL |
|
207 // Move the objects through iterations of RunL |
|
208 // ----------------------------------------------------------------------------- |
|
209 // |
|
210 TBool CMoveObject::MoveOwnedObjectsL() |
|
211 { |
|
212 PRINT( _L( "MM MTP => CMoveObject::MoveOwnedObjectsL" ) ); |
|
213 TBool ret = EFalse; |
|
214 |
|
215 if ( iMoveObjectIndex < iNumberOfObjects ) |
|
216 { |
|
217 MoveAndUpdateL( iObjectHandles[iMoveObjectIndex++] ); |
|
218 |
|
219 TRequestStatus* status = &iStatus; |
|
220 User::RequestComplete( status, iStatus.Int() ); |
|
221 SetActive(); |
|
222 } |
|
223 else |
|
224 { |
|
225 ret = ETrue; |
|
226 } |
|
227 |
|
228 PRINT1( _L( "MM MTP <= CMoveObject::MoveOwnedObjectsL ret = %d" ), ret ); |
|
229 return ret; |
|
230 } |
|
231 |
|
232 // ----------------------------------------------------------------------------- |
|
233 // CMoveObject::MoveFolderL |
|
234 // A helper function of MoveObjectL |
|
235 // ----------------------------------------------------------------------------- |
|
236 // |
|
237 void CMoveObject::MoveFolderL() |
|
238 { |
|
239 PRINT( _L( "MM MTP => CMoveObject::MoveFolderL" ) ); |
|
240 RBuf oldFolderName; |
|
241 oldFolderName.CreateL( KMaxFileName ); |
|
242 oldFolderName.CleanupClosePushL(); // + oldFileName |
|
243 oldFolderName = iObjectInfo->DesC( CMTPObjectMetaData::ESuid ); |
|
244 PRINT1( _L( "MM MTP <> CMoveObject::MoveFolderL oldFolderName = %S" ), &oldFolderName ); |
|
245 iPathToMove = oldFolderName.AllocL(); |
|
246 CleanupStack::PopAndDestroy( &oldFolderName ); // - oldFolderName |
|
247 |
|
248 GenerateObjectHandleListL( iObjectInfo->Uint( CMTPObjectMetaData::EHandle ) ); |
|
249 |
|
250 iNumberOfObjects = iObjectHandles.Count(); |
|
251 PRINT1( _L( "MM MTP <> CMoveObject::MoveFolderL iNumberOfObjects = %d" ), iNumberOfObjects ); |
|
252 |
|
253 TRequestStatus* status = &iStatus; |
|
254 User::RequestComplete( status, iStatus.Int() ); |
|
255 SetActive(); |
|
256 |
|
257 PRINT( _L( "MM MTP <= CMoveObject::MoveFolderL" ) ); |
|
258 } |
|
259 |
|
260 // ----------------------------------------------------------------------------- |
|
261 // CMoveObject::MoveObjectL |
128 // CMoveObject::MoveObjectL |
262 // move object operations |
129 // Move object operation |
263 // ----------------------------------------------------------------------------- |
130 // ----------------------------------------------------------------------------- |
264 // |
131 // |
265 TMTPResponseCode CMoveObject::MoveObjectL() |
132 void CMoveObject::MoveObjectL() |
266 { |
133 { |
267 PRINT( _L( "MM MTP => CMoveObject::MoveObjectL" ) ); |
134 PRINT( _L( "MM MTP => CMoveObject::MoveObjectL" ) ); |
268 TMTPResponseCode responseCode = EMTPRespCodeOK; |
135 TMTPResponseCode responseCode = EMTPRespCodeOK; |
269 |
136 |
270 GetParametersL(); |
137 GetParametersL(); |
274 newObjectName.CleanupClosePushL(); // + newObjectName |
141 newObjectName.CleanupClosePushL(); // + newObjectName |
275 newObjectName = *iDest; |
142 newObjectName = *iDest; |
276 |
143 |
277 const TDesC& suid( iObjectInfo->DesC( CMTPObjectMetaData::ESuid ) ); |
144 const TDesC& suid( iObjectInfo->DesC( CMTPObjectMetaData::ESuid ) ); |
278 TParsePtrC fileNameParser( suid ); |
145 TParsePtrC fileNameParser( suid ); |
279 |
146 if ( ( newObjectName.Length() + fileNameParser.NameAndExt().Length() ) |
280 // Check if the object is a folder or a file. |
147 <= newObjectName.MaxLength() ) |
281 TBool isFolder = EFalse; |
148 { |
282 User::LeaveIfError( BaflUtils::IsFolder( iFramework.Fs(), suid, isFolder ) ); |
149 newObjectName.Append( fileNameParser.NameAndExt() ); |
283 |
|
284 if ( !isFolder ) |
|
285 { |
|
286 if ( ( newObjectName.Length() + fileNameParser.NameAndExt().Length() ) <= newObjectName.MaxLength() ) |
|
287 { |
|
288 newObjectName.Append( fileNameParser.NameAndExt() ); |
|
289 } |
|
290 responseCode = CanMoveObjectL( suid, newObjectName ); |
150 responseCode = CanMoveObjectL( suid, newObjectName ); |
291 } |
151 |
292 else // It is a folder. |
152 if ( responseCode == EMTPRespCodeOK ) |
293 { |
|
294 TFileName rightMostFolderName; |
|
295 User::LeaveIfError( BaflUtils::MostSignificantPartOfFullName( suid, |
|
296 rightMostFolderName ) ); |
|
297 if ( ( newObjectName.Length() + rightMostFolderName.Length() + 1 ) <= newObjectName.MaxLength() ) |
|
298 { |
|
299 newObjectName.Append( rightMostFolderName ); |
|
300 // Add backslash. |
|
301 _LIT( KBackSlash, "\\" ); |
|
302 newObjectName.Append( KBackSlash ); |
|
303 } |
|
304 } |
|
305 |
|
306 iNewRootFolder = newObjectName.AllocL(); |
|
307 |
|
308 if ( responseCode == EMTPRespCodeOK ) |
|
309 { |
|
310 delete iFileMan; |
|
311 iFileMan = NULL; |
|
312 iFileMan = CFileMan::NewL( iFramework.Fs() ); |
|
313 |
|
314 if ( !isFolder ) |
|
315 { |
|
316 MoveFileL( newObjectName ); |
153 MoveFileL( newObjectName ); |
317 SendResponseL( responseCode ); |
154 } |
318 } |
155 else |
319 else |
156 // Destination is not appropriate for the full path name shouldn't be longer than 255 |
320 { |
157 responseCode = EMTPRespCodeInvalidDataset; |
321 MoveFolderL(); |
158 |
322 } |
159 SendResponseL( responseCode ); |
323 } |
160 |
324 CleanupStack::PopAndDestroy( &newObjectName ); // - newObjectName. |
161 CleanupStack::PopAndDestroy( &newObjectName ); // - newObjectName |
325 |
162 |
326 PRINT1( _L( "MM MTP <= CMoveObject::MoveObjectL responseCode = 0x%x" ), responseCode ); |
163 PRINT1( _L( "MM MTP <= CMoveObject::MoveObjectL responseCode = 0x%x" ), responseCode ); |
327 return responseCode; |
|
328 } |
164 } |
329 |
165 |
330 // ----------------------------------------------------------------------------- |
166 // ----------------------------------------------------------------------------- |
331 // CMoveObject::GetParametersL |
167 // CMoveObject::GetParametersL |
332 // Retrieve the parameters of the request |
168 // Retrieve the parameters of the request |
333 // ----------------------------------------------------------------------------- |
169 // ----------------------------------------------------------------------------- |
334 // |
170 // |
335 void CMoveObject::GetParametersL() |
171 void CMoveObject::GetParametersL() |
336 { |
172 { |
337 PRINT( _L( "MM MTP => CMoveObject::GetParametersL" ) ); |
173 PRINT( _L( "MM MTP => CMoveObject::GetParametersL" ) ); |
|
174 |
338 __ASSERT_DEBUG( iRequestChecker, Panic( EMmMTPDpRequestCheckNull ) ); |
175 __ASSERT_DEBUG( iRequestChecker, Panic( EMmMTPDpRequestCheckNull ) ); |
339 |
176 |
340 TUint32 objectHandle = Request().Uint32( TMTPTypeRequest::ERequestParameter1 ); |
177 TUint32 objectHandle = Request().Uint32( TMTPTypeRequest::ERequestParameter1 ); |
341 iStorageId = Request().Uint32( TMTPTypeRequest::ERequestParameter2 ); |
178 iStorageId = Request().Uint32( TMTPTypeRequest::ERequestParameter2 ); |
342 iNewParentHandle = Request().Uint32( TMTPTypeRequest::ERequestParameter3 ); |
179 iNewParentHandle = Request().Uint32( TMTPTypeRequest::ERequestParameter3 ); |
343 PRINT3( _L( "MM MTP <> objectHandle = 0x%x, iStoargeId = 0x%x, iNewParentHandle = 0x%x" ), |
180 PRINT3( _L( "MM MTP <> objectHandle = 0x%x, iStorageId = 0x%x, iNewParentHandle = 0x%x" ), |
344 objectHandle, iStorageId, iNewParentHandle ); |
181 objectHandle, |
|
182 iStorageId, |
|
183 iNewParentHandle ); |
345 |
184 |
346 // not taking owernship |
185 // not taking owernship |
347 iObjectInfo = iRequestChecker->GetObjectInfo( objectHandle ); |
186 iObjectInfo = iRequestChecker->GetObjectInfo( objectHandle ); |
348 __ASSERT_DEBUG( iObjectInfo, Panic( EMmMTPDpObjectNull ) ); |
187 __ASSERT_DEBUG( iObjectInfo, Panic( EMmMTPDpObjectNull ) ); |
349 |
188 |
350 if ( iNewParentHandle == 0 ) |
189 if ( iNewParentHandle == KMTPHandleNone ) |
351 { |
190 { |
352 SetDefaultParentObjectL(); |
191 SetDefaultParentObjectL(); |
353 } |
192 } |
354 else |
193 else |
355 { |
194 { |
356 CMTPObjectMetaData* parentObjectInfo = |
195 CMTPObjectMetaData* parentObject = iRequestChecker->GetObjectInfo( iNewParentHandle ); |
357 iRequestChecker->GetObjectInfo( iNewParentHandle ); |
196 __ASSERT_DEBUG( parentObject, Panic( EMmMTPDpObjectNull ) ); |
358 __ASSERT_DEBUG( parentObjectInfo, Panic( EMmMTPDpObjectNull ) ); |
197 |
359 delete iDest; |
198 delete iDest; |
360 iDest = NULL; |
199 iDest = NULL; |
361 iDest = parentObjectInfo->DesC( CMTPObjectMetaData::ESuid ).AllocL(); |
200 iDest = parentObject->DesC( CMTPObjectMetaData::ESuid ).AllocL(); |
362 PRINT1( _L( "MM MTP <> CMoveObject::GetParametersL iDest = %S" ), iDest ); |
201 PRINT1( _L( "MM MTP <> CMoveObject::GetParametersL iDest = %S" ), iDest ); |
363 } |
202 } |
364 PRINT( _L( "MM MTP <= CMoveObject::GetParametersL" ) ); |
203 PRINT( _L( "MM MTP <= CMoveObject::GetParametersL" ) ); |
365 } |
204 } |
366 |
205 |
433 PRINT1( _L( "MM MTP <= CMoveObject::CanMoveObjectL result = 0x%x" ), result ); |
273 PRINT1( _L( "MM MTP <= CMoveObject::CanMoveObjectL result = 0x%x" ), result ); |
434 return result; |
274 return result; |
435 } |
275 } |
436 |
276 |
437 // ----------------------------------------------------------------------------- |
277 // ----------------------------------------------------------------------------- |
|
278 // CMoveObject::MoveFileL |
|
279 // A helper function of MoveObjectL |
|
280 // ----------------------------------------------------------------------------- |
|
281 // |
|
282 void CMoveObject::MoveFileL( const TDesC& aNewFileName ) |
|
283 { |
|
284 TFileName oldFileName = iObjectInfo->DesC( CMTPObjectMetaData::ESuid ); |
|
285 PRINT2( _L( "MM MTP => CMoveObject::MoveFileL old name = %S, aNewFileName = %S" ), |
|
286 &oldFileName, |
|
287 &aNewFileName ); |
|
288 |
|
289 if ( iStorageId == iObjectInfo->Uint( CMTPObjectMetaData::EStorageId ) ) |
|
290 iSameStorage = ETrue; |
|
291 else |
|
292 iSameStorage = EFalse; |
|
293 |
|
294 // Move the file first no matter if it will fail in Get/SetPreviousPropertiesL |
|
295 // Already trapped inside |
|
296 GetPreviousPropertiesL( *iObjectInfo ); |
|
297 TRAPD( err, SetPropertiesL( aNewFileName ) ); |
|
298 |
|
299 CFileMan* fileMan = CFileMan::NewL( iFramework.Fs() ); |
|
300 err = fileMan->Move( oldFileName, aNewFileName ); |
|
301 |
|
302 if ( err != KErrNone ) |
|
303 PRINT1( _L( "MM MTP <> CMoveObject::MoveFileL err = %d" ), err ); |
|
304 |
|
305 PRINT( _L( "MM MTP <= CMoveObject::MoveFileL" ) ); |
|
306 } |
|
307 |
|
308 // ----------------------------------------------------------------------------- |
438 // CMoveObject::GetPreviousPropertiesL |
309 // CMoveObject::GetPreviousPropertiesL |
439 // Save the object properties before doing the move |
310 // Save the object properties before doing the move |
440 // ----------------------------------------------------------------------------- |
311 // ----------------------------------------------------------------------------- |
441 // |
312 // |
442 void CMoveObject::GetPreviousPropertiesL( const CMTPObjectMetaData& aObject ) |
313 void CMoveObject::GetPreviousPropertiesL( const CMTPObjectMetaData& aObject ) |
443 { |
314 { |
444 PRINT( _L( "MM MTP => CMoveObject::GetPreviousPropertiesL" ) ); |
315 PRINT( _L( "MM MTP => CMoveObject::GetPreviousPropertiesL" ) ); |
445 |
316 |
446 const TDesC& suid( aObject.DesC( CMTPObjectMetaData::ESuid ) ); |
317 const TDesC& suid( aObject.DesC( CMTPObjectMetaData::ESuid ) ); |
447 |
|
448 User::LeaveIfError( iFramework.Fs().Modified( suid, iPreviousModifiedTime ) ); |
|
449 |
318 |
450 // same storage, not necessary to get the properties |
319 // same storage, not necessary to get the properties |
451 if ( iSameStorage ) |
320 if ( iSameStorage ) |
452 return; |
321 return; |
453 |
322 |
454 TUint formatCode = aObject.Uint( CMTPObjectMetaData::EFormatCode ); |
323 TUint formatCode = aObject.Uint( CMTPObjectMetaData::EFormatCode ); |
455 const RArray<TUint>* properties = iDpConfig.GetSupportedPropertiesL( formatCode ); |
324 const RArray<TUint>* properties = iDpConfig.GetSupportedPropertiesL( formatCode ); |
456 TInt count = properties->Count(); |
325 TInt count = properties->Count(); |
457 CMTPTypeString* textData = NULL; |
|
458 TInt err = KErrNone; |
326 TInt err = KErrNone; |
459 TUint16 propCode; |
327 TUint16 propCode; |
460 TUint32 handle = aObject.Uint( CMTPObjectMetaData::EHandle ) ; |
328 TUint32 handle = aObject.Uint( CMTPObjectMetaData::EHandle ); |
461 |
329 |
462 if ( iPropertyElement ) |
330 if ( iPropertyElement != NULL ) |
463 { |
331 { |
464 delete iPropertyElement; |
332 delete iPropertyElement; |
465 iPropertyElement = NULL; |
333 iPropertyElement = NULL; |
466 } |
334 } |
467 |
335 |
468 for ( TInt i = 0; i < count; i++ ) |
336 for ( TInt i = 0; i < count; i++ ) |
469 { |
337 { |
470 propCode = (*properties)[i]; |
338 propCode = ( *properties )[i]; |
471 switch( propCode ) |
339 |
|
340 switch ( propCode ) |
472 { |
341 { |
473 case EMTPObjectPropCodeStorageID: |
342 case EMTPObjectPropCodeStorageID: |
474 case EMTPObjectPropCodeObjectFormat: |
343 case EMTPObjectPropCodeObjectFormat: |
475 case EMTPObjectPropCodeProtectionStatus: |
344 case EMTPObjectPropCodeProtectionStatus: |
476 case EMTPObjectPropCodeObjectSize: |
345 case EMTPObjectPropCodeObjectSize: |
477 case EMTPObjectPropCodeObjectFileName: |
346 case EMTPObjectPropCodeObjectFileName: |
478 case EMTPObjectPropCodeParentObject: |
347 case EMTPObjectPropCodeParentObject: |
479 case EMTPObjectPropCodePersistentUniqueObjectIdentifier: |
348 case EMTPObjectPropCodePersistentUniqueObjectIdentifier: |
480 case EMTPObjectPropCodeNonConsumable: |
|
481 case EMTPObjectPropCodeDateCreated: |
349 case EMTPObjectPropCodeDateCreated: |
482 case EMTPObjectPropCodeDateModified: |
350 case EMTPObjectPropCodeDateModified: |
483 break; |
351 break; |
484 |
352 |
|
353 case EMTPObjectPropCodeNonConsumable: |
|
354 iPropertyElement = &( iPropertyList->ReservePropElemL( handle, propCode ) ); |
|
355 iPropertyElement->SetUint8L( CMTPTypeObjectPropListElement::EValue, |
|
356 aObject.Uint( CMTPObjectMetaData::ENonConsumable ) ); |
|
357 break; |
|
358 |
485 case EMTPObjectPropCodeName: |
359 case EMTPObjectPropCodeName: |
486 case EMTPObjectPropCodeDateAdded: |
360 case EMTPObjectPropCodeDateAdded: |
487 if ( ( propCode == EMTPObjectPropCodeName ) |
361 case EMTPObjectPropCodeAlbumArtist: |
488 || ( ( !MmMtpDpUtility::IsVideoL( aObject.DesC( CMTPObjectMetaData::ESuid ), iFramework ) ) |
362 { |
489 && ( propCode == EMTPObjectPropCodeDateAdded ) ) ) |
363 CMTPTypeString* textData = CMTPTypeString::NewLC(); // + textData |
|
364 |
|
365 TRAP( err, iDpConfig.GetWrapperL().GetObjectMetadataValueL( propCode, |
|
366 *textData, |
|
367 aObject ) ); |
|
368 PRINT1( _L( "MM MTP <> CMoveObject::GetPreviousPropertiesL err = %d" ), err ); |
|
369 |
|
370 if ( err == KErrNone ) |
490 { |
371 { |
491 textData = CMTPTypeString::NewLC(); // + textData |
372 iPropertyElement = &( iPropertyList->ReservePropElemL( handle, propCode ) ); |
492 |
373 iPropertyElement->SetStringL( CMTPTypeObjectPropListElement::EValue, |
493 TRAP( err, iDpConfig.GetWrapperL().GetObjectMetadataValueL( propCode, |
374 textData->StringChars() ); |
494 *textData, |
|
495 aObject ) ); |
|
496 |
|
497 PRINT1( _L( "MM MTP <> CMoveObject::GetPreviousPropertiesL::ServiceSpecificObjectPropertyL err = %d" ), err ); |
|
498 |
|
499 if ( err == KErrNone ) |
|
500 { |
|
501 iPropertyElement = &(iPropertyList->ReservePropElemL(handle, propCode)); |
|
502 iPropertyElement->SetStringL(CMTPTypeObjectPropListElement::EValue, textData->StringChars()); |
|
503 // iPropertyElement = CMTPTypeObjectPropListElement::NewL( |
|
504 // handle, propCode, *textData ); |
|
505 } |
|
506 else if ( err == KErrNotFound ) |
|
507 { |
|
508 iPropertyElement = NULL; |
|
509 } |
|
510 else |
|
511 { |
|
512 User::Leave( err ); |
|
513 } |
|
514 |
|
515 CleanupStack::PopAndDestroy( textData ); // - textData |
|
516 } |
375 } |
|
376 else |
|
377 { |
|
378 iPropertyElement = NULL; |
|
379 } |
|
380 |
|
381 CleanupStack::PopAndDestroy( textData ); // - textData |
|
382 } |
517 break; |
383 break; |
518 |
384 |
519 default: |
385 default: |
520 { |
386 { |
521 ServiceGetSpecificObjectPropertyL( propCode, handle, aObject ); |
387 ServiceGetSpecificObjectPropertyL( propCode, handle, aObject ); |
522 } |
388 } |
523 break; |
389 break; |
524 } |
390 } |
525 |
391 |
526 if ( iPropertyElement ) |
392 if ( iPropertyElement != NULL ) |
527 { |
393 { |
528 iPropertyList->CommitPropElemL( *iPropertyElement ); |
394 iPropertyList->CommitPropElemL( *iPropertyElement ); |
529 |
|
530 iPropertyElement = NULL; |
395 iPropertyElement = NULL; |
531 } |
396 } |
532 |
|
533 } // end of for loop |
397 } // end of for loop |
534 |
398 |
535 PRINT1( _L( "MM MTP <= CMoveObject::GetPreviousPropertiesL err = %d" ), err ); |
399 PRINT1( _L( "MM MTP <= CMoveObject::GetPreviousPropertiesL err = %d" ), err ); |
536 } |
|
537 |
|
538 // ----------------------------------------------------------------------------- |
|
539 // CMoveObject::ServiceMetaDataToWrapper |
|
540 // |
|
541 // ----------------------------------------------------------------------------- |
|
542 // |
|
543 EXPORT_C TMTPResponseCode CMoveObject::ServiceMetaDataToWrapper( |
|
544 const TUint16 aPropCode, |
|
545 MMTPType& aNewData, |
|
546 const CMTPObjectMetaData& aObject ) |
|
547 { |
|
548 TMTPResponseCode resCode = EMTPRespCodeOK; |
|
549 |
|
550 TRAPD( err, iDpConfig.GetWrapperL().SetObjectMetadataValueL( aPropCode, |
|
551 aNewData, |
|
552 aObject ) ); |
|
553 |
|
554 PRINT1( _L("MM MTP <> CMoveObject::ServiceMetaDataToWrapper err = %d"), err); |
|
555 |
|
556 if ( err == KErrNone ) |
|
557 { |
|
558 resCode = EMTPRespCodeOK; |
|
559 } |
|
560 else if ( err == KErrTooBig ) |
|
561 // according to the codes of S60 |
|
562 { |
|
563 resCode = EMTPRespCodeInvalidDataset; |
|
564 } |
|
565 else if ( err == KErrPermissionDenied ) |
|
566 { |
|
567 resCode = EMTPRespCodeAccessDenied; |
|
568 } |
|
569 else if ( err == KErrNotFound ) |
|
570 { |
|
571 if ( MmMtpDpUtility::HasMetadata( aObject.Uint( CMTPObjectMetaData::EFormatCode ) ) ) |
|
572 resCode = EMTPRespCodeAccessDenied; |
|
573 else |
|
574 resCode = EMTPRespCodeOK; |
|
575 } |
|
576 else |
|
577 { |
|
578 resCode = EMTPRespCodeGeneralError; |
|
579 } |
|
580 |
|
581 PRINT1( _L("MM MTP <= CMoveObject::ServiceMetaDataToWrapper resCode = 0x%x"), resCode); |
|
582 |
|
583 return resCode; |
|
584 } |
400 } |
585 |
401 |
586 // ----------------------------------------------------------------------------- |
402 // ----------------------------------------------------------------------------- |
587 // CMoveObject::SetPreviousPropertiesL |
403 // CMoveObject::SetPreviousPropertiesL |
588 // Set the object properties after doing the move |
404 // Set the object properties after doing the move |
589 // ----------------------------------------------------------------------------- |
405 // ----------------------------------------------------------------------------- |
590 // |
406 // |
591 void CMoveObject::SetPreviousPropertiesL( const CMTPObjectMetaData& aObject ) |
407 void CMoveObject::SetPreviousPropertiesL() |
592 { |
408 { |
593 PRINT( _L( "MM MTP => CMoveObject::SetPreviousPropertiesL" ) ); |
409 PRINT( _L( "MM MTP => CMoveObject::SetPreviousPropertiesL" ) ); |
594 const TInt count( iPropertyList->NumberOfElements() ); |
410 |
595 PRINT1( _L( "MM MTP <> CMoveObject::SetPreviousPropertiesL count = %d" ), count ); |
|
596 TMTPResponseCode respcode = EMTPRespCodeOK; |
411 TMTPResponseCode respcode = EMTPRespCodeOK; |
597 CMTPTypeString* stringData = NULL; |
412 |
598 iPropertyList->ResetCursor(); |
413 iPropertyList->ResetCursor(); |
599 |
414 const TInt count = iPropertyList->NumberOfElements(); |
600 for ( TInt i = 0; i < count; i++ ) |
415 for ( TInt i = 0; i < count; i++ ) |
601 { |
416 { |
602 CMTPTypeObjectPropListElement& element = iPropertyList->GetNextElementL( ); |
417 CMTPTypeObjectPropListElement& element = iPropertyList->GetNextElementL(); |
603 |
418 |
604 TUint32 handle = element.Uint32L( |
419 TUint32 handle = element.Uint32L( CMTPTypeObjectPropListElement::EObjectHandle ); |
605 CMTPTypeObjectPropListElement::EObjectHandle ); |
420 TUint16 propertyCode = element.Uint16L( CMTPTypeObjectPropListElement::EPropertyCode ); |
606 TUint16 propertyCode = element.Uint16L( |
421 TUint16 dataType = element.Uint16L( CMTPTypeObjectPropListElement::EDatatype ); |
607 CMTPTypeObjectPropListElement::EPropertyCode ); |
422 PRINT3( _L( "MM MTP <> CCopyObject::SetPreviousPropertiesL = 0x%x, propertyCode = 0x%x, dataType = 0x%x" ), |
608 TUint16 dataType = element.Uint16L( |
423 handle, |
609 CMTPTypeObjectPropListElement::EDatatype ); |
424 propertyCode, |
610 PRINT3( _L( "MM MTP <> CMoveObject::SetPreviousPropertiesL = 0x%x, propertyCode = 0x%x, dataType = 0x%x" ), |
425 dataType ); |
611 handle, propertyCode, dataType ); |
|
612 |
426 |
613 switch ( propertyCode ) |
427 switch ( propertyCode ) |
614 { |
428 { |
615 case EMTPObjectPropCodeStorageID: |
429 case EMTPObjectPropCodeStorageID: |
616 case EMTPObjectPropCodeObjectFormat: |
430 case EMTPObjectPropCodeObjectFormat: |
617 case EMTPObjectPropCodeProtectionStatus: |
431 case EMTPObjectPropCodeProtectionStatus: |
618 case EMTPObjectPropCodeObjectSize: |
432 case EMTPObjectPropCodeObjectSize: |
619 case EMTPObjectPropCodeObjectFileName: |
433 case EMTPObjectPropCodeObjectFileName: |
620 case EMTPObjectPropCodeParentObject: |
434 case EMTPObjectPropCodeParentObject: |
621 case EMTPObjectPropCodePersistentUniqueObjectIdentifier: |
435 case EMTPObjectPropCodePersistentUniqueObjectIdentifier: |
622 case EMTPObjectPropCodeNonConsumable: |
|
623 case EMTPObjectPropCodeDateCreated: |
436 case EMTPObjectPropCodeDateCreated: |
624 case EMTPObjectPropCodeDateModified: |
437 case EMTPObjectPropCodeDateModified: |
625 case EMTPObjectPropCodeDateAdded: |
438 case EMTPObjectPropCodeDateAdded: |
626 break; |
439 break; |
627 |
440 |
|
441 case EMTPObjectPropCodeNonConsumable: |
|
442 iObjectInfo->SetUint( CMTPObjectMetaData::ENonConsumable, |
|
443 element.Uint8L( CMTPTypeObjectPropListElement::EValue ) ); |
|
444 iFramework.ObjectMgr().ModifyObjectL( *iObjectInfo ); |
|
445 break; |
|
446 |
628 case EMTPObjectPropCodeName: |
447 case EMTPObjectPropCodeName: |
|
448 case EMTPObjectPropCodeAlbumArtist: |
629 { |
449 { |
630 stringData = CMTPTypeString::NewLC( |
450 CMTPTypeString *stringData = CMTPTypeString::NewLC( element.StringL( CMTPTypeObjectPropListElement::EValue ) ); // + stringData |
631 element.StringL(CMTPTypeObjectPropListElement::EValue)); // + stringData |
451 |
632 |
452 respcode = iDpConfig.PropSettingUtility()->SetMetaDataToWrapper( iDpConfig, |
633 respcode = ServiceMetaDataToWrapper( propertyCode, |
453 propertyCode, |
634 *stringData, |
454 *stringData, |
635 aObject ); |
455 *iObjectInfo ); |
636 |
456 |
637 CleanupStack::PopAndDestroy( stringData ); // - stringData |
457 CleanupStack::PopAndDestroy( stringData ); // - stringData |
638 } |
458 } |
639 break; |
459 break; |
640 |
460 |
641 default: |
461 default: |
642 { |
462 { |
643 respcode = ServiceSetSpecificObjectPropertyL( propertyCode, |
463 respcode = iDpConfig.PropSettingUtility()->SetSpecificObjectPropertyL( iDpConfig, |
644 aObject, |
464 propertyCode, |
645 element ); |
465 *iObjectInfo, |
|
466 element ); |
646 } |
467 } |
647 break; |
468 break; |
648 } |
469 } |
649 } // end of for loop |
470 } // end of for loop |
650 |
471 |
651 if( respcode == EMTPRespCodeOK ) |
472 // ignore errors |
652 { |
473 if ( respcode == EMTPRespCodeOK ) |
653 // do nothing, ignore warning |
474 { |
|
475 // do nothing, just to get rid of build warning |
654 } |
476 } |
655 |
477 |
656 PRINT1( _L( "MM MTP <= CMoveObject::SetPreviousPropertiesL respcode = 0x%x" ), respcode ); |
478 PRINT1( _L( "MM MTP <= CMoveObject::SetPreviousPropertiesL respcode = 0x%x" ), respcode ); |
657 } |
479 } |
658 |
480 |
659 // ----------------------------------------------------------------------------- |
481 // ----------------------------------------------------------------------------- |
660 // CMoveObject::SetPropertiesL |
482 // CMoveObject::SetPropertiesL |
661 // Set the object properties in the object property store. |
483 // Set the object properties in the object property store. |
662 // ----------------------------------------------------------------------------- |
484 // ----------------------------------------------------------------------------- |
663 // |
485 // |
664 void CMoveObject::SetPropertiesL( const TDesC& aOldFileName, const TDesC& aNewFileName, |
486 void CMoveObject::SetPropertiesL( const TDesC& aNewFileName ) |
665 const CMTPObjectMetaData& aNewObject ) |
487 { |
666 { |
488 PRINT1( _L( "MM MTP => CMoveObject::SetPropertiesL, aNewFileName = %S" ), &aNewFileName ); |
667 PRINT2( _L( "MM MTP => CMoveObject::SetPropertiesL aOldFileName = %S, aNewFileName = %S" ), |
489 |
668 &aOldFileName, &aNewFileName ); |
490 TUint32 formatCode = iObjectInfo->Uint( CMTPObjectMetaData::EFormatCode ); |
669 |
|
670 TUint32 formatCode = aNewObject.Uint( CMTPObjectMetaData::EFormatCode ); |
|
671 // This is used to keep the same behavior in mass storage and device file manager. |
|
672 if ( formatCode == EMTPFormatCodeAbstractAudioVideoPlaylist ) |
491 if ( formatCode == EMTPFormatCodeAbstractAudioVideoPlaylist ) |
673 { |
492 { |
|
493 // This is used to keep the same behavior in mass storage and device file manager. |
674 PRINT( _L( "MM MTP <> CMoveObject::SetPropertiesL Playlist file do not update the MPX DB" ) ); |
494 PRINT( _L( "MM MTP <> CMoveObject::SetPropertiesL Playlist file do not update the MPX DB" ) ); |
675 } |
495 } |
676 else |
496 else |
677 { |
497 // TODO: Need rollback mechanism for consistant with image dp in fw. |
678 // if the two object in different stoarge, we should delete the old one and insert new one |
498 // Not sure if it should be trap if something wrong with MPX db. |
|
499 { |
679 if ( iSameStorage ) |
500 if ( iSameStorage ) |
680 iDpConfig.GetWrapperL().RenameObjectL( aOldFileName, aNewFileName ); |
501 { |
681 else |
502 iDpConfig.GetWrapperL().RenameObjectL( *iObjectInfo, aNewFileName ); |
682 { |
503 } |
683 iDpConfig.GetWrapperL().DeleteObjectL( aOldFileName, formatCode ); |
504 else // if the two object in different storage, we should delete the old one and insert new one |
684 iDpConfig.GetWrapperL().AddObjectL( aNewFileName ); |
505 { |
685 SetPreviousPropertiesL( aNewObject ); |
506 iDpConfig.GetWrapperL().DeleteObjectL( *iObjectInfo ); |
686 } |
507 iDpConfig.GetWrapperL().AddObjectL( *iObjectInfo ); |
687 } |
508 |
688 |
509 // Only leave when getting proplist element from data received by fw. |
689 // Reference DB is used PUID |
510 // It should not happen after ReceiveDataL in which construction of proplist already succeed. |
690 // if ( formatCode == EMTPFormatCodeAbstractAudioVideoPlaylist |
511 SetPreviousPropertiesL(); |
691 // || formatCode == EMTPFormatCodeM3UPlaylist ) |
512 } |
692 // { |
513 } |
693 // MMTPReferenceMgr& referenceMgr = iFramework.ReferenceMgr(); |
514 |
694 // CDesCArray* references = referenceMgr.ReferencesLC( aOldFileName ); // + references |
515 iObjectInfo->SetDesCL( CMTPObjectMetaData::ESuid, aNewFileName ); |
695 // referenceMgr.SetReferencesL( aNewFileName, *references ); |
516 iObjectInfo->SetUint( CMTPObjectMetaData::EStorageId, iStorageId ); |
696 // CleanupStack::PopAndDestroy( references ); // - references |
517 iObjectInfo->SetUint( CMTPObjectMetaData::EParentHandle, iNewParentHandle ); |
697 // // delete the old references |
518 iFramework.ObjectMgr().ModifyObjectL( *iObjectInfo ); |
698 // referenceMgr.RemoveReferencesL( aOldFileName ); |
519 |
699 // } |
520 // It's not necessary to change references of playlists since Reference DB is used PUID |
700 |
|
701 |
521 |
702 PRINT( _L( "MM MTP <= CMoveObject::SetPropertiesL" ) ); |
522 PRINT( _L( "MM MTP <= CMoveObject::SetPropertiesL" ) ); |
703 } |
523 } |
704 |
524 |
705 // ----------------------------------------------------------------------------- |
|
706 // CMoveObject::FinalPhaseMove |
|
707 // This function will actually delete the orginal folders from the file system |
|
708 // ----------------------------------------------------------------------------- |
|
709 // |
|
710 TMTPResponseCode CMoveObject::FinalPhaseMove() |
|
711 { |
|
712 PRINT( _L( "MM MTP => CMoveObject::FinalPhaseMove" ) ); |
|
713 TMTPResponseCode ret = EMTPRespCodeOK; |
|
714 |
|
715 TInt rel = iFileMan->RmDir( *iPathToMove ); |
|
716 PRINT1( _L( "MM MTP <> CMoveObject::FinalPhaseMove rel = %d" ), rel ); |
|
717 |
|
718 if ( rel != KErrNone ) |
|
719 { |
|
720 ret = EMTPRespCodeGeneralError; |
|
721 } |
|
722 |
|
723 PRINT1( _L( "MM MTP <= CMoveObject::FinalPhaseMove ret = 0x%x" ), ret ); |
|
724 return ret; |
|
725 } |
|
726 |
|
727 // ----------------------------------------------------------------------------- |
|
728 // CMoveObject::GenerateObjectHandleListL |
|
729 // Generate the list of handles that need to be moved to the new location |
|
730 // ----------------------------------------------------------------------------- |
|
731 // |
|
732 void CMoveObject::GenerateObjectHandleListL( TUint32 aParentHandle ) |
|
733 { |
|
734 PRINT1( _L( "MM MTP => CMoveObject::GenerateObjectHandleListL aParentHandle = 0x%x" ), aParentHandle ); |
|
735 RMTPObjectMgrQueryContext context; |
|
736 RArray<TUint> handles; |
|
737 TMTPObjectMgrQueryParams params( KMTPStorageAll, KMTPFormatsAll, |
|
738 aParentHandle ); |
|
739 CleanupClosePushL( context ); // + context |
|
740 CleanupClosePushL( handles ); // - handles |
|
741 |
|
742 do |
|
743 { |
|
744 iFramework.ObjectMgr().GetObjectHandlesL( params, context, handles ); |
|
745 |
|
746 TInt numberOfObjects = handles.Count(); |
|
747 for ( TInt i = 0; i < numberOfObjects; i++ ) |
|
748 { |
|
749 if ( iFramework.ObjectMgr().ObjectOwnerId( handles[i] ) == iFramework.DataProviderId() ) |
|
750 { |
|
751 iObjectHandles.AppendL( handles[i] ); |
|
752 continue; |
|
753 } |
|
754 |
|
755 // Folder |
|
756 if ( iFramework.ObjectMgr().ObjectOwnerId( handles[i] ) == 0 ) // We know that the device dp id is always 0, otherwise the whole MTP won't work. |
|
757 { |
|
758 GenerateObjectHandleListL( handles[i] ); |
|
759 } |
|
760 } |
|
761 } |
|
762 while ( !context.QueryComplete() ); |
|
763 |
|
764 CleanupStack::PopAndDestroy( &handles ); // - handles |
|
765 CleanupStack::PopAndDestroy( &context ); // - contect |
|
766 |
|
767 PRINT( _L( "MM MTP <= CMoveObject::GenerateObjectHandleListL" ) ); |
|
768 } |
|
769 |
|
770 // ----------------------------------------------------------------------------- |
|
771 // CMoveObject::MoveAndUpdateL |
|
772 // Move a single object and update the database |
|
773 // ----------------------------------------------------------------------------- |
|
774 // |
|
775 void CMoveObject::MoveAndUpdateL( TUint32 aObjectHandle ) |
|
776 { |
|
777 PRINT1( _L( "MM MTP => CMoveObject::MoveAndUpdateL aObjectHanlde = 0x%x" ), aObjectHandle ); |
|
778 |
|
779 CMTPObjectMetaData* objectInfo( CMTPObjectMetaData::NewLC() ); // + objectInfo |
|
780 |
|
781 RBuf fileName; |
|
782 fileName.CreateL( KMaxFileName ); |
|
783 fileName.CleanupClosePushL(); // + fileName |
|
784 |
|
785 RBuf rightPartName; |
|
786 rightPartName.CreateL( KMaxFileName ); |
|
787 rightPartName.CleanupClosePushL(); // + rightPartName |
|
788 |
|
789 RBuf oldName; |
|
790 oldName.CreateL( KMaxFileName ); |
|
791 oldName.CleanupClosePushL(); // + oldName |
|
792 |
|
793 if ( iFramework.ObjectMgr().ObjectL( TMTPTypeUint32( aObjectHandle ), *objectInfo ) ) |
|
794 { |
|
795 fileName = objectInfo->DesC( CMTPObjectMetaData::ESuid ); |
|
796 oldName = fileName; |
|
797 |
|
798 if ( objectInfo->Uint( CMTPObjectMetaData::EDataProviderId ) |
|
799 == iFramework.DataProviderId() ) |
|
800 { |
|
801 rightPartName = fileName.Right( fileName.Length() - iPathToMove->Length() ); |
|
802 |
|
803 if ( ( iNewRootFolder->Length() + rightPartName.Length() ) > fileName.MaxLength() ) |
|
804 { |
|
805 User::Leave( KErrCorrupt ); |
|
806 } |
|
807 |
|
808 fileName.Zero(); |
|
809 fileName.Append( *iNewRootFolder ); |
|
810 fileName.Append( rightPartName ); |
|
811 PRINT1( _L( "MM MTP <> MoveAndUpdateL fileName = %S" ), &fileName ); |
|
812 |
|
813 if ( iStorageId == objectInfo->Uint( CMTPObjectMetaData::EStorageId ) ) |
|
814 iSameStorage = ETrue; |
|
815 else |
|
816 iSameStorage = EFalse; |
|
817 GetPreviousPropertiesL( *objectInfo ); |
|
818 TInt err = iFileMan->Move( oldName, fileName ); |
|
819 PRINT1( _L( "MM MTP <> CMoveObject::MoveAndUpdateL Move error code = %d" ), err ); |
|
820 User::LeaveIfError( err ); |
|
821 User::LeaveIfError( iFramework.Fs().SetModified( fileName, iPreviousModifiedTime ) ); |
|
822 |
|
823 objectInfo->SetDesCL( CMTPObjectMetaData::ESuid, fileName ); |
|
824 objectInfo->SetUint( CMTPObjectMetaData::EStorageId, iStorageId ); |
|
825 TParsePtrC parentSuid( fileName ); |
|
826 TUint32 parentHandle = iFramework.ObjectMgr().HandleL( parentSuid.DriveAndPath() ); |
|
827 objectInfo->SetUint( CMTPObjectMetaData::EParentHandle, parentHandle ); |
|
828 |
|
829 //TUint32 parentHandle = iFramework.ObjectMgr().HandleL( parentSuid.DriveAndPath() ); |
|
830 PRINT1( _L( "MM MTP <> CMoveObject::MoveAndUpdateL parentHandle = 0x%x" ), parentHandle ); |
|
831 |
|
832 iFramework.ObjectMgr().ModifyObjectL( *objectInfo ); |
|
833 |
|
834 SetPropertiesL( oldName, fileName, *objectInfo ); |
|
835 } |
|
836 } |
|
837 else |
|
838 { |
|
839 User::Leave( KErrCorrupt ); |
|
840 } |
|
841 |
|
842 CleanupStack::PopAndDestroy( &oldName ); // - oldName |
|
843 CleanupStack::PopAndDestroy( &rightPartName ); // - rightPartName |
|
844 CleanupStack::PopAndDestroy( &fileName ); // - fileName |
|
845 CleanupStack::PopAndDestroy( objectInfo ); // - objectInfo |
|
846 PRINT( _L( "MM MTP <= CMoveObject::MoveAndUpdateL" ) ); |
|
847 } |
|
848 |
|
849 // end of file |
525 // end of file |