17 |
17 |
18 |
18 |
19 |
19 |
20 // INCLUDE FILES |
20 // INCLUDE FILES |
21 #include <bldvariant.hrh> |
21 #include <bldvariant.hrh> |
22 #include <browser_platform_variant.hrh> |
22 #include <Browser_platform_variant.hrh> |
23 |
23 |
24 #include "FileExt.h" |
24 #include "FileExt.h" |
25 #include "HttpClientApp.h" |
25 #include "HttpClientApp.h" |
26 #include "HttpDownload.h" |
26 #include "HttpDownload.h" |
27 #include "HttpStorage.h" |
27 #include "HttpStorage.h" |
694 CLOG_WRITE8_1( "Bad drive letter [%c]", drives[i] ); |
694 CLOG_WRITE8_1( "Bad drive letter [%c]", drives[i] ); |
695 } |
695 } |
696 } |
696 } |
697 CleanupStack::PopAndDestroy( drivesDynList ); |
697 CleanupStack::PopAndDestroy( drivesDynList ); |
698 CLOG_WRITE_2( "Saving content to %d Drive with %d B free space", driveSpaceMax, freeSpaceMax ); |
698 CLOG_WRITE_2( "Saving content to %d Drive with %d B free space", driveSpaceMax, freeSpaceMax ); |
699 TUint aStatus ; |
699 |
700 |
700 TDriveInfo driveInfo; |
701 if( KErrNone == DriveInfo::GetDriveStatus( iDownload->ClientApp()->Engine()->Fs(), driveSpaceMax , aStatus )) |
701 |
702 { |
702 if( !iDownload->ClientApp()->Engine()->Fs().Drive( driveInfo, driveSpaceMax) ) |
703 iRemovableStatus = (aStatus & DriveInfo::EDriveExternallyMountable) ? aStatus : 0 ; |
703 { |
704 if( iRemovableStatus ) |
704 iRemovableDest = (driveInfo.iDriveAtt & KDriveAttRemovable); |
705 { |
705 CLOG_WRITE_1( "Removable: [%d]", iRemovableDest ); |
706 iRemovableStatus = (aStatus & DriveInfo::EDriveRemovable) ? KDriveAttRemovable : KDriveAttInternal ; |
706 CLOG_WRITE_1( "driveInfo.iDriveAtt: [%d]", driveInfo.iDriveAtt ); |
707 } |
707 } |
708 else |
708 else |
709 { |
709 { |
710 iRemovableStatus = KDriveAttLocal ; |
710 CLOG_WRITE("DriveInfo failed"); |
711 } |
711 } |
712 CLOG_WRITE_1( "Removable: [%d]", iRemovableStatus ); |
|
713 CLOG_WRITE_1( "DriveInfo Status [%d]", aStatus ); |
|
714 } |
|
715 else |
|
716 { |
|
717 CLOG_WRITE("DriveStatus failed"); |
|
718 } |
|
719 |
712 |
720 return driveSpaceMax; |
713 return driveSpaceMax; |
721 #else |
714 #else |
722 // If no MMC is inserted, this will leave (and not set mmcOk). |
715 // If no MMC is inserted, this will leave (and not set mmcOk). |
723 bytesToWrite = iLength; |
716 bytesToWrite = iLength; |
727 TBool mmcOk = EFalse; |
720 TBool mmcOk = EFalse; |
728 TRAP_IGNORE( mmcOk = !SysUtil::MMCSpaceBelowCriticalLevelL |
721 TRAP_IGNORE( mmcOk = !SysUtil::MMCSpaceBelowCriticalLevelL |
729 ( &fs, bytesToWrite ); ) |
722 ( &fs, bytesToWrite ); ) |
730 if(!mmcOk) |
723 if(!mmcOk) |
731 { |
724 { |
732 iRemovableStatus = KDriveAttInternal ; |
|
733 CLOG_WRITE( "no MMC present" ); |
725 CLOG_WRITE( "no MMC present" ); |
734 return EDriveC; |
726 return EDriveC; |
735 } |
727 } |
736 CLOG_WRITE( "MMC is present " ); |
728 CLOG_WRITE( "MMC is present " ); |
737 TVolumeInfo volInfoC; |
729 TVolumeInfo volInfoC; |
738 TVolumeInfo volInfoE; |
730 TVolumeInfo volInfoE; |
739 fs.Volume(volInfoC,EDriveC); |
731 fs.Volume(volInfoC,EDriveC); |
740 fs.Volume(volInfoE,EDriveE); |
732 fs.Volume(volInfoE,EDriveE); |
741 TInt64 freeC = volInfoC.iFree;//free memory available in that drive |
733 TInt64 freeC = volInfoC.iFree;//free memory available in that drive |
742 TInt64 freeE = volInfoE.iFree; |
734 TInt64 freeE = volInfoE.iFree; |
743 freeC = freeE?EDriveC:EDriveE;//put the file in which ever drive has more memory |
735 return freeC>=freeE?EDriveC:EDriveE;//put the file in which ever drive has more memory |
744 iRemovableStatus = (EDriveC == freeC) ? KDriveAttInternal : KDriveAttRemovable ; |
|
745 return freeC; |
|
746 #endif |
736 #endif |
747 } |
737 } |
748 |
738 |
749 // Destination is FFS in default |
739 // Destination is FFS in default |
750 #ifdef RD_MULTIPLE_DRIVE |
740 #ifdef RD_MULTIPLE_DRIVE |
831 #ifdef RD_MULTIPLE_DRIVE |
821 #ifdef RD_MULTIPLE_DRIVE |
832 CleanupStack::PopAndDestroy( drivesDynList ); |
822 CleanupStack::PopAndDestroy( drivesDynList ); |
833 #endif |
823 #endif |
834 } |
824 } |
835 |
825 |
836 #ifdef RD_MULTIPLE_DRIVE |
|
837 TUint aStatus ; |
|
838 |
|
839 if( KErrNone == DriveInfo::GetDriveStatus( iDownload->ClientApp()->Engine()->Fs(), drive , aStatus )) |
|
840 { |
|
841 iRemovableStatus = (aStatus & DriveInfo::EDriveExternallyMountable) ? aStatus : 0 ; |
|
842 if( iRemovableStatus ) |
|
843 { |
|
844 iRemovableStatus = (aStatus & DriveInfo::EDriveRemovable) ? KDriveAttRemovable : KDriveAttInternal ; |
|
845 } |
|
846 else |
|
847 { |
|
848 iRemovableStatus = KDriveAttLocal ; |
|
849 } |
|
850 CLOG_WRITE_1( "Removable: [%d]", iRemovableStatus ); |
|
851 CLOG_WRITE_1( "DriveInfo Status [%d]", aStatus ); |
|
852 } |
|
853 else |
|
854 { |
|
855 CLOG_WRITE("DriveStatus failed"); |
|
856 } |
|
857 |
|
858 #else |
|
859 TDriveInfo driveInfo; |
826 TDriveInfo driveInfo; |
860 |
827 |
861 if( !iDownload->ClientApp()->Engine()->Fs().Drive( driveInfo, drive) ) |
828 if( !iDownload->ClientApp()->Engine()->Fs().Drive( driveInfo, drive) ) |
862 { |
829 { |
863 if (driveInfo.iDriveAtt & KDriveAttRemovable) |
830 iRemovableDest = (driveInfo.iDriveAtt & KDriveAttRemovable); |
864 iRemovableStatus = KDriveAttRemovable ; |
831 CLOG_WRITE_1( "Removable: [%d]", iRemovableDest ); |
865 else |
|
866 iRemovableStatus = KDriveAttInternal ; |
|
867 CLOG_WRITE_1( "Removable: [%d]", iRemovableStatus ); |
|
868 } |
832 } |
869 else |
833 else |
870 { |
834 { |
871 CLOG_WRITE("DriveInfo failed"); |
835 CLOG_WRITE("DriveInfo failed"); |
872 } |
836 } |
873 #endif |
837 |
874 |
|
875 if( err || !isSpace ) |
838 if( err || !isSpace ) |
876 { |
839 { |
877 CLOG_WRITE8( "OOD1" ); |
840 CLOG_WRITE8( "OOD1" ); |
878 iDownload->OnError( KErrDiskFull, EDiskFull ); |
841 iDownload->OnError( KErrDiskFull, EDiskFull ); |
879 User::Leave( KErrDiskFull ); |
842 User::Leave( KErrDiskFull ); |
1042 |
1005 |
1043 iDriveId = GetDestinationDriveId(); |
1006 iDriveId = GetDestinationDriveId(); |
1044 TInt drive; |
1007 TInt drive; |
1045 if( !iDownload->ClientApp()->Engine()->Fs().CharToDrive((*iDestFilename)[0], drive) ) |
1008 if( !iDownload->ClientApp()->Engine()->Fs().CharToDrive((*iDestFilename)[0], drive) ) |
1046 { |
1009 { |
1047 #ifdef RD_MULTIPLE_DRIVE |
1010 TDriveInfo driveInfo; |
1048 TUint aStatus ; |
1011 if( !iDownload->ClientApp()->Engine()->Fs().Drive( driveInfo, drive) ) |
1049 |
1012 { |
1050 if( KErrNone == DriveInfo::GetDriveStatus( iDownload->ClientApp()->Engine()->Fs(), drive , aStatus )) |
1013 iRemovableDest = (driveInfo.iDriveAtt & KDriveAttRemovable); |
1051 { |
1014 CLOG_WRITE_1( "Removable: [%d]", iRemovableDest ); |
1052 iRemovableStatus = (aStatus & DriveInfo::EDriveExternallyMountable) ? aStatus : 0 ; |
|
1053 if( iRemovableStatus ) |
|
1054 { |
|
1055 iRemovableStatus = (aStatus & DriveInfo::EDriveRemovable) ? KDriveAttRemovable : KDriveAttInternal ; |
|
1056 } |
|
1057 else |
|
1058 { |
|
1059 iRemovableStatus = KDriveAttLocal ; |
|
1060 } |
|
1061 CLOG_WRITE_1( "Removable: [%d]", iRemovableStatus ); |
|
1062 CLOG_WRITE_1( "DriveInfo Status [%d]", aStatus ); |
|
1063 } |
1015 } |
1064 else |
1016 else |
1065 { |
1017 { |
1066 CLOG_WRITE("DriveStatus failed"); |
|
1067 } |
|
1068 |
|
1069 #else |
|
1070 TDriveInfo driveInfo; |
|
1071 |
|
1072 if( !iDownload->ClientApp()->Engine()->Fs().Drive( driveInfo, drive) ) |
|
1073 { |
|
1074 if (driveInfo.iDriveAtt & KDriveAttRemovable) |
|
1075 iRemovableStatus = KDriveAttRemovable ; |
|
1076 else |
|
1077 iRemovableStatus = KDriveAttInternal ; |
|
1078 CLOG_WRITE_1( "Removable: [%d]", iRemovableStatus ); |
|
1079 } |
|
1080 else |
|
1081 { |
|
1082 CLOG_WRITE("DriveInfo failed"); |
1018 CLOG_WRITE("DriveInfo failed"); |
1083 } |
1019 } |
1084 #endif |
|
1085 } |
1020 } |
1086 else |
1021 else |
1087 { |
1022 { |
1088 CLOG_WRITE("CharToDrive failed"); |
1023 CLOG_WRITE("CharToDrive failed"); |
1089 } |
1024 } |
1106 APPEND_BUF_INT( aBuf, iStorageMethod ); |
1041 APPEND_BUF_INT( aBuf, iStorageMethod ); |
1107 APPEND_BUF_INT( aBuf, iProgressiveDownload); |
1042 APPEND_BUF_INT( aBuf, iProgressiveDownload); |
1108 APPEND_BUF_INT( aBuf, iDownloadedSize); |
1043 APPEND_BUF_INT( aBuf, iDownloadedSize); |
1109 AppendBufL( aBuf, iDdFilename ); |
1044 AppendBufL( aBuf, iDdFilename ); |
1110 APPEND_BUF_INT( aBuf, iDownload->iMoLength ); |
1045 APPEND_BUF_INT( aBuf, iDownload->iMoLength ); |
1111 APPEND_BUF_INT( aBuf, iRemovableStatus ); |
1046 APPEND_BUF_INT( aBuf, iRemovableDest ); |
1112 |
1047 |
1113 } |
1048 } |
1114 |
1049 |
1115 // ----------------------------------------------------------------------------- |
1050 // ----------------------------------------------------------------------------- |
1116 // CHttpStorage::SaveStorageInfoL |
1051 // CHttpStorage::SaveStorageInfoL |
1128 READ_INT_L( aInFile, iStorageMethod ); |
1063 READ_INT_L( aInFile, iStorageMethod ); |
1129 READ_INT_L( aInFile, iProgressiveDownload); |
1064 READ_INT_L( aInFile, iProgressiveDownload); |
1130 READ_INT_L( aInFile, iDownloadedSize ); |
1065 READ_INT_L( aInFile, iDownloadedSize ); |
1131 ReadHBufCL( aInFile, iDdFilename ); |
1066 ReadHBufCL( aInFile, iDdFilename ); |
1132 READ_INT_L( aInFile, iDownload->iMoLength ); |
1067 READ_INT_L( aInFile, iDownload->iMoLength ); |
1133 READ_INT_L( aInFile, iRemovableStatus ); |
1068 READ_INT_L( aInFile, iRemovableDest ); |
1134 |
1069 |
1135 } |
1070 } |
1136 |
1071 |
1137 // ----------------------------------------------------------------------------- |
1072 // ----------------------------------------------------------------------------- |
1138 // CHttpStorage::UpdateExtensionL |
1073 // CHttpStorage::UpdateExtensionL |