Bug 449976 - Can't open okular document archive saved from a directory of images
Summary: Can't open okular document archive saved from a directory of images
Status: RESOLVED FIXED
Alias: None
Product: okular
Classification: Applications
Component: general (show other bugs)
Version: 21.12.2
Platform: Gentoo Packages Linux
: NOR normal
Target Milestone: ---
Assignee: Okular developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-02-10 22:22 UTC by dirtyice
Modified: 2022-02-22 13:57 UTC (History)
3 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 dirtyice 2022-02-10 22:22:06 UTC
SUMMARY
After okular's only useful feature was removed a couple of years ago, I finally gathered my courage and tried to save the annotations I made, but okular can't read its own format back.

STEPS TO REPRODUCE
1. Open a directory with a buch of jpg images, make some annotations
2. When exiting, it will ask to save the chages. Click on save.
3. It will conplain that it can't save in the curent format, click on Save as Okular document archive
4. "After saving, the current document format requires the file to be reloaded. Your undo/redo history will be lost.
Do you want to continue?" Click on yes.

OBSERVED RESULT
Okular quits. In the console I see

kf.kio.slaves.file: copy() QUrl("file:///tmp/okular.CSKYyV") to QUrl("file:///home/dirty_ice/test") mode= -1
kf.kio.slaves.file: the file doesn't have any xattr
org.kde.okular.core: No plugin for mimetype '"application/zip"'.
The document hasn't been reloaded/swapped correctly

Trying to open the file manually, it says "Can not find a plugin which is able to handle the document being passed." Okay, it didn't include the .okular extension automatically, fix it and try again:
"Could not open file:///home/dirty_ice/test.okular."
And that's all.
The only way I managed to get my annotations back was to open the metadata.xml inside the .okular file, and copy the <pageList> to ~/.local/share/okular/docdata/<some_random_name>.xml, in this case when I open the dir my annotations are back, along with a message that this is deprecated and save to a file if I want to edit the document. Except the Save as button is disabled (both on the message and in the file menu), and it's read only, so I can't create new annotations or modify existing ones either.

EXPECTED RESULT
It should open the .okular file, hopefully without packing the hundreds of megabytes of images into it.

SOFTWARE/OS VERSIONS
Windows: nope
macOS: no way
Linux/KDE Plasma: Gentoo linux ~amd64
(available in About System)
KDE Plasma Version: not installed (I'm using awesome as a WM)
KDE Frameworks Version: 5.90.0
Qt Version: 5.15.2

ADDITIONAL INFORMATION
Comment 1 Albert Astals Cid 2022-02-10 22:54:23 UTC
> EXPECTED RESULT
> It should open the .okular file, hopefully without packing the hundreds of megabytes of images into it.

I mean, you asked it to do that, so I'm not sure why you're suddently surprised that the application did what you said.

Anyhow, you defenitely triggered an unexpected path, sadly folders of images is not something the code accounts for, my suggestion is that one shouldn't be able to annotate when opening folders of images, just when opening individual files.
Comment 2 dirtyice 2022-02-11 00:05:59 UTC
(In reply to Albert Astals Cid from comment #1)
> I mean, you asked it to do that, so I'm not sure why you're suddently
> surprised that the application did what you said.

Hmm, what do you mean? We have two things going on.
First I wanted to quit, and save the changes before I quit. Not necessarily a bug, it's just a bit weird that okular asks to reload the document, when it's going to quit right after it.
But my main problem is that I can't load the document it saved at all. I didn't ask okular to create an unopenable file.

> Anyhow, you defenitely triggered an unexpected path, sadly folders of images
> is not something the code accounts for, my suggestion is that one shouldn't
> be able to annotate when opening folders of images, just when opening
> individual files.
Couldn't it be made to work somehow? I mean, back when okular automatically saved annotations in a separate file into ~/.local/share/okular/docdata, this worked IIRC.
Comment 3 dirtyice 2022-02-11 00:11:10 UTC
Oh yes, sorry, now that I re-read my original bugreport, I noticed that the wall of text is under observed result and the expected result comes logically after steps to reproduce, it's only physically after observed result, but that's not what I exactly had on mind when written the report.
So TL;DR, my problem is that it can't load the file it created, everything else is additional information.
Comment 4 Bug Janitor Service 2022-02-14 14:00:20 UTC
A possibly relevant merge request was started @ https://invent.kde.org/graphics/okular/-/merge_requests/563
Comment 5 Albert Astals Cid 2022-02-22 13:57:19 UTC
Git commit 0197a78fb565b6ce6d19a81d7debafd667c26ca3 by Albert Astals Cid.
Committed on 22/02/2022 at 13:20.
Pushed by aacid into branch 'master'.

Part::queryClose: Don't ask the user if he wants to save file types we can't save

M  +29   -8    part/part.cpp
M  +3    -0    part/part.h

https://invent.kde.org/graphics/okular/commit/0197a78fb565b6ce6d19a81d7debafd667c26ca3