summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndy Shaw <andy.shaw@digia.com>2013-04-15 11:18:11 (GMT)
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-05-18 09:07:45 (GMT)
commit8664bdcacba15bfa554a5a9adc9536470d26bd72 (patch)
tree874c0b2f51c57205a987a0cb0a973bf8e8f2bc9b
parent5eafca5efbc29d86dac0e643e99017d8355b4e31 (diff)
downloadQt-8664bdcacba15bfa554a5a9adc9536470d26bd72.zip
Qt-8664bdcacba15bfa554a5a9adc9536470d26bd72.tar.gz
Qt-8664bdcacba15bfa554a5a9adc9536470d26bd72.tar.bz2
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> (cherry picked from qtbase/9ec493fa41d06a618d3983c02d9a1141d9d306df)
-rw-r--r--src/gui/dialogs/qfilesystemmodel.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/gui/dialogs/qfilesystemmodel.cpp b/src/gui/dialogs/qfilesystemmodel.cpp
index 4e9285b..0946133 100644
--- a/src/gui/dialogs/qfilesystemmodel.cpp
+++ b/src/gui/dialogs/qfilesystemmodel.cpp
@@ -854,7 +854,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"),