Dive edit: allow the user to explicitly clear a GPS location

If the GPS coordinates for a dive were incorrect for some reason and the
user wanted to clear them in order to then re-download / apply GPS
information from the Subsurface webservice, prior to this patch we would
always match the location name and re-populate the GPS coordinates, making
it impossible to clear a GPS location without also changing the location
name.

This patch fixes this - but if you have multiple dives with the incorrect
name / GPS location pair, the next edit to a dive that had the GPS
coordinates cleared will re-populate the GPS coordinates (at that point
Subsurface can no longer tell that this was intentional).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2014-08-16 07:09:11 -06:00
parent bb39a8730b
commit c58d136d33

View file

@ -1026,9 +1026,12 @@ void MainTab::on_location_textChanged(const QString &text)
// If we have GPS data for the location entered, add it.
void MainTab::on_location_editingFinished()
{
// if we have a location and no GPS data, look up the GPS data;
// but if the GPS data was intentionally cleared then don't
if (!currentTrip &&
!same_string(displayed_dive.location, "") &&
ui.coordinates->text().trimmed().isEmpty()) {
ui.coordinates->text().trimmed().isEmpty() &&
!(editMode == DIVE && dive_has_gps_location(current_dive))) {
struct dive *dive;
int i = 0;
for_each_dive (i, dive) {