Undo: implement undo of divemaster editing

This is mostly a trivial copy of the buddies code.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2019-02-07 21:23:00 +01:00 committed by Dirk Hohndel
parent a9bd0690fe
commit 02d572226d
6 changed files with 45 additions and 13 deletions

View file

@ -483,4 +483,27 @@ DiveField EditBuddies::fieldId() const
return DiveField::BUDDY;
}
// ***** DiveMaster *****
QStringList EditDiveMaster::data(struct dive *d) const
{
return stringToList(d->divemaster);
}
void EditDiveMaster::set(struct dive *d, const QStringList &v) const
{
QString text = v.join(", ");
free(d->divemaster);
d->divemaster = copy_qstring(text);
}
QString EditDiveMaster::fieldName() const
{
return tr("dive master");
}
DiveField EditDiveMaster::fieldId() const
{
return DiveField::DIVEMASTER;
}
} // namespace Command