aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui/undocommands.cpp
AgeCommit message (Collapse)Author
2015-10-03Use copy_string() to avoid potential crashGravatar Dirk Hohndel
If the trip has no location or notes calling strdup on NULL is just a bad idea. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-02Undo/redo of dive deletion needs to handle trips as wellGravatar Dirk Hohndel
If we delete dives that were part of a trip, that trip may get deleted as well. So if we undo that operation we need to bring back the trip, too. This also deals with a bug in the original code that did the delete both in calling code (in divelistview.cpp) and in the redo function. Because of the nature of the delete this didn't really matter but it is of course wrong and with the new code it would in fact cause an issue. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-06-14Fix renumbering of divesGravatar Dirk Hohndel
The implementation in commit 182fe790c9e8 ("Add ability to undo renumbering of dives") looks perfectly reasonable, but it depends on an implementation detail: it assumes that the keys of the QMap are returned in the same order in which they were placed there. Which apparently isn't the case for some version of Qt. With this commit we simply remember both the old and the new number for each dive and therefore the order in which they are processed doesn't matter. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-04-14Add ability to undo removing of dives from tripsGravatar Grace Karanja
Add the functionality to undo/redo removing of dives from trips. The code calling remove_dive_from_trip has moved to the UndoCommands class. Signed-off-by: Grace Karanja <gracie.karanja89@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-03-17Consistent variable names in UndoCommands classGravatar Grace Karanja
Implements a uniform variable naming scheme in the undocommands class. Signed-off-by: Grace Karanja <gracie.karanja89@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-28Add ability to undo renumbering of divesGravatar Grace Karanja
Expand the undo feature by storing a list of renumbered dives' ids and numbers so that the original numbers can be restored if needed. Signed-off-by: Grace Karanja <gracie.karanja89@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-14Add ability to undo shifting of dive timeGravatar Grace Karanja
Adds the ability to undo shifting of dive times. The change is captured at simplewidgets.cpp and an undo command is created. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-11Add option to undo deleted divesGravatar Grace Karanja
Add ability to undo deleted dives by storing a list of the deleted dives in a QUndoCommand. Signed-off-by: Grace Karanja <gracie.karanja89@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-02-11Add a structure to hold undo commandsGravatar Grace Karanja
Add the undocommands.cpp / undocommands.h files, which will hold a collection of classes that will hold undo commands. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>