Commit graph

2023 commits

Author SHA1 Message Date
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 a8e5f6e9f7 PDF: Allow signing unsigned signature fields 2022-01-24 13:18:36 +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 df4a7ef4e9 Merge remote-tracking branch 'origin/release/21.12' 2022-01-05 14:01:09 +01: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 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 d6870ae2ff Remove deprecated Generator::documentMetaData 2021-12-29 18:49:56 +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
Oliver Sander 24e48d9f5c Fix a typo in JavaScript code documentation 2021-12-14 09:37:51 +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 0d4f463729 Fix implementation of AFNumber_Format
We did not take sepStyle 3 into account.

Also sepStyle 1 and 0 where mixed up and it didn't work either because
replace() needs to be assigned back to the string

BUGS: 445868
2021-11-29 11:15:46 +00:00
Albert Astals Cid 810e9db2bb Merge remote-tracking branch 'origin/release/21.08' 2021-10-23 11:59:12 +02:00
Albert Astals Cid 2002f4e7e9 Relax the check for non square DPI
BUGS: 444168
2021-10-22 22:23:49 +00:00
Albert Astals Cid 7ccdd513b9 Merge remote-tracking branch 'origin/release/21.08' 2021-10-06 23:19:06 +02:00
Albert Astals Cid 913560eb78 util.printd: Don't crash if we get an unexpected oDate argument
BUGS: 443255
2021-10-05 22:55:16 +02:00
Albert Astals Cid a408499889 Make the stamps renderer as static as before
Looking for and loading the SVG file isn't cheap so cache it as we did
in the past
2021-10-01 19:31:23 +02:00
Albert Astals Cid b3379d331d Fix documentation of AnnotationUtils::loadStamp 2021-10-01 18:55:19 +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
l10n daemon script 7c87c702df SVN_SILENT made messages (.desktop file) - always resolve ours
In case of conflict in i18n, keep the version of the branch "ours"
To resolve a particular conflict, "git checkout --ours path/to/file.desktop"
2021-09-10 02:19:38 +00:00
l10n daemon script 7ae4288f35 SVN_SILENT made messages (.desktop file) - always resolve ours
In case of conflict in i18n, keep the version of the branch "ours"
To resolve a particular conflict, "git checkout --ours path/to/file.desktop"
2021-09-10 01:16:35 +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 0c659a5466 clang-tidy: Enable google-explicit-constructor 2021-08-29 08:52:35 +00: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 c0de8366fc Merge remote-tracking branch 'origin/release/21.08' 2021-08-27 10:44:29 +02:00
Albert Astals Cid bed447f769 textpage: Don't use the page bounding rect as initial text rect
The bounding rect is *visual* and it can happen that we have
invisible text and thus the algorithm will get super confused
because there will be text items that are outside the text area
2021-08-27 06:52:28 +00: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
Alex Richardson 0f4f3b1902 Fix -Werror build failure in synctex parser
I am cross-compiling with clang for FreeBSD and the build is failing with:
error: initializing 'char *' with an expression of type 'const char [1]' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]

Mark the char pointers as const to fix this build failure.
2021-07-12 14:18:39 +01: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 24c75071be Move sponsoring note outside of SPDX-FileCopyrightText statement 2021-06-10 08:11:56 +00:00
Alexander Lohnau 3c5cfc8abc Convert license files for core/synctex directory 2021-06-10 08:11:56 +00:00
Alexander Lohnau 2f193a63de Convert license headers to SPDX 2021-06-10 08:11:56 +00:00
l10n daemon script 6ad2ebdbbb SVN_SILENT made messages (.desktop file) - always resolve ours
In case of conflict in i18n, keep the version of the branch "ours"
To resolve a particular conflict, "git checkout --ours path/to/file.desktop"
2021-06-02 02:15:07 +00:00
Albert Astals Cid 81344f8aa8 Unbox alert() parameters when they are in an object
API let's you use both arguments or objects with named properties, so
support both.

This fixes the contents of the warning in 435833, the crash is still
there though, working on that next

CCBUGS: 435833
2021-05-24 19:53:03 +02: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 275b7ea57c Remove todo from NormalizedRect::operator|
as far as i can see that works just fine

GIT_SILENT
2020-12-25 23:58:33 +00:00
Albert Astals Cid b1fa4caaf2 Merge remote-tracking branch 'origin/release/20.12' 2020-12-22 01:25:17 +01:00
Albert Astals Cid d112682611 Make search work on documents that describe Å as A + ◌̊
BUGS: 430243
2020-12-21 22:32:39 +00:00
Albert Astals Cid 33ccbc0449 Signing: Don't say that there are no certificates if the user cancels...
...entering the pwd for the certificate store

Also Move CertificateStoreImpl to PopplerCertificateStore, since
PopplerCertificateStore was declared but never defined and use it
in CertificateTools to get the certificate list instead of calling
the poppler classes directly
2020-12-13 21:31:14 +00:00
Albert Astals Cid 242718a9a2 Only ask for certificate password if really needed 2020-12-13 21:31:14 +00: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
Albert Astals Cid 6325a4fe0b Make sure you have no unsaved changes before saving 2020-12-13 21:31:14 +00:00
Albert Astals Cid 18ef1349f1 Improvements to adding digital signatures
* Don't make WidgetAnnotation know about signatures stuff, widget
   annotations are for multiple things
 * Don't create an "empty" widget annotation and then call sign on it
   (which is wrong because widget annotations can be multiple things),
   just say sign the document with this data (cert, l&f, etc)
 * Remove the "management" functionality from CertificateTools it was
   only visual, i.e. it didn't really add/remove certificates
 * Ask for the NSS password (if needed)
2020-12-13 21:31:14 +00:00
Albert Astals Cid b09e23f6ab Run clang-format
Attempting to fix the whole chain of commits is not worth it
2020-12-13 21:31:14 +00:00
Albert Astals Cid bcf54ef2f1 These two methods don't need to be slots 2020-12-13 21:31:14 +00:00
Thorsten Behrens 3eedb21a83 Consistenly use CERT nick to refer to signing key 2020-12-13 21:31:14 +00:00
Thorsten Behrens f7d6045b92 Add poppler NSS support
Move certificate config down into generator code
Read available signing certificates from poppler NSS
2020-12-13 21:31:14 +00:00
Thorsten Behrens b96dac6df3 Add certificate store for access to NSS keys
WIP - add interfaces and methods to get access to NSS-via-poppler
sign certificates, and provide them for signing documents.
2020-12-13 21:31:14 +00:00
Thorsten Behrens 847b423e2a Add better diagnostics 2020-12-13 21:31:14 +00:00
Thorsten Behrens e031822744 Adapt to poppler sign api change
Now poppler offers signing via PDFConverter class. Add some error
handling, and store signature in temp file. Document gets reloaded
after replacing original file.
2020-12-13 21:31:14 +00:00
Thorsten Behrens e3e582ee5c Add feature flag for poppler signing API
Test and conditionally-compile pdf signing feature, depending
on poppler new-ness.
2020-12-13 21:31:14 +00:00
Katarina Behrens cc908b9f92 Pass pointer to widget annotation just added down the chain 2020-12-13 21:31:14 +00:00
Katarina Behrens 03381667f6 Pass certificate CN and password down the chain 2020-12-13 21:31:14 +00:00
Katarina Behrens d320fa17ad Stub some iface for signing the document 2020-12-13 21:31:14 +00:00
Nicolas Fella 50e8c4f333 Port an occurence of KMimeTypeTrader
It is about to be deprecated

See https://phabricator.kde.org/T12177
2020-12-12 18:04:26 +00:00
Albert Astals Cid 39846f8c16 Merge remote-tracking branch 'origin/release/20.12' 2020-12-09 21:15:36 +01:00
Albert Astals Cid d1c2eed1b6 Make the CI pass with new clang-tidy
Disable bugprone-suspicious-include since it's triggered by the moc
includes

Disable bugprone-reserved-identifier since it's triggered by all our
_OKULAR defines, and yes even if the spec says that underscore is
reserved, are we going to be that unlucky that the library decides to
start using _OKULAR ? not probably

Add two TODOs for the future to make NormalizedRect/Point faster

Silence a warning about a quick moving QString if we make it non const

Silence a uchar vs char warning that is in decades old code so
experience seems to suggest it's ok.
2020-12-09 19:53:50 +01:00
Albert Astals Cid d9487fc764 Merge remote-tracking branch 'origin/release/20.12' 2020-12-06 19:13:23 +01:00
Albert Astals Cid 4f2c2b2714 Document::openRelativeFile: Double check the url changed when we asked to
If not, open did not succeed and the callers (for example open document
X in page A) would like to know so they don't have to do the "change to
part A" part.

BUGS: 429924
2020-12-06 17:33:34 +00:00
Alexander Lohnau 3c1fa441d9 Remove dead code
A lot of this code has been commented out for over
a decade and adds no value to the project.
It is only annoying when you look over it ;).

Same for the KNS2 support which was commented out.

Also some of the debug statements didn't even build
anymore, because the properties got removed/refactored.
2020-11-14 10:52:00 +01:00
Albert Astals Cid 6bd6714ab0 poppler: Use actual function calls instead of xml to create poppler annotations 2020-11-11 00:43:54 +00:00
Albert Astals Cid becdc7c483 Revert the two last commits
f9841b0f8a and e0f45add55

They break the windows build, which shows there's something defenitely
fishy going on with the current code, but oh well, someone with more
time needs to figure out a proper solution
2020-11-11 01:31:47 +01:00
Albert Astals Cid e0f45add55 Enable -Wweak-vtables in clang
Read https://stackoverflow.com/a/23749273/11956287 for a full
explanation, but basically this is important for headers like the
interfaces/ and kdocumentviewer.h that are supposed to be used by third
partyies where it may happen that wrong things happen because the whole
class is inline in a header

For the classes that are defined in the .cpp or are not installed
headers this would not be necessary but it's not so hard to add a few
default defined destructors, so do that :)
2020-11-08 21:21:06 +00:00
Albert Astals Cid b9c40d709d Fix formatting after Laurent's commit
Please Laurent try to use MR when you do changes that may break our CI
like this one

CCMAIL: montel@kde.org
2020-10-23 22:48:44 +02:00
Laurent Montel 486e05b270 If include is define in .h remove it if it's defined in .cpp too (scripted) 2020-10-23 07:32:28 +02:00
l10n daemon script dc74ffa68c SVN_SILENT made messages (.desktop file) - always resolve ours
In case of conflict in i18n, keep the version of the branch "ours"
To resolve a particular conflict, "git checkout --ours path/to/file.desktop"
2020-10-17 06:04:22 +02:00
Nate Graham d78e2ff9e7 Merge branch 'release/20.08' into master 2020-09-29 09:36:56 -06:00
Kezi Olio bdb2df773d Fix forms when inertially scrolling
`setViewport` automatically adds an item to the history if it finds that it
moved for more than a page, which we don't want to do when automatically
scrolling, as with inertial scrolling.

This commit adds a new function `setViewportWithHistory()` which takes an
argument to optionally avoid preserving history. This avoids breaking ABI.
The new history-less functionality is used when inertially scrolling.

BUG: 421354
FIXED-IN: 1.11.2
2020-09-25 15:41:23 +00:00
Friedrich W. H. Kossebau 1784c1d0cb Use more nullptr instead of 0 2020-09-13 11:20:09 +02:00
Thomas Friedrichsmeier 3fda3ba561 Fix build using MinGW 2020-09-11 16:24:44 +02:00
Christoph Cullmann 25984bb2bb add missing export to class
BUG: 426358
2020-09-10 20:51:52 +02:00
Albert Astals Cid 2697105462 Revert cbddcd3273
KJS and KWallet are indeed optional, that's what the ${optionalComponents} variable does
2020-09-09 14:13:09 +02:00
Albert Astals Cid cbddcd3273 kwallet and kjs are mandatory in cmake anyway, remove ifdefs 2020-09-05 23:50:45 +00:00
Albert Astals Cid 511fc7acca Document the valid int values for TextAnnotation::setInplaceAlignment 2020-08-21 15:35:32 +02:00
Albert Astals Cid caa351c723 Bookmarks: Resolve symlinks before using an url
If a symlink points to another file, we should use that file as
canonical source for bookmarks, it doesn't make sense to have two
different sets of bookmarks for two paths that are essentially the same
file

BUGS: 424340
2020-08-07 22:34:30 +00:00
David Hurka 93e67cca93 Port away from QDesktopWidget
This ports Shell from QDesktopWidget to QScreen (trivial),
and removes unused QDesktopWidget includes (super-trivial).
2020-08-05 23:24:36 +00:00
Albert Astals Cid 88bf8a87de Fix compile on FreeBSD 2020-07-11 10:11:31 +02:00
Albert Astals Cid 19d98d6a74 Run clang-format
find . \( -name "*.cpp" -or -name "*.h"  -or -name "*.c"  -or -name "*.cc" \) -exec clang-format -i {} \;

If you reached this file doing a git blame, please see README.clang-format (added 2 commits in the future of this one)
2020-07-11 09:17:33 +02:00
Albert Astals Cid b558f7f762 Changes to make clang not mess up the clazy comment 2020-07-11 07:51:27 +02:00
Albert Astals Cid bd57b36c83 Add TODO for the future to fix requestFontData function 2020-07-11 07:50:05 +02:00
Albert Astals Cid 4c150c2889 Disable the overloaded-signal in two signals in TextDocumentGenerator
We already have a TODO for when we can do BIC changes
2020-07-09 21:38:29 +02:00
Laurent Montel 516fb89d94 Use camelcase include. (scripted) 2020-07-08 13:54:37 +02:00
Albert Astals Cid a3c7d81000 Merge remote-tracking branch 'origin/release/20.04' 2020-06-30 19:37:33 +02:00
Albert Astals Cid 795c7cb01f Increase kjs requirement for using the timeout check
Unfortunately with the new timeout code but older than 5.72 will crash on appAlert

So increase the requirement to > 5.71
2020-06-24 12:06:32 +02:00
l10n daemon script 7254c56886 SVN_SILENT made messages (.desktop file) - always resolve ours
In case of conflict in i18n, keep the version of the branch "ours"
To resolve a particular conflict, "git checkout --ours path/to/file.desktop"
2020-06-18 08:26:04 +02:00
l10n daemon script 90502b2961 SVN_SILENT made messages (.desktop file) - always resolve ours
In case of conflict in i18n, keep the version of the branch "ours"
To resolve a particular conflict, "git checkout --ours path/to/file.desktop"
2020-06-18 05:35:59 +02:00
l10n daemon script 1f50b2a6b4 SVN_SILENT made messages (.desktop file) - always resolve ours
In case of conflict in i18n, keep the version of the branch "ours"
To resolve a particular conflict, "git checkout --ours path/to/file.desktop"
2020-06-17 16:48:38 +02:00
l10n daemon script 2857dc241f SVN_SILENT made messages (.desktop file) - always resolve ours
In case of conflict in i18n, keep the version of the branch "ours"
To resolve a particular conflict, "git checkout --ours path/to/file.desktop"
2020-06-17 14:03:40 +02:00
Albert Astals Cid 03cee363cd Merge remote-tracking branch 'origin/release/20.04' 2020-06-15 23:41:57 +02:00
Albert Astals Cid d78cbb79c9 Fix/Workaround file where we can't enter values in some fields
The problem was that the JS checker for the field format was using the
willCommit property of event and we don't define it so the JS
interpreter was going "ok nope, out of here" and the field didn't get edited.

I've read the willCommit definition in js_api_reference.pdf for almost
30 minutes, and even it's just 3 lines i don't think i understand it,
but i think that returning true is "safer", i.e. says that this event is
going to actually change the field, which as far as i can see it's what
we always do

BUGS: 421508
2020-06-15 20:45:21 +00:00
l10n daemon script 35e43602d4 SVN_SILENT made messages (.desktop file) - always resolve ours
In case of conflict in i18n, keep the version of the branch "ours"
To resolve a particular conflict, "git checkout --ours path/to/file.desktop"
2020-06-11 09:34:54 +02:00
l10n daemon script ef53790eba SVN_SILENT made messages (.desktop file) - always resolve ours
In case of conflict in i18n, keep the version of the branch "ours"
To resolve a particular conflict, "git checkout --ours path/to/file.desktop"
2020-06-10 05:21:36 +02:00
Nate Graham 4ee6b5066d Merge branch 'release/20.04' 2020-06-09 13:16:33 -06:00
l10n daemon script cc452498e5 SVN_SILENT made messages (.desktop file) - always resolve ours
In case of conflict in i18n, keep the version of the branch "ours"
To resolve a particular conflict, "git checkout --ours path/to/file.desktop"
2020-06-09 09:16:32 +02:00
Nate Graham d195633b16 Display all of the page sizes in a new tab of the properties dialog
Previously it just said, "Multiple" for multi-page-size documents.
Now it will tell you the most common page size on the "Properties"
tab, and display a full table of all page sizes in a new "Page Sizes" tab.

For documents with only a single page size, there are no changes.
2020-06-02 23:24:26 +00:00
Nate Graham 0e71c95f29 Show page size field in Properties dialog when there are multiple sizes
Currently when a document has multiple page sizes, the Properties dialog
does not show the "Page Size" field at all. This MR populates the field
with the string "Multiple" for documents with multiple page sizes.
2020-05-27 09:40:50 -06:00
Yuri Chornoivan 4d75045cd8 Fix minor EBN issues 2020-04-04 12:17:50 +03:00
Albert Astals Cid 5035f90dd9 Fix forms sometimes showing an old value
If from processFormatAction we call setAppearanceText,
we need to call setAppearanceText from outside too, otherwise when the
formatting action doesn't create a different text we still show the old
old value

CCBUGS: 418445
2020-03-28 23:12:08 +00:00
Albert Astals Cid d3b43b0b1e Implement AFMakeNumber
Also make stringToNumber be stubborn when converting strings to numbers

CCBUGS: 418445
2020-03-28 23:12:08 +00:00
Albert Astals Cid 9084bfaabe Fake implement AFNumber_Keystroke
Needed by the file at bug 418445, since it's a validate kind of thing we
can leave it unimplemented for now
2020-03-28 23:12:08 +00:00
Albert Astals Cid f69e2114e7 Use poppler choicesWithExportValues if available 2020-03-28 23:12:08 +00:00
Albert Astals Cid 9694113a96 Let the user type the hyphen if he wants when searching
It happens that sometimes the hypen is actually "part of the word" like
in one-third, so if there's one- at the end of a line
and third at the beginning of the next, we should still match and not
force the user to type onethird, even we will also match onethird since
there's no way to know if "hyphen at end of line" is supposed to be part
of the word or not

BUGS: 418520
2020-03-28 13:59:01 +00:00
Albert Astals Cid 6a93a033b4 Document::processAction: If the url points to a binary, don't run it 2020-03-10 23:07:55 +01:00
Andre Heinecke ad405165b1 Add AFNumber_Format and l10n AFSimple_Calculate
This adds utility functions to util to work with QLocale
for formatting and Number handling.

At least until we support AFNumber_Keystroke to restrict
what a user enters in Number input fields it is good
behavior to expect the user to enter Numbers in the system's
Locale.

AFNumber_Format is new for formatting and uses the
Locale util functions.
2020-03-08 13:05:36 +01:00
Kevin Slagle 493853667d add global variable kMemCheckTime 2020-03-06 23:45:29 +00:00
Kevin Slagle 8d501fc43a getFreeMemory is called every two seconds when checking to see if the system is low on memory. Before this commit, half of these checks are useless (when okular is idle) since the cache is used when the cache is <=2 seconds old. This means that after they system is out of memory, up to 4 seconds (instead of 2) could go by before okular starts to free memory. 2020-03-06 23:45:29 +00:00
Albert Astals Cid 4964e7e42d Merge remote-tracking branch 'origin/release/19.12' 2020-03-02 22:22:06 +01:00
Albert Astals Cid 81c005710c Fix re-rendering of images when using partial updates
Partial updates trigger when the page is taking "too much" to render (>
500 ms).

When this happens we store a pixmap for the page, this meant that
Page::hasPixmap returned true, so when moving the viewport around we
would think that that page was already rendered, and thus needed no
rendering so we didn't add it to the list of requested pixmaps.

Then on document when seeing the new list of requested pixmaps we would
go and check and say "oh there's one request going on that we don't want
anymore, let's cancel it", so we would cancel the page that we actually
wanted (and clear the partial pixmap)

Then on the next scroll we would realize we did not have that page
pixmap and then request it again which since it's the current page would
immediately stop all other renders and start this one.

Then we would get a temporary pixmap and the loop of cancellations and
requesting again would keep happening as long as the user moved the
viewport.

We fix that my making hasPixmap return false if the pixmap we have is a
partial one, because that's what the function meant "forever" until we
recently introduced partial updates so all the calls to hasPixmap
actually mean "hasNonPartialPixmap"

BUGS: 418086
2020-03-02 21:06:03 +00:00
Kevin Slagle af99a04431 Use screen size when deciding if tile manager should be used 2020-03-01 09:32:27 +00:00
Albert Astals Cid 3720833be4 Enable clazy qstring-allocations 2020-02-21 17:45:03 +01:00
Albert Astals Cid dcf8f79481 Enable clazy isempty-vs-count and qhash-with-char-pointer-key 2020-02-21 17:09:46 +01:00
Albert Astals Cid 46d1ba0e20 Enable clazy missing-qobject-macro 2020-02-21 17:09:46 +01:00
Albert Astals Cid 6d0d61c2ad Enable clazy copyable-polymorphic 2020-02-21 17:09:43 +01:00
Albert Astals Cid 93540ac16d Enable most of clazy level2 2020-02-21 14:57:48 +01:00
Albert Astals Cid 968e9d6073 Enable clazy old-style-connect 2020-02-20 15:48:08 +01:00
Albert Astals Cid 91bce4a0a3 Enable clazy const-signal-or-slot 2020-02-20 12:42:23 +01:00
Albert Astals Cid e03943fae9 Enable clazy qstring-lef 2020-02-20 12:03:31 +01:00
Albert Astals Cid 95e19450c9 Enable clazy fully-qualified-moc-types 2020-02-20 10:59:54 +01:00
Albert Astals Cid 3b4dd35c9f Enable clazy lambda-in-connect 2020-02-20 10:57:47 +01:00
Albert Astals Cid eddbe03128 enable clazy strict-iterators 2020-02-20 10:15:24 +01:00
Albert Astals Cid 468f4b64c2 CI: Enable clazy inefficient-qlist-soft 2020-02-19 23:44:41 +01:00
Albert Astals Cid e2a1705703 CI: Enable clazy connect-not-normalized 2020-02-19 23:44:41 +01:00
Albert Astals Cid 3af705b3d7 CI: Enable clazy qdeleteall 2020-02-19 23:44:41 +01:00
Albert Astals Cid a23709b097 CI: Enable clazy range-loop 2020-02-19 23:44:41 +01:00
Albert Astals Cid 82d5810493 CI: Enable clazy detaching-temporary 2020-02-19 23:44:41 +01:00
Albert Astals Cid 6ddb7e6cc9 CI: Enable clazy qhash-namespace 2020-02-19 23:44:41 +01:00
Albert Astals Cid 96f00a4d29 CI: Enable clazy qstring-arg check 2020-02-19 23:44:37 +01:00
Yuri Chornoivan 5c6a297feb Fix minor EBN issues 2020-02-13 11:47:51 +02:00
Harri Porten c1afa356c0 Restrict time given for JavaScript evaluation to max. 2 seconds.
Possible improvement: alert the user of the timeout and offer
the option to continue or abort execution.
2020-02-11 22:34:46 +00:00
Albert Astals Cid 99b4f276e1 Clear m_openError before opening 2020-02-11 00:27:46 +01:00
Albert Astals Cid 18873d18a2 Document the since for Document::openError 2020-02-11 00:25:04 +01:00
Albert Astals Cid 987abf54d7 Move the private slot to a lambda
This way we don't need a private function in a public class
2020-02-11 00:25:00 +01:00
Andi Sardina Ramos c549d28f7f Solving the creation of an additional tab for a deleted file.
BUG: 412978
BUG: 412979
2020-02-10 23:22:06 +00:00
l10n daemon script a26dd5118a SVN_SILENT made messages (.desktop file) - always resolve ours
In case of conflict in i18n, keep the version of the branch "ours"
To resolve a particular conflict, "git checkout --ours path/to/file.desktop"
2020-02-04 10:04:28 +01:00
l10n daemon script 0d5bd0bc43 SVN_SILENT made messages (.desktop file) - always resolve ours
In case of conflict in i18n, keep the version of the branch "ours"
To resolve a particular conflict, "git checkout --ours path/to/file.desktop"
2020-02-04 06:09:17 +01:00
Albert Astals Cid b82682037e Merge remote-tracking branch 'origin/release/19.12' 2020-01-31 10:22:59 +01:00
Tobias Deiminger 378e99d719 Fix race condition in generator.cpp
The check whether to allocate a new QMutex was unprotected.
Two threads may check and allocate concurrently, but only one pointer gets
remembered, the other one will leak. In worst case the returned
mutex is different for two threads, so that two threads try to
synchronize by using two different mutexes.
2020-01-30 09:42:17 +01:00
Tobias Deiminger 593803b0a1 Fix render stop and high load due to timing issue
Text generation is connected to pixmap generation thread started signal.
However the signal may have been emitted faster than the connect could took place,
and because started is fired only once, the connected lambda never got executed.

generatePixmap tried to sync up with that never happening text generation anyway
by means of scheduling itself. This lead to a infinite loop via a no more sleeping QEventLoop.

Fixed by moving the connect in front of starting the thread.

BUG: 396137
BUG: 396087
CCBUG: 403643
2020-01-30 09:15:40 +01:00
Ahmad Samir 4a4456abd7 Port QRegExp to QRegularExpression in a couple of locations
Some instances of QRegExp are still left:
generators/mobipocket and generators/epub
2020-01-26 11:40:33 +00:00
Albert Astals Cid 2da1cd736a CI: Enable clang-tidy modernize-loop-convert 2020-01-24 17:23:39 +01:00
Laurent Montel 932cec415e Don't use nullptr as flags 2020-01-16 07:15:34 +01:00
Albert Astals Cid 2e46cf22f5 CI: enable clang tidy performance checks 2020-01-02 14:27:11 +01:00
Albert Astals Cid b001ea2019 CI: Enable a bunch of bugprone- clang-tidy warnings 2019-12-24 10:18:16 +00:00
Albert Astals Cid c81392a71c Remove wrong forward declarations
They are not needed and clang-tidy says they are on the wrong namespace
anyway
2019-12-23 13:15:57 +01:00
Albert Astals Cid 0a2287be19 CI: Enable two readability clang-tidy checks
Use jq to filter compile_commands.json to not include the compilation of
autogenerated files, we don't want to check those

Also filter out the synctex folder, since that is imported code
2019-12-23 12:06:49 +01:00
Albert Astals Cid c549acaab0 Move the Q_PRIVATE_SLOTS to lambda connections
Some of the invokeMethods with a queued connection get changed with a
QTimer::SingleShot with 0 which has the same behaviour
2019-12-20 16:42:58 +01:00
Albert Astals Cid 78cf6bd910 CI: enable more modernize checks
Since unfortunately some of the autogenerated includes don't pass the
checks we do a trick of building out of source and then specifying the
.*/okular/.* path as the only includes we care about
2019-12-18 12:51:13 +01:00
Albert Astals Cid a2ac42b9c7 CI: Enable modernize-use-bool-literals 2019-12-18 11:32:46 +01:00
Ahmad Samir ccf3a384c3 [core/*] replace foreach, deprecated, with range-for
The code compiles and okular seems to load and work as before, all unit
tests pass except (parttest and epubgeneratortest, but they fail on master
too).
2019-12-09 13:16:55 +00:00
Albert Astals Cid b588989dba Make AnnotationPrivate::distanceSqr const 2019-12-03 23:24:21 +00:00
Abby Berkers c56a924ab4 Add TeXiFy IDEA support 2019-11-30 01:02:03 +00:00
l10n daemon script 2d90b6210c SVN_SILENT made messages (.desktop file) - always resolve ours
In case of conflict in i18n, keep the version of the branch "ours"
To resolve a particular conflict, "git checkout --ours path/to/file.desktop"
2019-11-03 05:15:02 +01:00
Yuri Chornoivan 793d06c95d Fix minor issues found by EBN 2019-10-14 12:13:33 +03:00
Albert Astals Cid da21543a50 Small performance improvements 2019-10-05 22:16:43 +02:00
Christoph Cullmann 34476a6301 merge 19.08 fixes to master 2019-10-04 20:22:30 +02:00
Oliver Sander 8611cd775a Add @since markers for the new ViewCapability values 2019-10-02 13:00:57 +00:00
Felix Mauch bd25d17e70 Save view information per file
Adds the functionality to save the view mode (single page, facing...),
continuous scrolling, and margin trimming  to the document information,
as it is already done with the zoom information.
2019-10-02 13:00:57 +00:00
Laurent Montel 8beef33c05 Port some deprecated methods 2019-09-18 13:41:19 +02:00
Laurent Montel db0f477119 Port deprecated QLayout::setMargin 2019-09-18 13:35:04 +02:00
João Netto f31eb3cb68 Created private functions to avoid duplicated code in Document 2019-08-22 22:38:10 +00:00
João Netto 17814fc304 Implemented validate actions and made formwidgets leave these actions to QLineEdit::Event 2019-08-22 22:38:10 +00:00
João Netto 3081358836 Added support for Form Focus Events 2019-08-22 22:38:10 +00:00
Tobias Deiminger b5b273ad64 Enhance bounds check in TextDocumentGenerator
There's too much upstream / logic involved to statically prove
info.pages is always >= 0. Better check it at runtime.

CCBUG: 410844
2019-08-22 09:17:33 +02:00
João Netto 3eb6a91e25 Changed util.printd to use the default locale on case 2. Also made kjsfunctionstest to be in a consistent locale 2019-08-15 13:21:04 -03:00
João Netto 24fc9defe3 Changed AFTime_Format to work with user locale PM strings 2019-08-14 21:49:04 +00:00
João Netto f54d65ca86 Changed util.printd to work with the default locale set on QLocale::setDefault to allow consistent results in tests 2019-08-14 21:49:04 +00:00
João Netto e7b7f9bd48 Fixed wrong version in description of function 2019-08-14 20:37:11 +00:00
João Netto c7432cdae6 Implemented support for AFSpecial_Format and AFSpecial_Keystroke 2019-08-12 12:47:56 -03:00
João Netto 052662d78d Implemented support for AFTime_Format and AFTime_Keystroke 2019-08-12 11:13:03 -03:00
l10n daemon script b16dcf41aa SVN_SILENT made messages (.desktop file) - always resolve ours
In case of conflict in i18n, keep the version of the branch "ours"
To resolve a particular conflict, "git checkout --ours path/to/file.desktop"
2019-08-12 08:33:06 +02:00
l10n daemon script bf7a53d62b SVN_SILENT made messages (.desktop file) - always resolve ours
In case of conflict in i18n, keep the version of the branch "ours"
To resolve a particular conflict, "git checkout --ours path/to/file.desktop"
2019-08-12 05:10:27 +02:00
João Netto 6975c67a62 Changed nomenclature and add format action now sets the AP stream text 2019-08-11 14:55:21 +00:00
João Netto 53a8acf813 Removed the use of internalText(), replacing by text() 2019-08-11 14:55:21 +00:00
João Netto b66df68452 Implemented support for setAppearanceText defined on Poppler 2019-08-11 14:55:21 +00:00
João Netto b7249ce8c1 Implemented support for keystroke actions 2019-08-11 14:55:21 +00:00
Andre Heinecke da487f3a94 Add support for form text formatting
Summary:
With formatting there is an internal value, which represents
the true value of a field additionaly to the normal,
visible, text.

For fields which have formatting rules these might differ
and for calculations the internal value is used. The behavior
to format on focus in / focus out events is similar to
that of Acrobat reader.

Test Plan: Needs unit test

Reviewers: aacid

Subscribers: okular-devel

Tags: #okular

Maniphest Tasks: T8886

Differential Revision: https://phabricator.kde.org/D13171
2019-08-11 14:55:19 +00:00
Jan Grulich a738c98c20 Add information about substituting font into properties dialog
Reviewers: aacid

Subscribers: pino, ngraham, okular-devel

Tags: #okular

Differential Revision: https://phabricator.kde.org/D23027
2019-08-10 02:00:57 +02:00
João Netto f9e6b3e6e6 Extended util.printd support to cover new formats 2019-08-08 21:31:12 +00:00
João Netto 56e52eaf3d Support app.alert and util.printd 2019-08-08 21:31:12 +00:00
João Netto bb6bee53fe Added support for the full name of fields, which is used in the JavaScript 2019-08-07 22:40:50 +00:00
David Hurka 0602576cc5 Improve documentation of area classes
Summary:
This shall improve the documentation of several area classes,
including NormalizedPoint, NormalizedRect, RegularArea, RegularAreaRect.

This shall also clarify when absolute coordinates and when normalized
coordinates are used.

Describes the normalized coordinate system in NormalizedPoint, with a new term “reference area” do describe mapping.

TODO:
Page view rotation.
This is not done consistently in Okular, but can be changed later. I think this documentation will help (me) with that then.

Test Plan: Run doxygen

Reviewers: #okular, aacid

Reviewed By: #okular, aacid

Subscribers: aacid, okular-devel

Tags: #okular

Differential Revision: https://phabricator.kde.org/D21266
2019-07-21 20:00:10 +02:00
David Hurka c61a9587ec Improve documentation of TextEntity stuff
Summary:
This adds some important documentation on TextEntity and other classes, and improves some of the existing documentation.

This includes changing parameter names from ‘rect’ to ‘area’, because I found ‘rect’ misleading.

Test Plan: Run doxygen

Reviewers: #okular, aacid

Reviewed By: #okular, aacid

Subscribers: aacid, yurchor, okular-devel

Tags: #okular

Differential Revision: https://phabricator.kde.org/D21271
2019-07-21 10:49:51 +02:00
João Netto 60ff2f414e Fixed indentation, bad algebra and moved display enum to KJSDisplay 2019-07-20 12:06:42 +02:00
João Netto da01333817 Fixed the KJSPrototype pointers and deleted unused arguments. 2019-07-20 12:06:13 +02:00
João Netto ad858267d1 Implemented display support and updated dependencies to Poppler > 0.79
Moved executeScript to document private and support to display options for JavaScript
2019-07-20 12:06:12 +02:00
João Netto 552e4a3917 Added support for buttonSetIcon and buttonGetIcon.
Added support for the setIcon/getIcon defined in Poppler > 0_78
2019-07-20 12:05:37 +02:00
João Netto 7555212d29 Implemented the getOCGs and OCGs methods to support layer changing by JavaScript.
Implemented more unit tests to cover the OCGs
2019-07-20 12:04:59 +02:00