It is more logical to have the drawing tools first, then the eraser,
and then the action to delete everything. Also the two actions to erase
things are close to each other now.
The icon of "erase drawing" has been changed to draw-eraser-delete-objects
to distinguish it from the "Eraser" tool.
BUG: 399734
Differential Revision: https://phabricator.kde.org/D16171
For some reason Qt started sending mouse move events after all wheel
events so only reset the delta when the mouse move event represents an
actual move
Summary:
This diff unifies the calculation of the viewport position from a given DocumentViewport. PageView::notifyViewportChanged and PageView::slotRelayoutPages used to handle it differntly, which resulted in viewport jumps for no reason.
It happened in various situations, e.g. when jumping to a page using the footer page navigation, or when reloading the document after presentation mode left, or when resizing the main window after presentation mode left.
The diff selects the notifyViewportChanged way (align viewport top border with page top margin) as golden behavior in case of rePos.enabled == false.
BUGS: 357958
CCBUG: 341939
CCBUG: 400890
341939 and 400890 are fixed partially. These two still suffer from a minor displacement that happens when finished signal arrives from pixmap generation thread.
Test Plan:
- When using the footer page navigation to jump to different pages, new page top is always algined with viewport top.
- After changing page with footer page navigation, press F5 to reload. Page top stays aligned with viewport top.
- When exiting presentation mode, and touching the file, page top stays aligned with viewport top.
- When exiting presentation mode, and changing main window size, page top stays aligned with viewport top.
Reviewers: #okular, sander
Reviewed By: sander
Subscribers: ngraham, sander, aacid, okular-devel
Tags: #okular
Differential Revision: https://phabricator.kde.org/D16941
Summary:
This patch implements a "Zoom to 100%" action and sticks it in the {nav View} menu. Since it's a `KStandardAction` with a `KStandardShortcut`, we automatically get the correct icon and keyboard shortcut, but we do override the name to be "Zoom to 100%" since that's clearer for Okular's use case.
FEATURE: 400048
FIXED-IN: 18.12.0
Test Plan:
- Action works to zoom the document to 100% scale when invoked
- Action is disabled when document is opened at 100% scale or is manually zoomed to 100% scale after being opened
- All other zoom modes and action still work
{F6341045}
Reviewers: #okular, #vdg, abetts
Reviewed By: #vdg, abetts
Subscribers: davidhurka, sander, tobiasdeiminger, veqz, abetts, aacid, okular-devel
Tags: #okular
Differential Revision: https://phabricator.kde.org/D16345
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
Summary:
Typewriter is originally specified by the PDF reference as special FreeText annotation, where Intent=FreeTextTypewriter. It features opaque letters on transparent background, so that users can fill non interactive forms. Herewith typewriter is implemented natively for PDF, and there's also an Okular specific implementation for other document types. The added tool reuses the inline note UI.
This work was done during GSoC 2018. See https://community.kde.org/GSoC/2018/StatusReports/DileepSankhla for details.
FEATURE: 353401
Test Plan:
- okularpartrc is generated (if not yet existing) with typewriter as 10th tool
- typewriter tool is also available in Annotation Tools -> Add, Typ "Typewriter"
- selecting the tool and left click into document opens inline note input dialog
- finishing creates an annotation similar to inline note, but with transparent background
- saving into PDF results in /Subtype FreeText /IT /FreeTextTypeWriter
- saving typewriter into archive stores color with alpha channel = 0x00
- opening annotated archive works, if archive was created with old Okular, and opened in patched Okular
- opening annotated archive works, if archive was created with patched Okular, and opened in old Okular
Reviewers: sander
Reviewed By: sander
Subscribers: ngraham, sander, okular-devel
Tags: #okular
Differential Revision: https://phabricator.kde.org/D15204
Summary:
We request a inhibit lock of DBus type UNIX_FD from systemd logind. It's wrapped into (and owned by) a QDBusUnixFileDescriptor object of automatic storage. The file descriptor will be closed in QDBusUnixFileDescriptor Dtor, and may be reused by some other facility (e.g. pulseaudio).
If we want to store the lock longer than QDBusUnixFileDescriptor lifetime, we have to dup the file descriptor. If we don't dup, and close the original fd later in PresentationWidget::allowPowerManagement, bad things may happen.
Besides that, what we get from systemd is really a file descriptor, not a "cookie". So I renamed the m_sleepInhibitCookie to m_sleepInhibitFd and changed initial state to -1 accordingly.
BUG 393478
BUG 398720
Test Plan:
- bugs don't occur any longer
- inhibiting sleep during presentation mode still works
Reviewers: aacid
Reviewed By: aacid
Subscribers: ngraham, anthonyfieroni, okular-devel
Tags: #okular
Differential Revision: https://phabricator.kde.org/D15574
- Use a QPixmap object instead of a QPixmap*
Quote from the QPixmap documentation:
"QPixmap objects can be passed around by value
since the QPixmap class uses implicit data sharing."
- Replace another pointer by std::unique_ptr
Differential Revision: https://phabricator.kde.org/D15301
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
Previously, these tooltips were only shown in "Browse mode".
This patch adds them for "Selection", "Text selection", and
"Trim selection" as well. These are the modes where the cursor
changes to a hand when hovering over a link.
BUG: 397783
Differential Revision: https://phabricator.kde.org/D15123
Large specifications with many (nested) sections are painful to navigate
through when the TOC is expanded by default. Introduce four new options,
"Expand/Collapse whole section" is based on Kate's document view while
"Expand/Collapse all" was added to handle the top-level sections.
As for other viewers, PDF.js uses shift-click to handle the former while
using double-click on a the TOC icon to handle the latter. That is not
very obvious, so extending the context menu seems the next best option.
BUG: 216870
Differential Revision: https://phabricator.kde.org/D14904
Summary:
When save/save as functions are called they internally call the openFile() function, in the open file function the side bar item is set to Table of Contents (ToC) item
```
if ( m_document->metaData( QStringLiteral("OpenTOC") ).toBool() && m_sidebar->isItemEnabled( m_toc ) && !m_sidebar->isCollapsed() && m_sidebar->currentItem() != m_toc )
{
m_sidebar->setCurrentItem( m_toc, Sidebar::DoNotUncollapseIfCollapsed );
}
```
so I just store the sidebar's item before saving and then set this item back if changed.
BUG: 389668
Reviewers: #okular
Subscribers: aacid, okular-devel
Tags: #okular
Differential Revision: https://phabricator.kde.org/D14740
This fixes the same crash as bug 393334 but in a better way
the old way was setting a variable on destruction and then trying
to use that variable in a slot, but that's obviously wrong since
we were already mid destructing the object.
BUG: 396807
Summary:
This exposes the Okular's functionality of changing the document's colors
through its d-bus interface. This is mainly useful for scripting Okular to
switch to a 'day mode' or 'night mode'.
[Example] Switching themes of two applications with one hotkey:
{F5905771}
Reviewers: #okular, aacid
Reviewed By: #okular, aacid
Subscribers: okular-devel
Tags: #okular
Differential Revision: https://phabricator.kde.org/D13471
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
Summary:
BUG: 355043
Makes it easier to distinguish search results from text with a 'highlight' annotation.
Reviewers: #okular
Subscribers: okular-devel, simgunz, cfeck, aacid, ngraham
Tags: #okular
Differential Revision: https://phabricator.kde.org/D7662
Summary:
Mark the annotations that contain a non-empty popup. Especially useful to identify annotations that are not meant to contain an annotation as shapes or highlights.
BUG: 389836
Reviewers: #okular, aacid
Reviewed By: #okular, aacid
Subscribers: rkflx, aacid, ngraham
Tags: #okular
Differential Revision: https://phabricator.kde.org/D10797
Summary:
in drawPixmap(source, sourceRect) the source rect is in native pixels.
In this code the size was scaled by the DPR, but the location was not.
blendRect is the contents of a selection rectangle, offset from the
bounding darker blue rectangle. Hence we haven't really noticed.
This completely fixes the rectangle when the scale == 2.0/3.0
Some smaller artifacts remain on fractional scale factors, which is a
separate code bug with the same symptoms.
CCBUG: 386111
Reviewers: aacid, rkflx
Reviewed By: rkflx
Subscribers: sander, rkflx, anthonyfieroni, #okular
Tags: #okular
Differential Revision: https://phabricator.kde.org/D8980
Summary:
Seems like someone forgot to consistently apply a change. Maybe the path
construction should be factored into a reusable lambda?
Test Plan:
Open Okular, open settings > configure Okular. Without the patch, you'll get a
"QFSFileEngine::open: No file name specified" warning, with the patch it
disappears. Note that there is also an unrelated "Illegal icon group: 7"
warning from KIconThemes, but I'm 99% certain that this is on KIconThemes doing
a bogus check in KIconEffect::apply, not on Okular
Reviewers: #okular, hetzenecker, aacid
Reviewed By: #okular, aacid
Subscribers: aacid, #okular
Tags: #okular
Differential Revision: https://phabricator.kde.org/D12001
This fix smells a lot like a workaround for a bug in Qt but i could not
write down a sufficiently small testcase for it to report it to Qt, and
this is not wrong anyway since we eventually add playerPage to a
layout for this. What I tracked down was that since playerPage had no
parent, at some point a nativeId for it was being created and that
broke sizing back to the default 100x30 used in Qt instead of the
size we had given it.
For some reason i needed a PDF file with more than one video to
reproduce this problem, the first video was correctly sized but the
second one was 100x30.
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
Summary:
The FormWidgetInterface now has a generic slotRefresh that
refreshes what all widgets have in common. This is the read-only state for now.
Reviewers: #okular
Tags: #okular
Maniphest Tasks: T8097
Differential Revision: https://phabricator.kde.org/D10866
Summary:
This is more of a cleanup patch that removes the obsolete m_canBeEnabled
member variable which was a leftover IMO from a time where readOnly fields were
shown as disabled. readOnly fields are invisible, not disabled, and the code no longer assumes that
readOnly does not change over time.
Test Plan: Tested manually and with a unittest which is part of the series.
Reviewers: #okular
Subscribers: aacid
Tags: #okular
Maniphest Tasks: T8097
Differential Revision: https://phabricator.kde.org/D10865
Summary:
BUG: 388228
Diff applies to Applications/17.12, and should be easy to merge to master. It's kept quite minimal as suggested by Albert.
Albert also suggested to add a dedicated unit test and I'd agree, but am not yet sure how to do it. The original bug involves several classes, including UI: Document, Page, AddAnnotationCommand, PageView, PageViewAnnotator, MouseAnnotation - to name a few. So a test for the exact bug scenario would become a bigger integration test rather than an isolated unit test. The other approach would be to do a real unit test on MouseAnnotation. But again, MouseAnnotation has nasty dependencies (e.g., needs a parent PageView) which I'd have to mock. Any ideas? I'd be interested in a discussion on this topic.
Test Plan:
# Load a document (e.g. [[ http://www.philipebert.info/resources/WhatMathematicalKnowledgeCouldNotBe.pdf | linked PDF from bug report ]]) and enable highlight toolbar (F6).
# Create highlight annotation.
# Move the view port so that the annotation position is right beside the highlight tool icon.
# Move the mouse over the annotation, and then horizontally left until you reach the tool icon; it's important to stay over the highlight annotation as long as in viewport.
# Press ctrl-z for undo.
# Click on highlight tool, move right into the document, create new highlight annotation.
# Okular doesn't crash.
Reviewers: #okular
Subscribers: aacid, ngraham
Tags: #okular
Differential Revision: https://phabricator.kde.org/D9852
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
Summary:
When hovering the mouse over the X symbol to close a note the cursor remains the same of the current shape (hand, selection cursor) based on the tool selected.
This patch morphe the cursor to the standard arrow over the X symbol to close a note by adding setCursor() call in the CloseButton constructor
BUG: 384381
Test Plan:
1. Open okular and select Tools -> Review or press F6 to create a new pop-up note
2. Hover the mouse cursor over the close button (X) of the pop-up note window
3. You will see the standard arrow instead of the current tool based cursor.
Screenshot below (the tooltip saying "Close this note" was not captured by Spectacle application)
{F5685539}
Reviewers: #okular, ngraham
Reviewed By: ngraham
Subscribers: ngraham, #okular
Tags: #okular
Differential Revision: https://phabricator.kde.org/D10209
Summary:
When hovering the mouse over the X symbol to close a note the cursor remains the same of the current shape (hand, selection cursor) based on the tool selected.
This patch morphe the cursor to the standard arrow over the X symbol to close a note by adding setCursor() call in the CloseButton constructor
BUG: 384381
Test Plan:
1. Open okular and select Tools -> Review or press F6 to create a new pop-up note
2. Hover the mouse cursor over the close button (X) of the pop-up note window
3. You will see the standard arrow instead of the current tool based cursor.
Screenshot below (the tooltip saying "Close this note" was not captured by Spectacle application)
{F5685539}
Reviewers: #okular, ngraham
Reviewed By: ngraham
Subscribers: ngraham, #okular
Tags: #okular
Differential Revision: https://phabricator.kde.org/D10209
Summary:
pixelValue/pixelValue will give us a normalised value.
Normalised values shouldn't be modified by a device pixel ratio.
We want scaledRect not dScaledRect.
BUG: 386110
Test Plan:
Searched for text. Zoomed in, panned about
Created annotations, they still seemed to work
Subscribers: #okular
Tags: #okular
Differential Revision: https://phabricator.kde.org/D8832
Summary:
pixelValue/pixelValue will give us a normalised value.
Normalised values shouldn't be modified by a device pixel ratio.
We want scaledRect not dScaledRect.
BUG: 386110
Test Plan:
Searched for text. Zoomed in, panned about
Created annotations, they still seemed to work
Subscribers: #okular
Tags: #okular
Differential Revision: https://phabricator.kde.org/D8832
Summary:
FEATURE: 355283
The principle is simple. This patch enables overriding the default columns for Overview mode, if the document is small. For example, if document has 1 or 2 pages and the default columns in Okular settings is 3, Overview mode will enable 1 or 2 columns for better UX
Reviewers: #okular, rkflx, ngraham
Reviewed By: rkflx, ngraham
Subscribers: ltoscano, aacid, rkflx, ngraham
Tags: #okular
Differential Revision: https://phabricator.kde.org/D8385
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
Just use m_ff and cast it when needed.
This will make it easy in the future when the given form for a widget may change so we only need to update one value