diff options
author | Tobias Krause <tkr@openoffice.org> | 2009-11-25 11:40:47 +0100 |
---|---|---|
committer | Tobias Krause <tkr@openoffice.org> | 2009-11-25 11:40:47 +0100 |
commit | fc255b023172262c51a8b72603c2dc7b1aa4855a (patch) | |
tree | 5bcc570b71e2847d8050a02791452703bfe3919a /ucb | |
parent | b4083630cb439a9f54340db6840e8bc6cfcc42c8 (diff) |
tkr32: #i75446# change default behavior to check readonly flag during write.
Diffstat (limited to 'ucb')
-rw-r--r-- | ucb/source/ucp/gvfs/content.cxx | 25 | ||||
-rw-r--r-- | ucb/source/ucp/gvfs/directory.cxx | 25 |
2 files changed, 29 insertions, 21 deletions
diff --git a/ucb/source/ucp/gvfs/content.cxx b/ucb/source/ucp/gvfs/content.cxx index 743043c09fc7..a1953bd34248 100644 --- a/ucb/source/ucp/gvfs/content.cxx +++ b/ucb/source/ucp/gvfs/content.cxx @@ -633,20 +633,24 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues( } else if (rProp.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "IsReadOnly" ) ) ) { - if (m_info.valid_fields & GNOME_VFS_FILE_INFO_FIELDS_PERMISSIONS) { + + GnomeVFSFileInfo* fileInfo = gnome_vfs_file_info_new (); + + ::rtl::OString aURI = getOURI(); + gnome_vfs_get_file_info + ( (const sal_Char *)aURI, fileInfo, + GNOME_VFS_FILE_INFO_GET_ACCESS_RIGHTS ); + + if (fileInfo->valid_fields & GNOME_VFS_FILE_INFO_FIELDS_ACCESS) { bool read_only = true; - if (m_info.uid == getuid () && - m_info.permissions & GNOME_VFS_PERM_USER_WRITE) - read_only = false; - else if (m_info.gid == getgid () && - m_info.permissions & GNOME_VFS_PERM_GROUP_WRITE) - read_only = false; - else if (m_info.permissions & GNOME_VFS_PERM_OTHER_WRITE) - read_only = false; + if (fileInfo->permissions & GNOME_VFS_PERM_ACCESS_WRITABLE) + read_only = false; + xRow->appendBoolean( rProp, read_only ); } else xRow->appendVoid( rProp ); + gnome_vfs_file_info_unref (fileInfo); } else if (rProp.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "IsHidden" ) ) ) @@ -1125,7 +1129,8 @@ Content::getInfo( const uno::Reference< ucb::XCommandEnvironment >& xEnv ) ::rtl::OString aURI = getOURI(); Authentication aAuth( xEnv ); result = gnome_vfs_get_file_info - ( (const sal_Char *)aURI, &m_info, GNOME_VFS_FILE_INFO_DEFAULT ); + ( (const sal_Char *)aURI, &m_info, + GNOME_VFS_FILE_INFO_DEFAULT ); if (result != GNOME_VFS_OK) gnome_vfs_file_info_clear( &m_info ); } else diff --git a/ucb/source/ucp/gvfs/directory.cxx b/ucb/source/ucp/gvfs/directory.cxx index 19ace5ebf162..e7d3cec7ce4c 100644 --- a/ucb/source/ucp/gvfs/directory.cxx +++ b/ucb/source/ucp/gvfs/directory.cxx @@ -361,24 +361,24 @@ sal_Bool DataSupplier::getData() } - GnomeVFSFileInfo fileInfo; - fileInfo.name = 0; - while ((result = gnome_vfs_directory_read_next (dirHandle, &fileInfo)) == GNOME_VFS_OK) { - if( fileInfo.name && fileInfo.name[0] == '.' && - ( fileInfo.name[1] == '\0' || - ( fileInfo.name[1] == '.' && fileInfo.name[2] == '\0' ) ) ) + GnomeVFSFileInfo* fileInfo = gnome_vfs_file_info_new (); + + while ((result = gnome_vfs_directory_read_next (dirHandle, fileInfo)) == GNOME_VFS_OK) { + if( fileInfo->name && fileInfo->name[0] == '.' && + ( fileInfo->name[1] == '\0' || + ( fileInfo->name[1] == '.' && fileInfo->name[2] == '\0' ) ) ) continue; switch ( m_pImpl->m_nOpenMode ) { case ucb::OpenMode::FOLDERS: - if ( !(fileInfo.valid_fields & GNOME_VFS_FILE_INFO_FIELDS_TYPE) || - fileInfo.type != GNOME_VFS_FILE_TYPE_DIRECTORY ) + if ( !(fileInfo->valid_fields & GNOME_VFS_FILE_INFO_FIELDS_TYPE) || + fileInfo->type != GNOME_VFS_FILE_TYPE_DIRECTORY ) continue; break; case ucb::OpenMode::DOCUMENTS: - if ( !(fileInfo.valid_fields & GNOME_VFS_FILE_INFO_FIELDS_TYPE) || - fileInfo.type != GNOME_VFS_FILE_TYPE_REGULAR ) + if ( !(fileInfo->valid_fields & GNOME_VFS_FILE_INFO_FIELDS_TYPE) || + fileInfo->type != GNOME_VFS_FILE_TYPE_REGULAR ) continue; break; @@ -387,8 +387,11 @@ sal_Bool DataSupplier::getData() break; } - m_pImpl->m_aResults.push_back( new ResultListEntry( &fileInfo ) ); + m_pImpl->m_aResults.push_back( new ResultListEntry( fileInfo ) ); } + + gnome_vfs_file_info_unref (fileInfo); + #ifdef DEBUG g_warning ("Got %d directory entries", result); #endif |