summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2020-03-07 18:13:50 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2020-03-10 09:25:57 -0700
commit6400867910959ba566adc7596fb9e9c2fd48a7c3 (patch)
tree0ecd53fff543cc2694c55a2f3b1bf6fa67b1e314
parent79b04a2f01c96ceb1afea73f252e69a6c6d4d033 (diff)
downloadsubsurface-6400867910959ba566adc7596fb9e9c2fd48a7c3.tar.gz
mobile/filter: connect directly to filter
Since the divelist model is now placed on top of the common models, we can directly reset the filter. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
-rw-r--r--mobile-widgets/qmlmanager.cpp23
1 files changed, 15 insertions, 8 deletions
diff --git a/mobile-widgets/qmlmanager.cpp b/mobile-widgets/qmlmanager.cpp
index b7ed5a359..dc4961cef 100644
--- a/mobile-widgets/qmlmanager.cpp
+++ b/mobile-widgets/qmlmanager.cpp
@@ -2093,15 +2093,22 @@ void QMLManager::showDownloadPage(QString deviceString)
void QMLManager::setFilter(const QString filterText, int index)
{
- FilterData::Mode mode;
- // This is ugly - the indexes of the mode are hardcoded!
- switch(index) {
- default:
- case 0: mode = FilterData::Mode::FULLTEXT; break;
- case 1: mode = FilterData::Mode::PEOPLE; break;
- case 2: mode = FilterData::Mode::TAGS; break;
+ QString f = filterText.trimmed();
+ FilterData data;
+ if (!f.isEmpty()) {
+ // This is ugly - the indexes of the mode are hardcoded!
+ switch(index) {
+ default:
+ case 0: data.mode = FilterData::Mode::FULLTEXT; break;
+ case 1: data.mode = FilterData::Mode::PEOPLE; break;
+ case 2: data.mode = FilterData::Mode::TAGS; break;
+ }
+ if (data.mode == FilterData::Mode::FULLTEXT)
+ data.fullText = f;
+ else
+ data.tags = f.split(",", QString::SkipEmptyParts);
}
- DiveListSortModel::instance()->setFilter(filterText, mode);
+ DiveFilter::instance()->setFilter(data);
}
void QMLManager::setShowNonDiveComputers(bool show)