From 763bc47a89b1d7dc630454caea7cec0f21463927 Mon Sep 17 00:00:00 2001 From: Albert S Date: Sun, 14 May 2023 14:23:57 +0200 Subject: [PATCH] shared: LooqsQuery: Add outline search filters --- shared/looqsquery.cpp | 9 +++++++++ shared/looqsquery.h | 1 + 2 files changed, 10 insertions(+) diff --git a/shared/looqsquery.cpp b/shared/looqsquery.cpp index 5d43f59..fd5bbc3 100644 --- a/shared/looqsquery.cpp +++ b/shared/looqsquery.cpp @@ -29,6 +29,11 @@ bool LooqsQuery::hasContentSearch() const return (this->getTokensMask() & FILTER_CONTENT) == FILTER_CONTENT; } +bool LooqsQuery::hasOutlineSearch() const +{ + return (this->getTokensMask() & FILTER_OUTLINE_CONTAINS) == FILTER_OUTLINE_CONTAINS; +} + bool LooqsQuery::hasPathSearch() const { return (this->getTokensMask() & FILTER_PATH) == FILTER_PATH; @@ -289,6 +294,10 @@ LooqsQuery LooqsQuery::build(QString expression, TokenType loneWordsTokenType, b { tokenType = FILTER_TAG_ASSIGNED; } + else if(filtername == "toc" || filtername == "outline") + { + tokenType = FILTER_OUTLINE_CONTAINS; + } // TODO: given this is not really a "filter", this feels slightly misplaced here else if(filtername == "sort") { diff --git a/shared/looqsquery.h b/shared/looqsquery.h index 2ae9f14..2847cd8 100644 --- a/shared/looqsquery.h +++ b/shared/looqsquery.h @@ -68,6 +68,7 @@ class LooqsQuery this->limit = limit; } bool hasContentSearch() const; + bool hasOutlineSearch() const; bool hasPathSearch() const; void addSortCondition(SortCondition sc);