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)
{
FilterData::Mode mode;
QString f = filterText.trimmed();
FilterData data;
if (!f.isEmpty()) {
// 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;
case 0: data.mode = FilterData::Mode::FULLTEXT; break;
case 1: data.mode = FilterData::Mode::PEOPLE; break;
case 2: data.mode = FilterData::Mode::TAGS; break;
}
DiveListSortModel::instance()->setFilter(filterText, mode);
if (data.mode == FilterData::Mode::FULLTEXT)
data.fullText = f;
else
data.tags = f.split(",", QString::SkipEmptyParts);
}
DiveFilter::instance()->setFilter(data);
}
void QMLManager::setShowNonDiveComputers(bool show)