Commit graph

740 commits

Author SHA1 Message Date
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
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