mtpdataproviders/mtpimagedp/src/cmtpimagedpsendobjectinfo.cpp
branchRCL_3
changeset 19 0aa8cc770c8a
parent 15 f85613f12947
child 20 4a793f564d72
--- a/mtpdataproviders/mtpimagedp/src/cmtpimagedpsendobjectinfo.cpp	Thu Aug 19 10:44:03 2010 +0300
+++ b/mtpdataproviders/mtpimagedp/src/cmtpimagedpsendobjectinfo.cpp	Tue Aug 31 16:03:15 2010 +0300
@@ -752,6 +752,9 @@
     {
     __FLOG(_L8("CMTPImageDpSendObjectInfo::DoHandleSendObjectCompleteL - Entry"));    
     TBool result(ETrue);
+
+    delete iFileReceived;
+    iFileReceived = NULL;  
     
 #ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
     TInt64 objectsize = 0;
@@ -759,8 +762,10 @@
     TInt objectsize = 0;
 #endif
     
-    iFileReceived->File().Size(objectsize);    
-    
+    TEntry entry;
+    User::LeaveIfError(iFramework.Fs().Entry(iFullPath, entry));
+    objectsize = entry.FileSize();
+   
     if (objectsize != iObjectSize)
         {
         __FLOG_VA((_L8("object sizes differ %lu != %lu"), objectsize, iObjectSize));
@@ -789,34 +794,31 @@
         if (iProtectionStatus ==  EMTPProtectionNoProtection ||
             iProtectionStatus == EMTPProtectionReadOnly)
             {
-            TUint attValue = 0;
-            User::LeaveIfError(iFileReceived->File().Att(attValue));
-            attValue &= ~(KEntryAttNormal | KEntryAttReadOnly);
-            
+            entry.iAtt &= ~(KEntryAttNormal | KEntryAttReadOnly);
             if (iProtectionStatus == EMTPProtectionNoProtection)
                 {                        
-                attValue |= KEntryAttNormal;
+                entry.iAtt |= KEntryAttNormal;
                 }
             else
                 {
-                attValue |= KEntryAttReadOnly;
+                entry.iAtt |= KEntryAttReadOnly;
                 }
-            User::LeaveIfError(iFileReceived->File().SetAtt(attValue, ~attValue));
+            User::LeaveIfError(iFramework.Fs().SetAtt(iFullPath, entry.iAtt, ~entry.iAtt));
             }
+
         TTime modifiedTime;
         //update datemodified property.
         if(iDateMod != NULL && iDateMod->Length())
            {           
            iObjectPropertyMgr.ConvertMTPTimeStr2TTimeL(*iDateMod, modifiedTime);
-           User::LeaveIfError(iFileReceived->File().SetModified(modifiedTime));
            }
         else if(iDateCreated != NULL && iDateCreated->Length())
            {
            iObjectPropertyMgr.ConvertMTPTimeStr2TTimeL(*iDateCreated, modifiedTime);
-           User::LeaveIfError(iFileReceived->File().SetModified(modifiedTime));
            }
-                                   
-	     iFramework.RouteRequestUnregisterL(iExpectedSendObjectRequest, iConnection);
+        User::LeaveIfError(iFramework.Fs().SetModified(iFullPath, modifiedTime));
+
+        iFramework.RouteRequestUnregisterL(iExpectedSendObjectRequest, iConnection);
         
         //The MTP spec states that it is not mandatory for SendObjectInfo/SendObjectPropList
         //to be followed by a SendObject.  An object is reserved in the ObjectStore on 
@@ -827,10 +829,8 @@
 		
         CleanUndoList();
         SendResponseL(EMTPRespCodeOK);
-	    }        
+	    }
     
-    delete iFileReceived;
-    iFileReceived = NULL;  
     
     iSuccessful = result;
     __FLOG(_L8("CMTPImageDpSendObjectInfo::DoHandleSendObjectCompleteL - Exit"));