Commit graph

651 commits

Author SHA1 Message Date
Albert Astals Cid 3720833be4 Enable clazy qstring-allocations 2020-02-21 17:45:03 +01:00
Albert Astals Cid 93540ac16d Enable most of clazy level2 2020-02-21 14:57:48 +01:00
Albert Astals Cid 968e9d6073 Enable clazy old-style-connect 2020-02-20 15:48:08 +01:00
Albert Astals Cid 1a05112be1 CI: enable clazy incorrect-emit 2020-02-19 23:44:41 +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
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
Ahmad Samir 45c72ff0eb Port from deprecated foreach to range-for
autotests/*, conf/* , mobile/* , shell/*, part.cpp, extension.cpp

The code compiles and all unit tests pass (except for the two that
fail on master too).
2019-12-12 22:48:27 +00:00
Nicolas Fella 8d6c16e2a3 Remove unused include 2019-11-17 19:11:18 +00:00
kezi olio 51b90ecd73 Add kinetic scrolling & smooth navigation with cursor keys
This patch adds kinetic / inertial scrolling to ease the use of Okular on touchscreen devices, using Qt's QScroller. I think it's much nicer even for mouse usage.

I left the "mouse cursor wraps when going at the edge of the screen" mechanism intact.

Also, I made it so that there is a nice animation when using the up / down keys to navigate the document, instead of having discrete steps.

FEATURE: 413989

FIXED-IN: 1.10.0
2019-11-15 16:08:25 +00:00
Andy Sardina 4a4a2a1b52 Add "find in this document" to selection context menu
BUG: 408355

FIXED-IN: 1.9.0
2019-09-23 00:10:46 +02:00
Laurent Montel db0f477119 Port deprecated QLayout::setMargin 2019-09-18 13:35:04 +02:00
Nate Graham ea0ea9c93d Add "Open Containing Folder" feature
Summary:
This patch adds an "Open Containing Folder" menu item to the file menu, similar to
other KDE apps like Gwenview that have it there. This action is especially useful
for the case when you've downloaded a PDF from the internet that opens itself in
Okular. The location of this file may not be clear or easy to find without this
feature, and on several occasiona I have found myself wishing for it when this
happens.

Test Plan:
- Delete or move aside `~/.local/config/kxmlgui5/okular/part.rc`
- Menu item is enabled and works when there is an open document: {F6940449, size=full}
- Menu item is disabled when there is no open document: {F6940448, size=full}

Reviewers: #okular, aacid, sander

Reviewed By: #okular, aacid

Subscribers: shubham, davidhurka, okular-devel

Tags: #okular

Differential Revision: https://phabricator.kde.org/D22145
2019-07-17 08:35:09 -06: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
Shubham Jangra f788b5a384 Add action in Edit menu to select the text on current page
BUG: 358868

Test Plan: Click on "Select All Text on Current Page" entry in Edit menu to select the entire page. The selected text can then be copied via Edit menu item "Copy"

Reviewers: aacid, #vdg, ngraham

Reviewed By: #vdg, ngraham

Subscribers: yurchor, michaelweghorn, kde-doc-english, davidhurka, abetts, loh.tar, alexde, ngraham, okular-devel

Tags: #okular, #documentation

Differential Revision: https://phabricator.kde.org/D18744
2019-04-22 01:11:27 +02: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
Laurent Montel d120f2b655 Remove more deprecated method 2019-03-12 13:21:07 +01: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
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
Iñigo Salvador Azurmendi 3ce4e98adb Better wording 2019-01-05 00:01:02 +01:00
Oliver Sander 677fc76760 Fix 'Erase Drawing' tooltip text
Before, it said 'Erase Drawings', which is incorrect, because only
the drawing on the current page is erased.
2018-12-21 19:10:25 +01:00
Simone Gaiarin 1547c78340 Move "erase drawings" action to last position and change its icon
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
2018-12-21 12:44:04 +01:00
Albert Astals Cid c950ea92f5 PDF: Add a "Using Poppler $VERSION" string
It is sometimes useful to know which version of the poppler you're using
and to which you where built

Needs feature introduced in poppler just now
2018-12-19 00:41:37 +01: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
Michel Ludwig 2ea44c5291 Fix KDirWatch problem description in Part::setWatchFileModeEnabled
The problem is actually not the global watch list in KDirWatch, but
KDirWatch::stopScan causes unintended side effects via KDirWatchPrivate::_isStopped.

This bug is tracked in bug report 400541.

CCBUG: 400190
2018-11-01 07:48:32 +01:00
Michel Ludwig dcacd830f4 Don't call 'KDirWatch::stopScan()'
KDirWatch maintains one global watch list per application only. Calling
'stopScan' could therefore affect other code paths that make use of
KDirWatch (other loaded KParts, for example).

BUG: 400190
2018-10-28 17:35:10 +01:00
Albert Astals Cid 00c7aa0ec9 Fix saving to files that don't exist
Previous commit broke it. I'll add unit tests in a minute
2018-10-24 00:32:09 +02:00
Albert Astals Cid 97a25b51d3 Merge remote-tracking branch 'origin/Applications/18.08' 2018-10-22 21:41:34 +02:00
Albert Astals Cid 99fe8fa6cf Resolve symlinks before saving so we don't "break" them
Summary: BUGS: 399870

Reviewers: ngraham

Reviewed By: ngraham

Subscribers: shubham, ngraham, okular-devel

Tags: #okular

Differential Revision: https://phabricator.kde.org/D16364
2018-10-22 21:41:02 +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
Yuri Chornoivan c04ca1fa96 Fix minor EBN issues 2018-08-31 12:23:45 +03:00
Peter Wu 61c2c2cedd TOC: Add collapse/expand options
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
2018-08-26 14:05:26 +02:00
Ahmad Osama 5e622484c8 Fix problem of saving pdf switches from thumbnail view in sidebar to contents view
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
2018-08-13 11:13:00 +02:00
Michael Eden 031b794ec8 Expose 'change colors' through dbus interface
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
2018-06-26 13:05:45 +02:00
Albert Astals Cid 9d64765c21 Use QFile::encodeName instead of toLocal8Bit
It's the same unless you're on Mac, because Mac
2018-04-24 19:45:43 +02:00
Albert Astals Cid b3f8b51b39 Merge remote-tracking branch 'origin/Applications/18.04' 2018-04-23 23:09:19 +02:00
Albert Astals Cid 991eb0ed31 Use toLocal8Bit instead of toUtf8
It's the most "proper" way to do it, i guess in real world scenarios it
doesn't really matter though
2018-04-23 23:08:06 +02:00
Chinmoy Ranjan Pradhan c559268987 Obey umask rules when saving new file
Summary:
Okular saves a new file with permissions 0600 completely ignoring the umask value. This is because it
makes use of QTemporaryFile which creates file with the said permissions and which then Okular copies
to the new location.
So to overcome this generate new file permissions using old mask value and change permissions of the
new file.

BUG: 392682

Test Plan:
Set umask to 0040
Open a pdf file from the same shell and save it under a new name.
Before patch:
file permisions -> 0600
After patch:
file permisions -> 0606

Reviewers: #okular, aacid

Tags: #okular

Differential Revision: https://phabricator.kde.org/D12049
2018-04-23 23:07:19 +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
Aleix Pol aae8baf2d0 Only compile FileKeeper when it's necessary 2018-04-13 17:45:23 +02:00
Aleix Pol c8b0677a25 Remove unneeded dependencies 2018-04-13 17:05:16 +02:00
Albert Astals Cid 88faff5b3c Fix crash in Kile preview mode when enabling fullscreen
Does not make sese to ask the user if he wants to go fullscreen on the
kile preview widget (or the milou preview widget, the other user of this
feature), and besides not making sense, it's crashing :D

BUGS: 390383
2018-04-12 18:40:00 +02:00
Dileep Sankhla 09b7b079ac Option to exit after printing
Summary:
When running okular with the parameter --print to directly open the print mode, it doesn't exit after acknowledging the print dialog. Hence adding --print_and_exit option exits Okular after acknowledging the print dialog and thus is useful for the command line batch processing or a Dolphin service as the issue suggests.

FEATURE: 318998

Test Plan:
1. open a file in Okular using the parameter --print. It will open Okular in print mode with the print dialog
2. Either print the file or cancel the print dialog
3. You will find that Okular stays open
4. Now using this patch, see for available options with the --help parameter. You will find --print_and_exit option
5. Now open a file in Okular using the parameter --print_and_exit. It will open Okular in print mode with the print dialog
6. Either print the file or cancel the print dialog
7. You will find that Okular closes after acknowledging the dialog

Reviewers: aacid, #okular, ngraham

Subscribers: ltoscano, ngraham, aacid, #okular

Tags: #okular

Differential Revision: https://phabricator.kde.org/D10249
2018-03-03 17:36:50 +01:00
Albert Astals Cid de14b2df0c Merge remote-tracking branch 'origin/Applications/17.12' 2018-02-25 11:47:23 +01:00
Julian Wolff d19834f231 Make Part::openUrl not discard OpenUrlArguments
Applications using Okular as a KPart might set a file's mime type in the OpenUrlArguments.
Okular currently clears the arguments while opening a document. This revision fixes this, allowing
applications to actually pass a file's mime type to Okular.

BUG: 386600
2018-02-25 11:46:52 +01:00
Albert Astals Cid 7a182c2594 Merge remote-tracking branch 'origin/Applications/17.12' 2018-02-06 00:32:56 +01:00
Henrik Fehlauer ad1160be1b Fix saving annotations to gzipped files
Okular supports opening zipped files like document.pdf.gz by
transparently extracting them. However, since 559836c392 saving
annotations back was broken. This is because this commit tries to
prevent saving back changes to externally modified files to prevent data
loss. The way this is checked by comparing timestamps mistakenly
triggered for unchanged zipped files, too.

This can be solved by always comparing the before/after timestamps of
the actual file, instead of the timestamp of the temporary copy of the
extracted file. The change has to be done in two places so saving
repeatedly works too.

BUG: 338742

Test plan
    gzip autotests/data/file1.pdf && okular file1.pdf.gz
    Add annotation, saving works now instead of showing an error.
    touch normal.pdf still triggers modification warning.

Differential Revision: https://phabricator.kde.org/D9580
2018-02-06 00:31:36 +01:00
Albert Astals Cid e043d517c5 Merge remote-tracking branch 'origin/Applications/17.12' 2018-01-23 00:40:05 +01:00
Albert Astals Cid 4a80d3f963 Fix crash when exporting
We had a off by one from when we removed the document archive option from the export menu.

BUGS: 389216
2018-01-23 00:37:44 +01:00
Nathaniel Graham e44d505583 Improve dialog when PDF wants to open in presentation mode
Summary:
BUG: 388511

- Describe what's actually going to happen if you answer in the affirmative
- Use expressive button text with standard ok/cancel style icons
- Remove tooltips, since they're not needed when the buttons clearly indicate what will happen when you press them

Test Plan:
New dialog:
{F5626016}

Both buttons still work to do what they say they'll do.

Reviewers: #okular, aacid, rkflx

Reviewed By: rkflx

Subscribers: rkflx

Tags: #okular

Differential Revision: https://phabricator.kde.org/D9692
2018-01-07 11:49:32 -07:00