summaryrefslogtreecommitdiffstats
path: root/desktop-widgets/locationinformation.cpp
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2019-03-14 00:00:54 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2019-04-12 18:19:07 +0300
commit4d183e0d75a3ae5b536abb6ea254ba224d713f72 (patch)
tree2be4630d6cb83c2930da6c9c4fd081c09b658273 /desktop-widgets/locationinformation.cpp
parent2bb2643ae4d4c1b6d0c32c9a18e2225eed0b5936 (diff)
downloadsubsurface-4d183e0d75a3ae5b536abb6ea254ba224d713f72.tar.gz
Undo: implement undo of dive site notes editing
Simply copy the code of description editing. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'desktop-widgets/locationinformation.cpp')
-rw-r--r--desktop-widgets/locationinformation.cpp17
1 files changed, 6 insertions, 11 deletions
diff --git a/desktop-widgets/locationinformation.cpp b/desktop-widgets/locationinformation.cpp
index 28f3fa619..f02b45bd0 100644
--- a/desktop-widgets/locationinformation.cpp
+++ b/desktop-widgets/locationinformation.cpp
@@ -136,6 +136,9 @@ void LocationInformationWidget::diveSiteChanged(struct dive_site *ds, int field)
case LocationInformationModel::DESCRIPTION:
ui.diveSiteDescription->setText(diveSite->description);
return;
+ case LocationInformationModel::NOTES:
+ ui.diveSiteNotes->setText(diveSite->notes);
+ return;
default:
return;
}
@@ -192,14 +195,6 @@ void LocationInformationWidget::acceptChanges()
// now update the diveSite
copy_taxonomy(&taxonomy, &diveSite->taxonomy);
- uiString = copy_qstring(ui.diveSiteNotes->document()->toPlainText());
- if (!same_string(uiString, diveSite->notes)) {
- free(diveSite->notes);
- diveSite->notes = uiString;
- } else {
- free(uiString);
- }
-
if (!ui.diveSiteCoordinates->text().isEmpty())
parseGpsText(ui.diveSiteCoordinates->text(), diveSite->location);
mark_divelist_changed(true);
@@ -300,10 +295,10 @@ void LocationInformationWidget::on_diveSiteName_editingFinished()
Command::editDiveSiteName(diveSite, ui.diveSiteName->text());
}
-void LocationInformationWidget::on_diveSiteNotes_textChanged()
+void LocationInformationWidget::on_diveSiteNotes_editingFinished()
{
- if (diveSite && !same_string(qPrintable(ui.diveSiteNotes->toPlainText()), diveSite->notes))
- markChangedWidget(ui.diveSiteNotes);
+ if (diveSite)
+ Command::editDiveSiteNotes(diveSite, ui.diveSiteNotes->toPlainText());
}
void LocationInformationWidget::resetPallete()