From 86a01b69841131a747510eef1326007e4cbee18e Mon Sep 17 00:00:00 2001 From: Keith Bennett Date: Sat, 22 Mar 2014 17:16:44 +0000 Subject: [PATCH] Ensure that external DB changes are always detected. QFileSystemWatcher seems to reset itself occasionally. This patch works around the issue by re-applying the QFileSystemWatcher whenever a change is handled. --- src/gui/DatabaseTabWidget.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/gui/DatabaseTabWidget.cpp b/src/gui/DatabaseTabWidget.cpp index 545a2bd82..d96156cff 100644 --- a/src/gui/DatabaseTabWidget.cpp +++ b/src/gui/DatabaseTabWidget.cpp @@ -182,6 +182,14 @@ void DatabaseTabWidget::fileChanged(const QString &fileName) { const bool wasEmpty = m_changedFiles.isEmpty(); m_changedFiles.insert(fileName); + bool found = false; + Q_FOREACH (QString f, m_fileWatcher->files()) { + if (f == fileName) { + found = true; + break; + } + } + if (!found) m_fileWatcher->addPath(fileName); if (wasEmpty && !m_changedFiles.isEmpty()) QTimer::singleShot(200, this, SLOT(checkReloadDatabases())); }