mtpdataproviders/mtpimagedp/src/cmtpimagedpsendobjectinfo.cpp
branchRCL_3
changeset 20 4a793f564d72
parent 19 0aa8cc770c8a
equal deleted inserted replaced
19:0aa8cc770c8a 20:4a793f564d72
   750 */    
   750 */    
   751 TBool CMTPImageDpSendObjectInfo::DoHandleSendObjectCompleteL(TAny* /*aPtr*/)
   751 TBool CMTPImageDpSendObjectInfo::DoHandleSendObjectCompleteL(TAny* /*aPtr*/)
   752     {
   752     {
   753     __FLOG(_L8("CMTPImageDpSendObjectInfo::DoHandleSendObjectCompleteL - Entry"));    
   753     __FLOG(_L8("CMTPImageDpSendObjectInfo::DoHandleSendObjectCompleteL - Entry"));    
   754     TBool result(ETrue);
   754     TBool result(ETrue);
   755 
       
   756     delete iFileReceived;
       
   757     iFileReceived = NULL;  
       
   758     
   755     
   759 #ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
   756 #ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
   760     TInt64 objectsize = 0;
   757     TInt64 objectsize = 0;
   761 #else
   758 #else
   762     TInt objectsize = 0;
   759     TInt objectsize = 0;
   763 #endif
   760 #endif
   764     
   761     
   765     TEntry entry;
   762     iFileReceived->File().Size(objectsize);    
   766     User::LeaveIfError(iFramework.Fs().Entry(iFullPath, entry));
   763     
   767     objectsize = entry.FileSize();
       
   768    
       
   769     if (objectsize != iObjectSize)
   764     if (objectsize != iObjectSize)
   770         {
   765         {
   771         __FLOG_VA((_L8("object sizes differ %lu != %lu"), objectsize, iObjectSize));
   766         __FLOG_VA((_L8("object sizes differ %lu != %lu"), objectsize, iObjectSize));
   772         iFramework.RouteRequestUnregisterL(iExpectedSendObjectRequest, iConnection);         
   767         iFramework.RouteRequestUnregisterL(iExpectedSendObjectRequest, iConnection);         
   773         Rollback();
   768         Rollback();
   792     else if (result && !iCancelled)
   787     else if (result && !iCancelled)
   793 	    {	    	    
   788 	    {	    	    
   794         if (iProtectionStatus ==  EMTPProtectionNoProtection ||
   789         if (iProtectionStatus ==  EMTPProtectionNoProtection ||
   795             iProtectionStatus == EMTPProtectionReadOnly)
   790             iProtectionStatus == EMTPProtectionReadOnly)
   796             {
   791             {
   797             entry.iAtt &= ~(KEntryAttNormal | KEntryAttReadOnly);
   792             TUint attValue = 0;
       
   793             User::LeaveIfError(iFileReceived->File().Att(attValue));
       
   794             attValue &= ~(KEntryAttNormal | KEntryAttReadOnly);
       
   795             
   798             if (iProtectionStatus == EMTPProtectionNoProtection)
   796             if (iProtectionStatus == EMTPProtectionNoProtection)
   799                 {                        
   797                 {                        
   800                 entry.iAtt |= KEntryAttNormal;
   798                 attValue |= KEntryAttNormal;
   801                 }
   799                 }
   802             else
   800             else
   803                 {
   801                 {
   804                 entry.iAtt |= KEntryAttReadOnly;
   802                 attValue |= KEntryAttReadOnly;
   805                 }
   803                 }
   806             User::LeaveIfError(iFramework.Fs().SetAtt(iFullPath, entry.iAtt, ~entry.iAtt));
   804             User::LeaveIfError(iFileReceived->File().SetAtt(attValue, ~attValue));
   807             }
   805             }
   808 
       
   809         TTime modifiedTime;
   806         TTime modifiedTime;
   810         //update datemodified property.
   807         //update datemodified property.
   811         if(iDateMod != NULL && iDateMod->Length())
   808         if(iDateMod != NULL && iDateMod->Length())
   812            {           
   809            {           
   813            iObjectPropertyMgr.ConvertMTPTimeStr2TTimeL(*iDateMod, modifiedTime);
   810            iObjectPropertyMgr.ConvertMTPTimeStr2TTimeL(*iDateMod, modifiedTime);
       
   811            User::LeaveIfError(iFileReceived->File().SetModified(modifiedTime));
   814            }
   812            }
   815         else if(iDateCreated != NULL && iDateCreated->Length())
   813         else if(iDateCreated != NULL && iDateCreated->Length())
   816            {
   814            {
   817            iObjectPropertyMgr.ConvertMTPTimeStr2TTimeL(*iDateCreated, modifiedTime);
   815            iObjectPropertyMgr.ConvertMTPTimeStr2TTimeL(*iDateCreated, modifiedTime);
       
   816            User::LeaveIfError(iFileReceived->File().SetModified(modifiedTime));
   818            }
   817            }
   819         User::LeaveIfError(iFramework.Fs().SetModified(iFullPath, modifiedTime));
   818                                    
   820 
   819 	     iFramework.RouteRequestUnregisterL(iExpectedSendObjectRequest, iConnection);
   821         iFramework.RouteRequestUnregisterL(iExpectedSendObjectRequest, iConnection);
       
   822         
   820         
   823         //The MTP spec states that it is not mandatory for SendObjectInfo/SendObjectPropList
   821         //The MTP spec states that it is not mandatory for SendObjectInfo/SendObjectPropList
   824         //to be followed by a SendObject.  An object is reserved in the ObjectStore on 
   822         //to be followed by a SendObject.  An object is reserved in the ObjectStore on 
   825         //receiving a SendObjectInfo/SendObjectPropList request, but we only commit it 
   823         //receiving a SendObjectInfo/SendObjectPropList request, but we only commit it 
   826         //on receiving the corresponding SendObject request.  With Associations however 
   824         //on receiving the corresponding SendObject request.  With Associations however 
   827         //we commit the object straight away as the SendObject phase is often absent 
   825         //we commit the object straight away as the SendObject phase is often absent 
   828         //with folder creation.
   826         //with folder creation.
   829 		
   827 		
   830         CleanUndoList();
   828         CleanUndoList();
   831         SendResponseL(EMTPRespCodeOK);
   829         SendResponseL(EMTPRespCodeOK);
   832 	    }
   830 	    }        
   833     
   831     
       
   832     delete iFileReceived;
       
   833     iFileReceived = NULL;  
   834     
   834     
   835     iSuccessful = result;
   835     iSuccessful = result;
   836     __FLOG(_L8("CMTPImageDpSendObjectInfo::DoHandleSendObjectCompleteL - Exit"));
   836     __FLOG(_L8("CMTPImageDpSendObjectInfo::DoHandleSendObjectCompleteL - Exit"));
   837     return result;
   837     return result;
   838     }
   838     }