Okular supports opening zipped files like document.pdf.gz by
transparently extracting them. However, since 559836c392 saving
annotations back was broken. This is because this commit tries to
prevent saving back changes to externally modified files to prevent data
loss. The way this is checked by comparing timestamps mistakenly
triggered for unchanged zipped files, too.
This can be solved by always comparing the before/after timestamps of
the actual file, instead of the timestamp of the temporary copy of the
extracted file. The change has to be done in two places so saving
repeatedly works too.
BUG: 338742
Test plan
gzip autotests/data/file1.pdf && okular file1.pdf.gz
Add annotation, saving works now instead of showing an error.
touch normal.pdf still triggers modification warning.
Differential Revision: https://phabricator.kde.org/D9580
We need to store the id locally since we need it to map
"old form" to "new form" after save and at that stage the "old form"
poppler side is gone so we're accessing invalid memory
Summary:
When hovering the mouse over the X symbol to close a note the cursor remains the same of the current shape (hand, selection cursor) based on the tool selected.
This patch morphe the cursor to the standard arrow over the X symbol to close a note by adding setCursor() call in the CloseButton constructor
BUG: 384381
Test Plan:
1. Open okular and select Tools -> Review or press F6 to create a new pop-up note
2. Hover the mouse cursor over the close button (X) of the pop-up note window
3. You will see the standard arrow instead of the current tool based cursor.
Screenshot below (the tooltip saying "Close this note" was not captured by Spectacle application)
{F5685539}
Reviewers: #okular, ngraham
Reviewed By: ngraham
Subscribers: ngraham, #okular
Tags: #okular
Differential Revision: https://phabricator.kde.org/D10209
Summary:
Okular allows to drop changes when saving to a file format not
supporting those. However, this is only sensible for {nav Save As},
while for {nav Save} the {nav Continue} button is not needed. When this
behaviour was introduced in 481676dced, the `jpg` test row failed
subsequently, because `closeDialogHelper` relies on the availability of
the {nav Continue} button. The `epub` test row is similar, but `returns`
early because it does not allow `canSwapBackingFile` and therefore does
not fail the test afterwards.
As the test progresses, the initial {nav Save As} (`potato.jpg` to
`/tmp/123.jpg`) is implicitly followed by {nav Save} (`/tmp/123.jpg` to
`/tmp/123.jpg`) for each subsequent `part.saveAs`. This causes the
{nav Continue} button to vanish, so eventually the test will fail.
Forcing {nav Save As} so the {nav Continue} button continues to exist
could be done in multiple ways, but just alternating between two
different files to save seems like the most efficient and most readable
approach.
Test Plan:
- `./autotests/parttest testSaveAsUndoStackAnnotations:jpg` now passes.
- Other test rows still pass.
- No changes to non-test code needed.
Reviewers: aacid, #okular
Reviewed By: aacid, #okular
Subscribers: #okular
Tags: #okular
Differential Revision: https://phabricator.kde.org/D9579
text page was storing a pointer to a PagePrivate pointer but those die
after saving so we need to store a Page pointer since those are stable.
BUGS: 387247
bd20e48c3c updated Okular's copy of the synctex code to 1.19.
Unfortunately since this version the upstream code logs errors like
`"! SyncTeX Error : Ignored record...` when accessing selected synctex
files created with older versions of synctex.
The upstream `_synctex_log` contains `va_list arg` as a parameter, but
fails to initialize and tear down this properly via `va_start` and
`va_end`. In general this seems to work for the single argument case.
However, once we apply our hardening patch to get rid of the
`gnu_printf format attribute` warning and thus introduce a variadic
argument, things go wrong.
To fix this, we add the missing code. The remaining changes are just
refreshing the patches.
BUG: 383915
Test Plan:
Opening `empty.pdf` with `empty.synctex.gz` from
https://bugs.kde.org/attachment.cgi?id=109116 located
in the same folder does not lead to Okular segfaulting anymore.
Summary:
pixelValue/pixelValue will give us a normalised value.
Normalised values shouldn't be modified by a device pixel ratio.
We want scaledRect not dScaledRect.
BUG: 386110
Test Plan:
Searched for text. Zoomed in, panned about
Created annotations, they still seemed to work
Subscribers: #okular
Tags: #okular
Differential Revision: https://phabricator.kde.org/D8832
Summary:
Unfortunately, poppler (the only backed that supports saving) is not able
to save properly if the file is modified by a third party while it is opened
So we give the user a warning saying things went wrong and give him the option
to not reload/close, that way if there was something very important in the annotations
she added she can try to save them (even if by copy&paste the contents to a third program)
Reviewers: rkflx
Reviewed By: rkflx
Subscribers: ngraham, rkflx, ltoscano, #okular
Tags: #okular
Differential Revision: https://phabricator.kde.org/D8863
Summary:
It appears it's copied and pasted from LibCHM and while it's indeed
needed to support displaying CHM files, it's a library of its
own.
Reviewers: #okular
Tags: #okular
Differential Revision: https://phabricator.kde.org/D8879