Commit graph

240 commits

Author SHA1 Message Date
Sune Vuorela 3eee43ffd8 Don't use private Qt api
Add some more unit testing to expose some bugs in previous implementation and fix those as well.
2023-08-10 23:06:18 +00:00
Sune Vuorela c5909d0a6d Better suggested signed name
When signing a "filename versioned" pdf, e.g. foo-1.2.3.pdf, the
current suggestion for signed name is weird. the "_signed"
gets misplaced in the middle of the version.

Also, compressed pdf's (pdf.gz) gets up with weird suggestions.

Fix both of these cases and document (by tests) the current behavior.
2023-08-07 22:08:20 +00:00
Sune Vuorela 720e08220d Allow dbus to be disabled
In certain usecases, especially for non-linux desktop builds, the
advantage of of dbus is often limited. Provide a way to disable
building with dbus.

Note that this also disables the related functionalities of having a
second okular launch open the document in the first okular.

This also disables the unit tests that tests those features.
2023-07-18 07:53:42 +00:00
Oliver Sander f694ab6343 Add test for field number formatting
This adds a test document with most formatting options directly accessible through acrobat.
Currently only the number format functions are tested as they are the only ones implemented.

Original patch is from Oliver Sander, rebased and fixed up by Nicolas Fella
2023-07-10 09:03:19 +00:00
Volker Krause ec0e848c58 Rename the JS functions unit tests to no longer mention kjs 2023-06-22 17:44:49 +02:00
Friedrich W. H. Kossebau 725155b29d Include only needed headers instead of QtDBus module header
GIT_SILENT
2023-06-07 22:41:22 +00:00
Friedrich W. H. Kossebau 5e5ae0a7aa Include only needed headers instead of QtTest module header
GIT_SILENT
2023-06-07 23:11:21 +02:00
Sune Vuorela b32ae775b4 Remove virtual methods from signature and certificate info
This is an abi break, but it menas we can extend signature and
certificate info in the future without breaking the abi again.

While we are at it, there is no need to hand around pointers to
certificate/signature info any longer, so clean up that. Fix memleaks as
side effect.
2023-05-03 09:15:42 +00:00
Nicolas Fella 0501c5d8c4 Fix raising window when attaching to an existing instance on Wayland
When the second instance is launched it receives an activation token per environment variable

We need to pass that token to the first instance so that it can use it to raise itself

Also properly use startup ids for this on X11 instead of relying on forceActiveWindow, which is a hack
2023-02-09 12:26:52 +00:00
Albert Astals Cid d0beae60a9 Make signunsignedfieldtest pass again
the fake cert had expired ^_^
2022-11-20 01:25:46 +01:00
Albert Astals Cid b935e24876 Make the CloseDialogHelper work better on my setup 2022-11-19 20:39:55 +01:00
Albert Astals Cid 366464c012 parttext: Don't require pdflatex to run test
We can just run commit the files needed for it, makes life a bit easier
2022-11-19 20:39:51 +01:00
Albert Astals Cid 91afa74342 Set minimum requirement to Ubuntu 22.04 2022-11-19 09:48:15 +00:00
Nicolas Fella 80afe26873 Implement event.change
This represents the newly entered data for each keystroke. This is often a single added character, but for cases like pasting text it can be more complex.

The PDF API reference doesn't specify any algorithm to use.

The algorithm used here works by iterating through both strings from the start until the first different character is encountered. Then the rest of the new text is considered the difference.

This doesn't produce the theoretically optimal/minimal diff, but seems to work well enough for practical application.

When text is removed the diff is empty
2022-09-13 21:51:15 +00:00
Albert Astals Cid 44304b32a5 Use the poppler version includes instead of check_cxx_source_compiles 2022-05-04 01:16:35 +02:00
Albert Astals Cid d3dc35e159 Try to fix randomly failing jenkins 2022-04-08 10:46:46 +02:00
Albert Astals Cid 0d40301d50 Add a few definitions that will come with ECM 5.85
Better enforce them now, so that the work to port doesn't increase over
time

Not a super fan of this for regular applications, but oh well the ship
has sailed
2022-04-07 23:02:12 +00:00
M  B  8aa96484da Markdown: Fix images with special chars in URLs not loaded
If an image URL contains a non-ASCII character (e.g. `kartöffelchen.jpg`), the html returned by the markdown parser contains the encoded path `kart%C3%B6ffelchen.jpg`. We must decode the path before checking if the image file exists.
2022-04-03 16:02:44 +00:00
Albert Astals Cid 252236d413 Port a few more QLinkedList to QList
We don't need the special properties of QLinkedList in any of those and
QLinkedList is deprecated, so move away from it
2022-03-31 17:08:01 +02:00
Albert Astals Cid 0741ef1838 Port away from more QLinkedLists
QLinkedList is gone from Qt6

The almost 1:1 port is std::list but we don't need iterator stability on
removal/insertion so just port to QList
2022-03-22 12:58:59 +01:00
Albert Astals Cid 04c21b9c70 Fix cmake warning 2022-03-19 18:44:26 +01:00
Albert Astals Cid 6767b8739e Port a few QLinkedList to QList
QLinkedList is deprecated in later Qt5 and gone in Qt6

The 1:1 port is std::list but in this cases all we ever do
is create the lists, push back to them, and pass then around
to be read, for that a QList is more than enough
2022-03-19 11:22:55 +00:00
Albert Astals Cid 2d007f27d3 foreach -> for
A future ECM update is going to force that on us, so do it now anyway
2022-03-19 10:58:47 +00:00
Albert Astals Cid 6747e7fe8b signals-> Q_SIGNALS
A future ECM update is going to force that on us, so do it now anyway
2022-03-19 10:58:47 +00:00
Albert Astals Cid a2e1043149 slots -> Q_SLOTS
A future ECM update is going to force that on us, so do it now anyway
2022-03-19 10:58:47 +00:00
Volker Krause 50d0703ae0 Enable readability-braces-around-statements 2022-03-09 23:29:56 +01:00
Jiří Wolker f24aa63a97 Create welcome screen
This screen is similar to the one in Ark, but also shows you a list of
recently-opened documents.
2022-03-08 04:24:45 +00:00
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
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
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
Albert Astals Cid a8e5f6e9f7 PDF: Allow signing unsigned signature fields 2022-01-24 13:18:36 +01:00
Albert Astals Cid d11a7d42cb Merge remote-tracking branch 'origin/release/21.08' 2021-09-18 00:08:46 +02:00
Albert Astals Cid 6b978a554c annotationtoolbartest: Remove unneded cast
Also allows us not to compile a ./part/toggleactionmenu.cpp in the test, which seems to fix
the crashes in freebsd, makes some sense since we end up with two
ToggleActionMenu in the test, the one provided by the okularpart
library and the other compiled in
2021-09-17 15: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 0c659a5466 clang-tidy: Enable google-explicit-constructor 2021-08-29 08:52:35 +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
Alexander Lohnau ac083e44e3 Make meaning of sponsoring note more clear 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
Simone Gaiarin 87fa366c4a Adapt annotation toolbar tests to new toggleable quick annotation 2021-05-10 05:36:29 +00:00
Albert Astals Cid 34b8c1e72e Merge remote-tracking branch 'origin/release/21.04' 2021-05-07 23:40:46 +02:00
Albert Astals Cid be1f0de196 try to stabilize test 2021-05-07 18:24:02 +00:00
Gerd Wachsmuth 6a6b6ca345 Fix bug: select browse tool after trim select 2021-04-25 13:43:18 -06:00
shenleban tongying 1855f9e4b1 Patch: Let form and sign interface to respect the OSD setting 2021-04-23 03:44:44 +00:00
David Hurka 5a58d3bb8e Simplify ToggleActionMenu
* Remove the ImplicitDefaultAction intelligence, so ToggleActionMenu is
  not more than a KActionMenu with setDefaultAction().
* Instead, reset the default action when it gets removed from the menu().
  This is done by filtering QActionEvent from menu().
* Add an autotest for ToggleActionMenu.

This replaces prior efforts to fix problems in ToggleActionMenu
in !245 and !254, following the discussion on the virtual meeting
at 2021-02-26.

6b26a2b4b and 1786e6c99 have already ported PageView and
AnnotationActionHandler to the simplified interface.
2021-04-23 01:54:42 +00:00
Gerd Wachsmuth f6b58ed804 Fix bug: select browse tool after trim select 2021-04-21 08:01:10 +02:00
Gerd Wachsmuth 61551d2356 Fix: Viewport coords normalized w.r.t. full page
The coordinates in Viewport.rePos are normalized on the full page. In
two functions within pageview.cpp, these were treated as coordinates on
the cropped page.

CCBUG: 198427

This partially fixes the bug 198427 in the case that the cropping of the
target pages (and the pages around the target) is known at the time the
link is clicked. That is, it works if

- One uses 'Trim To Selection'
- One uses 'Trim To Margin' and has already viewed at the target
page(s).

In the case that the cropping of the page at the target is unknown, we
still end up at the wrong position.
2021-04-20 07:48:51 +02:00
Albert Astals Cid 0584660125 partest: Fix one test interfering with the next
Cleanup settings and docdata in between tests
2021-04-10 08:48:15 +00:00
Gerd Wachsmuth 0a23d4a001 Fix a bug with zoom levels on cropped pages
BUG: 342003

Uses ideas of https://bugs.kde.org/show_bug.cgi?id=342003#c5
2021-04-08 22:27:20 +02:00