741 */ |
751 */ |
742 TBool CMTPImageDpSendObjectInfo::DoHandleSendObjectCompleteL(TAny* /*aPtr*/) |
752 TBool CMTPImageDpSendObjectInfo::DoHandleSendObjectCompleteL(TAny* /*aPtr*/) |
743 { |
753 { |
744 __FLOG(_L8("CMTPImageDpSendObjectInfo::DoHandleSendObjectCompleteL - Entry")); |
754 __FLOG(_L8("CMTPImageDpSendObjectInfo::DoHandleSendObjectCompleteL - Entry")); |
745 TBool result(ETrue); |
755 TBool result(ETrue); |
|
756 |
|
757 delete iFileReceived; |
|
758 iFileReceived = NULL; |
746 |
759 |
747 #ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API |
760 #ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API |
748 TInt64 objectsize = 0; |
761 TInt64 objectsize = 0; |
749 #else |
762 #else |
750 TInt objectsize = 0; |
763 TInt objectsize = 0; |
751 #endif |
764 #endif |
752 |
765 |
753 iFileReceived->File().Size(objectsize); |
766 TEntry entry; |
754 |
767 User::LeaveIfError(iFramework.Fs().Entry(iFullPath, entry)); |
|
768 objectsize = entry.FileSize(); |
|
769 |
755 if (objectsize != iObjectSize) |
770 if (objectsize != iObjectSize) |
756 { |
771 { |
757 __FLOG_VA((_L8("object sizes differ %lu != %lu"), objectsize, iObjectSize)); |
772 __FLOG_VA((_L8("object sizes differ %lu != %lu"), objectsize, iObjectSize)); |
758 iFramework.RouteRequestUnregisterL(iExpectedSendObjectRequest, iConnection); |
773 iFramework.RouteRequestUnregisterL(iExpectedSendObjectRequest, iConnection); |
759 Rollback(); |
774 Rollback(); |
778 else if (result && !iCancelled) |
793 else if (result && !iCancelled) |
779 { |
794 { |
780 if (iProtectionStatus == EMTPProtectionNoProtection || |
795 if (iProtectionStatus == EMTPProtectionNoProtection || |
781 iProtectionStatus == EMTPProtectionReadOnly) |
796 iProtectionStatus == EMTPProtectionReadOnly) |
782 { |
797 { |
783 TUint attValue = 0; |
798 entry.iAtt &= ~(KEntryAttNormal | KEntryAttReadOnly); |
784 User::LeaveIfError(iFileReceived->File().Att(attValue)); |
|
785 attValue &= ~(KEntryAttNormal | KEntryAttReadOnly); |
|
786 |
|
787 if (iProtectionStatus == EMTPProtectionNoProtection) |
799 if (iProtectionStatus == EMTPProtectionNoProtection) |
788 { |
800 { |
789 attValue |= KEntryAttNormal; |
801 entry.iAtt |= KEntryAttNormal; |
790 } |
802 } |
791 else |
803 else |
792 { |
804 { |
793 attValue |= KEntryAttReadOnly; |
805 entry.iAtt |= KEntryAttReadOnly; |
794 } |
806 } |
795 User::LeaveIfError(iFileReceived->File().SetAtt(attValue, ~attValue)); |
807 User::LeaveIfError(iFramework.Fs().SetAtt(iFullPath, entry.iAtt, ~entry.iAtt)); |
796 } |
808 } |
|
809 |
797 TTime modifiedTime; |
810 TTime modifiedTime; |
798 //update datemodified property. |
811 //update datemodified property. |
799 if(iDateMod != NULL && iDateMod->Length()) |
812 if(iDateMod != NULL && iDateMod->Length()) |
800 { |
813 { |
801 iObjectPropertyMgr.ConvertMTPTimeStr2TTimeL(*iDateMod, modifiedTime); |
814 iObjectPropertyMgr.ConvertMTPTimeStr2TTimeL(*iDateMod, modifiedTime); |
802 User::LeaveIfError(iFileReceived->File().SetModified(modifiedTime)); |
|
803 } |
815 } |
804 else if(iDateCreated != NULL && iDateCreated->Length()) |
816 else if(iDateCreated != NULL && iDateCreated->Length()) |
805 { |
817 { |
806 iObjectPropertyMgr.ConvertMTPTimeStr2TTimeL(*iDateCreated, modifiedTime); |
818 iObjectPropertyMgr.ConvertMTPTimeStr2TTimeL(*iDateCreated, modifiedTime); |
807 User::LeaveIfError(iFileReceived->File().SetModified(modifiedTime)); |
|
808 } |
819 } |
809 |
820 User::LeaveIfError(iFramework.Fs().SetModified(iFullPath, modifiedTime)); |
810 iFramework.RouteRequestUnregisterL(iExpectedSendObjectRequest, iConnection); |
821 |
|
822 iFramework.RouteRequestUnregisterL(iExpectedSendObjectRequest, iConnection); |
811 |
823 |
812 //The MTP spec states that it is not mandatory for SendObjectInfo/SendObjectPropList |
824 //The MTP spec states that it is not mandatory for SendObjectInfo/SendObjectPropList |
813 //to be followed by a SendObject. An object is reserved in the ObjectStore on |
825 //to be followed by a SendObject. An object is reserved in the ObjectStore on |
814 //receiving a SendObjectInfo/SendObjectPropList request, but we only commit it |
826 //receiving a SendObjectInfo/SendObjectPropList request, but we only commit it |
815 //on receiving the corresponding SendObject request. With Associations however |
827 //on receiving the corresponding SendObject request. With Associations however |
816 //we commit the object straight away as the SendObject phase is often absent |
828 //we commit the object straight away as the SendObject phase is often absent |
817 //with folder creation. |
829 //with folder creation. |
818 |
830 |
819 CleanUndoList(); |
831 CleanUndoList(); |
820 SendResponseL(EMTPRespCodeOK); |
832 SendResponseL(EMTPRespCodeOK); |
821 } |
833 } |
822 |
834 |
823 delete iFileReceived; |
|
824 iFileReceived = NULL; |
|
825 |
835 |
826 iSuccessful = result; |
836 iSuccessful = result; |
827 __FLOG(_L8("CMTPImageDpSendObjectInfo::DoHandleSendObjectCompleteL - Exit")); |
837 __FLOG(_L8("CMTPImageDpSendObjectInfo::DoHandleSendObjectCompleteL - Exit")); |
828 return result; |
838 return result; |
829 } |
839 } |
1275 break; |
1285 break; |
1276 } |
1286 } |
1277 |
1287 |
1278 return resp; |
1288 return resp; |
1279 } |
1289 } |
|
1290 |
|
1291 /** |
|
1292 Check if the object is too large |
|
1293 @return ETrue if yes, otherwise EFalse |
|
1294 */ |
|
1295 TBool CMTPImageDpSendObjectInfo::IsTooLarge(TUint64 aObjectSize) const |
|
1296 { |
|
1297 __FLOG(_L8("IsTooLarge - Entry")); |
|
1298 TBool ret(aObjectSize > KMaxTInt64); |
|
1299 |
|
1300 if(!ret) |
|
1301 { |
|
1302 TBuf<255> fsname; |
|
1303 TUint32 storageId = iStorageId; |
|
1304 if (storageId == KMTPStorageDefault) |
|
1305 { |
|
1306 storageId = iFramework.StorageMgr().DefaultStorageId(); |
|
1307 } |
|
1308 TInt drive( iFramework.StorageMgr().DriveNumber(storageId) ); |
|
1309 if(drive != KErrNotFound) |
|
1310 { |
|
1311 iFramework.Fs().FileSystemSubType(drive, fsname); |
|
1312 |
|
1313 const TUint64 KMaxFatFileSize = 0xFFFFFFFF; //Maximal file size supported by all FAT filesystems (4GB-1) |
|
1314 _LIT(KFsFAT16, "FAT16"); |
|
1315 _LIT(KFsFAT32, "FAT32"); |
|
1316 |
|
1317 if((fsname.CompareF(KFsFAT16) == 0 || fsname.CompareF(KFsFAT32) == 0) && aObjectSize > KMaxFatFileSize) |
|
1318 { |
|
1319 ret = ETrue; |
|
1320 } |
|
1321 } |
|
1322 } |
|
1323 __FLOG_VA((_L8("Result = %d"), ret)); |
|
1324 __FLOG(_L8("IsTooLarge - Exit")); |
|
1325 return ret; |
|
1326 } |