Bug 314981

Summary: active-documentviewer desktop files are installed even if app is not built
Product: [Applications] okular Reporter: Jonathan Marten <jjm>
Component: generalAssignee: Okular developers <okular-devel>
Status: RESOLVED FIXED    
Severity: normal CC: aacid, notmart
Priority: NOR    
Version: 0.16.60   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:

Description Jonathan Marten 2013-02-12 09:25:05 UTC
If the "ActiveApp" component is not available when Okular is built, then the active-documentviewer executable is not included in the build (conditional in active/CMakeLists.txt).  However, the desktop files for the viewer are still installed (unconditional in, e.g. generators/poppler/CMakeLists.txt which installs active-documentviewer_pdf.desktop).

This means that "Reader" appears in the "Open With" menu for a supported MIME type, but choosing it produces the cryptic message:

    KDEInit could not launch 'active-documentviewer':
    Could not find 'active-documentviewer' executable.


Reproducible: Always

Steps to Reproduce:
1.  Build and install Okular without ActiveApp support (ensure that any old acrtive-documentviewer executable is cleaned up).
2.  Open a directory containing a PDF file in Dolphin or Konqueror.
3.  From the context menu over the PDF file, choose "Open With" - "Reader".

Actual Results:  
Error message as above.


Expected Results:  
"Reader" should not appear in the context menu if it is not available.


Instead of having to conditionalise all of the installs, one solution which appears to work is to add an additional entry to all of the generators/*/active-documentviewer_*.desktop and the active/app/active-documentviewer.desktop files:

TryExec=active-documentviewer
Comment 1 Albert Astals Cid 2013-02-12 22:41:54 UTC
Marco can i convince you to handle this?
Comment 2 Marco Martin 2013-02-20 10:15:55 UTC
Git commit 27c37c1fd1b87e8db40bfb3c46f1489559749286 by Marco Martin.
Committed on 20/02/2013 at 11:14.
Pushed by mart into branch 'master'.

use TryExec to not appear when not installed

when okular active is not installed, it should not appear in the open with menu, so add TryExec to see if the executable exists
this is used instead of conditional install to make easier for distributions to package the desktop and active versions separately
REVIEW:109047

M  +1    -0    generators/chm/active-documentviewer_chm.desktop
M  +1    -0    generators/comicbook/active-documentviewer_comicbook.desktop
M  +1    -0    generators/djvu/active-documentviewer_djvu.desktop
M  +1    -0    generators/dvi/active-documentviewer_dvi.desktop
M  +1    -0    generators/epub/active-documentviewer_epub.desktop
M  +1    -0    generators/fax/active-documentviewer_fax.desktop
M  +1    -0    generators/fictionbook/active-documentviewer_fb.desktop
M  +1    -0    generators/kimgio/active-documentviewer_kimgio.desktop
M  +1    -0    generators/ooo/active-documentviewer_ooo.desktop
M  +1    -0    generators/plucker/active-documentviewer_plucker.desktop
M  +1    -0    generators/poppler/active-documentviewer_pdf.desktop
M  +1    -0    generators/spectre/active-documentviewer_ghostview.desktop
M  +1    -0    generators/tiff/active-documentviewer_tiff.desktop
M  +1    -0    generators/txt/active-documentviewer_txt.desktop
M  +1    -0    generators/xps/active-documentviewer_xps.desktop

http://commits.kde.org/okular/27c37c1fd1b87e8db40bfb3c46f1489559749286
Comment 3 Marco Martin 2013-02-20 10:17:21 UTC
i added tryexec in the end so distributions can't include all that is in generators in the same package without having to worry to move out the files of active, if they want to make separate packages of both