ProjectExplorer: Don't prompt user whether 0 files should be deleted

Change-Id: I893c8af5e2c0f0172dd397732275bdec9918bc44
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
Robert Loehning
2020-07-22 21:35:49 +02:00
parent 7775334998
commit 1203be0bc3

View File

@@ -3629,14 +3629,16 @@ void ProjectExplorerPluginPrivate::removeFile()
const bool deleteFile = removeFileDialog.isDeleteFileChecked();
const QMessageBox::StandardButton reply = QMessageBox::question(
Core::ICore::dialogParent(), tr("Remove More Files?"),
tr("Remove these files as well?\n %1")
.arg(Utils::transform<QStringList>(siblings, [](const NodeAndPath &np) {
return np.second.toFileInfo().fileName();
}).join("\n ")));
if (reply == QMessageBox::Yes)
filesToRemove << siblings;
if (!siblings.isEmpty()) {
const QMessageBox::StandardButton reply = QMessageBox::question(
Core::ICore::dialogParent(), tr("Remove More Files?"),
tr("Remove these files as well?\n %1")
.arg(Utils::transform<QStringList>(siblings, [](const NodeAndPath &np) {
return np.second.toFileInfo().fileName();
}).join("\n ")));
if (reply == QMessageBox::Yes)
filesToRemove << siblings;
}
for (const NodeAndPath &file : filesToRemove) {
// Nodes can become invalid if the project was re-parsed while the dialog was open