Bug 384185 - Markdown backend does not reload automatically if the file has changed
Summary: Markdown backend does not reload automatically if the file has changed
Status: RESOLVED FIXED
Alias: None
Product: okular
Classification: Applications
Component: general (show other bugs)
Version: 1.2.70
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Okular developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-08-30 15:22 UTC by Oliver Sander
Modified: 2017-09-07 19:49 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Oliver Sander 2017-08-30 15:22:42 UTC
Okular reloads pdf files automatically when they change on disk.  I would expect the markdown backend to do the same. a) for consistency and b) because it is convenient when writing markdown.
Comment 1 Albert Astals Cid 2017-08-30 15:25:49 UTC
this is a bug not a wish, i'm kind of surprised this doens't work, nothing pdf sepcific in the reload path
Comment 2 Oliver Sander 2017-08-30 15:30:40 UTC
Can you reproduce it?
Comment 3 Albert Astals Cid 2017-08-30 22:21:40 UTC
Yes works for me.

HAvne't you destroyed this feature locally while testing patches D7595/D7495 ?
Comment 4 Oliver Sander 2017-08-31 09:04:15 UTC
No, I merely looked at these patches, but never tested them.

More experimentation has revealed the following: Automatic reload does work as expected when I 'touch' the file, or when I save it from 'vi'.  It does not work when I save it from Kate.  How can that be?
Comment 5 Julian Wolff 2017-08-31 09:12:23 UTC
I can confirm this too, for both markdown and txt documents (and probably others).

In part.cpp:1729, slotFileDirty, we check if the path of a document that got dirty matches with the file path of the currently loaded document.
When editing a document with Kate, the .kate-swp file gets dirty, but not the actual document.

For me this seems like a bug in either Kate or KDirWatch, not in Okular.
Comment 6 Albert Astals Cid 2017-08-31 19:37:58 UTC
We had code for this, i guess someone broke it when porting to KF5.
Comment 7 Albert Astals Cid 2017-08-31 19:53:43 UTC
After reading the code i agree it seems a regression in kdirwatch
Comment 8 Albert Astals Cid 2017-08-31 20:38:08 UTC
Meh, it's probably a regression in inotify since i build the old kdelibs4 version and that doesn't work anymore either. I'll try to add some more code and ideally an autotest.
Comment 9 Julian Wolff 2017-09-07 11:18:38 UTC
Git commit e3747ca3fd9b9926ff8c52879da7fca1a620fef5 by Julian Wolff.
Committed on 07/09/2017 at 11:18.
Pushed by jwolff into branch 'master'.

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.

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

M  +1    -0    part.cpp

https://commits.kde.org/okular/e3747ca3fd9b9926ff8c52879da7fca1a620fef5
Comment 10 Albert Astals Cid 2017-09-07 19:49:37 UTC
Git commit bedc3dbeadd450a860770308ffc2ca5538cf42b9 by Albert Astals Cid, on behalf of Julian Wolff.
Committed on 07/09/2017 at 19:49.
Pushed by aacid into branch 'Applications/17.08'.

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.

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

M  +1    -0    part.cpp

https://commits.kde.org/okular/bedc3dbeadd450a860770308ffc2ca5538cf42b9