mtpfws/mtpfw/dataproviders/dputility/src/cmtpsendobjectinfo.cpp
branchRCL_3
changeset 12 8b094906a049
parent 11 4843bb5893b6
child 14 60a94a45d437
equal deleted inserted replaced
11:4843bb5893b6 12:8b094906a049
    34 #include "cmtpsendobjectinfo.h"
    34 #include "cmtpsendobjectinfo.h"
    35 #include "mtpdppanic.h"
    35 #include "mtpdppanic.h"
    36 #include "cmtpfsexclusionmgr.h"
    36 #include "cmtpfsexclusionmgr.h"
    37 #include "cmtpdataprovidercontroller.h"
    37 #include "cmtpdataprovidercontroller.h"
    38 #include "cmtpdataprovider.h"
    38 #include "cmtpdataprovider.h"
       
    39 #include "cmtpstoragemgr.h"
    39 
    40 
    40 
    41 
    41 // Class constants.
    42 // Class constants.
    42 __FLOG_STMT(_LIT8(KComponent,"SendObjectInfo");)
    43 __FLOG_STMT(_LIT8(KComponent,"SendObjectInfo");)
    43 
    44 
   718         	iFramework.ObjectMgr().CommitReservedObjectHandleL(*iReceivedObject);
   719         	iFramework.ObjectMgr().CommitReservedObjectHandleL(*iReceivedObject);
   719         	
   720         	
   720         	TParsePtrC file( iFullPath );
   721         	TParsePtrC file( iFullPath );
   721         	_LIT( KTxtExtensionODF, ".odf" );
   722         	_LIT( KTxtExtensionODF, ".odf" );
   722         	if ( file.ExtPresent() && file.Ext().CompareF(KTxtExtensionODF)==0 )
   723         	if ( file.ExtPresent() && file.Ext().CompareF(KTxtExtensionODF)==0 )
   723         	    {;
   724         	    {
   724         	    TUint32 DpId = iFramework.DataProviderId();
   725         	    TUint32 DpId = iFramework.DataProviderId();
   725         	    DpId = iDpSingletons.MTPUtility().GetDpId(file.Ext().Mid(1),KNullDesC);
   726         	    DpId = iDpSingletons.MTPUtility().GetDpId(file.Ext().Mid(1),KNullDesC);
   726         	    //The data provider which owns all mimetypes of a file extension is not found 
   727         	    //The data provider which owns all mimetypes of a file extension is not found 
   727         	    if ( 255 == DpId )
   728         	    if ( 255 == DpId )
   728         	        {
   729         	        {
  1078     {
  1079     {
  1079     TMTPResponseCode ret = EMTPRespCodeOK;
  1080     TMTPResponseCode ret = EMTPRespCodeOK;
  1080     const TUint32 storeId(Request().Uint32(TMTPTypeRequest::ERequestParameter1));
  1081     const TUint32 storeId(Request().Uint32(TMTPTypeRequest::ERequestParameter1));
  1081     const TUint32 parentHandle(Request().Uint32(TMTPTypeRequest::ERequestParameter2));
  1082     const TUint32 parentHandle(Request().Uint32(TMTPTypeRequest::ERequestParameter2));
  1082     
  1083     
  1083     // this checking is only valid when the second parameter is not a special value.
  1084     if( (EMTPOpCodeSendObjectPropList == iOperationCode) || (EMTPOpCodeSendObjectInfo == iOperationCode) )
  1084     if (parentHandle != KMTPHandleAll && parentHandle != KMTPHandleNone)
  1085     	{
  1085         {
  1086 		if(storeId != KMTPStorageDefault)
  1086         //does not take owernship
  1087 			{
  1087         CMTPObjectMetaData* parentObjInfo = iRequestChecker->GetObjectInfo(parentHandle);
  1088 			if(!iSingletons.StorageMgr().IsReadWriteStorage(storeId))
  1088         __ASSERT_DEBUG(parentObjInfo, Panic(EMTPDpObjectNull));
  1089 				{
  1089         
  1090 				ret = EMTPRespCodeStoreReadOnly;
  1090         if (parentObjInfo->Uint(CMTPObjectMetaData::EStorageId) != storeId)      
  1091 				}
  1091             {
  1092 			}
  1092             ret = EMTPRespCodeInvalidObjectHandle;
  1093 		
  1093             }
  1094 		 // this checking is only valid when the second parameter is not a special value.
  1094         }
  1095 		if ((EMTPRespCodeOK == ret) && (parentHandle != KMTPHandleAll && parentHandle != KMTPHandleNone))
  1095         
  1096 			{
       
  1097 			//does not take owernship
       
  1098 			CMTPObjectMetaData* parentObjInfo = iRequestChecker->GetObjectInfo(parentHandle);
       
  1099 			__ASSERT_DEBUG(parentObjInfo, Panic(EMTPDpObjectNull));
       
  1100 			
       
  1101 			if (parentObjInfo->Uint(CMTPObjectMetaData::EStorageId) != storeId)      
       
  1102 				{
       
  1103 				ret = EMTPRespCodeInvalidObjectHandle;
       
  1104 				}
       
  1105 			}
       
  1106     	}
       
  1107     
  1096     return ret;
  1108     return ret;
  1097     }
  1109     }
  1098 
  1110 
  1099 /**
  1111 /**
  1100 Reserves space for and assigns an object handle to the received object, then
  1112 Reserves space for and assigns an object handle to the received object, then
  1223             {
  1235             {
  1224             entry.iAtt |= KEntryAttReadOnly;
  1236             entry.iAtt |= KEntryAttReadOnly;
  1225             }
  1237             }
  1226         User::LeaveIfError(iFramework.Fs().SetAtt(iFullPath, entry.iAtt, ~entry.iAtt));
  1238         User::LeaveIfError(iFramework.Fs().SetAtt(iFullPath, entry.iAtt, ~entry.iAtt));
  1227         }
  1239         }
       
  1240 
       
  1241     if(iDateMod != NULL && iDateMod->Length())
       
  1242        {
       
  1243        TTime modifiedTime;
       
  1244        iDpSingletons.MTPUtility().MTPTimeStr2TTime(*iDateMod, modifiedTime);
       
  1245        User::LeaveIfError(iFramework.Fs().SetModified(iFullPath, modifiedTime));
       
  1246        }  
       
  1247     
  1228     iReceivedObject->SetDesCL(CMTPObjectMetaData::EName, iName);
  1248     iReceivedObject->SetDesCL(CMTPObjectMetaData::EName, iName);
  1229     
  1249     
  1230     __FLOG(_L8("SetPropertiesL - Exit"));
  1250     __FLOG(_L8("SetPropertiesL - Exit"));
  1231     }
  1251     }
  1232 
  1252