Correct behaviors when saving database fails

* Mark database dirty if saving fails
* Restore database file from backup if unsafe save fails between deleting database file and copying temporary file into place
* Improve error message display for opening and saving database files
* Do not automatically retry saving after failure. This prevents deletion of the backup database file and improves user awareness of issues.
This commit is contained in:
Jonathan White 2019-04-03 10:23:18 -04:00
parent ec82931573
commit 3b0b5d85e9
7 changed files with 50 additions and 12 deletions

View file

@ -144,7 +144,7 @@ signals:
public slots:
bool lock();
bool save(int attempt = 0);
bool save();
bool saveAs();
void replaceDatabase(QSharedPointer<Database> db);
@ -255,6 +255,8 @@ private:
QUuid m_groupBeforeLock;
QUuid m_entryBeforeLock;
int m_saveAttempts;
// Search state
EntrySearcher* m_EntrySearcher;
QString m_lastSearchText;