Core: Remove FileUtils::removeFile(QString)

Only used once, and there's an easily accessible removeFiles(FilePaths)
at hand.

Change-Id: I939298515f27cd34d08afa327ebe198bc30851a1
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
hjk
2021-08-17 10:13:34 +02:00
parent bd5b6b60c9
commit c7165f2c3c
3 changed files with 2 additions and 7 deletions

View File

@@ -168,11 +168,6 @@ QString FileUtils::msgTerminalWithAction()
"Opens a submenu for choosing an environment, such as \"Run Environment\""); "Opens a submenu for choosing an environment, such as \"Run Environment\"");
} }
void FileUtils::removeFile(const QString &filePath, bool deleteFromFS)
{
removeFiles({FilePath::fromString(filePath)}, deleteFromFS);
}
void FileUtils::removeFiles(const FilePaths &filePaths, bool deleteFromFS) void FileUtils::removeFiles(const FilePaths &filePaths, bool deleteFromFS)
{ {
// remove from version control // remove from version control

View File

@@ -51,7 +51,6 @@ struct CORE_EXPORT FileUtils
static QString msgTerminalHereAction(); static QString msgTerminalHereAction();
static QString msgTerminalWithAction(); static QString msgTerminalWithAction();
// File operations aware of version control and file system case-insensitiveness // File operations aware of version control and file system case-insensitiveness
static void removeFile(const QString &filePath, bool deleteFromFS);
static void removeFiles(const Utils::FilePaths &filePaths, bool deleteFromFS); static void removeFiles(const Utils::FilePaths &filePaths, bool deleteFromFS);
static bool renameFile(const Utils::FilePath &from, const Utils::FilePath &to, static bool renameFile(const Utils::FilePath &from, const Utils::FilePath &to,
HandleIncludeGuards handleGuards = HandleIncludeGuards::No); HandleIncludeGuards handleGuards = HandleIncludeGuards::No);

View File

@@ -1260,7 +1260,8 @@ EntryBackup * RelativeResourceModel::removeEntry(const QModelIndex &index)
Utils::RemoveFileDialog removeFileDialog(fileNameBackup, Core::ICore::dialogParent()); Utils::RemoveFileDialog removeFileDialog(fileNameBackup, Core::ICore::dialogParent());
if (removeFileDialog.exec() == QDialog::Accepted) { if (removeFileDialog.exec() == QDialog::Accepted) {
deleteItem(index); deleteItem(index);
Core::FileUtils::removeFile(fileNameBackup, removeFileDialog.isDeleteFileChecked()); Core::FileUtils::removeFiles({Utils::FilePath::fromString(fileNameBackup)},
removeFileDialog.isDeleteFileChecked());
return new FileEntryBackup(*this, prefixIndex.row(), index.row(), fileNameBackup, aliasBackup); return new FileEntryBackup(*this, prefixIndex.row(), index.row(), fileNameBackup, aliasBackup);
} }
return nullptr; return nullptr;