diff options
Diffstat (limited to 'desktop-widgets/locationinformation.cpp')
-rw-r--r-- | desktop-widgets/locationinformation.cpp | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/desktop-widgets/locationinformation.cpp b/desktop-widgets/locationinformation.cpp index f02b45bd0..19d2befd2 100644 --- a/desktop-widgets/locationinformation.cpp +++ b/desktop-widgets/locationinformation.cpp @@ -139,6 +139,9 @@ void LocationInformationWidget::diveSiteChanged(struct dive_site *ds, int field) case LocationInformationModel::NOTES: ui.diveSiteNotes->setText(diveSite->notes); return; + case LocationInformationModel::TAXONOMY: + ui.diveSiteCountry->setText(taxonomy_get_country(&diveSite->taxonomy)); + return; default: return; } @@ -183,18 +186,6 @@ void LocationInformationWidget::acceptChanges() return; } - char *uiString; - uiString = copy_qstring(ui.diveSiteCountry->text()); - // if the user entered a different country, first update the local taxonomy - // this below will get copied into the diveSite - if (!same_string(uiString, taxonomy_get_country(&taxonomy)) && - !empty_string(uiString)) - taxonomy_set_country(&taxonomy, uiString, taxonomy_origin::GEOMANUAL); - else - free(uiString); - // now update the diveSite - copy_taxonomy(&taxonomy, &diveSite->taxonomy); - if (!ui.diveSiteCoordinates->text().isEmpty()) parseGpsText(ui.diveSiteCoordinates->text(), diveSite->location); mark_divelist_changed(true); @@ -277,10 +268,10 @@ void LocationInformationWidget::on_diveSiteCoordinates_textChanged(const QString } } -void LocationInformationWidget::on_diveSiteCountry_textChanged(const QString& text) +void LocationInformationWidget::on_diveSiteCountry_editingFinished() { - if (!same_string(qPrintable(text), taxonomy_get_country(&taxonomy))) - markChangedWidget(ui.diveSiteCountry); + if (diveSite) + Command::editDiveSiteCountry(diveSite, ui.diveSiteCountry->text()); } void LocationInformationWidget::on_diveSiteDescription_editingFinished() |