From 29a7ee6cf48a78d8344fb82546eae10ddc874a43 Mon Sep 17 00:00:00 2001
From: Friedemann Kleint <Friedemann.Kleint@nokia.com>
Date: Thu, 16 Feb 2012 11:05:53 +0100
Subject: [PATCH] Compile with Qt 5.

Change-Id: Iaca01f48059297befccf614a9835704559ceff2a
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
---
 .../projectexplorer/projectexplorer.cpp       | 24 +++++++++++--------
 1 file changed, 14 insertions(+), 10 deletions(-)

diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp
index ad2b1dfa9f3..a7664a63b63 100644
--- a/src/plugins/projectexplorer/projectexplorer.cpp
+++ b/src/plugins/projectexplorer/projectexplorer.cpp
@@ -2777,6 +2777,18 @@ void ProjectExplorerPlugin::renameFile()
     }
 }
 
+static inline bool fileSystemRenameFile(const QString &orgFilePath,
+                                        const QString &newFilePath)
+{
+#if QT_VERSION < 0x050000 // ### fixme: QTBUG-3570 might be fixed in Qt 5?
+    QFile f(orgFilePath); // Due to QTBUG-3570
+    QAbstractFileEngine *fileEngine = f.fileEngine();
+    if (!fileEngine->caseSensitive() && orgFilePath.compare(newFilePath, Qt::CaseInsensitive) == 0)
+        return fileEngine->rename(newFilePath);
+#endif
+    return QFile::rename(orgFilePath, newFilePath);
+}
+
 void ProjectExplorerPlugin::renameFile(Node *node, const QString &to)
 {
     FileNode *fileNode = qobject_cast<FileNode *>(node);
@@ -2794,16 +2806,8 @@ void ProjectExplorerPlugin::renameFile(Node *node, const QString &to)
     bool result = false;
     if (vc && vc->supportsOperation(Core::IVersionControl::MoveOperation))
         result = vc->vcsMove(orgFilePath, newFilePath);
-    if (!result) { // The moving via vcs failed or the vcs does not support moving, fall back
-        QFile f(orgFilePath);
-        if (!f.fileEngine()->caseSensitive()
-                && orgFilePath.compare(newFilePath, Qt::CaseInsensitive) == 0) {
-            // Due to QTBUG-3570
-            result = f.fileEngine()->rename(newFilePath);
-        } else {
-            result = QFile::rename(orgFilePath, newFilePath);
-        }
-    }
+    if (!result) // The moving via vcs failed or the vcs does not support moving, fall back
+        result = fileSystemRenameFile(orgFilePath, newFilePath);
     if (result) {
         // yeah we moved, tell the filemanager about it
         Core::FileManager::renamedFile(orgFilePath, newFilePath);
-- 
GitLab