mtpfws/mtpfw/dataproviders/dputility/src/cmtpsendobjectinfo.cpp
branchRCL_3
changeset 14 60a94a45d437
parent 12 8b094906a049
child 19 ef55b168cedb
--- a/mtpfws/mtpfw/dataproviders/dputility/src/cmtpsendobjectinfo.cpp	Mon Mar 15 12:43:12 2010 +0200
+++ b/mtpfws/mtpfw/dataproviders/dputility/src/cmtpsendobjectinfo.cpp	Wed Mar 31 22:58:56 2010 +0300
@@ -73,7 +73,7 @@
 EXPORT_C CMTPSendObjectInfo::~CMTPSendObjectInfo()
     {
     __FLOG(_L8("~CMTPSendObjectInfo - Entry"));
-    
+    __FLOG_2(_L8("iProgress:%d NoRollback:%d"),iProgress,iNoRollback);
     if ((iProgress == EObjectInfoSucceed ||
         iProgress == EObjectInfoFail || 
         iProgress == EObjectInfoInProgress) && !iNoRollback)
@@ -158,12 +158,6 @@
                 result = EMTPRespCodeObjectTooLarge;            
                 }
          	   
-            //File size is limited to KMaxTInt64 that is 8ExaBytes
-            //if the object size is more,then report this error.
-            if (!CanStoreFileL(iStorageId, iObjectSize)||(iObjectSize > (KMaxTInt64)))
-                {
-                result = EMTPRespCodeStoreFull;
-                }
             }
         }
         
@@ -313,7 +307,7 @@
         result = EFalse;
         }
     
-    __FLOG(_L8("DoHandleCompletingPhaseL - Exit"));
+    __FLOG_2(_L8("DoHandleCompletingPhaseL - Exit result:%d progress:%d"),result,iProgress);
     return result;    
     }
 
@@ -529,11 +523,6 @@
             SendResponseL(EMTPRespCodeObjectTooLarge);
             result = EFalse;            
             }
-        if(result && !CanStoreFileL(iStorageId, iObjectSize))
-            {
-            SendResponseL(EMTPRespCodeStoreFull);
-            result = EFalse;            
-            }
         }
 
     if (result)
@@ -571,7 +560,9 @@
         
         if (err != KErrNone)
             {
+            __FLOG_1(_L8("Fail to create fs object %d"),err);
             SendResponseL(ErrorToMTPError(err));
+            result = EFalse;
             }
         else
             {
@@ -640,7 +631,9 @@
         
         if (err != KErrNone)
             {
+            __FLOG_1(_L8("Fail to create fs object %d"),err);
             SendResponseL(ErrorToMTPError(err));
+            result = EFalse;
             }
         else
             {
@@ -798,31 +791,6 @@
     }
 
 /**
-Check if we can store the file on the storage
-@return ETrue if yes, otherwise EFalse
-*/
-TBool CMTPSendObjectInfo::CanStoreFileL(TUint32 aStorageId, TInt64 aObjectSize) const
-    {
-    __FLOG(_L8("CanStoreFileL - Entry"));
-    TBool result(ETrue);
-    if (aStorageId == KMTPStorageDefault)
-        {
-        aStorageId = iFramework.StorageMgr().DefaultStorageId();
-        }
-    TInt drive( iFramework.StorageMgr().DriveNumber(aStorageId) );
-    User::LeaveIfError(drive);
-    TVolumeInfo volumeInfo;
-    User::LeaveIfError(iFramework.Fs().Volume(volumeInfo, drive));
-    if (volumeInfo.iFree < aObjectSize)
-        {        
-        result = EFalse;
-        }
-    __FLOG_VA((_L8("Result = %d"), result));
-    __FLOG(_L8("CanStoreFileL - Exit"));
-    return result;        
-    }
-
-/**
 Check if the object is too large
 @return ETrue if yes, otherwise EFalse
 */
@@ -1157,14 +1125,16 @@
     {
     if(iIsFolder)
         {
-        __FLOG(_L8("It is a folder cancel process."));
+        __FLOG(_L8("Rollback the dir created."));
         iFramework.Fs().RmDir(iFullPath);
         // If it is folder, delete it from MTP database, i.e ObjectStore.
         TRAP_IGNORE(iFramework.ObjectMgr().RemoveObjectL(iFullPath));
         }
     else
         {
-        __FLOG(_L8("It is a file cancel process."));
+        __FLOG(_L8("Rollback the file created."));
+        delete iFileReceived;
+        iFileReceived = NULL;
         // Delete this object from file system.
         iFramework.Fs().Delete(iFullPath);
         TRAP_IGNORE(iFramework.ObjectMgr().UnreserveObjectHandleL(*iReceivedObject));
@@ -1188,6 +1158,9 @@
     case KErrDiskFull:
         resp = EMTPRespCodeStoreFull;
         break;
+        
+    default:
+        break;
         }
         
     return resp;