QmlDesigner: Skip imported files that already exist and are the same

When importing files to project, if the target file already exists
and has the same modified timestamp, silently skip copying the file
instead of asking if it should be overwritten.

Fixes: QDS-8402
Change-Id: If963e997c6bcfb3e46db6e74c46081784bdddc7e
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
This commit is contained in:
Miikka Heikkinen
2022-11-25 14:16:28 +02:00
parent 674ad1ead1
commit 3a899b34c7

View File

@@ -1051,7 +1051,11 @@ AddFilesResult addFilesToProject(const QStringList &fileNames, const QString &de
QStringList removeList;
for (const QString &fileName : fileNames) {
const QString targetFile = directory + "/" + QFileInfo(fileName).fileName();
if (QFileInfo::exists(targetFile)) {
Utils::FilePath srcFilePath = Utils::FilePath::fromString(fileName);
Utils::FilePath targetFilePath = Utils::FilePath::fromString(targetFile);
if (targetFilePath.exists()) {
if (srcFilePath.lastModified() == targetFilePath.lastModified())
continue;
const QString title = QCoreApplication::translate(
"ModelNodeOperations", "Overwrite Existing File?");
const QString question = QCoreApplication::translate(