diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2020-03-07 18:13:50 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2020-03-10 09:25:57 -0700 |
commit | 6400867910959ba566adc7596fb9e9c2fd48a7c3 (patch) | |
tree | 0ecd53fff543cc2694c55a2f3b1bf6fa67b1e314 /mobile-widgets | |
parent | 79b04a2f01c96ceb1afea73f252e69a6c6d4d033 (diff) | |
download | subsurface-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>
Diffstat (limited to 'mobile-widgets')
-rw-r--r-- | mobile-widgets/qmlmanager.cpp | 23 |
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) |