Revision: 201024 RCL_3
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Thu, 15 Jul 2010 19:35:12 +0300
branchRCL_3
changeset 17 dbd1c5e08735
parent 15 f85613f12947
child 18 453dfc402455
Revision: 201024 Kit: 2010127
connectivitymodules/SeCon/services/csc/src/caplist.cpp
connectivitymodules/SeCon/services/csc/src/caputils.cpp
connectivitymodules/SeCon/services/csc/src/stringlist.cpp
connectivitymodules/SeCon/services/ftp/inc/sconftp.h
connectivitymodules/SeCon/services/ftp/src/sconftp.cpp
mtpdataproviders/mtppictbridgedp/inc/s60dependency.h
mtpfws/mtpfw/common/inc/uiklafinternalcrkeys.h
mtpfws/mtpfw/dataproviders/devdp/src/cmtpdevicedp.cpp
mtpfws/mtpfw/dataproviders/devdp/src/cmtpgetstorageinfo.cpp
mtpfws/mtpfw/dataproviders/devdp/src/mtpdevicedpprocessor.cpp
mtpfws/mtpfw/dataproviders/dputility/src/cmtpmoveobject.cpp
mtpfws/mtpfw/dataproviders/dputility/src/cmtpsendobjectinfo.cpp
mtpfws/mtpfw/dataproviders/dputility/src/rmtputility.cpp
mtpfws/mtpfw/datatypes/group/mtpdatatypes.mmp
mtpfws/mtpfw/datatypes/src/cmtptypefile.cpp
mtpfws/mtpfw/datatypes/src/cmtptypeobjectproplist.cpp
mtpfws/mtpfw/inc/mtpcommonconst.h
mtpfws/mtpfw/src/cmtpobjectstore.cpp
--- a/connectivitymodules/SeCon/services/csc/src/caplist.cpp	Mon Jun 21 16:36:59 2010 +0300
+++ b/connectivitymodules/SeCon/services/csc/src/caplist.cpp	Thu Jul 15 19:35:12 2010 +0300
@@ -34,12 +34,10 @@
 //
 CCapList* CCapList::NewL()
     {
-    TRACE_FUNC_ENTRY;
     CCapList* self = new(ELeave) CCapList();
     CleanupStack::PushL( self );
     self->ConstructL();
     CleanupStack::Pop( self );
-    TRACE_FUNC_EXIT;
     return self;
     }
 
@@ -50,9 +48,7 @@
 //
 CCapList::~CCapList()
     {
-    TRACE_FUNC_ENTRY;
     delete iList;
-    TRACE_FUNC_EXIT;
     }
 
 // -----------------------------------------------------------------------------
@@ -71,9 +67,7 @@
 //
 void CCapList::ConstructL()
     {
-    TRACE_FUNC_ENTRY;
     iList = CStringList::NewL();
-    TRACE_FUNC_EXIT;
     }
 
 // -----------------------------------------------------------------------------
@@ -94,7 +88,6 @@
 //
 TInt CCapList::FindFromMark(TInt aId, TInt aType)
     {
-    TRACE_FUNC_ENTRY;
     TInt mark = List()->Mark();
     TInt count= List()->Count();
     
@@ -106,7 +99,6 @@
     TInt index=Find(aId, aType, mark);
     if ( index == KErrNotFound )
         {
-        LOGGER_WRITE_1( "CCapList::FindFromMark(TInt aId, TInt aType) returned : %d", KErrNotFound );
         return KErrNotFound;
         }
         
@@ -114,7 +106,6 @@
     __ASSERT_DEBUG(index>=mark, CapUtil::Panic(KErrGeneral));
 
     List()->SetMark(index+1);
-    LOGGER_WRITE_1( "CCapList::FindFromMark(TInt aId, TInt aType) returned : %d", index );
     return index;
     }
 
--- a/connectivitymodules/SeCon/services/csc/src/caputils.cpp	Mon Jun 21 16:36:59 2010 +0300
+++ b/connectivitymodules/SeCon/services/csc/src/caputils.cpp	Thu Jul 15 19:35:12 2010 +0300
@@ -198,12 +198,23 @@
         mobilePhone.GetCurrentNetwork( 
             status, mobilePhoneNetworkInfoPckg, mobilePhoneLocationArea );
         User::WaitForRequest( status );
-        User::LeaveIfError( status.Int() );     
+        User::LeaveIfError( status.Int() );
         }
     
     CleanupStack::PopAndDestroy( &mobilePhone );
     CleanupStack::PopAndDestroy( &server );
-    StrCopy( aLongName, mobilePhoneNetworkInfo.iLongName );
+    if ( mobilePhoneNetworkInfo.iLongName.Length() > 0 )
+        {
+        StrCopy( aLongName, mobilePhoneNetworkInfo.iLongName );
+        }
+    else if ( mobilePhoneNetworkInfo.iShortName.Length() > 0 )
+        {
+        StrCopy( aLongName, mobilePhoneNetworkInfo.iShortName );
+        }
+    else
+        {
+        StrCopy( aLongName, mobilePhoneNetworkInfo.iDisplayTag );
+        }
     StrCopy( aCountryCode, mobilePhoneNetworkInfo.iCountryCode );
     StrCopy( aNetworkID, mobilePhoneNetworkInfo.iNetworkId );
     
--- a/connectivitymodules/SeCon/services/csc/src/stringlist.cpp	Mon Jun 21 16:36:59 2010 +0300
+++ b/connectivitymodules/SeCon/services/csc/src/stringlist.cpp	Thu Jul 15 19:35:12 2010 +0300
@@ -33,10 +33,8 @@
 //
 CStringList* CStringList::NewL()
     {
-    TRACE_FUNC_ENTRY;
     CStringList* self = CStringList::NewLC();
     CleanupStack::Pop( self );
-    TRACE_FUNC_EXIT;
     return self;
     }
 
@@ -47,11 +45,9 @@
 //
 CStringList* CStringList::NewLC()
     {
-    TRACE_FUNC_ENTRY;
     CStringList* self = new ( ELeave ) CStringList();
     CleanupStack::PushL( self );
     self->ConstructL();
-    TRACE_FUNC_EXIT;
     return self;
     }
 
@@ -62,7 +58,6 @@
 //
 CStringList::CStringList()
     {
-    TRACE_FUNC;
     }
 
 // -----------------------------------------------------------------------------
@@ -72,10 +67,8 @@
 //
 CStringList::~CStringList()
     {
-    TRACE_FUNC_ENTRY;
     delete iLines;
     iLines = NULL;
-    TRACE_FUNC_EXIT;
     }
 
 // -----------------------------------------------------------------------------
@@ -85,11 +78,9 @@
 //
 void CStringList::ConstructL()
     {
-    TRACE_FUNC_ENTRY;
     const TInt KDefaultArrayGranularity = 10;
     iLines = new (ELeave) CDesCArrayFlat(KDefaultArrayGranularity);
     SetMark(0);
-    TRACE_FUNC_EXIT;
     }
 
 // -----------------------------------------------------------------------------
--- a/connectivitymodules/SeCon/services/ftp/inc/sconftp.h	Mon Jun 21 16:36:59 2010 +0300
+++ b/connectivitymodules/SeCon/services/ftp/inc/sconftp.h	Thu Jul 15 19:35:12 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
@@ -234,6 +234,8 @@
         */
         void UpdateDriveTypeInfoL();
         
+        void CreateObexBufObjectL( CObexBufObject*& aObject, CBufFlat*& aBuffer );
+        
         CSConFTP();
         virtual void ConstructL();
     
--- a/connectivitymodules/SeCon/services/ftp/src/sconftp.cpp	Mon Jun 21 16:36:59 2010 +0300
+++ b/connectivitymodules/SeCon/services/ftp/src/sconftp.cpp	Thu Jul 15 19:35:12 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
@@ -378,21 +378,7 @@
 
             if( ret == KErrNone )
                 {
-                delete aObject;
-                aObject = CObexBufObject::NewL( NULL );
-                        
-                if( aBuffer )
-                    {
-                    aBuffer->Reset();
-                    delete aBuffer;
-                    }
-                
-                aBuffer = CBufFlat::NewL( KSConBufferSize );
-                aBuffer->ResizeL( KSConBufferSize );
-                
-                TObexFilenameBackedBuffer bufferdetails( *aBuffer, iTempFileName, 
-                CObexBufObject::EDoubleBuffering );
-                aObject->SetDataBufL( bufferdetails );
+                CreateObexBufObjectL( aObject, aBuffer );
                 }
             }
         else
@@ -432,21 +418,7 @@
     
     if( ret == KErrNone )
         {
-        delete aObject;
-        aObject = CObexBufObject::NewL( NULL );
-                
-        if( aBuffer )
-            {
-            aBuffer->Reset();
-            delete aBuffer;
-            }
-        
-        aBuffer = CBufFlat::NewL( KSConBufferSize );
-        aBuffer->ResizeL( KSConBufferSize );
-        
-        TObexFilenameBackedBuffer bufferdetails( *aBuffer, iTempFileName, 
-        CObexBufObject::EDoubleBuffering );
-        aObject->SetDataBufL( bufferdetails );
+        CreateObexBufObjectL( aObject, aBuffer );
         
         if( lowMemory )
             {
@@ -460,6 +432,31 @@
     return ret;
     }
 
+void CSConFTP::CreateObexBufObjectL( CObexBufObject*& aObject, CBufFlat*& aBuffer )
+    {
+    delete aObject;
+    aObject = NULL;
+    aObject = CObexBufObject::NewL( NULL );
+    
+    delete aBuffer;
+    aBuffer = NULL;
+    
+    aBuffer = CBufFlat::NewL( KSConBufferSize );
+    aBuffer->ResizeL( KSConBufferSize );
+    
+    TObexFilenameBackedBuffer bufferdetails( *aBuffer, iTempFileName, 
+                    CObexBufObject::EDoubleBuffering );
+    TRAPD( err, aObject->SetDataBufL( bufferdetails ));
+    if ( err == KErrNoMemory )
+        {
+        LOGGER_WRITE( "KErrNoMemory, Using singe buffer strategy");
+        // If fails, use singe buffer strategy to save RAM
+        TObexFilenameBackedBuffer lowMemBufferdetails( *aBuffer, iTempFileName, 
+                    CObexBufObject::ESingleBuffering );
+        aObject->SetDataBufL( lowMemBufferdetails );
+        }
+    }
+
 // -----------------------------------------------------------------------------
 // CSConFTP::PutFileObjectFinalizeL( CObexBufObject*& aObject )
 // Stores the relayed file object to inbox or file system.
--- a/mtpdataproviders/mtppictbridgedp/inc/s60dependency.h	Mon Jun 21 16:36:59 2010 +0300
+++ b/mtpdataproviders/mtppictbridgedp/inc/s60dependency.h	Thu Jul 15 19:35:12 2010 +0300
@@ -24,7 +24,7 @@
 
 #include <e32base.h>
 
-#include <platform/mw/usbwatcherinternalpskeys.h>
+#include <platform/mw/UsbWatcherInternalPSKeys.h>
 #include <platform/mw/usbpersonalityids.h>
 #include <pathinfo.h> 
 #include <featmgr/featmgr.h>
--- a/mtpfws/mtpfw/common/inc/uiklafinternalcrkeys.h	Mon Jun 21 16:36:59 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,94 +0,0 @@
-/*
-* Copyright (c) 2004-2008 Nokia Corporation and/or its subsidiary(-ies). 
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  Internal Central Repository keys.
-*
-*/
-
-
-#ifndef __UIKLAF_INTERNAL_CR_KEYS_H__
-#define __UIKLAF_INTERNAL_CR_KEYS_H__
-
-const TUid KCRUidUiklaf = { 0x101F8774 };
-
-// Helper constants for free disk space levels.
-#define DISK_SPACE_OK        0
-#define DISK_SPACE_WARNING  -1
-#define DISK_SPACE_CRITICAL -2
-
-/**
- * Use KUikOODDiskFreeSpaceWarningNoteLevel instead of this!!
- * Threshold for disk space warning level (bytes).
- * Read-only key. Default value: 196608
- */
-const TUint32 KUikOODDiskWarningThreshold  = 0x00000001;
-
-/**
- * Threshold for disk space critical level (bytes).
- * Read-only key. Default value: 131072
- */
-const TUint32 KUikOODDiskCriticalThreshold = 0x00000002;
-
-/**
- * Threshold for low RAM level (bytes).
- * Read-only key. Default value: 750000
- */
-const TUint32 KUikOOMRamLowThreshold       = 0x00000003;
-
-/**
- * Threshold for good RAM level (bytes).
- * Read-only key. Default value: 1000000
- */
-const TUint32 KUikOOMRamGoodThreshold      = 0x00000004;
-
-/**
- * Timeout for application exit (milliseconds).
- * Read-only key. Default value: 1000000
- */
-const TUint32 KUikOOMMaxAppExitTime        = 0x00000005;
-
-/**
- * Threshold for disk space warning note level as percent of used disk space.
- * Read-only key. Default value: 95
- */
-const TUint32 KUikOODDiskFreeSpaceWarningNoteLevel = 0x00000006;
-
-/**
- * Threshold for disk space warning note level for mass memory.
- * Read-only key. Default value: 20971520
- */
-const TUint32 KUikOODDiskFreeSpaceWarningNoteLevelMassMemory = 0x00000007;
-
-#ifdef __MTP_NAVIENGINE_TEST
-//The free size of C-Drive of NaviEngine env is less than 21M,
-//it will block many ONB test cases
-const TInt KFreeSpaceThreshHoldDefaultValue(0);
-const TInt KFreeSpaceExtraReserved(0);
-
-#else
-//MTP should reserve some disk space to prevent OOD(Out of Disk) monitor 
-//popup 'Out of memory' note.When syncing music through ovi player,
-//sometimes device screen get freeze with this note
-//Be default, this value is read from Central Respository, if error while
-//reading, use this one
-const TInt KFreeSpaceThreshHoldDefaultValue(20*1024*1024);//20M bytes
-
-//Beside the OOD threshold value, we need to reserve extra disk space
-//for harvest server do the harvest, set this as 1M
-const TInt KFreeSpaceExtraReserved(1024*1024);//1M bytes
-
-#endif
-
-#endif __UIKLAF_INTERNAL_CR_KEYS_H__
-
-// End of file
--- a/mtpfws/mtpfw/dataproviders/devdp/src/cmtpdevicedp.cpp	Mon Jun 21 16:36:59 2010 +0300
+++ b/mtpfws/mtpfw/dataproviders/devdp/src/cmtpdevicedp.cpp	Thu Jul 15 19:35:12 2010 +0300
@@ -481,7 +481,7 @@
     
     __ASSERT_ALWAYS( isFolder, User::Leave( KErrArgument ));
     __ASSERT_ALWAYS( aParentHandle != KMTPHandleNone, User::Leave( KErrArgument ));
-    __ASSERT_ALWAYS( Framework().StorageMgr().ValidStorageId( aStorageId ), User::Invariant());
+    __ASSERT_ALWAYS( Framework().StorageMgr().ValidStorageId( aStorageId ), User::Leave( KErrArgument ));
 
     __FLOG_VA((_L16("Add Entry for Path:%S"), &aPath ));
     aObjectInfo.SetUint( CMTPObjectMetaData::EDataProviderId, Framework().DataProviderId() );
--- a/mtpfws/mtpfw/dataproviders/devdp/src/cmtpgetstorageinfo.cpp	Mon Jun 21 16:36:59 2010 +0300
+++ b/mtpfws/mtpfw/dataproviders/devdp/src/cmtpgetstorageinfo.cpp	Thu Jul 15 19:35:12 2010 +0300
@@ -26,10 +26,7 @@
 #include "rmtpdevicedpsingletons.h"
 #include "cmtpdevicedpconfigmgr.h"
 #include "mtpframeworkconst.h"
-
-//This file is exported from s60 sdk, now just copy it
-//to make sure onb can run
-#include "UiklafInternalCRKeys.h"
+#include "mtpcommonconst.h"
 
 // Class constants.
 __FLOG_STMT(_LIT8(KComponent,"GetStorageInfo");)
--- a/mtpfws/mtpfw/dataproviders/devdp/src/mtpdevicedpprocessor.cpp	Mon Jun 21 16:36:59 2010 +0300
+++ b/mtpfws/mtpfw/dataproviders/devdp/src/mtpdevicedpprocessor.cpp	Thu Jul 15 19:35:12 2010 +0300
@@ -52,6 +52,8 @@
 #include "cmtpgetserviceinfo.h"
 #include "cmtpgetformatcapabilities.h"
 #include "cmtpsetobjectprotection.h"
+#include "cmtpcommonrequestprocessor.h"
+
 /**
 device data provider mapping table from request ID to factory method of the request processor
 */
@@ -89,7 +91,9 @@
 		{EMTPOpCodeGetServiceIDs, CMTPGetServiceIds::NewL},
 		{EMTPOpCodeGetServiceInfo, CMTPGetServiceInfo::NewL},
 		{EMTPOpCodeGetFormatCapabilities,CMTPGetFormatCapabilities::NewL},
-		{EMTPOpCodeSetObjectProtection, CMTPSetObjectProtection::NewL}
+		{EMTPOpCodeSetObjectProtection, CMTPSetObjectProtection::NewL},
+		{EMTPOpCodeSetServicePropList,CMTPCommonRequestProcessor::NewL<EMTPRespCodeInvalidServiceID, ETrue>},		
+        {EMTPOpCodeDeleteServicePropList,CMTPCommonRequestProcessor::NewL<EMTPRespCodeInvalidServiceID, ETrue>}		
 	};
 
 /**
--- a/mtpfws/mtpfw/dataproviders/dputility/src/cmtpmoveobject.cpp	Mon Jun 21 16:36:59 2010 +0300
+++ b/mtpfws/mtpfw/dataproviders/dputility/src/cmtpmoveobject.cpp	Thu Jul 15 19:35:12 2010 +0300
@@ -36,7 +36,7 @@
 */    
 const TMTPRequestElementInfo KMTPMoveObjectPolicy[] = 
     {
-    	{TMTPTypeRequest::ERequestParameter1, EMTPElementTypeObjectHandle, EMTPElementAttrFileOrDir | EMTPElementAttrWrite, 0, 0, 0},   	
+    	{TMTPTypeRequest::ERequestParameter1, EMTPElementTypeObjectHandle, EMTPElementAttrFileOrDir, 0, 0, 0},   	
         {TMTPTypeRequest::ERequestParameter2, EMTPElementTypeStorageId, EMTPElementAttrWrite, 0, 0, 0},                
         {TMTPTypeRequest::ERequestParameter3, EMTPElementTypeObjectHandle, EMTPElementAttrDir, 1, 0, 0}
     };
--- a/mtpfws/mtpfw/dataproviders/dputility/src/cmtpsendobjectinfo.cpp	Mon Jun 21 16:36:59 2010 +0300
+++ b/mtpfws/mtpfw/dataproviders/dputility/src/cmtpsendobjectinfo.cpp	Thu Jul 15 19:35:12 2010 +0300
@@ -540,7 +540,7 @@
             }
         }
 
-    if (result)
+    if (result && !iIsFolder)
         {    
         result &= !Exists(iFullPath);
         if (!result)
@@ -613,7 +613,7 @@
             }
         }
         
-    if (result) 
+    if (result && !iIsFolder)
         {
         result = !Exists(iFullPath);
         if (!result)
@@ -1100,18 +1100,28 @@
     iReceivedObject->SetUint(CMTPObjectMetaData::EStorageId, iStorageId);
     iReceivedObject->SetDesCL(CMTPObjectMetaData::ESuid, iFullPath);
     
-    iFramework.ObjectMgr().ReserveObjectHandleL(*iReceivedObject, iObjectSize);    
-    
     if(iIsFolder)
         {
-        SetPropertiesL(); 
-        iFramework.ObjectMgr().CommitReservedObjectHandleL(*iReceivedObject);       
+        SetPropertiesL();
+        TUint32 handle = iFramework.ObjectMgr().HandleL(iFullPath);
+        if (handle != KMTPHandleNone)
+            {
+            // The folder is already in DB
+            iReceivedObject->SetUint(CMTPObjectMetaData::EHandle, handle);
+            iFramework.ObjectMgr().ModifyObjectL(*iReceivedObject);
+            }
+        else
+            {
+            iFramework.ObjectMgr().ReserveObjectHandleL(*iReceivedObject, iObjectSize);
+            iFramework.ObjectMgr().CommitReservedObjectHandleL(*iReceivedObject);
+            }
         }
     else
-    	{
-    	iExpectedSendObjectRequest.SetUint32(TMTPTypeRequest::ERequestSessionID, iSessionId);
-    	iFramework.RouteRequestRegisterL(iExpectedSendObjectRequest, iConnection);
-    	}
+        {
+        iFramework.ObjectMgr().ReserveObjectHandleL(*iReceivedObject, iObjectSize);    
+        iExpectedSendObjectRequest.SetUint32(TMTPTypeRequest::ERequestSessionID, iSessionId);
+        iFramework.RouteRequestRegisterL(iExpectedSendObjectRequest, iConnection);
+        }
     TUint32 parameters[3];
     parameters[0] = iStorageId;
     parameters[1] = iParentHandle;
@@ -1124,7 +1134,10 @@
     {
     if (iIsFolder)
         {
-        User::LeaveIfError(iFramework.Fs().MkDirAll(iFullPath));
+        if (!Exists(iFullPath))
+            {
+            User::LeaveIfError(iFramework.Fs().MkDirAll(iFullPath));
+            }
         }
     else
         {
--- a/mtpfws/mtpfw/dataproviders/dputility/src/rmtputility.cpp	Mon Jun 21 16:36:59 2010 +0300
+++ b/mtpfws/mtpfw/dataproviders/dputility/src/rmtputility.cpp	Thu Jul 15 19:35:12 2010 +0300
@@ -526,6 +526,7 @@
         if (KErrNone != iFramework->Fs().Entry(entryName, entry))
             {
             // Skip objects that don't use the file path as SUID.
+            CleanupStack::PopAndDestroy(&rightPartName);            
             CleanupStack::PopAndDestroy(&entryName);
             continue;
             }        
--- a/mtpfws/mtpfw/datatypes/group/mtpdatatypes.mmp	Mon Jun 21 16:36:59 2010 +0300
+++ b/mtpfws/mtpfw/datatypes/group/mtpdatatypes.mmp	Thu Jul 15 19:35:12 2010 +0300
@@ -37,8 +37,8 @@
 MW_LAYER_SYSTEMINCLUDE_SYMBIAN
 
 USERINCLUDE     ../inc
-//For UiklafInternalCRKeys.h,should be removed, after we switched to DFs
-USERINCLUDE		../../common/inc
+USERINCLUDE 	../../inc
+
 
 
 SOURCEPATH      ../src
--- a/mtpfws/mtpfw/datatypes/src/cmtptypefile.cpp	Mon Jun 21 16:36:59 2010 +0300
+++ b/mtpfws/mtpfw/datatypes/src/cmtptypefile.cpp	Thu Jul 15 19:35:12 2010 +0300
@@ -21,9 +21,7 @@
 #include <mtp/cmtptypefile.h>
 #include <mtp/mtpdatatypeconstants.h>
 
-//This file is exported from s60 sdk, now just copy it
-//to make sure onb can run
-#include "UiklafInternalCRKeys.h"
+#include "mtpcommonconst.h"
 
 // File type constants.
 const TInt KMTPFileChunkSizeForLargeFile(0x00080000); // 512K
--- a/mtpfws/mtpfw/datatypes/src/cmtptypeobjectproplist.cpp	Mon Jun 21 16:36:59 2010 +0300
+++ b/mtpfws/mtpfw/datatypes/src/cmtptypeobjectproplist.cpp	Thu Jul 15 19:35:12 2010 +0300
@@ -609,9 +609,27 @@
                 {
                   User::Leave(KErrArgument);
                 }
-            TUint16 retValue;
-            GetValueL(&retValue, sizeof(TUint16));
-			return retValue;
+            
+            //Workaround for partial deletion issue observed on Windows XP/Windows7.
+            //When send an object from PC to device through Windows explorer, it will
+            //include the 'ProtectionStatus' property in the dataset of 'SendObjectPropList' 
+            //command. While syncing through Ovi player or Windows Media Player, this property
+            //will not be included.
+            //When we delete a folder which contains read-only objects,we returns partial 
+            //deletion code, because read-only object should not be deleted according to MTP spec.
+            //On receiving this,Windows popup a dialog saying 'device stops response', this really
+            //give user bad experience, to prevent this, we make this workaround here: when dataprovider
+            //query value of 'ProtectionStatus' property,always return EMTPProtectionNoProtection(0x0000).
+            if (EMTPObjectPropCodeProtectionStatus == iPropertyCode)
+                {
+                return EMTPProtectionNoProtection;
+                }
+            else
+                {
+                TUint16 retValue;
+                GetValueL(&retValue, sizeof(TUint16));
+                return retValue;
+                }
 		default:
 			User::Leave(KErrArgument);
 		}	
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mtpfws/mtpfw/inc/mtpcommonconst.h	Thu Jul 15 19:35:12 2010 +0300
@@ -0,0 +1,53 @@
+// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+ @file
+ @internalComponent
+*/
+
+#ifndef MTPCOMMONCONST_H
+#define MTPCOMMONCONST_H
+
+#ifdef __SERIES60_
+#include <UiklafInternalCRKeys.h>
+#else
+//Following is copied from 'UiklafInternalCRKeys.h', which is
+//exported from S60 sdk, in Symbian CBR, this file does not exist.
+const TUid KCRUidUiklaf = { 0x101F8774 };
+const TUint32 KUikOODDiskFreeSpaceWarningNoteLevel = 0x00000006;
+const TUint32 KUikOODDiskFreeSpaceWarningNoteLevelMassMemory = 0x00000007;
+#endif
+
+#ifdef __MTP_NAVIENGINE_TEST
+//The free size of C-Drive of NaviEngine env is less than 21M,
+//it will block many ONB test cases
+const TInt KFreeSpaceThreshHoldDefaultValue(0);
+const TInt KFreeSpaceExtraReserved(0);
+
+#else
+//MTP should reserve some disk space to prevent OOD(Out of Disk) monitor 
+//popup 'Out of memory' note.When syncing music through ovi player,
+//sometimes device screen get freeze with this note
+//Be default, this value is read from Central Respository, if error while
+//reading, use this one
+const TInt KFreeSpaceThreshHoldDefaultValue(20*1024*1024);//20M bytes
+
+//Beside the OOD threshold value, we need to reserve extra disk space
+//for harvest server,Thumbnail manager to store their data, set this as 7M
+const TInt KFreeSpaceExtraReserved(7*1024*1024);//7M bytes
+
+#endif
+#endif //MTPCOMMONCONST_H
--- a/mtpfws/mtpfw/src/cmtpobjectstore.cpp	Mon Jun 21 16:36:59 2010 +0300
+++ b/mtpfws/mtpfw/src/cmtpobjectstore.cpp	Thu Jul 15 19:35:12 2010 +0300
@@ -442,6 +442,12 @@
 	TBool needUpdateOwner = EFalse;
 	TUint dpId(aObject.Uint(CMTPObjectMetaData::EDataProviderId));
 
+	if ((aObject.DesC(CMTPObjectMetaData::ESuid)).Length() > KMaxFileName)
+	{
+	// The length of object uid should not excceeds KMaxFileName
+	User::Leave( KErrBadName );
+	}
+
 	TFileName suid;
 	suid.CopyLC(aObject.DesC(CMTPObjectMetaData::ESuid));
 	TUint32 suidHash = DefaultHash::Des16(suid);
@@ -478,7 +484,8 @@
 				aObject.SetUint(CMTPObjectMetaData::EHandle, handle);
 				id = iEnumeratingCacheObjList[found]->iPOUID;
 				aObject.SetUint(CMTPObjectMetaData::EIdentifier, id);
-				if(iEnumeratingCacheObjList[found]->iFormatcode != aObject.Uint(CMTPObjectMetaData::EFormatCode))
+				if(iEnumeratingCacheObjList[found]->iFormatcode != aObject.Uint(CMTPObjectMetaData::EFormatCode) ||
+					 iEnumeratingCacheObjList[found]->iObjParentId != aObject.Uint(CMTPObjectMetaData::EParentHandle))
 					{//have different owner
 					needUpdateOwner = ETrue;
 					}
@@ -523,6 +530,7 @@
 		needToInsert = ETrue;
 		__FLOG_VA((_L8("InsertObjectL After enmueration, needUpdateOwner %d needToInsert %d"), needUpdateOwner, needToInsert));
 		}
+		
 	if (needToInsert)//needToInsert and needUpdateOwner can't be true at same time
 		{
 		TUint32 parentHandle(aObject.Uint(CMTPObjectMetaData::EParentHandle));
@@ -562,6 +570,7 @@
 			iBatched.SetColL(EObjectStoreModes, aObject.Uint(CMTPObjectMetaData::EModes));
 			iBatched.SetColL(EObjectStoreNonConsumable, aObject.Uint(CMTPObjectMetaData::ENonConsumable));
 			iBatched.SetColL(EObjectStoreName, aObject.DesC(CMTPObjectMetaData::EName));
+			iBatched.SetColL(EObjectStoreParentHandle, aObject.Uint(CMTPObjectMetaData::EParentHandle));
 			iBatched.PutL();
 			CleanupStack::Pop(&iBatched);
 			IncTranOpsNumL();	
@@ -938,6 +947,14 @@
 			{
 			err = iDatabase.Recover();
 			}
+		if(KErrNone == err)
+			{
+			err = iDatabase.Compact();
+			if(KErrNone != err)
+				{//the DB file is corrupt
+				BaflUtils::DeleteFile(iSingletons.Fs(), fullName);
+				}
+			}
 		}
 	
 	if (err != KErrNone)