#2947 File hierarchy dialog. Fix effective filter

This commit is contained in:
Bjørn Erik Jensen 2018-05-22 15:10:31 +02:00
parent e8d586054c
commit 87e91069e0

View File

@ -69,7 +69,7 @@ static const QChar SEPARATOR = RiaFilePathTools::SEPARATOR;
static QStringList prefixStrings(const QStringList& strings, const QString& prefix);
static QStringList trimLeftStrings(const QStringList& strings, const QString& trimText);
static void sortStringsByLength(QStringList& strings, bool ascending = true);
static QString effectivePathFilter(const QString& enteredPathFilter);
//--------------------------------------------------------------------------------------------------
///
@ -602,7 +602,7 @@ void RicFileHierarchyDialog::updateEffectiveFilter()
{
QString effFilter = QString("%1/%2/%3%4")
.arg(m_rootDir->text())
.arg(!m_pathFilter->text().isEmpty() ? m_pathFilter->text() : "*")
.arg(effectivePathFilter(m_pathFilter->text()))
.arg(fileNameFilter())
.arg(fileExtensionsText());
@ -853,3 +853,13 @@ void sortStringsByLength(QStringList& strings, bool ascending /*= true*/)
}
QString effectivePathFilter(const QString& enteredPathFilter)
{
QString p = RiaFilePathTools::toInternalSeparator(enteredPathFilter);
if (p.endsWith(QString(SEPARATOR) + "**")) return p;
else if (p.endsWith(QString(SEPARATOR) + "*")) return p + "*";
else if (p.endsWith("**")) return p.replace("**", "*/**");
else return p + "/**";
}