From 9ec493fa41d06a618d3983c02d9a1141d9d306df Mon Sep 17 00:00:00 2001
From: Andy Shaw <andy.shaw@digia.com>
Date: Mon, 15 Apr 2013 13:18:11 +0200
Subject: [PATCH] Convert the new filename to native separators before checking
 it

If a native separator was put in the new name when renaming a file name
via the file dialog then it would correctly fail. But if a non-native
one was used on Windows then it would cause the file to be moved
instead if the directory existed.

Change-Id: If01760b8c54a69b600c9a44c7509017be70d33e3
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
---
 src/widgets/dialogs/qfilesystemmodel.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/widgets/dialogs/qfilesystemmodel.cpp b/src/widgets/dialogs/qfilesystemmodel.cpp
index 9556c0ed151..8e3ecc3e0e4 100644
--- a/src/widgets/dialogs/qfilesystemmodel.cpp
+++ b/src/widgets/dialogs/qfilesystemmodel.cpp
@@ -850,7 +850,7 @@ bool QFileSystemModel::setData(const QModelIndex &idx, const QVariant &value, in
         return true;
 
     if (newName.isEmpty()
-        || newName.contains(QDir::separator())
+        || QDir::toNativeSeparators(newName).contains(QDir::separator())
         || !QDir(filePath(parent(idx))).rename(oldName, newName)) {
 #ifndef QT_NO_MESSAGEBOX
         QMessageBox::information(0, QFileSystemModel::tr("Invalid filename"),
-- 
GitLab