void QFileSystemMetaData::fillFromTEntry(const TEntry& entry) { entryFlags &= ~(QFileSystemMetaData::SymbianTEntryFlags); knownFlagsMask |= QFileSystemMetaData::SymbianTEntryFlags; //Symbian doesn't have unix type file permissions entryFlags |= QFileSystemMetaData::ReadPermissions; if(!entry.IsReadOnly()) { entryFlags |= QFileSystemMetaData::WritePermissions; } //set the type if(entry.IsDir()) entryFlags |= (QFileSystemMetaData::DirectoryType | QFileSystemMetaData::ExecutePermissions); else entryFlags |= QFileSystemMetaData::FileType; //set the attributes entryFlags |= QFileSystemMetaData::ExistsAttribute; if(entry.IsHidden()) entryFlags |= QFileSystemMetaData::HiddenAttribute; #ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API size_ = entry.FileSize(); #else size_ = (TUint)(entry.iSize); #endif modificationTime_ = entry.iModified; }
// --------------------------------------------------------------------------- // CRfsFileMan::ResetAttributes // --------------------------------------------------------------------------- // void CRfsFileMan::ResetAttributes( const TDesC& aFullPath, const TEntry& aEntry ) { FUNC_LOG; if ( aEntry.IsReadOnly() ) { TInt err = iFs.SetEntry( aFullPath, aEntry.iModified, 0, KEntryAttReadOnly | KEntryAttHidden ); ERROR( err, "Failed to reset attributes" ); } }
void FormatEntry(TDes& aBuffer, const TEntry& aEntry) { _LIT(KEntryDetails,"Entry details: "); _LIT(KReadOnly," Read-only"); _LIT(KHidden," Hidden"); _LIT(KSystem," System"); _LIT(KDirectory," Directory"); _LIT(KArchive," Archive"); _LIT(KNewLIne,"\n"); aBuffer.Append(KEntryDetails); if(aEntry.IsReadOnly()) aBuffer.Append(KReadOnly); if(aEntry.IsHidden()) aBuffer.Append(KHidden); if(aEntry.IsSystem()) aBuffer.Append(KSystem); if(aEntry.IsDir()) aBuffer.Append(KDirectory); if(aEntry.IsArchive()) aBuffer.Append(KArchive); aBuffer.Append(KNewLIne); }
/** Verify request */ TMTPResponseCode CMTPSetObjectPropValue::CheckRequestL() { TMTPResponseCode responseCode = CMTPRequestProcessor::CheckRequestL(); TUint32 handle = Request().Uint32(TMTPTypeRequest::ERequestParameter1); CMTPObjectMetaData* meta = iRequestChecker->GetObjectInfo(handle); __ASSERT_DEBUG(meta, Panic(EMTPDpObjectNull)); if(!iSingleton.StorageMgr().IsReadWriteStorage(meta->Uint(CMTPObjectMetaData::EStorageId))) { responseCode = EMTPRespCodeAccessDenied; } if(responseCode == EMTPRespCodeOK) { TUint32 propCode = Request().Uint32(TMTPTypeRequest::ERequestParameter2); if(propCode != EMTPObjectPropCodeAssociationType && propCode != EMTPObjectPropCodeAssociationDesc) { const TInt count = sizeof(KMTPDpSupportedProperties) / sizeof(TUint16); TInt i = 0; for(i = 0; i < count; i++) { if(KMTPDpSupportedProperties[i] == propCode && IsPropCodeReadonly(propCode)) // Object property code supported, but cann't be set. { responseCode = EMTPRespCodeAccessDenied; break; } else if(KMTPDpSupportedProperties[i] == propCode) // Object property code supported and can be set. { break; } } if(i == count) { responseCode = EMTPRespCodeInvalidObjectPropCode; } } else if(meta->Uint(CMTPObjectMetaData::EFormatCode) != EMTPFormatCodeAssociation) { responseCode = EMTPRespCodeInvalidObjectFormatCode; } } else { const TDesC& suid(meta->DesC(CMTPObjectMetaData::ESuid)); TEntry entry; LEAVEIFERROR( iFramework.Fs().Entry(suid, entry), OstTraceExt1( TRACE_ERROR, CMTPSETOBJECTPROPVALUE_CHECKREQUESTL, "Gets entry details for %S failed!", suid)); //According to spec, there are 4 statuses: No Protection; Read-only; Read-only data; Non-transferrable data //Currently, we only use FS's Read-only attribute to support No Protection and Read-only statuses. //so if the attribute is read-only, we will return EMTPRespCodeAccessDenied. if (entry.IsReadOnly()) { responseCode = EMTPRespCodeAccessDenied; } } return responseCode; }