mtpfws/mtpfw/dataproviders/dputility/src/cmtpsendobjectinfo.cpp
branchRCL_3
changeset 48 debf68073f2f
parent 39 dbd1c5e08735
child 58 142dacf7b30e
--- a/mtpfws/mtpfw/dataproviders/dputility/src/cmtpsendobjectinfo.cpp	Tue Sep 14 22:52:29 2010 +0300
+++ b/mtpfws/mtpfw/dataproviders/dputility/src/cmtpsendobjectinfo.cpp	Wed Sep 15 13:07:27 2010 +0300
@@ -100,7 +100,8 @@
 @param aConnection    The connection from which the request comes
 */    
 CMTPSendObjectInfo::CMTPSendObjectInfo(MMTPDataProviderFramework& aFramework, MMTPConnection& aConnection) :
-    CMTPRequestProcessor(aFramework, aConnection, 0, NULL)
+    CMTPRequestProcessor(aFramework, aConnection, 0, NULL),
+    iHiddenStatus( EMTPVisible )
     {
     }
 
@@ -660,14 +661,15 @@
         
     if (!iIsFolder)
         {        
-        delete iFileReceived;
-        iFileReceived = NULL;
         
         TEntry fileEntry;
         User::LeaveIfError(iFramework.Fs().Entry(iFullPath, fileEntry));
 
         if (fileEntry.FileSize() != iObjectSize)
             {
+			delete iFileReceived;
+        	iFileReceived = NULL;
+			
             iFramework.RouteRequestUnregisterL(iExpectedSendObjectRequest, iConnection);
             
             iFramework.Fs().Delete(iFullPath);
@@ -713,6 +715,8 @@
         if(!iIsFolder)
             {
             SetPropertiesL();    
+            delete iFileReceived;
+            iFileReceived = NULL;
             iFramework.ObjectMgr().CommitReservedObjectHandleL(*iReceivedObject);
             iFullPath.LowerCase();
             __FLOG_VA((_L8("File Name %S"), &iFullPath));
@@ -939,6 +943,9 @@
     case EMTPObjectPropCodeName:
     	iName = aElement.StringL(CMTPTypeObjectPropListElement::EValue);
     	break;
+    case EMTPObjectPropCodeHidden:
+        iHiddenStatus = aElement.Uint16L(CMTPTypeObjectPropListElement::EValue);
+        break;
     default:
         break;
         }
@@ -1031,6 +1038,7 @@
         break;
         
     case EMTPObjectPropCodeAssociationType:
+    case EMTPObjectPropCodeHidden:
         if (aElement.Uint16L(CMTPTypeObjectPropListElement::EDatatype) != EMTPTypeUINT16)
              {
              responseCode = EMTPRespCodeInvalidObjectPropFormat;
@@ -1199,6 +1207,7 @@
 void CMTPSendObjectInfo::SetPropertiesL()
     {
     __FLOG(_L8("SetPropertiesL - Entry"));
+
     TEntry entry;
     User::LeaveIfError(iFramework.Fs().Entry(iFullPath, entry));  
     
@@ -1235,14 +1244,42 @@
             {
             entry.iAtt |= KEntryAttReadOnly;
             }
-        User::LeaveIfError(iFramework.Fs().SetAtt(iFullPath, entry.iAtt, ~entry.iAtt));
+        if ( iFileReceived )
+            {
+            User::LeaveIfError(iFileReceived->File().SetAtt(entry.iAtt, ~entry.iAtt));
+            }
+        else
+            {
+            User::LeaveIfError(iFramework.Fs().SetAtt(iFullPath, entry.iAtt, ~entry.iAtt));
+            }
         }
-
+    
+    if ( EMTPHidden == iHiddenStatus )
+        {
+		entry.iAtt &= ~KEntryAttHidden;
+        entry.iAtt |= KEntryAttHidden;
+        if ( iFileReceived )
+            {
+            User::LeaveIfError(iFileReceived->File().SetAtt(entry.iAtt, ~entry.iAtt));
+            }
+        else
+            {
+            User::LeaveIfError(iFramework.Fs().SetAtt(iFullPath, entry.iAtt, ~entry.iAtt));
+            }
+        }
+    
     if(iDateMod != NULL && iDateMod->Length())
        {
        TTime modifiedTime;
        iDpSingletons.MTPUtility().MTPTimeStr2TTime(*iDateMod, modifiedTime);
-       User::LeaveIfError(iFramework.Fs().SetModified(iFullPath, modifiedTime));
+       if ( iFileReceived )
+           { 
+           User::LeaveIfError(iFileReceived->File().SetModified( modifiedTime ));
+           }
+       else
+           {
+           User::LeaveIfError(iFramework.Fs().SetModified(iFullPath, modifiedTime));
+           }
        }  
     
     iReceivedObject->SetDesCL(CMTPObjectMetaData::EName, iName);