Commit bedc3dbe authored by Julian Wolff's avatar Julian Wolff Committed by Albert Astals Cid

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
parent 075b8153
...@@ -547,6 +547,7 @@ m_cliPresentation(false), m_cliPrint(false), m_embedMode(detectEmbedMode(parentW ...@@ -547,6 +547,7 @@ m_cliPresentation(false), m_cliPrint(false), m_embedMode(detectEmbedMode(parentW
// document watcher and reloader // document watcher and reloader
m_watcher = new KDirWatch( this ); m_watcher = new KDirWatch( this );
connect( m_watcher, &KDirWatch::dirty, this, &Part::slotFileDirty ); connect( m_watcher, &KDirWatch::dirty, this, &Part::slotFileDirty );
connect( m_watcher, &KDirWatch::created, this, &Part::slotFileDirty );
m_dirtyHandler = new QTimer( this ); m_dirtyHandler = new QTimer( this );
m_dirtyHandler->setSingleShot( true ); m_dirtyHandler->setSingleShot( true );
connect( m_dirtyHandler, &QTimer::timeout,this, &Part::slotDoFileDirty ); connect( m_dirtyHandler, &QTimer::timeout,this, &Part::slotDoFileDirty );
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment