Commit graph

192 commits

Author SHA1 Message Date
Albert Astals Cid 0584660125 partest: Fix one test interfering with the next
Cleanup settings and docdata in between tests
2021-04-10 08:48:15 +00:00
Gerd Wachsmuth 0a23d4a001 Fix a bug with zoom levels on cropped pages
BUG: 342003

Uses ideas of https://bugs.kde.org/show_bug.cgi?id=342003#c5
2021-04-08 22:27:20 +02:00
Nate Graham 157377b007 Fix multi-document open test failure
Fixes the test failure introduced with
d0b9b138cc.
2021-03-17 16:28:50 -06: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 084631d11e Use more standard cmake functionality to search for discount
Instead of rolling our own, that's harder to understand and buggy anyway

BUGS: 431311
2021-01-24 11:16:49 +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 35590a273d Fix CI
Laurent please use MR like everyone else does, otherwise you break the
build for the rest of us.

CCMAIL: montel@kde.org
2020-12-13 21:59:08 +01:00
Laurent Montel dd1938755e Don't include QtTest as it includes all QtCore includes 2020-12-13 17:51:28 +01:00
Albert Astals Cid 239827baad Rework how we open urls that have a #
Previously if it was a remote url that had # and a . after the # we
assumed the url had no fragment and everything was filename.

We don't do that anymore, what we do now is try to open the url as
parsed, i.e. before the # is the filename after is the fragment, and if
that fails we try to open everything as filename and nothing as
fragment.

Unfortunately given how kpart internals handle opening local vs remote
urls we need to do this in two places.

Also we have to remove the test that checked that the url was mangled at
the shell level because we don't do that anymore. Unfortunately can't
add a test for the new codepage since it would involve starting an http
server ^_^

Filenames:
  source2e.pdf
  foo#bar.pdf

What works:
 * okular http://localhost/source2e.pdf#subsection.68.3
 * okular file:///srv/http/source2e.pdf#subsection.68.3
 * okular source2e.pdf#subsection.68.3 (in the /srv/http folder)
 * okular source2e.pdf#2
 * okular http://localhost/foo#bar.pdf
 * okular file:///srv/http/foo#bar.pdf
 * okular foo#bar.pdf (in the /srv/http folder)

What doesn't work:
 * okular http://localhost/foo#bar.pdf#2

I think it's a fair limitation that if you want to open a file that contains # in the name and also use a # page marker you need to use the encoded url like okular http://localhost/foo%23bar.pdf#2
after all things like firefox will totally fail opening http://localhost/foo#bar.pdf and will just work if you give the encoded url

BUGS: 426976
2020-11-26 10:07:58 +00:00
David Hurka 19d5dd8ec7 New part/ directory for okularpart sources from /, ui/, conf/
Source files are no longer separated by UI and non-UI and similar,
but only by their build target.

* ui/ -> part/
* Move all source files from conf/ to part/
* Keep config skeleton definitions in conf/, needed for the mobile target too
* Move editdrawingtooldialogtest.h from conf/autotests/ to autotests/
* ui/data/icons/ -> icons/
* Move /part.cpp, /part.rc and similar files to part/
* Adapt include paths in source files
* Adapt CMakeLists.txt files (in / and in subdirectories)
* Adapt /Messages.sh
2020-11-18 19:32:56 +00:00
David Hurka 843c43cc6b Fix cursor not updated after clicking internal link
updateCursor() was called by wheelEvent(), which made sense,
because after the wheel event the page will have moved under the cursor.

With smooth scrolling, it makes less sense in wheelEvent(),
because at that point scrolling is still in the future.

scrollContentsBy() appears to be called on every scroll step.
(It is documented to be called at scrollbar value changes, so makes sense.)

This patch removes updateCursor() from wheelEvent(), but adds it to scrollContentsBy().

I did not check anything out with d->visibleItems, as was indicated it graphics/okular!176.

BUG: 421437
2020-10-20 18:52:00 -06:00
Oliver Sander da934a0a0a Make cursor open hand again after clicking on internal link
CCBUG: 421437
2020-10-13 18:35:02 +00:00
Nate Graham c69e8a5b13 Merge branch 'release/20.08' into master 2020-10-13 10:09:36 -06:00
Oliver Sander cc3f2857e0 Add an autotest for bug 421159
Bug 421159 involves a combination of scrolling with the scroll bar
and the mouse wheel.  This patch adds an autotest for the bug,
to make sure it doesn't come back.
2020-09-20 21:27:39 +02:00
Albert Astals Cid 6b08af754f Remove poppler 0.79 ifdefs since we require 0.86 now 2020-09-13 01:20:14 +02:00
Albert Astals Cid 9264723002 Remove poppler 0.73 ifdefs since we require 0.86 now
This actually fixes a mistake in SignatureFormTest::testSignatureForm
2020-09-13 01:16:27 +02:00
Albert Astals Cid 7dce3389cb Remove poppler 0.65 ifdefs since we require 0.86 now 2020-09-13 01:11:08 +02:00
Albert Astals Cid c019a7e76c Remove poppler 0.64 ifdefs since we require 0.86 now 2020-09-13 01:10:10 +02:00
Michael Weghorn b696d6dbfb Support '#page=<pagenum>' fragment to open at page <pagenum>
Support the '#page=<pagenum>' fragment to specify which page
to open the document at, in addition to the existing '#<pagenum>'
syntax.

For PDF, the '#page=<pagenum>' fragment is specified in RFC 8118,
section 3.

BUG: 406831
2020-09-10 13:30:00 +00:00
Albert Astals Cid 4da86fb8de Merge remote-tracking branch 'origin/release/20.08' into master 2020-09-06 12:11:49 +02:00
Simone Gaiarin cd96735ae2 Maintain quick annotation shortcut compatibility with Okular < 1.11.0
During the upgrade to Okular 1.11.0 the shortcuts for the quick annotations have been changed from the keys 1, 2, 3,... to Alt + 1, 2, 3,... making some users unhappy.

CCBUG: 426009
2020-09-06 10:08:19 +00:00
Markus Brenneis 89cf21b222 Add support for image sizes in markdowns
The discount markdown parser supports parsing explicit image sizes in markdown, but we ignore them and replace them with the actual image dimensions. With this patch, any specified image sizes are respected.
2020-08-22 23:32:27 +00:00
Simone Gaiarin 72f5a2db08 Find built-in tool corresponding to quick tool at runtime
In this way it is possible to drop the `sourceId` attribute from the quick tools definition. This simplifies the code logic and makes it easier to update user settings from the previous version of Okular (because there is no need to add the attribute `sourceId`

This also fixes the crash due to the fact that `sourceId` was not correctly created when a quick annotation is created from the Annotation page of Okualr Settings.

BUG: 424810
FIXED-IN: 1.11.0
2020-08-05 22:49:56 +00:00
Simone Gaiarin 00118158b9 Test that 'Quick Annotations' is correctly populated 2020-07-23 20:58:06 +00:00
Simone Gaiarin d31ec70726 Test enabled/disabled state of actions after a config reparsing 2020-07-23 20:58:06 +00:00
Simone Gaiarin 20b298cfd2 Test enabled state of "Quick Annotations" action 2020-07-23 20:58:06 +00: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
Laurent Montel 516fb89d94 Use camelcase include. (scripted) 2020-07-08 13:54:37 +02:00
Simone Gaiarin 0b05d7ce99 Overhaul annotations UX
Create a new new annotation toolbar to replace the current one as discussed in the task T8076.
Fixes:
BUG: 386578
BUG: 374728
BUG: 352310
BUG: 330518
BUG: 341914
BUG: 157289
BUG: 358057
BUG: 412767
BUG: 413595
BUG: 420462
FIXED-IN: 1.11.0

Test Plan
Before testing this revision
Delete or Temporary move aside the following files:

~/.config/okularpartrc
~/.config/okularrc
~/.local/share/kxmlgui5/okular/part.rc
~/.local/share/kxmlgui5/okular/shell.rc

Nomenclature
Actions in the main toolbar:

Quick annotations
Actions in the annotation toolbar:

Annotation actions Highlighter, Underline, Squiggle, Strike out, Typewriter,
Inline note, Popup note, Freehand line, Arrow, Straight line, Rectangle, Ellipse,
Polygon, Stamp

Annotation config actions Line width, Color, Inner color, Opacity, Font, Annotation settings

Other actions Add to Quick Annotations, Pin

Autotests

 First run: annotation toolbar is not visible

 Selecting Tools > Annotations shows the annotation toolbar (below the main toolbar by default)

 Select an annotation > toolbar is shown

 Select a quick annotation > toolbar is shown

 Hide action (red cross) on the toolbar hides the toolbar

 Keys 1-9,0 select the (builtin) Annotation actions (one case tested)

 Keys Alt+1-9,0 select the quick annotation actions (one case tested)

 No annotation action selected: Quick Annotations is enabled, Add to quick annotations is disabled, Annotation config actions are disabled, Pin is enabled

 The current document is an image: Highlighter, Underline, Squiggle, Strike out are disabled (also in Quick annotations)

 The current document is protected: All actions are disabled

 Select annotation: the  Annotation config actions are enabled and their values set to the ones for the current annotation (taken from okularpartrc)

 Click an annotation action when none selected: browse mode is selected

 Click the currently selected annotation action: the action is unchecked and the tool disabled (back to browse mode)

 Click ESC: the currently selected annotation action is unchecked

 If Pin unchecked the selected annotation is unchecked after it has be used once and we are back to Browse mode

 The annotation systems works when multiple Okular tabs are open (the selected annotation is per-tab)

Manual tests

(TODO) Check that kconf_update updates the key AnnotationTools to QuickAnnotationTools in ~/.config/okularpartrc

Color icon is a format-text-color (if inline note or typewriter) or format-stroke-color for all other annotations
All actions have tooltips (some change based on the fact that the icon is enabled or not)
If a custom Line Width or Opacity is set through the Annotation Settings dialog, its value appears as a new checked action in the Line width or Opacity menu
If a custom stamp is selected through the Annotation Settings dialog, its name or filename (without path) appears as a new checked action in the Stamp menu
In Configure Okular > Annotations it is only possible to configure the quick annotations. Modifying them here updates the Quick annotations list after clicking Apply

The current document is an image: Highlighter, Underline, Squiggle, Strike out are disabled in Quick annotations
The state of Pin action is remembered across Okular launches
Selecting a quick action selects the corresponding action and loads its config values (color, line width, ...)
Setting the color and fill color works for all annotations (to be tested carefully, can be problematic for typewriter and inline note given the different internal mechanism to store the color in the settings)
Test stamp annotation (handled differently from the rest of the annotations)

Merge Request: https://invent.kde.org/graphics/okular/-/merge_requests/105
2020-06-04 13:01:31 +00:00
Albert Astals Cid 1a430419a4 Merge remote-tracking branch 'origin/release/20.04' 2020-05-26 23:10:04 +02:00
Albert Astals Cid 040e11c52b Fix ZoomIn getting stuck when on facing pages
We need to use int when calculating colWidth in zoomFactorFitMode since
we also use int when calculating it in PageView::slotRelayoutPages,
otherwise the calculated numbers are veeeeeeery similar but not the same
and the algorithm gets all confused

BUGS: 420824
2020-05-26 00:48:08 +02:00
Oliver Sander 13070218eb Test whether documents that request fullscreen are handled properly 2020-05-16 22:24:43 +00:00
Andi Sardina Ramos d735d50cde Give the option of switching to a tab if the file is already open instead of opening a new tab
Disabled by default

BUG: 419096
2020-04-23 07:39:32 +00:00
Yuri Chornoivan 4d75045cd8 Fix minor EBN issues 2020-04-04 12:17:50 +03: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
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
David Hurka 311cae2abe Create mouse mode menu autotest 2020-03-04 18:58:25 +00:00
Albert Astals Cid 3720833be4 Enable clazy qstring-allocations 2020-02-21 17:45:03 +01:00
Albert Astals Cid 46d1ba0e20 Enable clazy missing-qobject-macro 2020-02-21 17:09:46 +01:00
Albert Astals Cid 968e9d6073 Enable clazy old-style-connect 2020-02-20 15:48:08 +01:00
Albert Astals Cid a9598e83e8 Enable all of clazy level1 2020-02-20 13:35:35 +01:00
Albert Astals Cid edb44b1fd3 Enable clazy connect-3arg-lambda 2020-02-20 12:42:34 +01:00
Albert Astals Cid 93de247795 Enable all of clazy level0 2020-02-20 11:34:47 +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 96f00a4d29 CI: Enable clazy qstring-arg check 2020-02-19 23:44:37 +01:00
Albert Astals Cid 5ecbb51f77 Enable modernize-use-nullptr 2020-02-19 18:10:05 +01:00
Andi Sardina Ramos d9069ef661 The shell and the part need to be independent of each other.
This reverts commit 931425987ab9138bd843e02488dfaa6fa1afd52f.
2020-02-16 23:33:56 +00: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