Commit graph

725 commits

Author SHA1 Message Date
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
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 ba35bbd9e6 emit -> Q_EMIT
A future ECM is going to force that on us, so do it early
2022-03-19 10:58:47 +00:00
Albert Astals Cid 9d3842c796 Move to clang-format 13 2022-03-10 00:23:22 +01:00
Volker Krause 50d0703ae0 Enable readability-braces-around-statements 2022-03-09 23:29:56 +01: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
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 5e8beb532a Set correct textfield value on keystroke
event.value is the old value, we need to set the new value here

Modifying event.value is not supported when not committing
2022-03-02 23:20:14 +01:00
Nicolas Fella fd1c312d57 Fix keystroke events
event.value is the value before editing, not after
2022-02-24 23:39:28 +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 218edc6f4a Merge remote-tracking branch 'origin/release/21.12' 2022-01-29 11:47:52 +01:00
Albert Astals Cid feef900250 Make sure helper apps we start are in path
QProcess will happily start things in CWD which is not what we want
2022-01-28 22:51:20 +00:00
Albert Astals Cid 8a36e7350d Make Utils::realDpi work on QWindow not on QWidget
Small step towards the goal of okularcore not linking to QWidgets
2022-01-27 19:25:30 +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 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 e2ac1dcd1e PDF: Fix memory leak when the file has Optional Content links 2022-01-04 16:42:35 +00: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 1f84075c12 Don't use KMessageBox in document class
Just use the existing signals to warn the user about it
2021-09-09 17:43:26 +02:00
Albert Astals Cid eee71036a7 Fix crash in bug 400104 again
And also make clazy happier so we don't need an exclude
2021-08-27 10:45:35 +02:00
Albert Astals Cid b747f0feb1 CI: silence clazy warning now that there's a new clazy version 2021-08-27 00:15:17 +02:00
Luigi Toscano 9327fd485d Fix terminology: MIME Type 2021-07-02 19:27:53 +02:00
Alexander Lohnau ac083e44e3 Make meaning of sponsoring note more clear 2021-06-10 08:11:56 +00:00
Alexander Lohnau bf4c8da4fc Manual fixes to license headers 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 72658e0ec3 Fix saving signed revisions of a signature
We don't need a QDataStream to assign a QByteArray to a QByteArray, and
it was adding some noise at the beginning which is clearly not what we
want
2021-05-06 21:09:49 +00:00
Oliver Sander ccda6d2a65 Remove device pixel ratio scaling from PixmapRequest
The PixmapRequest constructor expected width and height in logical
pixels, and scaled them to device pixels.  However, not knowing what
screen the request is for, it had to use qApp->devicePixelRatio()
for the scaling.  That value may not be correct if not all screens
use the same scaling.

Fix this by introducing a new constructor that takes the device
pixel ratio as an additional argument, and deprecating the old
constructor.
2021-03-08 00:23:11 +01:00
Albert Astals Cid 49f784ecf9 When signing save to a new file, not over the current one 2020-12-13 21:31:14 +00:00
Albert Astals Cid 9728d8b426 We don't do getFoo in Okular API 2020-12-13 21:31:14 +00:00