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.
This commit is contained in:
Keith Bennett 2014-03-22 17:16:44 +00:00
parent b432103b82
commit 86a01b6984

View File

@ -182,6 +182,14 @@ void DatabaseTabWidget::fileChanged(const QString &fileName)
{ {
const bool wasEmpty = m_changedFiles.isEmpty(); const bool wasEmpty = m_changedFiles.isEmpty();
m_changedFiles.insert(fileName); 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()) if (wasEmpty && !m_changedFiles.isEmpty())
QTimer::singleShot(200, this, SLOT(checkReloadDatabases())); QTimer::singleShot(200, this, SLOT(checkReloadDatabases()));
} }