--- a/mtpfws/mtpfw/datatypes/src/cmtptypefile.cpp Fri Apr 16 15:51:48 2010 +0300
+++ b/mtpfws/mtpfw/datatypes/src/cmtptypefile.cpp Mon May 03 13:19:02 2010 +0300
@@ -17,10 +17,16 @@
@file
@publishedPartner
*/
-
+#include <centralrepository.h>
#include <mtp/cmtptypefile.h>
#include <mtp/mtpdatatypeconstants.h>
+#include "mtpframeworkconst.h"
+
+//This file is exported from s60 sdk, now just copy it
+//to make sure onb can run
+#include "UiklafInternalCRKeys.h"
+
// File type constants.
const TInt KMTPFileChunkSizeForLargeFile(0x00080000); // 512K
@@ -32,14 +38,6 @@
const TUint KUSBHeaderLen = 12;
-//MTP should reserve some disk space to prevent ood monitor popup
-//'Out of memory' note.When syncing music through ovi suite,
-//sometimes device screen get freeze with this note
-//If you need to adjust this value,please also update the definition
-//in file 'cmtpgetstorageinfo.cpp'
-const TInt KFreeSpaceThreshHoldValue(11*1024*1024);//11M
-
-
CMTPTypeFile::CFileWriter* CMTPTypeFile::CFileWriter::NewL(RFile& aFile, RBuf8& aWriteBuf)
{
CFileWriter *self = new(ELeave)CFileWriter(aFile, aWriteBuf);
@@ -197,7 +195,39 @@
fs.Volume(volumeInfo,driveNo);
fs.Close();
- if(volumeInfo.iFree <= KFreeSpaceThreshHoldValue + aSize)
+ //Read the threshold value from Central Repository and check against it
+ CRepository* repository(NULL);
+ TInt thresholdValue(0);
+ TRAPD(err,repository = CRepository::NewL(KCRUidUiklaf));
+ if (err == KErrNone)
+ {
+ if (driveNo == EDriveC)
+ {
+ TInt warningUsagePercent(0);
+ err = repository->Get(KUikOODDiskFreeSpaceWarningNoteLevel,warningUsagePercent);
+ if (err == KErrNone)
+ {
+ thresholdValue = ((volumeInfo.iSize*(100-warningUsagePercent))/100)
+ + KFreeSpaceExtraReserved;
+ }
+ }
+ else
+ {
+ err = repository->Get(KUikOODDiskFreeSpaceWarningNoteLevelMassMemory,thresholdValue);
+ if (err == KErrNone)
+ {
+ thresholdValue += KFreeSpaceExtraReserved;
+ }
+ }
+ delete repository;
+ }
+
+ if (err != KErrNone)
+ {
+ thresholdValue = KFreeSpaceThreshHoldDefaultValue + KFreeSpaceExtraReserved;
+ }
+
+ if(volumeInfo.iFree <= thresholdValue + aSize)
{
User::Leave(KErrDiskFull);
}