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>
This commit is contained in:
Andy Shaw 2013-04-15 13:18:11 +02:00 committed by The Qt Project
parent eb95685556
commit 9ec493fa41

View File

@ -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"),