60 /** |
64 /** |
61 Destructor |
65 Destructor |
62 */ |
66 */ |
63 EXPORT_C CMTPCopyObject::~CMTPCopyObject() |
67 EXPORT_C CMTPCopyObject::~CMTPCopyObject() |
64 { |
68 { |
65 __FLOG(_L8("~CMTPCopyObject - Entry")); |
69 OstTraceFunctionEntry0( CMTPCOPYOBJECT_CMTPCOPYOBJECT_DES_ENTRY ); |
66 Cancel(); |
70 Cancel(); |
67 iDpSingletons.Close(); |
71 iDpSingletons.Close(); |
68 iSingletons.Close(); |
72 iSingletons.Close(); |
69 |
73 |
70 delete iTimer; |
74 delete iTimer; |
71 delete iDest; |
75 delete iDest; |
72 delete iNewFileName; |
76 delete iNewFileName; |
73 delete iFileMan; |
77 delete iFileMan; |
74 |
78 |
75 __FLOG(_L8("~CMTPCopyObject - Exit")); |
79 OstTraceFunctionExit0( CMTPCOPYOBJECT_CMTPCOPYOBJECT_DES_EXIT ); |
76 __FLOG_CLOSE; |
|
77 } |
80 } |
78 |
81 |
79 /** |
82 /** |
80 Standard c++ constructor |
83 Standard c++ constructor |
81 */ |
84 */ |
82 CMTPCopyObject::CMTPCopyObject(MMTPDataProviderFramework& aFramework, MMTPConnection& aConnection) : |
85 CMTPCopyObject::CMTPCopyObject(MMTPDataProviderFramework& aFramework, MMTPConnection& aConnection) : |
83 CMTPRequestProcessor(aFramework, aConnection, sizeof(KMTPCopyObjectPolicy)/sizeof(TMTPRequestElementInfo), KMTPCopyObjectPolicy), |
86 CMTPRequestProcessor(aFramework, aConnection, sizeof(KMTPCopyObjectPolicy)/sizeof(TMTPRequestElementInfo), KMTPCopyObjectPolicy), |
84 iTimer(NULL) |
87 iTimer(NULL) |
85 { |
88 { |
86 __FLOG_OPEN(KMTPSubsystem, KComponent); |
|
87 } |
89 } |
88 |
90 |
89 |
91 |
90 |
92 |
91 TMTPResponseCode CMTPCopyObject::CheckRequestL() |
93 TMTPResponseCode CMTPCopyObject::CheckRequestL() |
92 { |
94 { |
93 __FLOG(_L8("CheckRequestL - Entry")); |
95 OstTraceFunctionEntry0( CMTPCOPYOBJECT_CHECKREQUESTL_ENTRY ); |
94 TMTPResponseCode result = CMTPRequestProcessor::CheckRequestL(); |
96 TMTPResponseCode result = CMTPRequestProcessor::CheckRequestL(); |
95 if ( (EMTPRespCodeOK == result) && (!iSingletons.StorageMgr().IsReadWriteStorage(Request().Uint32(TMTPTypeRequest::ERequestParameter2))) ) |
97 if ( (EMTPRespCodeOK == result) && (!iSingletons.StorageMgr().IsReadWriteStorage(Request().Uint32(TMTPTypeRequest::ERequestParameter2))) ) |
96 { |
98 { |
97 result = EMTPRespCodeStoreReadOnly; |
99 result = EMTPRespCodeStoreReadOnly; |
98 } |
100 } |
102 CMTPObjectMetaData* object(CMTPObjectMetaData::NewLC()); |
104 CMTPObjectMetaData* object(CMTPObjectMetaData::NewLC()); |
103 if(iFramework.ObjectMgr().ObjectL(KHandle, *object)) |
105 if(iFramework.ObjectMgr().ObjectL(KHandle, *object)) |
104 { |
106 { |
105 const TDesC& suid(object->DesC(CMTPObjectMetaData::ESuid)); |
107 const TDesC& suid(object->DesC(CMTPObjectMetaData::ESuid)); |
106 iIsFolder = EFalse; |
108 iIsFolder = EFalse; |
107 User::LeaveIfError(BaflUtils::IsFolder(iFramework.Fs(), suid, iIsFolder)); |
109 LEAVEIFERROR(BaflUtils::IsFolder(iFramework.Fs(), suid, iIsFolder), |
|
110 OstTraceExt1( TRACE_ERROR, DUP1_CMTPCOPYOBJECT_CHECKREQUESTL, "can't judge whether %S is a folder", suid )); |
108 if(!iIsFolder) |
111 if(!iIsFolder) |
109 { |
112 { |
110 if(iDpSingletons.CopyingBigFileCache().IsOnGoing()) |
113 if(iDpSingletons.CopyingBigFileCache().IsOnGoing()) |
111 { |
114 { |
112 __FLOG(_L8("CheckRequestL - A big file copying is ongoing, respond with access denied")); |
115 OstTrace0( TRACE_NORMAL, CMTPCOPYOBJECT_CHECKREQUESTL, |
|
116 "CheckRequestL - A big file copying is ongoing, respond with access denied" ); |
113 result = EMTPRespCodeAccessDenied; |
117 result = EMTPRespCodeAccessDenied; |
114 } |
118 } |
115 } |
119 } |
116 } |
120 } |
117 CleanupStack::PopAndDestroy(object); |
121 CleanupStack::PopAndDestroy(object); |
118 } |
122 } |
119 __FLOG(_L8("CheckRequestL - Exit")); |
123 OstTraceFunctionExit0( CMTPCOPYOBJECT_CHECKREQUESTL_EXIT ); |
120 return result; |
124 return result; |
121 } |
125 } |
122 |
126 |
123 /** |
127 /** |
124 CopyObject request handler |
128 CopyObject request handler |
125 */ |
129 */ |
126 void CMTPCopyObject::ServiceL() |
130 void CMTPCopyObject::ServiceL() |
127 { |
131 { |
128 __FLOG(_L8("ServiceL - Entry")); |
132 OstTraceFunctionEntry0( CMTPCOPYOBJECT_SERVICEL_ENTRY ); |
129 TUint32 handle = KMTPHandleNone; |
133 TUint32 handle = KMTPHandleNone; |
130 TMTPResponseCode responseCode = EMTPRespCodeOK; |
134 TMTPResponseCode responseCode = EMTPRespCodeOK; |
131 TRAPD(err, responseCode = CopyObjectL(handle)); |
135 TRAPD(err, responseCode = CopyObjectL(handle)); |
132 if(err != KErrNone) |
136 if(err != KErrNone) |
133 { |
137 { |
134 SendResponseL(EMTPRespCodeAccessDenied); |
138 SendResponseL(EMTPRespCodeAccessDenied); |
135 } |
139 } |
136 else if(responseCode != EMTPRespCodeOK) |
140 else if(responseCode != EMTPRespCodeOK) |
137 { |
141 { |
138 __FLOG_VA((_L8("ServiceL, sending response with respond code %d"), responseCode)); |
142 OstTrace1( TRACE_NORMAL, CMTPCOPYOBJECT_SERVICEL, "ServiceL, sending response with respond code %d", responseCode ); |
139 SendResponseL(responseCode); |
143 SendResponseL(responseCode); |
140 } |
144 } |
141 else if (iIsFolder) |
145 else if (iIsFolder) |
142 { |
146 { |
143 __FLOG_VA((_L8("ServiceL, sending response with handle=%d, respond code OK"), handle)); |
147 OstTrace1( TRACE_NORMAL, DUP1_CMTPCOPYOBJECT_SERVICEL, "ServiceL, sending response with handle=%d, respond code OK", handle ); |
144 SendResponseL(EMTPRespCodeOK, 1, &handle); |
148 SendResponseL(EMTPRespCodeOK, 1, &handle); |
145 } |
149 } |
146 __FLOG(_L8("ServiceL - Exit")); |
150 OstTraceFunctionExit0( CMTPCOPYOBJECT_SERVICEL_EXIT ); |
147 } |
151 } |
148 |
152 |
149 |
153 |
150 /** |
154 /** |
151 Second phase constructor |
155 Second phase constructor |
152 */ |
156 */ |
153 void CMTPCopyObject::ConstructL() |
157 void CMTPCopyObject::ConstructL() |
154 { |
158 { |
|
159 OstTraceFunctionEntry0( CMTPCOPYOBJECT_CONSTRUCTL_ENTRY ); |
155 iSingletons.OpenL(); |
160 iSingletons.OpenL(); |
156 iDpSingletons.OpenL(iFramework); |
161 iDpSingletons.OpenL(iFramework); |
|
162 OstTraceFunctionExit0( CMTPCOPYOBJECT_CONSTRUCTL_EXIT ); |
157 } |
163 } |
158 |
164 |
159 |
165 |
160 /** |
166 /** |
161 A helper function of CopyObjectL. |
167 A helper function of CopyObjectL. |
162 @param aNewFileName the new full filename after copy. |
168 @param aNewFileName the new full filename after copy. |
163 @return objectHandle of new copy of object. |
169 @return objectHandle of new copy of object. |
164 */ |
170 */ |
165 void CMTPCopyObject::CopyFileL(const TDesC& aNewFileName) |
171 void CMTPCopyObject::CopyFileL(const TDesC& aNewFileName) |
166 { |
172 { |
167 __FLOG(_L8("CopyFileL - Entry")); |
173 OstTraceFunctionEntry0( CMTPCOPYOBJECT_COPYFILEL_ENTRY ); |
168 delete iNewFileName; |
174 delete iNewFileName; |
169 iNewFileName = NULL; |
175 iNewFileName = NULL; |
170 iNewFileName = aNewFileName.AllocL(); // Store the new file name |
176 iNewFileName = aNewFileName.AllocL(); // Store the new file name |
171 const TDesC& suid(iObjectInfo->DesC(CMTPObjectMetaData::ESuid)); |
177 const TDesC& suid(iObjectInfo->DesC(CMTPObjectMetaData::ESuid)); |
172 GetPreviousPropertiesL(suid); |
178 GetPreviousPropertiesL(suid); |
173 |
179 |
174 User::LeaveIfError(iFileMan->Copy(suid, *iDest, CFileMan::EOverWrite, iStatus)); |
180 LEAVEIFERROR(iFileMan->Copy(suid, *iDest, CFileMan::EOverWrite, iStatus), |
|
181 OstTraceExt2( TRACE_ERROR, CMTPCOPYOBJECT_COPYFILEL, "copy %S to %S failed!", suid, *iDest)); |
175 if ( !IsActive() ) |
182 if ( !IsActive() ) |
176 { |
183 { |
177 SetActive(); |
184 SetActive(); |
178 } |
185 } |
179 |
186 |
180 delete iTimer; |
187 delete iTimer; |
181 iTimer = NULL; |
188 iTimer = NULL; |
182 iTimer = CPeriodic::NewL(EPriorityStandard); |
189 iTimer = CPeriodic::NewL(EPriorityStandard); |
183 TTimeIntervalMicroSeconds32 KCopyObjectIntervalNone = 0; |
190 TTimeIntervalMicroSeconds32 KCopyObjectIntervalNone = 0; |
184 iTimer->Start(TTimeIntervalMicroSeconds32(KCopyObjectTimeOut), KCopyObjectIntervalNone, TCallBack(CMTPCopyObject::OnTimeoutL, this)); |
191 iTimer->Start(TTimeIntervalMicroSeconds32(KCopyObjectTimeOut), KCopyObjectIntervalNone, TCallBack(CMTPCopyObject::OnTimeoutL, this)); |
185 |
192 |
186 __FLOG(_L8("CopyFileL - Exit")); |
193 OstTraceFunctionExit0( CMTPCOPYOBJECT_COPYFILEL_EXIT ); |
187 } |
194 } |
188 |
195 |
189 /** |
196 /** |
190 A helper function of CopyObjectL. |
197 A helper function of CopyObjectL. |
191 @param aNewFolderName the new full file folder name after copy. |
198 @param aNewFolderName the new full file folder name after copy. |
192 @return objecthandle of new copy of the folder. |
199 @return objecthandle of new copy of the folder. |
193 */ |
200 */ |
194 TUint32 CMTPCopyObject::CopyFolderL(const TDesC& aNewFolderName) |
201 TUint32 CMTPCopyObject::CopyFolderL(const TDesC& aNewFolderName) |
195 { |
202 { |
196 __FLOG(_L8("CopyFolderL - Entry")); |
203 OstTraceFunctionEntry0( CMTPCOPYOBJECT_COPYFOLDERL_ENTRY ); |
197 const TDesC& suid(iObjectInfo->DesC(CMTPObjectMetaData::ESuid)); |
204 const TDesC& suid(iObjectInfo->DesC(CMTPObjectMetaData::ESuid)); |
198 TUint32 handle; |
205 TUint32 handle; |
199 if (iObjectInfo->Uint(CMTPObjectMetaData::EDataProviderId) == iFramework.DataProviderId()) |
206 if (iObjectInfo->Uint(CMTPObjectMetaData::EDataProviderId) == iFramework.DataProviderId()) |
200 { |
207 { |
201 GetPreviousPropertiesL(suid); |
208 GetPreviousPropertiesL(suid); |
202 User::LeaveIfError(iFramework.Fs().MkDir(aNewFolderName)); |
209 LEAVEIFERROR(iFramework.Fs().MkDir(aNewFolderName), |
|
210 OstTraceExt1( TRACE_ERROR, CMTPCOPYOBJECT_COPYFOLDERL, "create directory %S failed!", aNewFolderName)); |
203 SetPreviousPropertiesL(aNewFolderName); |
211 SetPreviousPropertiesL(aNewFolderName); |
204 handle = UpdateObjectInfoL(aNewFolderName); |
212 handle = UpdateObjectInfoL(aNewFolderName); |
205 } |
213 } |
206 else |
214 else |
207 { |
215 { |
208 handle = iFramework.ObjectMgr().HandleL(aNewFolderName); |
216 handle = iFramework.ObjectMgr().HandleL(aNewFolderName); |
209 } |
217 } |
210 __FLOG(_L8("CopyFolderL - Exit")); |
218 OstTraceFunctionExit0( CMTPCOPYOBJECT_COPYFOLDERL_EXIT ); |
211 return handle; |
219 return handle; |
212 } |
220 } |
213 |
221 |
214 /** |
222 /** |
215 Copy object operation |
223 Copy object operation |
216 @return the object handle of the resulting object. |
224 @return the object handle of the resulting object. |
217 */ |
225 */ |
218 TMTPResponseCode CMTPCopyObject::CopyObjectL(TUint32& aNewHandle) |
226 TMTPResponseCode CMTPCopyObject::CopyObjectL(TUint32& aNewHandle) |
219 { |
227 { |
220 __FLOG(_L8("CopyObjectL - Entry")); |
228 OstTraceFunctionEntry0( CMTPCOPYOBJECT_COPYOBJECTL_ENTRY ); |
221 TMTPResponseCode responseCode = EMTPRespCodeOK; |
229 TMTPResponseCode responseCode = EMTPRespCodeOK; |
222 aNewHandle = KMTPHandleNone; |
230 aNewHandle = KMTPHandleNone; |
223 |
231 |
224 GetParametersL(); |
232 GetParametersL(); |
225 |
233 |
299 delete iDest; |
308 delete iDest; |
300 iDest = NULL; |
309 iDest = NULL; |
301 iDest = parentObjectInfo->DesC(CMTPObjectMetaData::ESuid).AllocL(); |
310 iDest = parentObjectInfo->DesC(CMTPObjectMetaData::ESuid).AllocL(); |
302 iNewParentHandle = parentObjectHandle; |
311 iNewParentHandle = parentObjectHandle; |
303 } |
312 } |
304 __FLOG(_L8("GetParametersL - Exit")); |
313 OstTraceFunctionExit0( CMTPCOPYOBJECT_GETPARAMETERSL_EXIT ); |
305 } |
314 } |
306 |
315 |
307 /** |
316 /** |
308 Get a default parent object, ff the request does not specify a parent object, |
317 Get a default parent object, ff the request does not specify a parent object, |
309 */ |
318 */ |
310 void CMTPCopyObject::SetDefaultParentObjectL() |
319 void CMTPCopyObject::SetDefaultParentObjectL() |
311 { |
320 { |
312 __FLOG(_L8("SetDefaultParentObjectL - Entry")); |
321 OstTraceFunctionEntry0( CMTPCOPYOBJECT_SETDEFAULTPARENTOBJECTL_ENTRY ); |
313 |
322 |
314 const CMTPStorageMetaData& storageMetaData( iFramework.StorageMgr().StorageL(iStorageId) ); |
323 const CMTPStorageMetaData& storageMetaData( iFramework.StorageMgr().StorageL(iStorageId) ); |
315 const TDesC& driveBuf( storageMetaData.DesC(CMTPStorageMetaData::EStorageSuid) ); |
324 const TDesC& driveBuf( storageMetaData.DesC(CMTPStorageMetaData::EStorageSuid) ); |
316 delete iDest; |
325 delete iDest; |
317 iDest = NULL; |
326 iDest = NULL; |
318 iDest = driveBuf.AllocL(); |
327 iDest = driveBuf.AllocL(); |
319 iNewParentHandle = KMTPHandleNoParent; |
328 iNewParentHandle = KMTPHandleNoParent; |
320 |
329 |
321 __FLOG(_L8("SetDefaultParentObjectL - Exit")); |
330 OstTraceFunctionExit0( CMTPCOPYOBJECT_SETDEFAULTPARENTOBJECTL_EXIT ); |
322 } |
331 } |
323 |
332 |
324 /** |
333 /** |
325 Check if we can copy the file to the new location |
334 Check if we can copy the file to the new location |
326 */ |
335 */ |
327 TMTPResponseCode CMTPCopyObject::CanCopyObjectL(const TDesC& aOldName, const TDesC& aNewName) const |
336 TMTPResponseCode CMTPCopyObject::CanCopyObjectL(const TDesC& aOldName, const TDesC& aNewName) const |
328 { |
337 { |
329 __FLOG(_L8("CanCopyObjectL - Entry")); |
338 OstTraceFunctionEntry0( CMTPCOPYOBJECT_CANCOPYOBJECTL_ENTRY ); |
330 TMTPResponseCode result = EMTPRespCodeOK; |
339 TMTPResponseCode result = EMTPRespCodeOK; |
331 |
340 |
332 TEntry fileEntry; |
341 TEntry fileEntry; |
333 User::LeaveIfError(iFramework.Fs().Entry(aOldName, fileEntry)); |
342 LEAVEIFERROR(iFramework.Fs().Entry(aOldName, fileEntry), |
|
343 OstTraceExt1( TRACE_ERROR, DUP1_CMTPCOPYOBJECT_CANCOPYOBJECTL, "Can't get entry details for %S", aOldName )); |
334 TInt drive(iFramework.StorageMgr().DriveNumber(iStorageId)); |
344 TInt drive(iFramework.StorageMgr().DriveNumber(iStorageId)); |
335 User::LeaveIfError(drive); |
345 LEAVEIFERROR(drive, |
|
346 OstTraceExt2( TRACE_ERROR, DUP2_CMTPCOPYOBJECT_CANCOPYOBJECTL, |
|
347 "Get driver number for storage %d failed! error code %d", iStorageId, drive)); |
|
348 |
336 TVolumeInfo volumeInfo; |
349 TVolumeInfo volumeInfo; |
337 User::LeaveIfError(iFramework.Fs().Volume(volumeInfo, drive)); |
350 LEAVEIFERROR(iFramework.Fs().Volume(volumeInfo, drive), |
338 |
351 OstTrace1( TRACE_ERROR, DUP3_CMTPCOPYOBJECT_CANCOPYOBJECTL, "can't get volume information for driver %d", drive)); |
|
352 |
339 #ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API |
353 #ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API |
340 if(volumeInfo.iFree < fileEntry.FileSize()) |
354 if(volumeInfo.iFree < fileEntry.FileSize()) |
341 #else |
355 #else |
342 if(volumeInfo.iFree < fileEntry.iSize) |
356 if(volumeInfo.iFree < fileEntry.iSize) |
343 #endif |
357 #endif |
346 } |
360 } |
347 else if (BaflUtils::FileExists(iFramework.Fs(), aNewName)) |
361 else if (BaflUtils::FileExists(iFramework.Fs(), aNewName)) |
348 { |
362 { |
349 result = EMTPRespCodeInvalidParentObject; |
363 result = EMTPRespCodeInvalidParentObject; |
350 } |
364 } |
351 __FLOG_VA((_L8("CanCopyObjectL - Exit with response code 0x%04X"), result)); |
365 OstTrace1( TRACE_NORMAL, CMTPCOPYOBJECT_CANCOPYOBJECTL, "response code 0x%04X", result ); |
|
366 OstTraceFunctionExit0( CMTPCOPYOBJECT_CANCOPYOBJECTL_EXIT ); |
352 return result; |
367 return result; |
353 } |
368 } |
354 |
369 |
355 /** |
370 /** |
356 Save the object properties before doing the copy |
371 Save the object properties before doing the copy |
357 */ |
372 */ |
358 void CMTPCopyObject::GetPreviousPropertiesL(const TDesC& aFileName) |
373 void CMTPCopyObject::GetPreviousPropertiesL(const TDesC& aFileName) |
359 { |
374 { |
360 __FLOG(_L8("GetPreviousPropertiesL - Entry")); |
375 OstTraceFunctionEntry0( CMTPCOPYOBJECT_GETPREVIOUSPROPERTIESL_ENTRY ); |
361 User::LeaveIfError(iFramework.Fs().Modified(aFileName, iPreviousModifiedTime)); |
376 LEAVEIFERROR(iFramework.Fs().Modified(aFileName, iPreviousModifiedTime), |
362 __FLOG(_L8("GetPreviousPropertiesL - Exit")); |
377 OstTraceExt1( TRACE_ERROR, CMTPCOPYOBJECT_GETPREVIOUSPROPERTIESL, "Can't get the last modification date and time for %S", aFileName)); |
|
378 if ( iIsFolder ) |
|
379 { |
|
380 TEntry fileEntry; |
|
381 User::LeaveIfError(iFramework.Fs().Entry( aFileName, fileEntry )); |
|
382 iIsHidden = fileEntry.IsHidden(); |
|
383 } |
|
384 |
|
385 OstTraceFunctionExit0( CMTPCOPYOBJECT_GETPREVIOUSPROPERTIESL_EXIT ); |
363 } |
386 } |
364 |
387 |
365 /** |
388 /** |
366 Set the object properties after doing the copy |
389 Set the object properties after doing the copy |
367 */ |
390 */ |
368 void CMTPCopyObject::SetPreviousPropertiesL(const TDesC& aFileName) |
391 void CMTPCopyObject::SetPreviousPropertiesL(const TDesC& aFileName) |
369 { |
392 { |
370 __FLOG(_L8("SetPreviousPropertiesL - Entry")); |
393 OstTraceFunctionEntry0( CMTPCOPYOBJECT_SETPREVIOUSPROPERTIESL_ENTRY ); |
371 User::LeaveIfError(iFramework.Fs().SetModified(aFileName, iPreviousModifiedTime)); |
394 LEAVEIFERROR(iFramework.Fs().SetModified(aFileName, iPreviousModifiedTime), |
372 __FLOG(_L8("SetPreviousPropertiesL - Exit")); |
395 OstTraceExt1( TRACE_ERROR, CMTPCOPYOBJECT_SETPREVIOUSPROPERTIESL, "Sets the date and time for %S failed", aFileName)); |
|
396 if ( iIsFolder && iIsHidden ) |
|
397 { |
|
398 TEntry fileEntry; |
|
399 User::LeaveIfError(iFramework.Fs().Entry( aFileName, fileEntry )); |
|
400 fileEntry.iAtt &= ~KEntryAttHidden; |
|
401 fileEntry.iAtt |= KEntryAttHidden; |
|
402 User::LeaveIfError(iFramework.Fs().SetAtt( aFileName, fileEntry.iAtt, ~fileEntry.iAtt)); |
|
403 } |
|
404 OstTraceFunctionExit0( CMTPCOPYOBJECT_SETPREVIOUSPROPERTIESL_EXIT ); |
373 } |
405 } |
374 |
406 |
375 /** |
407 /** |
376 Update object info in the database. |
408 Update object info in the database. |
377 */ |
409 */ |
378 TUint32 CMTPCopyObject::UpdateObjectInfoL(const TDesC& aNewObjectName) |
410 TUint32 CMTPCopyObject::UpdateObjectInfoL(const TDesC& aNewObjectName) |
379 { |
411 { |
380 __FLOG(_L8("UpdateObjectInfoL - Entry")); |
412 OstTraceFunctionEntry0( CMTPCOPYOBJECT_UPDATEOBJECTINFOL_ENTRY ); |
381 |
413 |
382 // We should not modify this object's handle, so just get a "copy". |
414 // We should not modify this object's handle, so just get a "copy". |
383 CMTPObjectMetaData* objectInfo(CMTPObjectMetaData::NewLC()); |
415 CMTPObjectMetaData* objectInfo(CMTPObjectMetaData::NewLC()); |
384 const TMTPTypeUint32 objectHandle(iObjectInfo->Uint(CMTPObjectMetaData::EHandle)); |
416 const TMTPTypeUint32 objectHandle(iObjectInfo->Uint(CMTPObjectMetaData::EHandle)); |
385 if(iFramework.ObjectMgr().ObjectL(objectHandle, *objectInfo)) |
417 if(iFramework.ObjectMgr().ObjectL(objectHandle, *objectInfo)) |
428 iTimer = NULL; |
460 iTimer = NULL; |
429 } |
461 } |
430 |
462 |
431 const TDesC& suid(iObjectInfo->DesC(CMTPObjectMetaData::ESuid)); |
463 const TDesC& suid(iObjectInfo->DesC(CMTPObjectMetaData::ESuid)); |
432 TEntry fileEntry; |
464 TEntry fileEntry; |
433 User::LeaveIfError(iFramework.Fs().Entry(suid, fileEntry)); |
465 LEAVEIFERROR(iFramework.Fs().Entry(suid, fileEntry), |
|
466 OstTraceExt1( TRACE_ERROR, DUP1_CMTPCOPYOBJECT_DOONTIMEOUTL, "Gets the entry details for %S failed!", suid)); |
|
467 |
434 TUint32 handle = KMTPHandleNone; |
468 TUint32 handle = KMTPHandleNone; |
435 handle = UpdateObjectInfoL(*iNewFileName); |
469 handle = UpdateObjectInfoL(*iNewFileName); |
436 CMTPFSEntryCache& aCache = iDpSingletons.CopyingBigFileCache(); |
470 CMTPFSEntryCache& aCache = iDpSingletons.CopyingBigFileCache(); |
437 |
471 |
438 // Cache the target file entry info, which is used to send response to getobjectproplist and getobjectinfo |
472 // Cache the target file entry info, which is used to send response to getobjectproplist and getobjectinfo |
439 aCache.SetOnGoing(ETrue); |
473 aCache.SetOnGoing(ETrue); |
440 aCache.SetTargetHandle(handle); |
474 aCache.SetTargetHandle(handle); |
441 aCache.SetFileEntry(fileEntry); |
475 aCache.SetFileEntry(fileEntry); |
442 |
476 |
443 __FLOG_VA((_L8("UpdateFSEntryCache, sending response with handle=%d, respond code OK for a big file copy"), handle)); |
477 OstTrace1( TRACE_NORMAL, CMTPCOPYOBJECT_DOONTIMEOUTL, |
|
478 "UpdateFSEntryCache, sending response with handle=%d, respond code OK for a big file copy", handle ); |
444 SendResponseL(EMTPRespCodeOK, 1, &handle); |
479 SendResponseL(EMTPRespCodeOK, 1, &handle); |
445 |
480 |
446 __FLOG(_L8("DoOnTimeoutL - Exit")); |
481 OstTraceFunctionExit0( CMTPCOPYOBJECT_DOONTIMEOUTL_EXIT ); |
447 } |
482 } |
448 |
483 |
449 /** |
484 /** |
450 CMTPCopyObject::RunL |
485 CMTPCopyObject::RunL |
451 */ |
486 */ |
452 void CMTPCopyObject::RunL() |
487 void CMTPCopyObject::RunL() |
453 { |
488 { |
454 __FLOG(_L8("RunL - Entry")); |
489 OstTraceFunctionEntry0( CMTPCOPYOBJECT_RUNL_ENTRY ); |
455 |
490 |
456 User::LeaveIfError(iStatus.Int()); |
491 LEAVEIFERROR(iStatus.Int(), |
|
492 OstTrace1( TRACE_ERROR, DUP2_CMTPCOPYOBJECT_RUNL, "wrong istatus %d", iStatus.Int())); |
457 SetPreviousPropertiesL(*iNewFileName); |
493 SetPreviousPropertiesL(*iNewFileName); |
458 CMTPFSEntryCache& aCache = iDpSingletons.CopyingBigFileCache(); |
494 CMTPFSEntryCache& aCache = iDpSingletons.CopyingBigFileCache(); |
459 // Check to see if we are copying a big file |
495 // Check to see if we are copying a big file |
460 if(aCache.IsOnGoing()) |
496 if(aCache.IsOnGoing()) |
461 { |
497 { |
462 __FLOG(_L8("RunL - Big file copy complete")); |
498 OstTrace0( TRACE_NORMAL, CMTPCOPYOBJECT_RUNL, "RunL - Big file copy complete" ); |
463 aCache.SetOnGoing(EFalse); |
499 aCache.SetOnGoing(EFalse); |
464 aCache.SetTargetHandle(KMTPHandleNone); |
500 aCache.SetTargetHandle(KMTPHandleNone); |
465 } |
501 } |
466 else |
502 else |
467 { |
503 { |