mtpfws/mtpfw/dataproviders/dputility/src/cmtpsetobjectprotection.cpp
branchRCL_3
changeset 6 ef55b168cedb
parent 5 3673b591050c
child 15 f85613f12947
--- a/mtpfws/mtpfw/dataproviders/dputility/src/cmtpsetobjectprotection.cpp	Wed Apr 14 16:49:36 2010 +0300
+++ b/mtpfws/mtpfw/dataproviders/dputility/src/cmtpsetobjectprotection.cpp	Tue Apr 27 17:30:23 2010 +0300
@@ -28,6 +28,7 @@
 #include "mtpframeworkconst.h"
 #include "rmtpdpsingletons.h"
 #include "rmtputility.h"
+#include "cmtpstoragemgr.h"
 
 /**
 Verification data for the SetObjectPropValue request
@@ -63,6 +64,7 @@
 EXPORT_C CMTPSetObjectProtection::~CMTPSetObjectProtection()
     {   
     delete iObjMeta;
+    iSingletons.Close();
     }
 
 /**
@@ -85,6 +87,11 @@
         {
         return EMTPRespCodeInvalidObjectHandle;
         }
+    if(!iSingletons.StorageMgr().IsReadWriteStorage(iObjMeta->Uint(CMTPObjectMetaData::EStorageId)))
+		{
+		return EMTPRespCodeAccessDenied; //EMTPRespCodeStoreReadOnly
+		}
+    
     TUint32 statusValue = Request().Uint32(TMTPTypeRequest::ERequestParameter2);
     //Currently we only support EMTPProtectionNoProtection and EMTPProtectionReadOnly
     if ( statusValue!=EMTPProtectionNoProtection && statusValue!=EMTPProtectionReadOnly )
@@ -151,4 +158,5 @@
 void CMTPSetObjectProtection::ConstructL()
     {   
     iObjMeta = CMTPObjectMetaData::NewL();
+    iSingletons.OpenL();
     }