diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2020-02-03 10:08:44 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2020-02-04 02:18:58 +0100 |
commit | 3fc2da567bbc0e13c96f8fcbfd2f75fb51147d21 (patch) | |
tree | 00b226ada31e0feeed7c6ace4685cbf02b4ee144 | |
parent | 670a5bd55a44c0b5605dfdf796911c51aea55aba (diff) | |
download | subsurface-3fc2da567bbc0e13c96f8fcbfd2f75fb51147d21.tar.gz |
Dive site: ignore dive sites without location in proximity search
When editing a dive site, the user can search for close dive sites
to merge duplicates. Dive sites without location are treated as
being located at 0N0E. This makes no sense, because:
When selecting a dive site without location, we shouldn't list
dive sites close to 0N0E.
Likewise when having a dive site close to 0N0E, we shouldn't list
dive sites that have no location.
Therefore, ignore these cases.
This also means that now dive sites without location are not
considered as close to other dive sites without location. That
might be a debatable point.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
-rw-r--r-- | CHANGELOG.md | 1 | ||||
-rw-r--r-- | qt-models/divelocationmodel.cpp | 5 |
2 files changed, 5 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 76cd441fe..c7e3dd1c9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,4 @@ +Desktop: ignore dive sites without location in proximity search Mobile: add personalized option for units Mobile: add Dive Summary page Mobile: option to reset default cylinder diff --git a/qt-models/divelocationmodel.cpp b/qt-models/divelocationmodel.cpp index 526a196de..5fca153a4 100644 --- a/qt-models/divelocationmodel.cpp +++ b/qt-models/divelocationmodel.cpp @@ -285,8 +285,11 @@ GeoReferencingOptionsModel::GeoReferencingOptionsModel(QObject *parent) : QStrin bool GPSLocationInformationModel::filterAcceptsRow(int sourceRow, const QModelIndex &parent) const { + if (!has_location(&location)) + return false; + struct dive_site *ds = sourceModel()->index(sourceRow, LocationInformationModel::DIVESITE, parent).data().value<dive_site *>(); - if (!ds || ds == ignoreDs || ds == RECENTLY_ADDED_DIVESITE) + if (!ds || ds == ignoreDs || ds == RECENTLY_ADDED_DIVESITE || !has_location(&ds->location)) return false; return distance <= 0 ? same_location(&ds->location, &location) |