diff --git a/src/gui/DatabaseWidget.cpp b/src/gui/DatabaseWidget.cpp index 45fc058eb..4453fb36c 100644 --- a/src/gui/DatabaseWidget.cpp +++ b/src/gui/DatabaseWidget.cpp @@ -58,6 +58,10 @@ #include "config-keepassx.h" +#ifdef Q_OS_LINUX +#include +#endif + #ifdef WITH_XC_SSHAGENT #include "sshagent/SSHAgent.h" #endif @@ -1173,6 +1177,21 @@ void DatabaseWidget::updateFilePath(const QString& filePath) m_fileWatcher.removePath(m_filePath); } +#if defined(Q_OS_LINUX) + struct statfs statfsBuf; + bool forcePolling = false; + const auto NFS_SUPER_MAGIC = 0x6969; + + if (!statfs(filePath.toLocal8Bit().constData(), &statfsBuf)) { + forcePolling = (statfsBuf.f_type == NFS_SUPER_MAGIC); + } else { + // if we can't get the fs type let's fall back to polling + forcePolling = true; + } + auto objectName = forcePolling ? QLatin1String("_qt_autotest_force_engine_poller") : QLatin1String(""); + m_fileWatcher.setObjectName(objectName); +#endif + m_fileWatcher.addPath(filePath); m_filePath = filePath; m_db->setFilePath(filePath);