Commit graph

279 commits

Author SHA1 Message Date
Nicolas Fella
d1ecad897c Implement keystroke commit events
When a form field loses focus a special keystroke event with
willCommit=true is sent.

This is based on work by Joao Netto <joaonetto901@gmail.com>
2022-03-07 22:14:26 +00:00
Albert Astals Cid
1aa175cf3f Support SaveAs action
If a new enough (unreleases as of now) poppler is available

BUGS: 451010
2022-03-06 19:16:27 +00:00
Nicolas Fella
1d64fea660 Port away from KToolInvokation 2022-03-03 21:54:28 +01:00
Albert Astals Cid
27c8919a42 Merge remote-tracking branch 'origin/release/21.12' 2022-02-27 12:09:58 +01:00
Nicolas Fella
03d83eb22d Don't create keystroke event when cursor moves
Currently we send a keystroke when the cursor moves but the text doesn't change.

Acrobat doesn't do it so let's do the same
2022-02-24 22:12:13 +01:00
Nicolas Fella
6c8cafbb1c Simplify keystroke event handling
Make it more similar to how we handle the format event.

We pass the new value to processKeystrokeAction, that calls the script
and sets the new value for the form object according to the result. If
needed the widget is refreshed to reflect the new text
2022-02-24 16:10:22 +01:00
Nicolas Fella
ae8251a145 Don't clear focus when setting formwidget visible
Otherwise setVisibility(true) removes the focus
2022-02-24 15:36:43 +01:00
Huu-Tinh Pham
57829d1d81 added fallback icon for thumbnail sync context menu
The sync icon was missing when using the Breeze Icon pack.
Now a sync icon and a refresh icon is used for this thumbnail sync action.
2022-02-23 15:31:12 +00:00
snooxx 💤
9432565ede Fix broken page MiniBar
The `MiniBar` normally used to display page numbers and to provide
navigation buttons regressed since 01557c16c4 to only show an empty
non-functional button called "Page Number", along with multiple
warnings:
`QObject::connect(MiniBar, QAction): invalid nullptr parameter`

This is caused by moving `setupViewerActions()` to a place where
`m_miniBar` is not initialized yet, even though it has a runtime
`connect`-dependency on it.

By moving `setupViewerActions()` back, the `MiniBar` starts working
again. Now the `m_addBookmark` action, which is created in that
function, is not available anymore to be passed to the constructor of
`BookmarkList`. To avoid moving the setup of the latter away from the
rest of the sidebar code, only assigning the action to the bookmark
button contained in the `BookmarkList` is deferred to
`setupViewerActions()`.

As requested, any accidental future `nullptr`-access will be handled by
crashing, even in Release builds, by omitting any checks.

BUG: 450347

Test Plan:

Page numbers show up again in toolbar, no more `connect` warnings.
2022-02-22 23:16:34 +00:00
Albert Astals Cid
818b714252 Fix wrong default font string for annotation tools 2022-02-22 14:38:44 +01:00
Albert Astals Cid
0197a78fb5 Part::queryClose: Don't ask the user if he wants to save file types we can't save
BUGS: 449976
2022-02-22 13:20:37 +00:00
Andreas Naumann
147a638619 Adds option editor-cmd to the commandline
Adds the option "editor-cmd" for the [feature request](https://bugs.kde.org/show_bug.cgi?id=263732) .

BUG: 263732
2022-02-18 13:33:28 +00:00
Huu-Tinh Pham
a3fde02232 Onetime sync thumbnail
Added context menu entry to quick sync thumbnails with the current page. This is handy in case the user is not using "Link the thumbnails with the page" and wants quick sync thumbnails without changing settings or search for the page in the thumbnails view.

Before
![image](/uploads/389216ce4720f1891ddc4f2bf8ee14ea/image.png)

After
![image](/uploads/b4804d11992695d3a6be6642c9d7ac16/image.png)
2022-02-18 12:12:41 +00:00
Albert Astals Cid
4cd6bfd30e mobile: Add Signature Viewing UI
Move a few files from part/ to gui/ since they are also used by the
mobile/ frontend
2022-02-18 08:32:13 +00:00
Yuri Chornoivan
28e362b6a1 Simplify the string for the 'Search for...' action
BUG: 450334
2022-02-17 15:09:42 +02:00
Jeremy Whiting
1be2290358 Allow user to select tts voice in addition to engine.
To make tts more user friendly allow user to select which
voice is used for tts playback.
2022-02-14 08:20:14 -07:00
Albert Astals Cid
a3fbd52739 Tell the user if he tries to save an Okular Archive with the wrong extension 2022-02-10 22:26:31 +00:00
Nicolas Fella
a6c8d6dac3 Simplify printing code
Remove pointless null check, we know printDialog isn't null since we create it right before

Create PrintDialog on the stack

We create and destroy it all within one function

This way we get guaranteed cleanup for free
2022-02-04 13:26:09 +01:00
Nate Graham
3c98dcdb0c Improve Bookmark action icons and text
This commit updates the "remove bookmark" actions to use the more
specific "bookmark-remove" icon, rather than the more general
"list-remove" icon or the older "edit-delete-bookmarks" icon which does
not exist in the Breeze icon theme. For compatibility's sake, a fallback
is added to try "edit-delete-bookmarks" if "bookmark-remove" is not
found in the active icon theme.

It also uses a longer but clearer string for the "remove all bokmarks"
context menu item.
2022-02-01 19:58:42 +00:00
Nate Graham
4dd3dc3f39 Improve UI for Bookmarks sidebar page buttons
Currently there are two tiny icons-only buttons with very similar icons
(which may even be identical in some icon themes). One of them is
checkable, and the other one triggers an immediate action. And there is
lots of unused space to the right of them.

This commit overhauls them in the following way:
- The toggle button becomes a checkbox with visible text, and is
  inverted; now when checked, it shows all bookmarks
- The checkbox moves above the view and search field, to communicate
  that it affects everything below it
- The button to add a bookmark gets some visible text

This should make the UI much clearer, at the cost of one extra line of
vertical space from the bookmarks list.
2022-02-01 19:58:42 +00:00
Nate Graham
01557c16c4 Put an "Add Bookmark" button on the Bookmarks sidebar
Previously, the only ways to add a bookmark were with the menu item or
keyboard shortcut. This commit adds a button at the bottom of the
bookmarks sidebar to do the same thing, which seems like a logical place
for such functionality.

setupViewerActions() was moved to earlier in the setup process to ensure
that m_addBookmark is assigned by the time the bookmarks sidebar is
created, since it gets passed that action in its constructor.

BUG: 357625
FIXED-IN: 21.12
2022-02-01 19:58:42 +00:00
Albert Astals Cid
9cded33c83 Fix incorrect spacing sequence
\% is not a valid C escape character, we just want % here
2022-01-28 22:50:55 +00:00
Nicolas Fella
3e2e5cc95e Simplify form action handling
Instead of going widget -> controller -> pageview -> document do
widget -> document directly.
2022-01-24 16:00:19 +01:00
Albert Astals Cid
a8e5f6e9f7 PDF: Allow signing unsigned signature fields 2022-01-24 13:18:36 +01:00
Albert Astals Cid
d59967d8e1 Merge remote-tracking branch 'origin/release/21.12' 2022-01-24 12:53:23 +01:00
Albert Astals Cid
fa6743aa04 Support the PDF Print named action
Also stop casting directly from a poppler enum to an okular enum, it's
not cool

BUGS: 448791
2022-01-23 22:20:46 +00:00
Albert Astals Cid
3e919b4287 Fix saving to okular archive on Windows
BUGS: 431717
2022-01-23 22:20:13 +00:00
Albert Astals Cid
e6483c98fc Merge remote-tracking branch 'origin/release/21.12' 2022-01-19 17:21:07 +01:00
Albert Astals Cid
6795ae7f2c Fix previewing embedded files on Windows
BUGS: 448735
2022-01-19 15:03:41 +00:00
Albert Astals Cid
f03bbfa89d PDF: Allow signing documents that need password to open them
We need the password since in the middle of the signing process we need to reopen
the document we just created to do some final modifications
2022-01-05 13:59:37 +00:00
Albert Astals Cid
df4a7ef4e9 Merge remote-tracking branch 'origin/release/21.12' 2022-01-05 14:01:09 +01:00
Albert Astals Cid
44c86de7e4 Fix two Signature issues on multipage/multisignature documents
First issue:
 - The "document is totally signed" was based on the last signature of
   the last page (that had signatures) that is not correct and needs to
   be based in the last signature by date

 - The "Rev #" number was based on the signature on the page, so if we
   had two pages with one signature each the model showed "Rev 1" for
   both

It adds new API which is not awesome in a stable branch, but the first
issue is important enough that warrants this to go to the stable branch
2022-01-03 23:38:23 +01:00
Albert Astals Cid
a2576dc746 Act on core/ TODOs that are not binary compatible
I'm going to need to break binary compatibility to add a new feature
so may as well cleanup all the TODOs regarding that

Changes:
 * Moving a few destructors to the header
 * Removing a few unnecessary & in params
 * Adding a few necessary & in params
 * Making print return an enum instead of a bool and then having another
   function that returns the enum
 * Make Generator::requestFontData be a virtual
 * Remove unused enum
 * Remove a few filePrinter unneeded functions
 * Remove unused TextDocumentGenerator::addMetaData signal
2021-12-29 09:35:25 +00:00
Albert Astals Cid
1e8824eca9 Merge remote-tracking branch 'origin/release/21.12' 2021-12-27 23:29:17 +01:00
Albert Astals Cid
e145f27970 Fix uninitialized memory read when opening the settings
==25792== Conditional jump or move depends on uninitialised value(s)
==25792==    at 0xFC1F7C2: PreferredScreenSelector::preferredScreen() const (dlgpresentation.cpp:215)
==25792==    by 0xFC1F422: PreferredScreenSelector::repopulateList() (dlgpresentation.cpp:163)
==25792==    by 0xFC1F23F: PreferredScreenSelector::PreferredScreenSelector(QWidget*) (dlgpresentation.cpp:151)
==25792==    by 0xFC1EFBB: DlgPresentation::DlgPresentation(QWidget*) (dlgpresentation.cpp:128)
==25792==    by 0xFC15825: PreferencesDialog::PreferencesDialog(QWidget*, KConfigSkeleton*, Okular::EmbedMode) (preferencesdialog.cpp:45)
==25792==    by 0xFC4A522: Okular::Part::slotPreferences() (part.cpp:2834)
2021-12-27 21:55:24 +00:00
Albert Astals Cid
5e474c3e88 Merge remote-tracking branch 'origin/release/21.12' 2021-12-26 23:08:23 +01:00
Albert Astals Cid
2a041d4845 Fix crash when adding stamps to the quick annotations
BUGS: 447409
2021-12-26 22:34:16 +01:00
Albert Astals Cid
62eec7d5b1 Show the "No signing certs" warning earlier
No need to ask for the user to draw a rectangle for the signature
if there's no certs to sign anyway

CCBUGS: 446549
2021-12-12 23:43:37 +00:00
Albert Astals Cid
8d078c4191 Merge remote-tracking branch 'origin/release/21.12' 2021-11-24 22:10:49 +01:00
Albert Astals Cid
1f00898af0 Presentation: Don't hide toolbar if we're not really leaving the window
BUGS: 444427
2021-11-23 23:41:32 +00:00
Kai Uwe Broulik
8eca2bfa9d [PageViewMessage] Resolve icon on the fly
Use `PM_SmallIconSize` for size calculation exclusively and
then have `QPainter` resolve it to the correct device pixel
ratio during paint.
2021-11-23 21:55:01 +01:00
Albert Astals Cid
975bf990ed Fix zoom actions not being updated correctly
BUGS: 440173
2021-11-23 19:46:08 +00:00
Marco Rebhan
583f5717fd m_share only exists when using purpose
(cherry picked from commit ea9e53311e)
2021-11-11 01:04:02 +01:00
Marco Rebhan
ea9e53311e
m_share only exists when using purpose 2021-11-10 14:49:32 +01:00
Felix Ernst
7bd0f8f399 Add KHamburgerMenu 2021-11-09 01:27:50 +00:00
Albert Astals Cid
bb36c93170 Remove wrong Q_UNUSED marker
We're assigning it in the initializers list
2021-11-08 11:16:31 +01:00
Nate Graham
aceed15e84 Improve "can not overwrite" message some more
This commit uses KUIT formatting for the filename part of the string,
fixes a grammar error ("read only" used as an adjective) and adds a bit
more detail for the user to help them figure out what happened.
2021-11-03 05:01:56 +00:00
Nate Graham
d61a7ddf1c Merge branch 'release/21.08' 2021-10-18 08:58:41 -06:00
Bharadwaj Raju
99209e29f7 Make Quick Annotations button open the full toolbar when no Quick Annotations are configured 2021-10-18 14:58:11 +00:00
Bharadwaj Raju
cc64011e3b Revert ce6582c76 2021-10-18 14:53:49 +05:30
Yuri Chornoivan
6ce455405c Remove extra space 2021-10-15 18:37:03 +03:00
Albert Astals Cid
3657958900 Merge remote-tracking branch 'origin/release/21.08' 2021-10-14 22:37:18 +02:00
Bharadwaj Raju
ce6582c761 Change labels of selection and annotation tools to be imperative
This makes them conform to the HIG and also looks cleaner.
2021-10-14 18:22:19 +00:00
Albert Astals Cid
9e2d256a6f Fix bookmark menu actions missing after switching tabs
BUGS: 442668
2021-10-12 23:21:56 +02:00
Christoph Roick
2fc710d10a Restrict quick annotation shortcut context
Only handle shortcuts to quick annotation actions
if the Okular part is focussed. Otherwise, Okular as
embedded plugin might involuntarily steal numeric input
from the main application (like in the Kate preview plugin).
2021-10-07 17:57:44 +02:00
Mahmoud Khalil
8b3dfcb3f4 PDF: Add Stamps to the file properly
By using Poppler 20.10 new custom image stamps APIs

Instead of the incompatible hack we used before that only worked for Okular.

This is done by modifying the update function used by PopplerAnnotationProxy in order to load the image in
the correct dimensions and send it to the poppler-Qt5 frontend.

We temporarily store the stamp annotation appearance when deleting it so that we can set it again when doing an undo undo.
2021-10-01 16:04:50 +00:00
Albert Astals Cid
b22bba31f2 Improve can not overwrite message 2021-09-26 10:07:05 +00:00
Albert Astals Cid
6d52b045dd Improve dialog text when asking for annotation author name
The previous texts were totally wrong

BUGS: 442381
2021-09-20 21:27:27 +00:00
Albert Astals Cid
f5b67b7462 Merge remote-tracking branch 'origin/release/21.08' 2021-09-16 22:32:42 +02:00
Albert Astals Cid
d9d09ef738 Don't allow saving over read-only files
BUGS: 440986
2021-09-16 18:50:46 +00:00
Georgiy Sgibnev
c061d57515 Fix issues when cancelling while adding a digital signature 2021-09-13 20:46:18 +00:00
Albert Astals Cid
c8a439132d Merge remote-tracking branch 'origin/release/21.08' 2021-09-09 21:28:12 +02:00
Albert Astals Cid
376925a10d Remove \n if it's the last char of the selected text
BUGS: 342874
2021-09-09 17:33:28 +00:00
Albert Astals Cid
b80d3614ef Add Expired stamp 2021-08-30 00:45:39 +02:00
Albert Astals Cid
09c68d06f8 Merge remote-tracking branch 'origin/release/21.08' 2021-08-30 00:45:33 +02:00
Albert Astals Cid
6b9a15fb1a Stamps: Fix final showing the expired stamp
BUGS: 441134
2021-08-29 21:54:15 +00:00
Albert Astals Cid
0c659a5466 clang-tidy: Enable google-explicit-constructor 2021-08-29 08:52:35 +00:00
Yuri Chornoivan
79ce3890a8 Fix minor typo 2021-08-15 08:53:44 +03:00
Simone Gaiarin
60645dfda5 Rename kcfg setting to primaryAnnotationToolBar 2021-08-13 21:28:39 +00:00
Simone Gaiarin
f57e12e2e7 Move default annotation toolbar setting to annotation setting page 2021-08-13 21:28:39 +00:00
Simone Gaiarin
5a92d40160 Make annotation toolbar settings labels more descriptive 2021-08-13 21:28:39 +00:00
Simone Gaiarin
54dd173ca6 Use combobox to select default annotation toolbar style 2021-08-13 21:28:39 +00:00
Simone Gaiarin
8ca2498de1 Make annotation toolbar visibility changed connection unique 2021-08-13 21:28:39 +00:00
Simone Gaiarin
5d968d5112 Add new toolbar holding the quick annotations minibar action
This toolbar emulates the old version of the Okular annotation bar
2021-08-13 21:28:39 +00:00
Simone Gaiarin
8837a1138f Add quick annotation minibar action
BUG: 425438
BUG: 425598

Fix #20
2021-08-13 21:28:39 +00:00
Volker Krause
a3f242cbcb Remove unused D-Bus include
This matters in the context of the upcoming D-Bus removal from KIO on
Android, which will also allow Okular to build without D-Bus on Android.
2021-08-12 17:01:21 +02:00
Albert Astals Cid
f143b323f1 Only show the Stamps warning when adding stamps to PDF files 2021-08-11 09:00:05 +02:00
Albert Astals Cid
76e26fd1fd Merge remote-tracking branch 'origin/release/21.08' 2021-08-09 23:03:45 +02:00
David Hurka
4afd214701 ToggleActionMenu::createWidget(): Do not crash if parent is not a QToolBar
There used to be a Q_ASSERT_X that was triggered when a widget was requested
with something else than a QToolBar as parent widget.

However, when the ToggleActionMenu is added to a QMenu,
createWidget() is called with the QMenu as parent.
This case was missed to be tested, but occurs when the toolbar
is detached/moved by the user.
2021-08-06 13:58:02 +02:00
Albert Astals Cid
2639524584 Merge remote-tracking branch 'origin/release/21.08' 2021-08-01 01:21:17 +02:00
Kishore Gopalakrishnan
89a8cfc096 Take into account the label size while setting size of the page number box. 2021-07-31 23:17:43 +00:00
Nate Graham
9819baffbf Merge branch 'release/21.08' 2021-07-23 06:57:50 -06:00
David Hurka
c399a11054 Fix Page Up/Down scrolling when scrollbars are turned off
PageView::slotScrollUp/Down() queried the size of the scrollbar instead of the viewport,
which has no obvious reason and doesn’t work when scrollbars are not there.

Probably the scrollbar size was thought to be more robust
in times when PageView had overshoot enabled.

Also fixes code documentation for these methods,
and removes another spaghetti feature where Continuous mode was queried
in an `if` branch before the one where it is relevant.

BUG: 421822
2021-07-22 21:05:53 +00:00
Josef Filzmaier
1d90817660 Replace kWarning with qWarning
Even in comments
2021-07-16 00:11:53 +02:00
Alexander Lohnau
7c9322ad7a
Remove defunct and unused knsrc file 2021-07-03 17:44:07 +02:00
David Hurka
b805603c58 CursorWrapHelper: Do not crash on Wayland.
According to https://bugs.kde.org/show_bug.cgi?id=437334
the cursor position is not necessarily known on Wayland.
That would trigger the Q_ASSERT_X, so this patch removes
it. This does not solve the problem that we can not wrap
the cursor, but it prevents crashing Okular if using the
debug build on Wayland. You’re reading rectangular text.

BUG: 437334
CCBUG: 439471
2021-07-02 21:36:13 +00:00
Albert Astals Cid
ec1fda4f87 Merge remote-tracking branch 'origin/release/21.04' 2021-06-27 01:13:50 +02:00
Gerd Wachsmuth
e1a14b4a1a Request Pixmaps in slotRelayoutPages 2021-06-26 10:13:34 +00:00
Simone Gaiarin
230a68d537 Uncheck mouse mode action when annotation tool selected
When the annotation is unchecked the previous mouse mode is restored.

The slot slotMouseNormalToggled is changed back to its original version
of slotSetMouseNormal given that we needed to pass the checked state
only to detach the annotations, and we do it in the lambda now.

BUG: 398108

BUG: 437377

FIXED-IN: 21.08
2021-06-19 14:12:19 +00:00
Simone Gaiarin
67a54bd8e0 Save zoom mouse mode action to a variable 2021-06-19 14:12:19 +00:00
Simone Gaiarin
44f7a6de25 Do not unselect annotation tool in none selected 2021-06-19 14:12:19 +00:00
Ahmad Samir
960dc24674 Fix signatures.html help:/ url
From a glimpse at the khelpcenter code, I think it indexes all the html
pages in a manual, then finds the requested page by searching for the filename
(I am not 100% sure, though), for example either of these two urls work:
help:/okular/index.html#adding_digital_signatures
help:/okular/signatures.html#adding_digital_signatures

but when falling back to opening the manual at docs.kde.org in a web browser
that indexing isn't available, so we have to be a bit more precise with the
urls, so use the second url.

(cherry picked from commit df02881611)
2021-06-17 00:50:01 +02:00
Ahmad Samir
df02881611 Fix signatures.html help:/ url
From a glimpse at the khelpcenter code, I think it indexes all the html
pages in a manual, then finds the requested page by searching for the filename
(I am not 100% sure, though), for example either of these two urls work:
help:/okular/index.html#adding_digital_signatures
help:/okular/signatures.html#adding_digital_signatures

but when falling back to opening the manual at docs.kde.org in a web browser
that indexing isn't available, so we have to be a bit more precise with the
urls, so use the second url.
2021-06-16 22:47:51 +00:00
Alexander Lohnau
ac083e44e3 Make meaning of sponsoring note more clear 2021-06-10 08:11:56 +00:00
Alexander Lohnau
356bd482be Convert license headers to SPDX for newly added files 2021-06-10 08:11:56 +00:00
Alexander Lohnau
83dfef19ab Put author and mail on same SPDX-FileCopyrightText line 2021-06-10 08:11:56 +00:00
Alexander Lohnau
24c75071be Move sponsoring note outside of SPDX-FileCopyrightText statement 2021-06-10 08:11:56 +00:00
Alexander Lohnau
2f193a63de Convert license headers to SPDX 2021-06-10 08:11:56 +00:00
Albert Astals Cid
73c3fa57f9 Merge remote-tracking branch 'origin/release/21.04' 2021-06-04 23:45:06 +02:00
Albert Astals Cid
e457ceb731 FormLineEdit: Don't run focusin action when gaining focus because of window management
Adobe Reader doesn't do it, and with reason, because otherwise we end up
with:
 * Run focus in script
 * script shows alert()
 * field loses focus and gains it again once the alert() is closed
 * infinite loop

BUGS: 436990
2021-06-04 21:17:41 +00:00