mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +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)
|
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)
|
||||||
|
|
Loading…
Add table
Reference in a new issue