From e3747ca3fd9b9926ff8c52879da7fca1a620fef5 Mon Sep 17 00:00:00 2001 From: Julian Wolff Date: Thu, 7 Sep 2017 13:18:13 +0200 Subject: [PATCH] Fix automatic reload of files saved with QSaveFile Summary: Files saved with QSaveFile don't get dirty. They are deleted and replaced. Thus, inotify and KDirWatch don't emit a "dirty" signal (which is the correct behaviour). Listening for the "created" signal of KDirWatch allows us to get notified on replaced files. BUG: 384185 Test Plan: Opened a markdown document in Okular. Edited and saved the document with Kate. The file is reloaded in Okular as expected. Reviewers: aacid Reviewed By: aacid Subscribers: sander, rkflx, #okular Tags: #okular Differential Revision: https://phabricator.kde.org/D7671 --- part.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/part.cpp b/part.cpp index e8bdca08e..41d028f21 100644 --- a/part.cpp +++ b/part.cpp @@ -547,6 +547,7 @@ m_cliPresentation(false), m_cliPrint(false), m_embedMode(detectEmbedMode(parentW // document watcher and reloader m_watcher = new KDirWatch( this ); connect( m_watcher, &KDirWatch::dirty, this, &Part::slotFileDirty ); + connect( m_watcher, &KDirWatch::created, this, &Part::slotFileDirty ); m_dirtyHandler = new QTimer( this ); m_dirtyHandler->setSingleShot( true ); connect( m_dirtyHandler, &QTimer::timeout,this, &Part::slotDoFileDirty );