From c3a3ab96641087e21974782a1d99f4cdc9c24efd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorbj=C3=B8rn=20Lindeijer?= Date: Tue, 14 Apr 2009 12:18:23 +0200 Subject: [PATCH] Small tweaks to NTFS writable check fix --- .../coreplugin/editormanager/editormanager.cpp | 3 +-- src/plugins/texteditor/basetextdocument.cpp | 12 ++++-------- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/src/plugins/coreplugin/editormanager/editormanager.cpp b/src/plugins/coreplugin/editormanager/editormanager.cpp index 49fedc4dcb6..f9b2cde57b2 100644 --- a/src/plugins/coreplugin/editormanager/editormanager.cpp +++ b/src/plugins/coreplugin/editormanager/editormanager.cpp @@ -1173,9 +1173,8 @@ bool EditorManager::saveFile(IEditor *editor) return true; } - if (file->isReadOnly() || fileName.isEmpty()) { + if (file->isReadOnly() || fileName.isEmpty()) return saveFileAs(editor); - } m_d->m_core->fileManager()->blockFileChange(file); const bool success = file->save(fileName); diff --git a/src/plugins/texteditor/basetextdocument.cpp b/src/plugins/texteditor/basetextdocument.cpp index 92b7f2a4cdb..7106b03550e 100755 --- a/src/plugins/texteditor/basetextdocument.cpp +++ b/src/plugins/texteditor/basetextdocument.cpp @@ -146,15 +146,14 @@ bool BaseTextDocument::isReadOnly() const const QFileInfo fi(m_fileName); #ifdef Q_OS_WIN32 - // be careful when getting info from files on network drives - int old_ntfs_permission_lookup = qt_ntfs_permission_lookup; - qt_ntfs_permission_lookup = 1; + // Check for permissions on NTFS file systems + qt_ntfs_permission_lookup++; #endif - const int ro = !fi.isWritable(); + const bool ro = !fi.isWritable(); #ifdef Q_OS_WIN32 - qt_ntfs_permission_lookup = old_ntfs_permission_lookup; + qt_ntfs_permission_lookup--; #endif return ro; } @@ -175,9 +174,6 @@ bool BaseTextDocument::open(const QString &fileName) if (!file.exists()) return false; - if (!fi.isReadable()) - return false; - if (!file.open(QIODevice::ReadWrite) && !file.open(QIODevice::ReadOnly)) return false;