Undo: use QUndoStack::isClean() to determine unsaved changes

Properly implement the unsaved-changes flag(s). Since we currently have
two kinds of changes, there are two flags:
1) dive_list_changed in divelist.c marks non-undoable changes. This flag
   is only cleared on save or load.
2) QUndoStack::isClean() is used to determine the state of undoable
   changes. Every time the user returns to the state where they saved,
   this flag is cleared.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2019-03-30 18:39:27 +01:00 committed by Dirk Hohndel
parent 837ab6c90b
commit 58f2e5f77c
9 changed files with 46 additions and 31 deletions

View file

@ -20,6 +20,8 @@
#include "git-access.h"
#include "table.h"
/* This flag is set to true by operations that are not implemented in the
* undo system. It is therefore only cleared on save and load. */
static bool dive_list_changed = false;
bool autogroup = false;

View file

@ -108,7 +108,6 @@ void reverseGeoLookup(degrees_t latitude, degrees_t longitude, taxonomy_data *ta
taxonomy->category[ri].category = TC_ADMIN_L3;
taxonomy->nr++;
}
mark_divelist_changed(true);
} else {
report_error("geonames.org did not provide reverse lookup information");
qDebug() << "no reverse geo lookup; geonames returned\n" << fullReply;
@ -157,7 +156,6 @@ void reverseGeoLookup(degrees_t latitude, degrees_t longitude, taxonomy_data *ta
if (idx == taxonomy->nr)
taxonomy->nr++;
}
mark_divelist_changed(true);
}
} else {
report_error("timeout accessing geonames.org");