From b72f1d53558344392daa916f69ece7db8c7a9d89 Mon Sep 17 00:00:00 2001 From: Nils Schwabe Date: Fri, 21 Mar 2014 17:30:03 +0100 Subject: added functionality to filter box --- src/vsession.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/vsession.cpp') diff --git a/src/vsession.cpp b/src/vsession.cpp index ba7a478..e8e301e 100644 --- a/src/vsession.cpp +++ b/src/vsession.cpp @@ -82,6 +82,24 @@ void VSession::readKeywords() { } } +bool VSession::containsKeywords(const QList& keywords) const { + for (int j = 0; j < keywords.length(); ++j) { + bool keywordFlag = true; + if (!this->shortDescription().contains(keywords[j], Qt::CaseInsensitive) + && !this->description().contains(keywords[j], Qt::CaseInsensitive) + && !this->getAttribute("creator", "param").contains(keywords[j], Qt::CaseInsensitive)) { + keywordFlag = false; + for (int i = 0; i < this->keywords().length(); ++i) { + if (this->keywords()[i].contains(keywords[j], Qt::CaseInsensitive)) { + keywordFlag = true; + } + } + if (!keywordFlag) return false; + } + } + return true; +} + QString VSession::getNodeText(const QString& nodeName) const { return this->doc_.namedItem(nodeName).toText().data(); } -- cgit v1.2.3-55-g7522