In the future we might want to use undo-commands for mobile as
well (even if not implementing undo).
Therefore, move the undo-command source from desktop-widgets
to their own commands top-level folder.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
ImportDiveSites adds the provided dive sites to the core dive site table
and stores the source data so it can be undone.
Signed-off-by: Doug Junkins <junkins@foghead.com>
Add a "purge unused dive sites" button to the dive site list.
Connect it to a new PurgeUnusedDiveSites command. Implementation
was trivial: simply copy the DeleteDiveSites command.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This one was rather trivial, as there is no actual merging
done. Quite simply, a number of dive sites are removed and
their dive added to a different dive site.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Simply copy code of the other edit dive site functions. Here though
introduce a destructor in the undo command to free the taxonomy data.
Remove the taxonomy member of the LocationInformationWidget class,
because it is not needed anymore.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Since no dive site field editing enters edit mode anymore,
the whole edit mode state and code can be removed from the
widget.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Simply copy the code of note editing. It's a bit more complex,
since we have to parse the Gps coordinates. For consitency,
rename the COORD field to LOCATION (the field in the dive_site
struct is called LOCATION).
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Simply copy the code of notes editing, but use the taxonomy_* functions
to read and set the value. Moreover, replace the three TAXONOMY_n field
ids by a single TAXONOMY id. We will probably never show one column per
taxonomy field, but rather a single column with a string derived from all
taxonomy fields.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Implement a dive site addition undo command and connect it to
the add dive site button. The added dive site has a default
name ("new dive site").
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Simply duplicate the code of dive site name editing. Split out
the common functionality that swaps a C and a Qt string.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Implement an undo command that edits the name of a dive site.
Connect it to the dive site table, so that names can be edited
directly in the table.
Send signals on undo / redo so that the dive site table and
the dive site edit widget can be updated.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Create a new undo-command for deleting dive sites. If there are dives
associated with that site, the dives will be removed. The frontend
is not yet updated in such a case, as that infrastructure is in a
different PR.
Connect the trashcan icon of the dive site table to the undo command.
Currently, this code is in the dive site model, which makes little
sense, but is how the TableView class works. We might want to change
that when cylinder and weight editing are made undoable.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>