mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Correctly handle updating the name of dive sites from GPS
If the user downloaded the GPS data from the Subsurface webservice before naming a dive site, we run into a special case where entering a new name for a dive location should just update the name of the automatically named site which already has the correct GPS information. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
b1a929260f
commit
1b8ac21f6b
2 changed files with 10 additions and 2 deletions
|
@ -310,6 +310,10 @@ QVariant DiveLocationModel::data(const QModelIndex &index, int role) const
|
||||||
case Qt::DisplayRole:
|
case Qt::DisplayRole:
|
||||||
return new_ds_value[index.row()];
|
return new_ds_value[index.row()];
|
||||||
case Qt::ToolTipRole:
|
case Qt::ToolTipRole:
|
||||||
|
if (same_string(displayed_dive_site.notes,"SubsurfaceWebservice"))
|
||||||
|
return "Update dive site name";
|
||||||
|
else
|
||||||
|
return "Create a new dive site";
|
||||||
return "Create a new dive site";
|
return "Create a new dive site";
|
||||||
case Qt::DecorationRole:
|
case Qt::DecorationRole:
|
||||||
return plusIcon;
|
return plusIcon;
|
||||||
|
|
|
@ -892,8 +892,12 @@ void MainTab::updateDiveSite(int divenr)
|
||||||
copy_dive_site(newDs, &displayed_dive_site);
|
copy_dive_site(newDs, &displayed_dive_site);
|
||||||
|
|
||||||
if (origDs && pickedUuid != origDs->uuid && same_string(origDs->notes, "SubsurfaceWebservice")) {
|
if (origDs && pickedUuid != origDs->uuid && same_string(origDs->notes, "SubsurfaceWebservice")) {
|
||||||
// this is a special case - let's remove the original dive site if this was the only user
|
// this is a special case - let's keep the GPS data and
|
||||||
|
// remove the original dive site if this was the only user
|
||||||
|
newDs->latitude.udeg = origDs->latitude.udeg;
|
||||||
|
newDs->longitude.udeg = origDs->longitude.udeg;
|
||||||
if (!is_dive_site_used(origDs->uuid, false)) {
|
if (!is_dive_site_used(origDs->uuid, false)) {
|
||||||
|
if (verbose)
|
||||||
qDebug() << "delete the autogenerated dive site" << origDs->name;
|
qDebug() << "delete the autogenerated dive site" << origDs->name;
|
||||||
delete_dive_site(origDs->uuid);
|
delete_dive_site(origDs->uuid);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue