Bug 225907 - don't "reload" document when file has been deleted
Summary: don't "reload" document when file has been deleted
Status: RESOLVED DUPLICATE of bug 234139
Alias: None
Product: okular
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: unspecified Unspecified
: NOR normal
Target Milestone: ---
Assignee: Okular developers
URL:
Keywords:
: 228196 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-02-08 13:09 UTC by uetsah
Modified: 2010-10-06 11:29 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description uetsah 2010-02-08 13:09:32 UTC
Version:            (using KDE 4.3.5)
Installed from:    Unlisted Binary Package

The "reload document on file change" feature is really neat, especially for people who produce PDFs files themselves.

However, in case the document file isn't accessible at all anymore (i.e., deleted or read permissions removed), Okular should really skip the "reload", as that'll just result in a blank grey Okular window which obviously isn't useful in *any* circumstance. On the other hand, there *are* common usecases where it actually becomes quite inconvenient.

__Usecase example:__

 - I click a PDF link in a web browser
 - The web browser opens the PDF in a new Okular window - I leave it open for reading later
 - I close the web browser
 - I bring up the Okular window, and find: It's empty!!

The following happened: The web browser automatically downloaded the PDF, saved it to a temporary file, and passed that file to Okular instead of the original URL. When closed, the browser deleted all it's temporary files. Okular "reloaded" the now nonexisting file.
Now if I want to read the PDF, I need to close the Okular window, re-open the browser and find and open the PDF link again, this time remembering not to close the browser.
This is a rather annoying experience, and the fact that it now happened to me 3 times in a row (y'know, when I do online research I have other things on my mind than constantly thinking about what window close will accidentally trigger which file reload) caused me to finally report this issue...
Comment 1 Albert Astals Cid 2010-02-20 16:17:10 UTC
It seems to me that you could disable the watch file option and be happy.

Of course the "better" solution would be showing a message saying the file was removed from the file system and not "reloading" it until the file gets recreated.

But i don't have time to implement that.
Comment 2 uetsah 2010-02-20 17:07:51 UTC
> It seems to me that you could disable the watch file option and be happy.

That's what I've done, but I'm not really happy with it, as I find that feature useful in other circumstances... (When files actually do *change*, not get deleted...)

> Of course the "better" solution would be showing a message saying the file was
> removed from the file system and not "reloading" it until the file gets
> recreated.

Probably just adding [*] or [deleted] to the window title would suffice.
Okular already has enough redundant message boxes that can get in your way...

> But i don't have time to implement that.

I understand that...
I still hope that someone might implement it in the future though.
Comment 3 Pino Toscano 2010-02-20 17:24:27 UTC
The only occasion when Okular reloads the document is when the document is changed, but not when it is deleted.
What you see is mostly an effect of the recent hiccups in the KDE file watching service, which most probably is sending (also or only) a "deleted" notification.
Please wait for KDE 4.4.1, and test back when you have such version.
Comment 4 Albert Astals Cid 2010-02-23 20:11:26 UTC
*** Bug 228196 has been marked as a duplicate of this bug. ***
Comment 5 Ivo Anjo 2010-02-25 00:18:56 UTC
I've just built the KDE 4.4 branch and re-tested this.
Both
- taking away read permissions from an open file
- doing open with on firefox, then closing firefox
still make okular reload to an empty window, so I'd say this is unrelated to the KDE file watching problems (or they are still there).
Comment 6 David Faure 2010-02-25 01:50:46 UTC
SVN commit 1095777 by dfaure:

Fix bug found by discussing with pinotree about #225907: deleted() wasn't emitted anymore.
Added unittest for that, and checked that dirty() isn't emitted (due to my other recent
changes to KDirWatch), so at least deletion of the watched file is handled correctly now.
Fixed for: 4.4.1
CCBUG: 225907


 M  +2 -2      kio/kdirwatch.cpp  
 M  +21 -0     tests/kdirwatch_unittest.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1095777
Comment 7 Pino Toscano 2010-08-14 22:20:15 UTC
>  - I click a PDF link in a web browser

uetsah, is firefox the said "web browser", by chance?
If so, this is another case for the fixed bug #234139.
Comment 8 André Neves 2010-10-06 08:23:19 UTC
I can confirm that this bug applies to Firefox, not occuring when opening a file in Okular and manually deleting it behind the scenes.

So I guess that's a step in order to categorize this as a duplicate of #234139.
Comment 9 uetsah 2010-10-06 11:23:07 UTC
"uetsah, is firefox the said "web browser", by chance? If so, this is another case for the fixed bug #234139."

Yes, but I thought it also happened with console delete/rename back when I reported the bug (but I could also be mistaken).

In any case, it seems to be indeed fixed now for me (using KDE 4.5.1).
Both the Firefox case, and the rename/delete case work fine now - the document stays open in Okular.

Thanks, btw... :-)
Comment 10 Pino Toscano 2010-10-06 11:29:10 UTC

*** This bug has been marked as a duplicate of bug 234139 ***