Commit graph

74 commits

Author SHA1 Message Date
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
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
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
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
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
Albert Astals Cid 3720833be4 Enable clazy qstring-allocations 2020-02-21 17:45:03 +01:00
Albert Astals Cid 93540ac16d Enable most of clazy level2 2020-02-21 14:57:48 +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 2da1cd736a CI: Enable clang-tidy modernize-loop-convert 2020-01-24 17:23:39 +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
Yuri Chornoivan 793d06c95d Fix minor issues found by EBN 2019-10-14 12:13:33 +03:00
Laurent Montel db0f477119 Port deprecated QLayout::setMargin 2019-09-18 13:35:04 +02: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
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 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
João Netto 53a8acf813 Removed the use of internalText(), replacing by text() 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
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
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
João Netto cc10164d34 Implemented initial support for animatedPDF
When refreshing, widgets must check if they should be visible

Implemented unit tests to the JavaScript functions.
2019-07-20 12:04:45 +02:00
Laurent Montel cb691f70dc Fix some clazy warning
Summary: fix clazy warning

Reviewers: aacid

Reviewed By: aacid

Subscribers: nicolasfella, okular-devel

Tags: #okular

Differential Revision: https://phabricator.kde.org/D20832
2019-05-27 08:02:57 +02:00
Albert Astals Cid 47d7d04b5e delete copy constructor and assignment operator of some internal classes
they are unused(except the PageViewItem one), but if anyone would use
them things would go wrong, so protect us from it

Actually fixes a bug in PageView::slotFitWindowToPage in which we were
copying constructing PageViewItem and that's bad
2019-01-10 00:28:49 +01:00
Albert Astals Cid ba5ec662a2 Fix crash when writing to some forms
typo type typeo :D

BUGS: 402307
2018-12-18 22:48:04 +01:00
Yuri Chornoivan 39b6e8147d Fix minor EBN issues 2018-09-01 11:25:57 +03:00
Yuri Chornoivan c04ca1fa96 Fix minor EBN issues 2018-08-31 12:23:45 +03:00
Andre Heinecke bf90867c13 Add support for dynamic visibility
Summary:
This adds the hidden property to JavaScript fields and
uses it to implement support for HideAction.

Test Plan: Unit test in the next commit.

Reviewers: #okular

Subscribers: aacid

Tags: #okular

Maniphest Tasks: T8274

Differential Revision: https://phabricator.kde.org/D11596
2018-04-23 23:55:01 +02:00
Andre Heinecke 8ed1d14f8d Fix CheckBox script usage
Summary:
This implements setting / getting the value of buttons,
which is important for checkboxes in scripts. It also moves
the checkbox activate action after the value is set so that
the correct value is used when the activation script is
executed.

Reviewers: #okular

Tags: #okular

Maniphest Tasks: T8097

Differential Revision: https://phabricator.kde.org/D10868
2018-03-20 23:19:29 +01:00
Andre Heinecke 6897e042df Add support to set read only from scripts
Summary:
This makes it possible to set the read only state from
scripts. Requires Poppler master with the patch attached to the parent task.

Reviewers: #okular

Subscribers: aacid

Tags: #okular

Maniphest Tasks: T8097

Differential Revision: https://phabricator.kde.org/D10867
2018-03-20 23:19:29 +01:00
Andre Heinecke cead2bbef3 Add initial support for built-in javascript functs
Summary:
This starts by adding support for AFSimple_Calculate which
is the standard "calculate" function in Adobe Acrobat Pro.

Reviewers: #okular

Subscribers: aacid

Tags: #okular

Maniphest Tasks: T7805

Differential Revision: https://phabricator.kde.org/D10049
2018-02-22 00:12:44 +01:00
Andre Heinecke d50c06df25 Add refresh widgets if underlying field changes
Summary:
If a field is updated because of a calculate form action /
a script execution, not only refresh the rendered pixmap but
also the corresponding formWidget.

Test Plan: Unittest in separate revision. Tested it manually, too.

Reviewers: #okular

Subscribers: aacid

Tags: #okular

Maniphest Tasks: T7805

Differential Revision: https://phabricator.kde.org/D10048
2018-02-22 00:12:34 +01:00
Andre Heinecke d3a549ca25 Add JavaScript Event Object handling
Summary:
This adds a new data object "Event" that can be used
to carry information in and out of JavaScript execution
contexts. The Event Object is defined in the Adobe JavaScript
scripting reference.

The implementation now adds handling for the FieldCalculate
Event. It should be extensible enough so that in the future
more events could be supported.

Reviewers: #okular

Subscribers: aacid

Tags: #okular

Maniphest Tasks: T7805

Differential Revision: https://phabricator.kde.org/D10073
2018-02-22 00:11:20 +01:00
Kevin Funk a53a2402ca clang-tidy: modernize-use-nullptr run
Semi-ACK'd by Albert :)
2017-09-06 00:19:48 +02:00