Commit graph

1987 commits

Author SHA1 Message Date
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
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
Yuri Chornoivan e7ead0d3f5 Fix EBN issues 2019-07-14 10:15:45 +03:00
Albert Astals Cid ec51b2f02f Remove QFontDatabase::supportsThreadedFontRendering checks
We require Qt 5.8 and there (and up) it returns true unconditionally and
it's now marked as deprecated
2019-07-04 00:09:04 +02:00
Albert Astals Cid f1ba0d297f Merge remote-tracking branch 'origin/Applications/19.04' 2019-07-03 00:19:08 +02:00
Dr. David Alan Gilbert f4a883ea5d Partial fix for high res displays
Summary:
On high res displays we end up using
the tile manager on single pages, that doesn't work
(for reasons that aren't yet clear) - but it
doesn't make sense if we most of the page anyway.

BUG: 401339

Reviewers: #okular, aacid

Subscribers: okular-devel

Tags: #okular

Differential Revision: https://phabricator.kde.org/D20882
2019-06-22 16:43:20 +02:00
Alexander Volkov 3311ba3a67 Use lambdas instead of QSignalMapper
Reviewers: #okular, aacid

Reviewed By: #okular, aacid

Subscribers: okular-devel

Tags: #okular

Differential Revision: https://phabricator.kde.org/D17481
2019-06-10 14:07:55 +03:00
Laurent Montel 563c8b3465 Fix spectre genrator after my clean forward 2019-06-04 07:12:42 +02:00
Laurent Montel 9f90e14dd1 Fix forward declaration 2019-06-03 08:48:32 +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
David Hurka 9791d25916 Improve documentation of Document::setPageTextSelection()
Summary:
Improve the documentation of Document::setPageTextSelection()
and PagePrivate::setTextSelections(). Also mention which argument
will be deleted.

Test Plan: Check doxygen output

Reviewers: #okular, aacid

Reviewed By: #okular, aacid

Subscribers: okular-devel

Tags: #okular

Differential Revision: https://phabricator.kde.org/D21069
2019-05-09 10:50:18 +02:00
Michael Weghorn 748884b4c7 PDF: Implement scaling options for non-rasterized printing
Summary:
This adds another 'FilePrinter::printFile' method that
accepts an additional parameter to specify whether or not to
do scaling and passes the 'fit-to-page' to CUPS dependent
on what is specified.

If FilePrinter is used, The PDF generator now passes this
option depending on the scaling mode that was selected in the
custom print options widget, which is therefore now enabled
for non-rasterized printing as well.

Test Plan:
1) open a PDF document in Okular and open the print dialog
2) go to the "PDF Options" tab
3) verify that "Force rasterisation" is disabled, but the
  "Scale mode" combobox is active.
4) test all the three options available in the "Scale mode"
   combobox do what they say
5) Make sure the three options still work as expected for
   the "Force rasterisation" case.

Reviewers: #okular, ngraham, sander

Reviewed By: ngraham

Subscribers: aacid, fvogt, okular-devel

Tags: #okular

Differential Revision: https://phabricator.kde.org/D18179
2019-04-14 21:11:36 -06:00
Michael Weghorn 8bf1a91175 Add option to ignore print margins for non-PDF generators
Summary:
This adds a combobox in the print dialog of the non-PDF
generators to allow selecting whether or not to take
print margins into account.

For the PDF case and rasterized printing, new print otions have
been implemented in commit 2e97d58750
already, which adds an additional option to do no scaling at all.

For consistency reasons, the same terms also used for the PDF
case are used in the combobox (i.e. the two of the three that
apply).

This adds a new abstract class 'PrintOptionsWidget' with a
'ignorePrintMargins()' method to indicate whether print margins
should be ignored or not, and a default implementation.
The existing widget for the PDF generator now derives from this
class.

In order to avoid an ABI breakage, the return value of
'Document::printConfigurationWidget' is left as a 'QWidget *'
and a dynamic_cast is done on use.

FilePrinter is adapted to take into account the value set by
'QPrinter::setFullPage()' and the margin options
are now passed accordingly (either the values set in the dialog or '0').

A big thanks to Albert Astals Cid <aacid@kde.org> for showing how
to extend the initial implementation to cover more generators.

Test Plan:
1) Open a PostScript file in Okular (using a document size that matches
  a paper size available on the printer used later makes it easier
  to see things behave as expected)

2) open print dialog, go to "Print options" and notice that there is a new
  "Scale mode" combobox whose value is set to "Fit to printable area"
   by default.

3) don't change any options, print to a printer that has hardware margins

Expected result: the document is scaled to the printable area (e.g.
scaled down so that the printer's hardware margins remain empty) as it
has been without this change.

4) Set the value of the "Print Options" -> "Scale mode" combobox to
   "Fit to full page" and print again

Expected result: The document is scaled to the full page size, i.e. ignoring
the printer's hardware margins.

5) Try steps 1-4 with other document formats supported by Okular and
   observe that they behave the same (except for the PDF case, where
   there's a combobox with three options that has been implemented
   independent of this change).

Reviewers: #okular, ngraham

Reviewed By: ngraham

Subscribers: fvogt, rkflx, arthurpeters, ltoscano, okular-devel, aacid, ngraham

Tags: #okular

Differential Revision: https://phabricator.kde.org/D10974
2019-04-03 08:00:35 -06:00
Albert Astals Cid fe0c8ad7c9 MarkDown: Enable option to disable smartypants formatting
BUGS: 404616

Subscribers: okular-devel

Tags: #okular

Differential Revision: https://phabricator.kde.org/D19405
2019-03-30 23:51:00 +01:00
Laurent Montel 5a3a49c310 Port qSort to std::sort 2019-03-12 13:13:53 +01:00
Yuri Chornoivan 2b6e75e411 Add TeXstudio support
Summary:
Some people need it because it is now the default TeX editor in distributions.

BUG: 404120

Test Plan: "Settings -> Configure Okular... -> Editor -> TeXstudio". Should work for the reverse search if the tex file is compiled with \usepackage[active]{srcltx}

Reviewers: #okular, ngraham

Reviewed By: ngraham

Subscribers: ngraham, okular-devel, kde-doc-english

Tags: #okular, #documentation

Differential Revision: https://phabricator.kde.org/D19272
2019-02-24 22:22:00 +02:00
Joao Netto 716b234100 Implemented find function from console
Summary:
Implemented feature request to find from console.

BUG: 362038

Reviewers: #okular, aacid

Reviewed By: #okular, aacid

Subscribers: ngraham, aacid, yurchor, okular-devel

Tags: #okular

Differential Revision: https://phabricator.kde.org/D18144
2019-02-13 23:59:52 +01:00
Yuri Chornoivan 3832a6522f Update Okular developer documentation
Differential Revision: https://phabricator.kde.org/D17801
2019-02-07 08:13:11 +02:00
Albert Astals Cid 014b97fd96 Include cmath for std::floor 2019-01-29 00:04:25 +01:00
Albert Astals Cid 27b76ee7c0 TextDocumentGenerator: Support links that span more than one line
Summary:
If a link spans more than one line we need one rect for each of the lines

BUGS: 403247

Subscribers: okular-devel

Tags: #okular

Differential Revision: https://phabricator.kde.org/D18303
2019-01-28 22:09:30 +01:00
Albert Astals Cid 5cce9a11fe Small refactor in TextDocumentGeneratorPrivate
add const to a few variables

Make two functions return a qlist instead of using a member qlist to
return the results in them
2019-01-16 19:29:52 +01:00
Yuri Chornoivan 614f580b79 Fix minor typos 2019-01-11 09:09:34 +02:00
Chinmoy Ranjan Pradhan a234a902dc Implement digital signature support for PDF
This is a squash of the original branch

It also contains fixes/rework from Albert Astals Cid

If you're interested in its history have a look at the
gsoc2018_digitalsignature branch

The poppler dependency situation is:
 * With 0.51 you get most signature information
 * With 0.68 you also get signature location/reason information
 * With 0.73 you also get signature certificate information
2019-01-10 23:13:54 +01:00
Albert Astals Cid ab96e0c07d Remove support for RegularArea template to have ptr as first typename
We don't use it and it had problems if you tried to use the copy
constructor or the assignment operator so better just remove it.

I'm unusure if this is binary incompatible, but oh well
2019-01-10 00:58:12 +01:00
Albert Astals Cid 4fb7582093 Obey rule-of-three in NormalizedPoint and NormalizedRect
I.e. make sure they have destructor, copy constructor and asignment
operator

They don't really need them since it's plain data that can be copied
with the defaul implementations (which is actually what i am using) but
since we had some of them implemented and some not, clazy was
complaining that this is generally a bad idea, so implement them all
2019-01-10 00:44:41 +01: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 7254c1826c K_PLUGIN_FACTORY_WITH_JSON -> K_PLUGIN_CLASS_WITH_JSON
Now that we require KF5 5.44
2019-01-07 00:56:08 +01:00
Albert Astals Cid a4a1978516 Merge remote-tracking branch 'origin/Applications/18.12' 2018-12-18 22:49:46 +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 6102c65d6e Minor fixes to API docs 2018-11-20 19:43:11 +02:00
Yuri Chornoivan 5478b2ec92 Fix minor typos 2018-11-14 21:12:15 +02:00
Albert Astals Cid ec692e459b Remove unused variables 2018-11-02 18:03:26 +01:00
Yuri Chornoivan e7cd4bf9c7 Fix doxygen markup 2018-10-27 10:43:35 +03:00
Albert Astals Cid 93b9615597 Remove #ifdef for Qt 5.8 since it is required for some time 2018-10-26 23:45:00 +02:00
Albert Astals Cid 9b96848720 Merge remote-tracking branch 'origin/Applications/18.08' 2018-10-21 22:27:16 +02:00
Albert Astals Cid 27197b5f76 Fix crash if processing a link closes the document
BUGS: 400104
2018-10-21 22:25:47 +02:00
Yuri Chornoivan 69c7b834d1 Fix minor API docs EBN issues 2018-10-19 09:00:06 +03:00
Yuri Chornoivan 2f014ccd20 Fix minor EBN issues 2018-10-18 22:04:49 +03:00
l10n daemon script 4e9bbfddb0 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"
2018-10-10 06:37:12 +02:00
Albert Astals Cid a482c56ba2 Select current format on the configure backend dialog
Subscribers: sander, okular-devel

Tags: #okular

Differential Revision: https://phabricator.kde.org/D14820
2018-10-08 22:54:03 +02:00
Dileep Sankhla e44ff38706 Support setting text color for typewriter annotations
Summary:
Changing typewriter text color can be done in the typewriter properties dialog, or programmatically via new okular API methods TextAnnotation::textColor and TextAnnotation::setTextColor.

poppler >= 0.69 is required to store text color natively inside PDF documents. For other document types, text color is stored as metadata inside the document archive.

This work was done during GSoC 2018. See https://community.kde.org/GSoC/2018/StatusReports/DileepSankhla for details.

Test Plan:
- properties dialog of typewriter annotation has "Font Color" picker
- saving to PDF results in <r> <g> <b> rg operation in /DA
- saving to archive results in fontColor="rrggbb" attribute in metadata.xml

Reviewers: sander

Reviewed By: sander

Subscribers: kde-doc-english, sander, okular-devel

Tags: #okular, #documentation

Differential Revision: https://phabricator.kde.org/D15205
2018-10-04 20:02:55 +02:00
Albert Astals Cid 3cdb348d1e Merge remote-tracking branch 'origin/Applications/18.08' 2018-10-02 21:30:37 +02:00
Albert Astals Cid ee5b830ced Fine tune opening of archives after last change
Since openDocument will do MatchContent if the mime passed fails, we
need to do matchExtension here
2018-10-02 21:29:48 +02:00
Albert Astals Cid 3a1a037dd3 Merge remote-tracking branch 'origin/Applications/18.08' 2018-10-02 01:35:14 +02:00
Albert Astals Cid caf52d0ed9 Fine tune opening files
If we're going to set triedMimeFromFileContent to true we need to
actually try the contents and not the extension.

This is a KF5 porting mistake
2018-10-02 00:33:58 +02:00
Tobias Deiminger 0128f33f43 Fix isNull check for RegularArea
Summary:
First check in RegularArea::isNull sais this: "I'm a QList. If I'm empty, I'm not null". That doesn't make sense, invert it.

The next check says: "If I contain at least one shape which is not null, I'm not null.". That makes sense, keep it.

Test Plan: - check for regression in callers (TextPage::findText, TextPage::text, TextPage::words)

Reviewers: aacid

Reviewed By: aacid

Subscribers: okular-devel

Tags: #okular

Differential Revision: https://phabricator.kde.org/D15344
2018-09-08 22:30:26 +02:00
Dileep Sankhla d61cef693d Store all annotation color attributes as ARGB string
Summary:
This is mainly preparation for D15204 (typewriter), where storing RGB won't be sufficient any longer.
Typewriter will need transparent background (alpha=0x00), which can only be expressed as ARGB string.

Current code handles name format identical for all annotations. It doesn't hurt to store all annotations in ARGB format, so instead of introducing special handling for typewriter, let's store all annotation color attributes as ARGB string.

Note: In case of previously existing okularpartrc, configuration will be reused without conversion. New color format will be written when new settings are saved. This has no bad effect.

Test Plan:
- when [Reviews] section in okularpartrc is initially generated, all annotation color attributes are in #AARRGGBB format
- saving into archive stores color with alpha channel (#AARRGGBB), for all kind of annotations

Reviewers: sander

Reviewed By: sander

Subscribers: dileepsankhla, sander, okular-devel

Tags: #okular

Differential Revision: https://phabricator.kde.org/D15279
2018-09-07 18:33:16 +02:00
Albert Astals Cid 21836ba072 Merge remote-tracking branch 'origin/Applications/18.08' 2018-09-03 21:15:52 +02:00
Albert Astals Cid 8ff7abc14d Fix path traversal issue when extracting an .okular file
Summary:
With specially crafted .okular files you can trick okular to create temporary files outside the temporary folder

We fix that by making sure the file doesn't have folders since the ones we create don't

BUGS: 398096

Subscribers: okular-devel

Tags: #okular

Differential Revision: https://phabricator.kde.org/D15192
2018-09-03 21:14:50 +02: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
Albert Astals Cid 6a37055351 Merge remote-tracking branch 'origin/Applications/18.08' 2018-08-27 01:09:44 +02:00
Yuri Chornoivan c7722c4078 Fix minor EBN issues 2018-08-17 21:05:01 +03:00
Albert Astals Cid 9ba8dd2cd7 Make sure sorting in the configure backends is always the same
The sorting is not the best, but at least it's always the same now :D
2018-08-14 10:37:30 +02:00
Albert Astals Cid 4f06f742f9 Fix properties dialog path not being correct on Save As
We need to clear DocumentInfo because otherwise it is cached and refers
to the old file

BUGS: 397039
2018-08-09 00:27:42 +02:00
l10n daemon script d85fe1df64 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"
2018-08-04 07:49:58 +02:00
Albert Astals Cid 6d3837e6f4 Merge remote-tracking branch 'origin/Applications/18.04' 2018-07-10 00:51:34 +02:00
Albert Astals Cid 14dc396cdb Do not crash on right-click on TOC item with no associated page
BUGS: 396326
2018-07-10 00:49:08 +02:00
Albert Astals Cid 66b5f9c83c Merge remote-tracking branch 'origin/Applications/18.04' 2018-05-30 10:57:00 +02:00
Albert Astals Cid 95bc29a76f Force release of free memory
This should not be needed, but i can totally reproduce that without it
top is still reporting lots of memory used by Okular when it's really
not (heaptrack reports memory freed correctly)

BUGS: 394834
2018-05-30 10:55:17 +02:00
Andre Heinecke 18d404c3ee Support additional widget actions in PDF Forms
Summary:
This adds support for actions associated with form fields
through corresponding annotation widgets.

Test Plan:
Still needs a unit test, only tested manually with
the document attached in the task.

Reviewers: #okular, aacid

Reviewed By: #okular, aacid

Subscribers: okular-devel, aacid

Tags: #okular

Maniphest Tasks: T8627

Differential Revision: https://phabricator.kde.org/D12665
2018-05-30 10:04:21 +02:00
Andre Heinecke 3ae2ae06e8 Fix recalculating forms twice
Summary:
As a side effect of f0a80a67 a recalculation was triggered
by the notifyFormChanges called in EditFormTextCommand::redo,
which is called for each edit. So calculation was done twice.

Test Plan: The calculate forms test still passes.

Reviewers: aacid

Subscribers: okular-devel

Tags: #okular

Differential Revision: https://phabricator.kde.org/D12825
2018-05-28 16:03:54 +02:00
Aleix Pol ac53737242 Remove dup'ed comment 2018-05-13 17:56:05 +02:00
Aleix Pol cf4bb5e3b1 Android: Make it possible to associate with files
Summary:
Put the file into a file descriptor and open this file descriptor.
Just application/pdf for now.

Test Plan: opened some documents on my phone

Reviewers: #okular, aacid, mart

Reviewed By: mart

Subscribers: okular-devel

Tags: #okular

Differential Revision: https://phabricator.kde.org/D12770
2018-05-11 19:27:13 +02:00
Albert Astals Cid 3a060a1680 Delete old actions when setting new
Noone should be calling this twice, but there's no need to leak memory if they do
2018-04-30 14:03:22 +02:00
Andre Heinecke 1de0f5465b Add support for chained / next actions
Summary:
This adds support for multiple actions following each
other through the "Next" value of Action dictionaries.

Test Plan: Activates the corresponding part of the visibilitytest.

Reviewers: #okular

Subscribers: sander, aacid

Tags: #okular

Maniphest Tasks: T8278

Differential Revision: https://phabricator.kde.org/D11609
2018-04-30 14:02:49 +02: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
Albert Astals Cid 47836646d7 Merge remote-tracking branch 'origin/Applications/18.04' 2018-04-17 00:39:32 +02:00
Ahmad Osama 6a2ed4f314 [Okular] Bug 387282: Highlighting of search results lost when rotating page
Summary:
The highlights were removed when rotating the page, also the RotaionJob::rotationMatrix function was not rotating the Highlihgts correctly.
I removed the deletion and modified the rotaionMatrix function by making it shorter and adding a translation after the rotatin. I tried different rotations and they are working fine.
BUG: 387282

Reviewers: #okular

Subscribers: aacid, ngraham, #okular

Tags: #okular

Differential Revision: https://phabricator.kde.org/D11901
2018-04-17 00:39:02 +02:00
Aleix Pol c325b342f3 Make some frameworks optional so okular can be built on Android
Summary:
Disables KWallet integration if there's no KWallet, KJS if there's no
KJS and KDocTools.
Here's a list of frameworks that don't work on Android:
https://cgit.kde.org/sysadmin/ci-tooling.git/tree/local-metadata/project-ignore-rules.yaml

Test Plan: Still works locally, ran Okular and Okular Mobile on Android.

Reviewers: #okular, aacid

Subscribers: aacid

Tags: #okular

Differential Revision: https://phabricator.kde.org/D12177
2018-04-16 22:41:19 +02:00
Albert Astals Cid d3c89a1505 Cancel request when removing an observer
There's no need to continue generating something that won't be useful.
Also fixes a crash if the request would report partial updates since at that stage it uses the observer and that is gone
2018-04-06 11:19:23 +02:00
Albert Astals Cid 21f2c91010 Fix crash when changing pages fast on presentation mode
The crash would happen because we were setting partial updates to true on requests
that were synchronous, because that sync request was cancelling an async one (prerender)
so now we only set newRequest partial updates to true when cancellingm another one if it's asynchronous

And a sync but with partial updates request would make stuff crash because the request
would all be processed on the main thread but generator_pdf.cpp cakks signalPartialPixmapRequest
with a queued connection so we that function was called the request would have already gone
2018-04-02 21:13:27 +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 f0a80a675f Recalculate forms after command form changes
Summary:
notifyFormChanged is called by documentcommands when
Form fields are changed. E.g. by Undo / Redo.
We need to recalculate after such changes.

Test Plan:
Tested with simple_calculate example.

Run the unit test with the added line commented out and it failed, with the added line it passes.

Reviewers: #okular

Subscribers: aacid, ltoscano

Tags: #okular

Maniphest Tasks: T7805

Differential Revision: https://phabricator.kde.org/D10547
2018-02-22 00:13:25 +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
Sergio Bragin 54c741844b Fix realDpi function for Mac
Summary:
Removes old Utils::realDpi function for Mac. The old code employs functions
CGDisplayCurrentMode and CGDisplayIOServicePort, which are deprecated as
of versions 10.6 and 10.9, respectively. Now Mac uses the same code, as
Linux does, since it works out of the box.

This commit automatically fixes the long-standing bug of having an
implementation of realDpiX() and realDpiY(), which are not declared in
the utils.h file.

Reviewers: #okular, rjvbb

Reviewed By: rjvbb

Subscribers: rjvbb, cullmann, aacid, kde-mac, ltoscano, #okular

Tags: #okular

Differential Revision: https://phabricator.kde.org/D10415
2018-02-18 19:24:19 +01:00
Albert Astals Cid 739b591e25 Merge remote-tracking branch 'origin/Applications/17.12' 2018-02-15 10:14:45 +01:00
Albert Astals Cid e8d9feed70 Fix potential crash in document saving
Probably doesn't happen very often since most of the times people don't save while rendering is still happening
but if that is the case we need to wait for all the rendering to finish otherwise we remove the document
from under the render thread feet and bad things happen
2018-02-14 17:51:01 +01:00
Andre Heinecke 9f458a54cf Fix regression in refreshPixmaps 2018-02-10 00:37:19 +01:00
Albert Astals Cid 2d8b2c7e95 Add support for cancellable image rendering and text extraction
Summary:
Only supported by the pdf backend if using poppler >= 0.63

Sadly had to change the generator API

Text cancellation is a bit wobbly still since poppler has large parts
of the code where doesn't check for the cancellation flag, but that
is something that will get automagically fixed for us if the poppler
side is improved

Test Plan: Needs https://bugs.freedesktop.org/show_bug.cgi?id=104263

Reviewers: ervin, rkflx

Reviewed By: ervin, rkflx

Subscribers: #okular

Tags: #okular

Differential Revision: https://phabricator.kde.org/D9328
2018-02-01 22:53:28 +01:00
Albert Astals Cid 5acb6d06f0 Merge remote-tracking branch 'origin/Applications/17.12' 2018-01-31 11:18:53 +01:00
Albert Astals Cid acd3c81e23 Fix regression due to more QTemporaryFile behaviour changes
Make sure we call fileName because otherwise things break
2018-01-31 11:18:09 +01:00
Laurent Montel 85a91c1bb7 Fix i18n usage 2018-01-29 13:19:45 +01:00
Michel Ludwig 6b259d7000 Use Windows ANSI versions of the PathFind... methods
Differential Revision: https://phabricator.kde.org/D9937
2018-01-19 21:23:02 +01:00
Albert Astals Cid 4fc203076b Code simplification
No need to use d->m_loadedGenerators to find the generator since we already have m_generator
2017-12-14 14:33:18 +01:00
Albert Astals Cid 4e6c9f8f7a Fix crash when accessing text page after save
text page was storing a pointer to a PagePrivate pointer but those die
after saving so we need to store a Page pointer since those are stable.

BUGS: 387247
2017-12-05 23:07:10 +01:00
Henrik Fehlauer dccd83783d Prevent Okular from crashing when synctex logs an error
bd20e48c3c updated Okular's copy of the synctex code to 1.19.
Unfortunately since this version the upstream code logs errors like
`"! SyncTeX Error : Ignored record...` when accessing selected synctex
files created with older versions of synctex.

The upstream `_synctex_log` contains `va_list arg` as a parameter, but
fails to initialize and tear down this properly via `va_start` and
`va_end`. In general this seems to work for the single argument case.
However, once we apply our hardening patch to get rid of the
`gnu_printf format attribute` warning and thus introduce a variadic
argument, things go wrong.

To fix this, we add the missing code. The remaining changes are just
refreshing the patches.

BUG: 383915

Test Plan:
Opening `empty.pdf` with `empty.synctex.gz` from
https://bugs.kde.org/attachment.cgi?id=109116 located
in the same folder does not lead to Okular segfaulting anymore.
2017-11-30 14:57:05 +01:00
Henrik Fehlauer b6573a2713 Change whitespace in synctex patches
15-prevent-leaks-and-segfault.diff did not apply cleanly with quilt.
After fixing this, some of the other patches needed a refresh.
2017-11-30 12:45:58 +01:00
Albert Astals Cid 9c352ca67c Workaround to build with older Qt
As explained in the comment we can do with using an older Qt since what this adds is really a small nicety in a corner case
2017-11-16 15:35:50 +01:00
Albert Astals Cid 3957683d76 Merge branch 'dont-use-docdata-for-annots-and-forms' into Applications/17.12 2017-11-16 15:00:23 +01:00
Albert Astals Cid 19b7e3c112 The work in this branch was sponsored by LiMux
give them some credit in the headers
2017-11-16 09:58:31 +01:00
Albert Astals Cid e29892fda4 some review tweaks 2017-11-15 11:20:25 +01:00
Albert Astals Cid 2102843273 Use the undo stack to set the modified bit
This way it's much easier to track whether we are modified or not
2017-11-14 14:52:02 +01:00
Albert Astals Cid 8e80a4f570 Account for Okular::PagePrivate::findEquivalentForm failing
It should never fail but it's better if we have the backup for not crashing at least if it does
2017-11-14 09:57:38 +01:00
Albert Astals Cid 302c38672f Make Document::swapBackingFileArchive use swapBackingFile 2017-11-14 09:49:32 +01:00
Albert Astals Cid eea5127e73 We also support opening Okular archive files 2017-11-13 17:30:54 +01:00
Albert Astals Cid a2f5560c00 PDF: Support the poppler 0.62 renderToImage with update callback
Summary:
This way pages that take more than 500ms to render get updated every so often so that the
user can see that the program didn't hang, it's just that it's taking long to render

Tags:
incremental rendering, partial updates

BUGS: 344081

Subscribers: #okular

Tags: #okular

Differential Revision: https://phabricator.kde.org/D8379
2017-11-09 17:28:54 +01:00
Albert Astals Cid d2d7a880b1 Minor style adjustment 2017-11-06 09:28:04 +01:00
Albert Astals Cid 099d3cfcc8 Update @since to 1.3
Let's see if we can squeeze it in
2017-11-06 06:10:13 +01:00
Albert Astals Cid 0da737a92b Merge remote-tracking branch 'origin/master' into dont-use-docdata-for-annots-and-forms 2017-11-03 10:03:00 +01:00
Albert Astals Cid 8944660ce7 Unbreak the code, need to register the metatype too ^_^ 2017-11-02 23:41:12 +01:00
Albert Astals Cid c2c1d76a0f Merge remote-tracking branch 'origin/Applications/17.08' 2017-11-02 17:50:02 +01:00
Albert Astals Cid 662fa69a2d Fix crash on rotation jobs
We don't need to delete the threadweaver job, threadweaver does it by itself,
and if we call deleteLater it may happen that the main thread deletes it
and then when the threadweaver thread tries to call the delete things are
gone and it goes kaboom

BUGS: 382725
2017-11-02 17:49:08 +01:00
Albert Astals Cid 453f45e7f7 Start the text generation request via a queued connection
Summary:
so that pixmap generation gets a chance to start before the text generation

This makes that on files where both the text generation and the pixmap generation
are slow at least we see something "as fast as possible" since only either text generation
or pixmap generation threads run at the same time

Reviewers: #okular, mlaurent

Reviewed By: mlaurent

Subscribers: michaelweghorn, dvratil, mlaurent, #okular

Tags: #okular

Differential Revision: https://phabricator.kde.org/D8378
2017-10-31 10:04:03 +01:00
Albert Astals Cid cd24ad31c8 Implement missing todo in Document::swapBackingFileArchive
And extend tests to include archive files
2017-10-30 17:01:46 +01:00
Albert Astals Cid 0cb4ff7dad Fix copy&paste mistake 2017-10-26 21:09:21 +02:00
Albert Astals Cid ca5422d0e9 Implement swapBackingFile for the PDF backend
How does it work:
 * What it does is really closing and opening the file again through poppler
 * This means that things that are generated in "open" time like Page, Rects, Annotations, Forms need to be updated
	* For Page what we do is swap the PagePrivate so that other classes that hold Page* don't break
		* Since some parts of the PagePrivate can be reused, we move them in PagePrivate::adoptGeneratedContents
	* For all the commands in the undo stack we need to update the annotations/forms it refers to, added a new function to do that
	* The annotationmodel needs updating it's pointers
	* The widgets for the forms are reused and their form* updated
	* the widgets for the videos are recreased since videos don't really hold much content (you lose the playing status on save but i think that's acceptable)

TODO: Make this work for .okular files
TODO: For files with password we will need to reload the file, asking for the password again and thus losing the undo stack, warn the user
TODO: autotests
2017-10-26 15:30:44 +02:00
Albert Astals Cid 8690497be7 Add Page::annotation
Will use it later
2017-10-25 15:21:46 +02:00
Albert Astals Cid 54bcb44559 Merge remote-tracking branch 'origin/master' into dont-use-docdata-for-annots-and-forms 2017-10-23 16:03:18 +02:00
Lukas Hetzenecker ecc1141e02 HiDPI Support for Okular
Summary:
This patch enables HiDPI throughout the application

Every pixmap is multiplied by the devicePixelRatioF
QPainter code is ajusted to take the DPR value into account

All pixmaps get cached with the highest DPR of all screens. When moving the application to another screen, the cache doesn't have to be invalidated.

BUGS: 362856 383589
REVIEW: D6268
2017-10-14 14:47:20 +02:00
Albert Astals Cid a93661e892 Merge remote-tracking branch 'origin/master' into dont-use-docdata-for-annots-and-forms 2017-09-27 15:01:57 +02:00
Albert Astals Cid ef7c9c67bf Implement continuous search
Show non-intrusive info messages whenever the search start over from the
beginning or the bottom of the document, instead of asking the user if
s/he wants to continue the search. This is consistent with search in
KWrite/Kate and with web browsers.

Based on work of and reviewed by Elvis Angelaccio
2017-09-26 23:27:25 +02:00
l10n daemon script 62ce3db93b 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"
2017-09-16 05:03:07 +02:00
Henrik Fehlauer bd20e48c3c Update to synctex 1.19
Summary:
This should prevent crashes when reloading some synctex-enabled pdf
files created with newer versions of TeXLive. We also gain bugfixes,
features and improved accuracy from the last 6 years of synctex
development.

Procedure followed:
- svn co svn://tug.org/texlive/trunk/Build/source/texk/web2c/synctexdir
- Check out revision 45150
- Update files present in core/synctex/*
- Adapt Okular code to changes
- Review and drop or update/apply old patches using quilt
- Create missing patches for local synctex changes
- New patch: Omit warning message when opening non-synctex pdf
- Two new patches to fix more compiler warnings
- New patch: Plug multiple leaks and prevent a segfault

TODO for later:
- Move sync file detection code to Okular to never call into synctex C code for non-synctex files
- Evaluate feasibility of upstreaming all patches for TeXLive 2018 and using synctex as a library

BUG: 383915
FIXED-IN: 17.12.0

Test Plan:
- No crash in synctex on reloading empty.pdf from bugreport anymore.
- Shift-clicking on a word in a simple pdf opens Kate with the corresponding tex line.
- Forward and backward search in Kile seems to work.
- Works with synctex files from both TeXLive 2015 and 2017.
- PartTest::testForwardPDF still passes.
- No additional memory leaks in autotests and with basic synctex and non-synctex usage of Okular.

Reviewers: #okular, sander, #kile, aacid

Reviewed By: #okular, aacid

Subscribers: mludwig, aacid

Tags: #okular

Differential Revision: https://phabricator.kde.org/D7594
2017-09-12 21:56:49 +02:00
Albert Astals Cid 04ed10d3ea Merge remote-tracking branch 'origin/master' into dont-use-docdata-for-annots-and-forms 2017-09-11 19:51:51 +02:00
Kevin Funk a53a2402ca clang-tidy: modernize-use-nullptr run
Semi-ACK'd by Albert :)
2017-09-06 00:19:48 +02:00
Albert Astals Cid a8a79368c7 Fix memory leak in text document settings d-pointers 2017-08-27 13:19:16 +02:00
Albert Astals Cid 0eb2f227b0 Fix memory leak in text document settings d-pointers 2017-08-27 13:18:31 +02:00
Albert Astals Cid afd3a1423a Make it clear that the caller to convert takes ownership 2017-08-25 01:17:31 +02:00
Albert Astals Cid 0919ad87d1 Fix width and height being switched when printing Custom size
BUGS: 383734
2017-08-21 00:09:27 +02:00
Albert Astals Cid fd5cc83e85 Fix warning in newer gcc versions 2017-07-27 16:57:40 +02:00
Oliver Sander 5fdbecf446 Simplify method FilePrinter::psPaperSize
The method FilePrinter::psPaperSize used to contain a long
list of hard-coded paper sizes for the different paper formats.
This patch makes the method get the same information
from QPrinter directly, which is much simpler and more
robust, too.

Note that the method is not actually used anywhere in okular,
though, so this change is purely cosmetic.

REVIEW: 130043
2017-07-05 20:37:36 +02:00
Tobias Deiminger 0957abc39a Add annotation resize functionality
Usage:
If you left-click an annotation, it gets selected. Resize handles appear on the selection rectangle. When cursor is moved over one of the 8 resize handles on the corners/edges, the cursor shape changes to indicate resize mode. Everywhere else on the annotation means "move", just as it was before resize feature was added. Pressing ESC or clicking an area outside the annotation cancels a selection. Pressing Del deletes a selected annotation.

Feature is only applicable for annotation types AText, AStamp and AGeom.

Implementation:
It works by eventually changing AnnotationPrivate::m_boundary and notifying generator (i.e. poppler) about that change. Annotation state handling is shifted out of PageView into a new class MouseAnnotation (ui/pageviewmouseannotation.cpp). Some functionality not related to resizing but to annotation interaction in general is also shifted to class MouseAnnotation, to build a single place of responsiblity.

Other changes:
Add method Document::adjustPageAnnotation, backed by a QUndoCommand.
class Okular::AdjustAnnotationCommand.
Add Annotation::adjust and Annotation::canBeResized methods.
Draw resize handles in PagePainter::paintCroppedPageOnPainter.

Resize and move work
-for types AText, AStamp and AGeom
-on all pages of document
-when viewport position changes
-when zoom level changes
-for all page rotations (0°, 90°, 180°, 270°)

Selection is canceled
-when currently selected annotation is deleted
-on mouse click outside of currently selected annotation
-ESC is pressed

Viewport is shifted when mouse cursor during move/resize comes close to viewport border.
Resize to negative is prevented.
Tiny annotations are still selectable.
If mouse is moved over an annotation type that we can focus, and the annotation is not yet focused, mouse cursor shape changes to arrow.
If mouse cursor rests over an annotation A, while annotation B is focused, a tooltip for annotation A is shown.
Selected Annotation is deleted when Del is pressed.

Test for regressions:
-Annotation interaction (focus, move, resize, start playback, ...) are only done in mode EnumMouseMode::Browse.
-If mouse is moved over an annotation type where we can start an action, mouse cursor shape changes to pointing hand.
-If mouse is moved over an annotation type that we can't interact with, mouse cursor shape stays a open hand.
-If mouse cursor rests over an annotation of any type, a tooltip for that annotation is shown.
-Grab/move scroll area (on left click + mouse move) is prevented, if mouse is over focused annotation, or over AMovie/AScreen/AFileAttachment annotation.
-A double click on a annotation starts the "annotator".

REVIEW: 127366
BUG: 177778
BUG: 314843
BUG: 358060
2017-03-19 23:18:17 +01:00
Albert Astals Cid 4573c7a646 Recalculate forms after other are edited
BUGS: 376958
2017-03-03 01:08:44 +01:00
Albert Astals Cid cfc158977f Add the additional action to form 2017-03-03 00:41:06 +01:00
Albert Astals Cid 56bcdad680 Refresh the pixmap of the page that contains the field when setting its text 2017-03-03 00:36:08 +01:00
Albert Astals Cid 2ca1779feb Add a way to get the PagePrivate if you have the Page 2017-03-03 00:32:08 +01:00
Albert Astals Cid 1d2dd42c67 no need for & here 2017-03-02 22:45:45 +01:00
Albert Astals Cid 19be15b6a5 Field readOnly applies to the user but not to JS 2017-03-02 22:38:29 +01:00
Albert Astals Cid 519f0acac7 document which variant kind is returned 2017-03-02 22:23:41 +01:00
Albert Astals Cid ec70995895 QString as key is evil, add a nice enum 2017-03-02 21:04:59 +01:00
Albert Astals Cid 191a37fb52 Q_DECL_OVERRIDE -> override 2017-03-02 20:39:24 +01:00
Albert Astals Cid 4072eb0c3a Add override 2017-03-02 20:38:50 +01:00
Albert Astals Cid b50aff3ed7 Q_NULLPTR -> nullptr 2017-03-02 20:09:32 +01:00