Commit 93353920 authored by Konstantin Tokarev's avatar Konstantin Tokarev Committed by Daniel Teske

Added overload for FileName::isChildOf

Change-Id: I9c5b0e7f3eda13ef3b6903723c27267d090b9d24
Reviewed-by: default avatarDaniel Teske <daniel.teske@nokia.com>
parent fd817c67
......@@ -535,6 +535,12 @@ bool FileName::isChildOf(const FileName &s) const
return at(s.size()) == QLatin1Char('/');
}
/// \overload
bool FileName::isChildOf(const QDir &dir) const
{
return isChildOf(Utils::FileName::fromString(dir.absolutePath()));
}
/// \returns whether FileName endsWith \a s
bool FileName::endsWith(const QString &s) const
{
......
......@@ -162,6 +162,7 @@ public:
bool operator>=(const FileName &other) const;
bool isChildOf(const FileName &s) const;
bool isChildOf(const QDir &dir) const;
bool endsWith(const QString &s) const;
Utils::FileName relativeChildPath(const FileName &parent) const;
......
......@@ -820,7 +820,7 @@ bool ResourceModel::setData(const QModelIndex &index, const QVariant &value, int
if (newFileName.isEmpty())
return false;
if (!newFileName.isChildOf(Utils::FileName::fromString(baseDir.absolutePath())))
if (!newFileName.isChildOf(baseDir))
return false;
return renameFile(file(index), newFileName.toString());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment