summaryrefslogtreecommitdiffstats
path: root/src/widgets/dialogs
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2016-04-27 09:18:05 +0200
committerLiang Qi <liang.qi@qt.io>2016-04-27 09:18:05 +0200
commit23a36fd2bfcdb57849deaa1e10e6e3f7b1156ed8 (patch)
treeb527c7e3ba4a831b542b0bccfb6a5a748a8a4fd9 /src/widgets/dialogs
parentc003a18ee332abf2387172eb0856a176a32a6c8f (diff)
parent072f5b513e486e884ea7fa4a1cac9aedf3846374 (diff)
Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts: src/corelib/io/qprocess_win.cpp src/widgets/itemviews/qheaderview.cpp Change-Id: I0a59ade9cd6e91f770fdf298a7d72a41e79fd761
Diffstat (limited to 'src/widgets/dialogs')
-rw-r--r--src/widgets/dialogs/qfilesystemmodel.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/widgets/dialogs/qfilesystemmodel.cpp b/src/widgets/dialogs/qfilesystemmodel.cpp
index c72761f2ae..f639be809c 100644
--- a/src/widgets/dialogs/qfilesystemmodel.cpp
+++ b/src/widgets/dialogs/qfilesystemmodel.cpp
@@ -867,9 +867,11 @@ bool QFileSystemModel::setData(const QModelIndex &idx, const QVariant &value, in
if (newName == idx.data().toString())
return true;
+ const QString parentPath = filePath(parent(idx));
+
if (newName.isEmpty()
|| QDir::toNativeSeparators(newName).contains(QDir::separator())
- || !QDir(filePath(parent(idx))).rename(oldName, newName)) {
+ || !QDir(parentPath).rename(oldName, newName)) {
#ifndef QT_NO_MESSAGEBOX
QMessageBox::information(0, QFileSystemModel::tr("Invalid filename"),
QFileSystemModel::tr("<b>The name \"%1\" can not be used.</b><p>Try using another name, with fewer characters or no punctuations marks.")
@@ -896,7 +898,7 @@ bool QFileSystemModel::setData(const QModelIndex &idx, const QVariant &value, in
parentNode->visibleChildren.removeAt(visibleLocation);
QFileSystemModelPrivate::QFileSystemNode * oldValue = parentNode->children.value(oldName);
parentNode->children[newName] = oldValue;
- QFileInfo info(d->rootDir, newName);
+ QFileInfo info(parentPath, newName);
oldValue->fileName = newName;
oldValue->parent = parentNode;
#ifndef QT_NO_FILESYSTEMWATCHER
@@ -908,7 +910,7 @@ bool QFileSystemModel::setData(const QModelIndex &idx, const QVariant &value, in
parentNode->visibleChildren.insert(visibleLocation, newName);
d->delayedSort();
- emit fileRenamed(filePath(idx.parent()), oldName, newName);
+ emit fileRenamed(parentPath, oldName, newName);
}
return true;
}