Implemented major autoreload functionality

* Ignore autoreload on save / save-as
* Consolidated db save code
* Corrected bug (crash) in merge entry code due to not cloning the entry
* Enhanced known modified status of database
* Implemented test cases for autoreload
This commit is contained in:
Jonathan White 2016-11-11 17:58:47 -05:00
parent 20c3ca7d37
commit 7fb33653ad
No known key found for this signature in database
GPG key ID: 506BDC439519BC13
9 changed files with 190 additions and 55 deletions

View file

@ -92,13 +92,14 @@ public:
EntryView* entryView();
void showUnlockDialog();
void closeUnlockDialog();
void ignoreNextAutoreload();
Q_SIGNALS:
void closeRequest();
void currentModeChanged(DatabaseWidget::Mode mode);
void groupChanged();
void entrySelectionChanged();
void databaseChanged(Database* newDb);
void databaseChanged(Database* newDb, bool unsavedChanges);
void databaseMerged(Database* mergedDb);
void groupContextMenuRequested(const QPoint& globalPos);
void entryContextMenuRequested(const QPoint& globalPos);
@ -136,6 +137,8 @@ public Q_SLOTS:
void switchToOpenMergeDatabase(const QString& fileName);
void switchToOpenMergeDatabase(const QString& fileName, const QString& password, const QString& keyFile);
void switchToImportKeepass1(const QString& fileName);
void databaseModified();
void databaseSaved();
// Search related slots
void search(const QString& searchtext);
void setSearchCaseSensitive(bool state);
@ -194,8 +197,12 @@ private:
bool m_searchCaseSensitive;
bool m_searchCurrentGroup;
// Autoreload
QFileSystemWatcher m_fileWatcher;
QTimer m_fileWatchTimer;
bool m_ignoreNextAutoreload;
QTimer m_ignoreWatchTimer;
bool m_databaseModified;
};
#endif // KEEPASSX_DATABASEWIDGET_H