Utils: Tr::tr

Change-Id: Ic03e20993f05fb5b49a12c891d86afb2c8e18e08
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Alessandro Portale
2023-01-24 16:49:41 +01:00
parent 17b28909a9
commit 4d6827dde9
65 changed files with 486 additions and 1964 deletions

View File

@@ -539,17 +539,13 @@ bool DesktopDeviceFileAccess::removeRecursively(const FilePath &filePath, QStrin
QDir dir(fileInfo.absoluteFilePath());
dir.setPath(dir.canonicalPath());
if (dir.isRoot()) {
if (error) {
*error = QCoreApplication::translate("Utils::FileUtils",
"Refusing to remove root directory.");
}
if (error)
*error = Tr::tr("Refusing to remove root directory.");
return false;
}
if (dir.path() == QDir::home().canonicalPath()) {
if (error) {
*error = QCoreApplication::translate("Utils::FileUtils",
"Refusing to remove your home directory.");
}
if (error)
*error = Tr::tr("Refusing to remove your home directory.");
return false;
}
@@ -560,20 +556,14 @@ bool DesktopDeviceFileAccess::removeRecursively(const FilePath &filePath, QStrin
return false;
}
if (!QDir::root().rmdir(dir.path())) {
if (error) {
*error = QCoreApplication::translate("Utils::FileUtils",
"Failed to remove directory \"%1\".")
.arg(filePath.toUserOutput());
}
if (error)
*error = Tr::tr("Failed to remove directory \"%1\".").arg(filePath.toUserOutput());
return false;
}
} else {
if (!QFile::remove(filePath.path())) {
if (error) {
*error = QCoreApplication::translate("Utils::FileUtils",
"Failed to remove file \"%1\".")
.arg(filePath.toUserOutput());
}
if (error)
*error = Tr::tr("Failed to remove file \"%1\".").arg(filePath.toUserOutput());
return false;
}
}