Correct multiple issues with database saving

* Mark the database as clean after fully completing the file save operation INSTEAD of when merely writing the database to a file.

* Stop the modified timer when marking the database as clean, this prevents latent erroneous modified signals from being emitted.

* Do not restart the modified timer after a new change is detected while it is still running.
This commit is contained in:
Jonathan White
2019-12-08 09:52:01 -05:00
parent 6dd9702b79
commit f9cb2bd5df
3 changed files with 11 additions and 26 deletions

View File

@@ -21,9 +21,9 @@
#include <QDateTime>
#include <QHash>
#include <QObject>
#include <QPointer>
#include <QScopedPointer>
#include <QTimer>
#include "config-keepassx.h"
#include "crypto/kdf/AesKdf.h"
@@ -37,7 +37,6 @@ enum class EntryReferenceType;
class FileWatcher;
class Group;
class Metadata;
class QTimer;
class QIODevice;
struct DeletedObject
@@ -155,9 +154,6 @@ signals:
void databaseDiscarded();
void databaseFileChanged();
private slots:
void startModifiedTimer();
private:
struct DatabaseData
{
@@ -211,7 +207,7 @@ private:
DatabaseData m_data;
QPointer<Group> m_rootGroup;
QList<DeletedObject> m_deletedObjects;
QPointer<QTimer> m_timer;
QTimer m_modifiedTimer;
QPointer<FileWatcher> m_fileWatcher;
bool m_initialized = false;
bool m_modified = false;