forked from qt-creator/qt-creator
CorePlugin: Prevent double warnings for overwriting files
Task-number: QDS-6824 Change-Id: I935b2b1076a4e765230a7462c470d7c134063249 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -830,8 +830,7 @@ FilePath DocumentManager::getSaveFileName(const QString &title, const FilePath &
|
||||
bool repeat;
|
||||
do {
|
||||
repeat = false;
|
||||
filePath = FileUtils::getSaveFilePath(nullptr, title, path, filter, selectedFilter,
|
||||
QFileDialog::DontConfirmOverwrite);
|
||||
filePath = FileUtils::getSaveFilePath(nullptr, title, path, filter, selectedFilter);
|
||||
if (!filePath.isEmpty()) {
|
||||
// If the selected filter is All Files (*) we leave the name exactly as the user
|
||||
// specified. Otherwise the suffix must be one available in the selected filter. If
|
||||
@@ -852,10 +851,8 @@ FilePath DocumentManager::getSaveFileName(const QString &title, const FilePath &
|
||||
suffixOk = true;
|
||||
break;
|
||||
}
|
||||
if (!suffixOk && !suffixes.isEmpty())
|
||||
if (!suffixOk && !suffixes.isEmpty()) {
|
||||
filePath = filePath.stringAppended(suffixes.at(0));
|
||||
}
|
||||
}
|
||||
if (filePath.exists()) {
|
||||
if (QMessageBox::warning(ICore::dialogParent(), tr("Overwrite?"),
|
||||
tr("An item named \"%1\" already exists at this location. "
|
||||
@@ -865,6 +862,10 @@ FilePath DocumentManager::getSaveFileName(const QString &title, const FilePath &
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
} while (repeat);
|
||||
if (!filePath.isEmpty())
|
||||
setFileDialogLastVisitedDirectory(filePath.absolutePath());
|
||||
|
@@ -217,7 +217,7 @@ void GenerateResource::generateMenuEntry()
|
||||
QTC_ASSERT(currentProject, return);
|
||||
const FilePath projectPath = currentProject->projectFilePath().parentDir();
|
||||
|
||||
auto projectFileName = Core::DocumentManager::getSaveFileName(
|
||||
auto projectFileName = Core::DocumentManager::getSaveFileNameWithExtension(
|
||||
QCoreApplication::translate("QmlDesigner::GenerateResource", "Save Project as QRC File"),
|
||||
projectPath.pathAppended(currentProject->displayName() + ".qrc"),
|
||||
QCoreApplication::translate("QmlDesigner::GenerateResource",
|
||||
@@ -366,7 +366,7 @@ void GenerateResource::generateMenuEntry()
|
||||
QTC_ASSERT(currentProject, return);
|
||||
const FilePath projectPath = currentProject->projectFilePath().parentDir();
|
||||
|
||||
const FilePath resourceFileName = Core::DocumentManager::getSaveFileName(
|
||||
const FilePath resourceFileName = Core::DocumentManager::getSaveFileNameWithExtension(
|
||||
QCoreApplication::translate("QmlDesigner::GenerateResource", "Save Project as Resource"),
|
||||
projectPath.pathAppended(currentProject->displayName() + ".qmlrc"),
|
||||
QCoreApplication::translate("QmlDesigner::GenerateResource",
|
||||
|
Reference in New Issue
Block a user