Commit graph

617 commits

Author SHA1 Message Date
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
Albert Astals Cid
e371292a37 Merge remote-tracking branch 'origin/Applications/17.12' 2017-12-15 00:32:46 +01:00
Albert Astals Cid
9504d91c61 Don't call m_formsMessage->setVisible( true ) on unsetDummyMode
The only reasons to show m_formsMessage are on openFile if we have forms (to show the toggle button) or if we have xfa forms (unsuppported warning)
2017-12-15 00:32:03 +01:00
Nathaniel Graham
da89a035c1 Use a distinct and more appropriate icon for Layers
Summary: BUG: 387424

Test Plan:
Tested in KDE Neon. Before, using Breeze icons:
{F5517757}

After, using Breeze icons:
{F5523390}

Before, using Oxygen icons:
{F5523394}

After, using Oxygen icons:
{F5523395}

Reviewers: aacid, #okular

Reviewed By: aacid, #okular

Subscribers: rkflx

Tags: #okular

Differential Revision: https://phabricator.kde.org/D9043
2017-12-03 09:20:59 -07:00
Albert Astals Cid
559836c392 Give warnings when the file is modified externally
Summary:
Unfortunately, poppler (the only backed that supports saving) is not able
to save properly if the file is modified by a third party while it is opened

So we give the user a warning saying things went wrong and give him the option
to not reload/close, that way if there was something very important in the annotations
she added she can try to save them (even if by copy&paste the contents to a third program)

Reviewers: rkflx

Reviewed By: rkflx

Subscribers: ngraham, rkflx, ltoscano, #okular

Tags: #okular

Differential Revision: https://phabricator.kde.org/D8863
2017-11-20 14:53:17 +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
1420c9411e Save or Discard dialog: show only the file name and not the full url 2017-11-16 12:03: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
481676dced Do not show "Continue" while on Save format warning
It makes no sense, only on Save As makes sense
2017-11-15 14:10:36 +01:00
Albert Astals Cid
37097a0c38 Some text tweaking suggested in the phabricator review 2017-11-15 10:08:20 +01:00
Albert Astals Cid
d7457e3569 Fix double dialog in closing sometimes
sometimes = when you opened a .okular containing a png and an annotation and then saved as to just png

Found by the autotest that stopped passing \o/
2017-11-15 09:46:36 +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
1ed2522b53 tweak can't save in this format warning message with suggestion from Burkhard 2017-11-13 23:23:32 +01:00
Albert Astals Cid
bd724e4944 Get the okular archive mime translation name from kcoreaddons
Instead of asking the translators to translate it again
2017-11-13 18:12:34 +01:00
Albert Astals Cid
34f40b2c6f Tweak migrationMessage text a bit 2017-11-13 15:35:06 +01:00
Albert Astals Cid
210a6ced5a Tweak saveAs + file with password text 2017-11-13 10:37:35 +01:00
Albert Astals Cid
3c99a280f3 Add the file url to the save text
Makes more clear we're going to be saving over it
2017-11-13 10:10:46 +01:00
Elvis Angelaccio
40afb82926 Don't use exec() to open dialogs
Summary:
exec() is blocking and should not be used if possible.

Currently it makes impossible to interact with a 2nd okular window
if the first window has the Properties or Embedded Files dialog open.

It also causes a double delete crash when closing okular via dbus
while either of those dialogs is open.

We can use open() instead which does not block the event loop and fixes
both the problems.

Test Plan:
1. Open the Properties or Embedded Files dialog, then close okular via dbus.
2. Open two okular windows, then open the Properties or Embedded Files dialog in one of them and try to use the other window.

Reviewers: #okular

Tags: #okular

Differential Revision: https://phabricator.kde.org/D8704
2017-11-12 12:17:02 +01:00
Albert Astals Cid
433d1eac23 Initialize copyJob just in case 2017-11-06 10:02:20 +01:00
Albert Astals Cid
9d450161b2 Use new style connects 2017-11-06 10:02:09 +01:00
Albert Astals Cid
c14fbe5eb6 Remove SaveAsDontShowWarning
It was only used in tests as a way to "hide" warning dialogs, now we have a proper way to
close them, this way we make sure that dialogs are should when they should not not when they should not
2017-10-30 11:12:00 +01:00
Albert Astals Cid
8d7ea894f3 make parttest pass again 2017-10-26 21:24:09 +02:00
Albert Astals Cid
147735fc5a set the modified flag when saving a file that doesn't support saving all of the things (e.g. annotations) but supports file swapping
Example, png files.

If you add an annotation and save and choose to lose changes, the annotation will still be around "in okular" but not on the file, so we need to mark the file as modified so that when the user tries to close he will get again the warning of "you're trying to save and will lose data" because otherwise the user may think the annotation actually was saved since he can see it
2017-10-26 19:16:48 +02:00
Albert Astals Cid
b2673a58b1 When saving a file that had password we will reload it
Also tweak error messages a bit
2017-10-26 18:58:34 +02:00
Albert Astals Cid
8b06b0feec Make it clear continue will make you lose changes 2017-10-26 15:47:21 +02:00
Albert Astals Cid
1095ffd85d We always need to swap/reload even if the url is the same
Since our generators are file oriented, saving means a new file was saved so we need to reopen the new one for things to work properly
2017-10-25 15:06:25 +02:00
Albert Astals Cid
ead094862f Fix using && for flags 2017-10-25 15:03:19 +02:00
Albert Astals Cid
5413d38d22 Fix Cltr+S being used both for save and saveas 2017-10-23 16:33:20 +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
Kevin Ottens
a5da013a4d Add a "share" menu to Okular
Summary: This is implemented using the Purpose framework.

BUG: 173896

Reviewers: aacid

Subscribers: #okular

Tags: #okular

Differential Revision: https://phabricator.kde.org/D8244
2017-10-18 16:55:21 +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
Alexey Demennikov
a57ffdbd95 added the "remove this bookmark" to bookmarks section
Summary:
**FEATURE**: 357626
Remove bookmark from popup menu added

Reviewers: #okular, aacid

Reviewed By: #okular, aacid

Subscribers: aacid

Tags: #okular

Differential Revision: https://phabricator.kde.org/D7848
2017-09-16 22:15:54 +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
Julian Wolff
e3747ca3fd Fix automatic reload of files saved with QSaveFile
Summary:
Files saved with QSaveFile don't get dirty. They are deleted and replaced.
Thus, inotify and KDirWatch don't emit a "dirty" signal (which is the correct behaviour).
Listening for the "created" signal of KDirWatch allows us to get notified on replaced files.

BUG: 384185

Test Plan:
Opened a markdown document in Okular.
Edited and saved the document with Kate.
The file is reloaded in Okular as expected.

Reviewers: aacid

Reviewed By: aacid

Subscribers: sander, rkflx, #okular

Tags: #okular

Differential Revision: https://phabricator.kde.org/D7671
2017-09-07 13:18:30 +02:00
Kevin Funk
a53a2402ca clang-tidy: modernize-use-nullptr run
Semi-ACK'd by Albert :)
2017-09-06 00:19:48 +02:00