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>
This commit is contained in:
Berthold Stoeger 2020-03-07 18:13:50 +01:00 committed by Dirk Hohndel
parent 79b04a2f01
commit 6400867910

View file

@ -2093,15 +2093,22 @@ void QMLManager::showDownloadPage(QString deviceString)
void QMLManager::setFilter(const QString filterText, int index) void QMLManager::setFilter(const QString filterText, int index)
{ {
FilterData::Mode mode; QString f = filterText.trimmed();
// This is ugly - the indexes of the mode are hardcoded! FilterData data;
switch(index) { if (!f.isEmpty()) {
default: // This is ugly - the indexes of the mode are hardcoded!
case 0: mode = FilterData::Mode::FULLTEXT; break; switch(index) {
case 1: mode = FilterData::Mode::PEOPLE; break; default:
case 2: mode = FilterData::Mode::TAGS; break; 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) void QMLManager::setShowNonDiveComputers(bool show)