mtpfws/mtpfw/dataproviders/dputility/src/cmtpsetobjectprotection.cpp
branchRCL_3
changeset 19 ef55b168cedb
parent 16 3673b591050c
child 32 f85613f12947
equal deleted inserted replaced
16:3673b591050c 19:ef55b168cedb
    26 #include "mtpdppanic.h"
    26 #include "mtpdppanic.h"
    27 #include "cmtpdataprovidercontroller.h"
    27 #include "cmtpdataprovidercontroller.h"
    28 #include "mtpframeworkconst.h"
    28 #include "mtpframeworkconst.h"
    29 #include "rmtpdpsingletons.h"
    29 #include "rmtpdpsingletons.h"
    30 #include "rmtputility.h"
    30 #include "rmtputility.h"
       
    31 #include "cmtpstoragemgr.h"
    31 
    32 
    32 /**
    33 /**
    33 Verification data for the SetObjectPropValue request
    34 Verification data for the SetObjectPropValue request
    34 */
    35 */
    35 const TMTPRequestElementInfo KMTPSetObjectProtectionPolicy[] = 
    36 const TMTPRequestElementInfo KMTPSetObjectProtectionPolicy[] = 
    61 Destructor
    62 Destructor
    62 */  
    63 */  
    63 EXPORT_C CMTPSetObjectProtection::~CMTPSetObjectProtection()
    64 EXPORT_C CMTPSetObjectProtection::~CMTPSetObjectProtection()
    64     {   
    65     {   
    65     delete iObjMeta;
    66     delete iObjMeta;
       
    67     iSingletons.Close();
    66     }
    68     }
    67 
    69 
    68 /**
    70 /**
    69 Standard c++ constructor
    71 Standard c++ constructor
    70 */  
    72 */  
    83     iFramework.ObjectMgr().ObjectL(TMTPTypeUint32(handle), *iObjMeta);
    85     iFramework.ObjectMgr().ObjectL(TMTPTypeUint32(handle), *iObjMeta);
    84     if (!iObjMeta )
    86     if (!iObjMeta )
    85         {
    87         {
    86         return EMTPRespCodeInvalidObjectHandle;
    88         return EMTPRespCodeInvalidObjectHandle;
    87         }
    89         }
       
    90     if(!iSingletons.StorageMgr().IsReadWriteStorage(iObjMeta->Uint(CMTPObjectMetaData::EStorageId)))
       
    91 		{
       
    92 		return EMTPRespCodeAccessDenied; //EMTPRespCodeStoreReadOnly
       
    93 		}
       
    94     
    88     TUint32 statusValue = Request().Uint32(TMTPTypeRequest::ERequestParameter2);
    95     TUint32 statusValue = Request().Uint32(TMTPTypeRequest::ERequestParameter2);
    89     //Currently we only support EMTPProtectionNoProtection and EMTPProtectionReadOnly
    96     //Currently we only support EMTPProtectionNoProtection and EMTPProtectionReadOnly
    90     if ( statusValue!=EMTPProtectionNoProtection && statusValue!=EMTPProtectionReadOnly )
    97     if ( statusValue!=EMTPProtectionNoProtection && statusValue!=EMTPProtectionReadOnly )
    91         {
    98         {
    92         return EMTPRespCodeInvalidParameter;
    99         return EMTPRespCodeInvalidParameter;
   149 Second-phase construction
   156 Second-phase construction
   150 */          
   157 */          
   151 void CMTPSetObjectProtection::ConstructL()
   158 void CMTPSetObjectProtection::ConstructL()
   152     {   
   159     {   
   153     iObjMeta = CMTPObjectMetaData::NewL();
   160     iObjMeta = CMTPObjectMetaData::NewL();
       
   161     iSingletons.OpenL();
   154     }
   162     }