summaryrefslogtreecommitdiffstats
path: root/qt-models
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2020-02-03 10:08:44 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2020-02-04 02:18:58 +0100
commit3fc2da567bbc0e13c96f8fcbfd2f75fb51147d21 (patch)
tree00b226ada31e0feeed7c6ace4685cbf02b4ee144 /qt-models
parent670a5bd55a44c0b5605dfdf796911c51aea55aba (diff)
downloadsubsurface-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>
Diffstat (limited to 'qt-models')
-rw-r--r--qt-models/divelocationmodel.cpp5
1 files changed, 4 insertions, 1 deletions
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)