Bug 354268 - Attached files are open as annotations
Summary: Attached files are open as annotations
Status: RESOLVED FIXED
Alias: None
Product: okular
Classification: Applications
Component: PDF backend (show other bugs)
Version: 0.20.3
Platform: Mageia RPMs Linux
: NOR normal
Target Milestone: ---
Assignee: Okular developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-10-23 17:25 UTC by Denis Bitouzé
Modified: 2015-10-29 08:13 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Here is the PDF file, `bar.pdf', to which the `foo.tex' file is attached. (13.18 KB, application/pdf)
2015-10-27 08:25 UTC, Denis Bitouzé
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Denis Bitouzé 2015-10-23 17:25:44 UTC
Consider the following MWE to be compiled with `pdflatex' that attaches the `foo.tex' file to the PDF:

--8<---------------cut here---------------start------------->8---
\begin{filecontents*}{foo.tex}
\documentclass{article}
\begin{document}
Foo.
\end{document}
\end{filecontents*}
%
\documentclass{article}
\usepackage{xcolor}
\usepackage[color=black]{attachfile2}
\begin{document}
\textattachfile{foo.tex}{Link to `foo.tex'}.
\end{document}
--8<---------------cut here---------------end--------------->8---

The link is supposed to open `foo.tex' but:

1. Okular doesn't consider it as a link (the mouse pointer doesn't change to the finger when you hover above the link).
2. Nevertheless:
- a double (left) click  opens an empty annotation where you expect the attached `foo.tex' file to be open,
- a right click only allows to save the attached `foo.tex' file, not to open it.

By contrast, Adobe Reader and Evince do the expected job: a click on the link open the `foo.tex' file with the default `.tex` editor (Evince having the drawback to open it with a different name: `foo.tex.xxx', where `xxx' is a random string).




 `foo.tex.xxx'
instead, where `xxx' is a random string. The file open has the same
content as `foo.tex' but, because of its strange extension, is not open
as a `.tex' file by the underlying text editor.

Notice that Adobe Reader opens this file with the same name.

Reproducible: Always

Steps to Reproduce:
1. Compile the above file with `pdflatex`.
2. Open the corresponding PDF with Okular.
3. Double click on the text: "Link to ‘foo.tex’".

Actual Results:  
An annotation is open.

Expected Results:  
The attached file should be open in the (external) default editor for `.tex` files.
Comment 1 Albert Astals Cid 2015-10-26 23:37:11 UTC
Don't make my life harder than it needs to be, please attach all the files needed to reproduce the problem you're speaking about.
Comment 2 Denis Bitouzé 2015-10-27 08:25:15 UTC
Created attachment 95155 [details]
Here is the PDF file, `bar.pdf', to which the `foo.tex' file is attached.
Comment 3 Albert Astals Cid 2015-10-27 23:08:19 UTC
You can access the file by right clicking, but on a second read of the pdf spec it seems it hints the user should be able to view/save the file on left clicking.

Since running stuff is always ugly security wise i'll just show the save dialog and let the user carry on from there.
Comment 4 Albert Astals Cid 2015-10-27 23:29:20 UTC
Git commit a675670ddaefc6da554523b6a6dfc8d1e1073e2b by Albert Astals Cid.
Committed on 27/10/2015 at 23:28.
Pushed by aacid into branch 'Applications/15.08'.

Save file attachments on left click

Instead of having to right click on it and choosing save from the menu

M  +10   -0    ui/pageview.cpp

http://commits.kde.org/okular/a675670ddaefc6da554523b6a6dfc8d1e1073e2b
Comment 5 Denis Bitouzé 2015-10-28 05:38:56 UTC
>Since running stuff is always ugly security wise i'll just show the save dialog and let the user carry on from there.

I agree security matters but too bad the ability to directly open the file is disabled: what about a warning and/or allow only some types of files to be directly open (PDF and text files, e.g. .tex ones)? Once again, Adobe Reader and Evince allow this.
Comment 6 Albert Astals Cid 2015-10-28 21:22:27 UTC
feel free to create a wish item about that, i consider this fixed as files are more easily accessible now.
Comment 7 Denis Bitouzé 2015-10-29 08:13:31 UTC
Done: https://bugs.kde.org/show_bug.cgi?id=354538.