From 3fc2da567bbc0e13c96f8fcbfd2f75fb51147d21 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Mon, 3 Feb 2020 10:08:44 +0100 Subject: 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 --- qt-models/divelocationmodel.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'qt-models/divelocationmodel.cpp') 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(); - 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) -- cgit v1.2.3-70-g09d2