forked from qt-creator/qt-creator
ProjectExplorer: Do not list files more than once in the rename dialog
... for project tree entries. The same file can occur more than once in the tree. Task-number: QTCREATORBUG-26268 Change-Id: I8af1e3a73d54e5a54c858fb3f7a8cf4afa83c7e2 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -308,12 +308,14 @@ bool FlatModel::setData(const QModelIndex &index, const QVariant &value, int rol
|
||||
if (orgFilePath != newFilePath && orgFilePath.suffix() == newFilePath.suffix()) {
|
||||
const QList<Node *> candidateNodes = ProjectTree::siblingsWithSameBaseName(node);
|
||||
if (!candidateNodes.isEmpty()) {
|
||||
QStringList fileNames = transform<QStringList>(candidateNodes, [](const Node *n) {
|
||||
return n->filePath().fileName();
|
||||
});
|
||||
fileNames.removeDuplicates();
|
||||
const QMessageBox::StandardButton reply = QMessageBox::question(
|
||||
Core::ICore::dialogParent(), tr("Rename More Files?"),
|
||||
tr("Would you like to rename these files as well?\n %1")
|
||||
.arg(transform<QStringList>(candidateNodes, [](const Node *n) {
|
||||
return n->filePath().fileName();
|
||||
}).join("\n ")));
|
||||
.arg(fileNames.join("\n ")));
|
||||
if (reply == QMessageBox::Yes) {
|
||||
for (Node * const n : candidateNodes) {
|
||||
QString targetFilePath = orgFileInfo.absolutePath() + '/'
|
||||
|
Reference in New Issue
Block a user