Currently Okular stops the user from saving their document if it has
unsaved changes and was modified externally. This makes some sense
because there are now two sources of truth, and Okular cannot reconcile
them itself. However as a consequence, it causes data loss since the
user's unsaved changes in Okular become un-save-able. This is quite
frustrating when it happens.
But this prohibiton on saving over an externally-modified document only
really makes sense for a "Save" operation that overwrites the original
document. If instead, the user does a "Save As...", then they can save
their local changes to another file and avoid losing unsaved changes.
Then if needed, they can manually compare the original
externally-modified document with their newly-saved document and
reconcile the changes by hand.
Accordingly, this commit avoids showing the error message box and
blocking saving if the user is doing a "Save As..." to a new location,
rather than overwriting the open file.
BUG: 402017
FIXED-IN: 23.04.1
(cherry picked from commit b5191a2c1f)
Adobe's docs say:
For example, for a field with a value of “020”, value returns the integer 20,
while valueAsString returns the string “020”.
Share most of the fieldGetValue code by splitting it out into a 'Core'
variant and then using it in both GetValue and GetValueAsString.
BUGS: 468036
(cherry picked from commit 24a9d097d7)
Detecting aboutToClose is not enough because savingAs doesn't always go
through aboutToClose it can go through swapBackingFile
BUGS: 467603
(cherry picked from commit c62dc60ead)
When using an LTR language, people scan user interfaces left-to right
and top to bottom. This means that the most frequently-used controls
should be located at the top left, so people see them first.
This commit uses that principle to re-arrange the toolbar a bit, so that
after the "show/hide sidebar button" (which needs to be the left-most
item to connect it with the left sidebar), the left-most items in the
default toolbar are the zoom and view mode controls. These are
viewing-related controls, and Okular is first and foremost a viewer app.
The controls that let you interact with the document (select stuff,
annotate) are moved over to the right side of the toolbar because they
are used for secondary workflows.
The zoom buttons are also grouped together to connect them in the user's
mind.
Finally, the separator lines are re-added to disconnect the "show/hide
sidebar" button from the now-icons-only zoom buttons.
(cherry picked from commit 8c8744f2e3)