From 64324db6627227ea4e1b37aa960d71c2078fc850 Mon Sep 17 00:00:00 2001 From: hjk Date: Mon, 13 Sep 2021 13:23:19 +0200 Subject: [PATCH] Utils: Remove FilePath::isChildOf(QDir) overload After replacing its use in the two remaining places. Change-Id: I6900ccdaf4ba4cf035e59b1222f06b037e7da512 Reviewed-by: David Schulz --- src/libs/utils/filepath.cpp | 6 ------ src/libs/utils/filepath.h | 1 - src/plugins/resourceeditor/qrceditor/resourcefile.cpp | 6 +----- 3 files changed, 1 insertion(+), 12 deletions(-) diff --git a/src/libs/utils/filepath.cpp b/src/libs/utils/filepath.cpp index 0a0a56d31dd..5138010fb04 100644 --- a/src/libs/utils/filepath.cpp +++ b/src/libs/utils/filepath.cpp @@ -1011,12 +1011,6 @@ bool FilePath::isChildOf(const FilePath &s) const return m_data.at(s.m_data.size()) == QLatin1Char('/'); } -/// \overload -bool FilePath::isChildOf(const QDir &dir) const -{ - return isChildOf(FilePath::fromString(dir.absolutePath())); -} - /// \returns whether FilePath startsWith \a s bool FilePath::startsWith(const QString &s) const { diff --git a/src/libs/utils/filepath.h b/src/libs/utils/filepath.h index 4bee82f44ed..129bdf76c86 100644 --- a/src/libs/utils/filepath.h +++ b/src/libs/utils/filepath.h @@ -180,7 +180,6 @@ public: [[nodiscard]] QDir toDir() const; // Avoid. [[nodiscard]] FilePath absolutePath() const; // Avoid. Use resolvePath(...)[.parent()] with proper base. [[nodiscard]] FilePath absoluteFilePath() const; // Avoid. Use resolvePath(...) with proper base. - [[nodiscard]] bool isChildOf(const QDir &dir) const; // Avoid. Use isChildOf(FilePath). private: friend class ::tst_fileutils; diff --git a/src/plugins/resourceeditor/qrceditor/resourcefile.cpp b/src/plugins/resourceeditor/qrceditor/resourcefile.cpp index 34aed64b882..8b783ec4ef5 100644 --- a/src/plugins/resourceeditor/qrceditor/resourcefile.cpp +++ b/src/plugins/resourceeditor/qrceditor/resourcefile.cpp @@ -51,10 +51,6 @@ using namespace ResourceEditor; using namespace ResourceEditor::Internal; -/****************************************************************************** -** File -*/ - File::File(Prefix *prefix, const QString &_name, const QString &_alias) : Node(this, prefix) , name(_name) @@ -843,7 +839,7 @@ bool ResourceModel::setData(const QModelIndex &index, const QVariant &value, int if (newFileName.isEmpty()) return false; - if (!newFileName.isChildOf(baseDir)) + if (!newFileName.isChildOf(filePath().absolutePath())) return false; return renameFile(file(index), newFileName.toString());