mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 22:20:21 +00:00
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:
parent
79b04a2f01
commit
6400867910
1 changed files with 15 additions and 8 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue