Commit graph

754 commits

Author SHA1 Message Date
Pratham Gandhi 5b449e5fdf Keystroke, format, validate, calculate events support for combo boxes.
Added keystroke, format, validate, calculate events for combo boxes. Also did some refactoring for recalculateForms method.
2024-09-15 20:39:31 +00:00
Nicolas Fella e165180bb0 Rework UX for adding digital signature
Currently when adding a signature the user is prompted to specify a
rectangle, then chose a certificate. The problem here is that the
user doesn't know what size is appropriate, so it takes some trial and
error to get something good.

To address this change the flow a bit. First ask which certificate and
other parameters should be used. With that information we create a
signature annotation object and add that to the page. The user can
then move and resize it like any annotation util the size and placement
is right.

Once the user is happy with the placement they click on a Finish Signing
button that then prompts for where to save the signed document and signs
it.

This makes the warning about a too small signature rect redundant since
the user sees that the signature won't fit. It was only an approximation
anyway.

CCBUG: 443403
2024-09-12 14:54:27 +02:00
Athul Raj Kollareth 036b037d8c Support pdf Default Page Layout
Allow pdf to specify default view mode.

BUG: 188239
2024-08-19 22:36:37 +00:00
Emir SARI 3aa9cb22dc Minor i18n improvements
- Use multiplication sign instead of `x`
- Use ellipsis
- Apply i18n to some paper sizes
2024-08-15 19:03:39 +00:00
Pratham Gandhi be64de02c5 Added support for MouseDown, MouseEnter and MouseExit events 2024-08-12 20:28:24 +00:00
Pratham Gandhi 934ccc2718 Implemented reset forms in okular 2024-08-09 16:50:41 +00:00
Pratham Gandhi 43b536bdf9 Implement DocClose, DocWillPrint, DocDidPrint, DocWillSave and
DocDidSave methods.
2024-07-21 23:33:41 +00:00
Pratham Gandhi c4c98e9958 Added option to save committed values and restore them if not accepted.
Also did some refactoring on the keystroke, format, validate methods.
Created new methods that can accept any generalized form field to allow
for the operations on FormFieldChoice as well.
2024-07-08 21:32:08 +00:00
Sune Vuorela d211a6a9e9 More cppcheck fixes 2024-06-26 12:48:44 +00:00
Pratham Gandhi 2fe492891f Fixed cursor position and undo/redo merges
Fixes two things:

1. Cursor positions are being incorrectly calculated in scenarios where keystroke actions reject some input text.
2. Undo/redo operations were buggy and the commands would not merge often leading to single character undo/redo most of the times.
2024-06-15 18:26:51 +00:00
Pratham Gandhi 1b78471a41 Made event.change evaluate to whole incoming text.
Currently event.change evaluates from first point of difference to end of the string. This MR modifies it to evaluate to whole incoming text. Now we evaluate whatever change is coming in, even if that change contains some common substring with original string (not considering only from the first point of difference).

The current definition makes it difficult to evaluate the final value from event.value and event.change within Javascript. This change is also better from compatibility POV as other readers such as Adobe and PDF.js make similar calculations.
2024-06-11 22:41:59 +00:00
Pratham Gandhi 51980dd07e Implemented DocOpen event and fixed doc() function of JSField 2024-06-11 08:52:35 +00:00
Pratham Gandhi 667d615582 Added selStart and selEnd properties to event object 2024-05-31 19:43:12 +00:00
Sune Vuorela 4509b7bc42 Various minor fixes
Mostly derived from cppcheck runs
2024-04-16 15:44:19 +02:00
Sune Vuorela 56a2a8d3bd cleanups: Sprinkle in a bit unique_ptr
Document memory ownership with unique_ptr's and do a bit of code
cleanups.
2024-03-06 21:57:08 +00:00
Sune Vuorela 1d93a42263 Newer clazy: More potential detaching temporary 2024-03-04 16:49:25 +01:00
Sune Vuorela dc88b5873a Don't put slashes in plugin prefix
It complicates stuff further down the line and we don't gain much for
it, so work with the rest of the stack rather than work around it.

One of the complications is that if bindir contains both plugins and executable, we will have okular and okular/ in the same folder and that doesn't really work.
2024-01-09 14:12:45 +00:00
Sune Vuorela 7e07b41e06 document diff; port from deprecated
Use std::u32string for ucs4 representation. That can non-deprecated be
fed back into QString. Unfortunately the data from toUcs4 can't.
2023-12-21 13:38:58 +00:00
Sune Vuorela 792425fc77 s/qAsConst/std::as_const/
We now definitely has std::as_const available and Qt has started nagging
about converting to std::as_const.

Implementation is the same for both functions, and qAsConst was a
stop-gap measure until std::as_const was sufficiently available.
2023-12-19 11:46:24 +00:00
Sune Vuorela a72ad046f7 Remove ifdef'ed out code 2023-12-18 22:56:22 +00:00
Sune Vuorela be29ae5eec Make some RegularExpressions static 2023-12-18 22:56:22 +00:00
Carl Schwan 946a8aa386 Port away from QTextStream::setCodec 2023-12-18 22:56:22 +00:00
Carl Schwan c02926d213 Port away from KRun::isExcecutableFile
This method moved to KIO::OpenUrlJob
2023-12-18 22:56:22 +00:00
Sune Vuorela a9717a8e5f Use CI environment for clang/clazy
In order to be able to also do this with Qt6 we can't currently rely on
'random distro' to be able to give us an environment sufficient for
running clang and clazy, so use the CI system setup instead

A side effect is that we get a newer clazy and clang-tidy and thus is a
few more issues to either ignore or fix.

Also, ask ninja to continue as long as possible rather than stop at
first error to be able to get succes in as few runs as possible
2023-12-15 09:39:03 +00:00
Sune Vuorela 32c804296a Get rid of QStringRef 2023-12-06 19:12:43 +00:00
Sune Vuorela 69943b5819 Fix deprecated warning QMap::unite
It looks like we mostly come with new values, and if we actually end up
with duplication we want the newest found and not do multi inserts.
2023-12-06 17:28:23 +00:00
Nicolas Fella 1b479dfb7b Port away from deprecated KRun 2023-12-06 09:22:16 +00:00
Nicolas Fella d4a344a189 Port away from deprecated KPluginLoader 2023-09-11 19:29:44 +00:00
Nicolas Fella 4addfcc4ec Remove kdelibs4 migration code when using Qt6
Upgrading 4->6 is not supported by KF6
2023-09-11 17:46:07 +00:00
Jeremy Whiting 4ae7d68857 Fix more Qt deprecations.
Mostly QPrinter::Orientation -> QPageLayout::Orientation and
a few things about sizes.
2023-08-10 23:12:39 +00:00
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
Albert Astals Cid 532cb0cdcd Initial implementation of app.popUpMenuEx
It is defenitely not a full implementation but it's enough for the one
file we have that needs it for now

BUGS: 472764
2023-08-05 18:20:54 +00:00
Albert Astals Cid 29810ad3dd Handle absolute urls in Document::processAction
BUGS: 472440
2023-07-23 18:28:56 +02:00
Max Mueggler 8308112867 Fix bug where entire next page would be preloaded when zoomed into one page
This bug would cause out-of-memory errors when zoomed in.

There's an equivalent (and therefore redundant) check for if the
normalizedRect is null, so it looks like the normalizedArea != 0 check
was an oversight, if anything.
2023-06-29 08:28:51 +00:00
Sune Vuorela 03368e06f4 Make phonon optional
In certain configurations not lugging around a multimedia framework could be preferred.
2023-06-21 15:50:58 +00:00
Sune Vuorela 0c383d8cfc Random minor/pedantic fixes 2023-06-17 11:04:41 +00:00
Sune Vuorela 9f498c7f55 Allow new signatures to have image backgrounds 2023-06-14 17:47:41 +00:00
Sune Vuorela da7ca71291 Add location and reason to signing info 2023-06-14 17:47:41 +00:00
Sune Vuorela ed0b1551fb Simple deprecation. SkipEmptyParts 2023-05-12 10:43:04 +00:00
Sune Vuorela 5c9e0e2585 Rename setViewportWithHistory to setViewport and remove the old setViewport 2023-05-12 10:39:41 +00:00
Albert Astals Cid c62dc60ead Fix crash when executing the Save action
Detecting aboutToClose is not enough because savingAs doesn't always go
through aboutToClose it can go through swapBackingFile

BUGS: 467603
2023-04-05 22:06:55 +00:00
Albert Astals Cid 052264c3e5 Use KIO::OpenUrlJob instead of KRun::runService
Works much better in Windows
2023-03-27 15:14:04 +00:00
Max Mueggler 71770ed815 Replace QTime with QDeadlineTimer in DocumentPrivate::getFreeMemory
QTime is quite inefficient and getFreeMemory sometimes gets called quite
frequently. I found that upwards of 10% of CPU time was being spent
inside of QTime in some cases. Besides being the recommended thing for
this use case, QDeadlineTimer is a lot more efficient.
2023-02-23 22:24:07 +00:00
Willyanto Willyanto 98876cf588 Replace qSwap with std::swap
Fixes obsolete function 'qSwap' called. It is recommended to use 'std::swap'
instead. (CWE-477)
2023-01-26 18:11:50 +00:00
Max Mueggler aa0386dccd Fix hasPixmap setting size of TilesManager 2022-12-01 20:21:12 +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 030a34f1ff Fix Windows compile with new stricter defines 2022-04-08 10:52:26 +02:00
Albert Astals Cid 8c31962e81 Port a few QLinkedList to std::list
here we do quite a bit removals from the middle, so feels better to have
something that is cheap to do that like std::list
2022-03-31 17:27:13 +02: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