From 17c88cb2e79bd673a875f8c9654eed6c7adbcbd0 Mon Sep 17 00:00:00 2001 From: Fawzi Mohamed Date: Mon, 1 Aug 2011 14:58:33 +0200 Subject: [PATCH] filemanager: fix regression when trying to save read-only file When saving a read-only file, a dialog should appear with Make Writable / Save As / Cancel should open. Avoids relying on permission error to detect read-only files as qfsfileengine_unix.cpp treats errno == EACCESS as a QFile::OpenError. Change-Id: Icdffdc4617c8ef2b58d58aeedbb2b454d0da9465 Task-Number: QTCREATORBUG-5066 Reviewed-on: http://codereview.qt.nokia.com/2442 Reviewed-by: Qt Sanity Bot Reviewed-by: Fawzi Mohamed --- src/plugins/coreplugin/filemanager.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/plugins/coreplugin/filemanager.cpp b/src/plugins/coreplugin/filemanager.cpp index caabbeced3c..562199489e7 100644 --- a/src/plugins/coreplugin/filemanager.cpp +++ b/src/plugins/coreplugin/filemanager.cpp @@ -628,8 +628,7 @@ bool FileManager::saveFile(IFile *file, const QString &fileName, bool *isReadOnl if (isReadOnly) { QFile ofi(effName); // Check whether the existing file is writable - if (ofi.exists() && !ofi.open(QIODevice::ReadWrite) - && ofi.error() == QFile::PermissionsError) { + if (!ofi.open(QIODevice::ReadWrite) && ofi.open(QIODevice::ReadOnly)) { *isReadOnly = true; goto out; }