mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
2bb2643ae4
commit
4d183e0d75
7 changed files with 53 additions and 13 deletions
|
@ -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()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue