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