← Back to team overview

kicad-developers team mailing list archive

[PATCH] properly read default PDF viewer and use (under Linux Debian)

 

Hi guys

the following patch fix the problem of detecting the default PDF viewer and
use it to open PDF files (under Linux Debian) in the kicad main window when
you double click on a PDF doc.

It would be great to test it under windows and OSX.

cheers
Fabrizio





>From b3aa02b874476ae9f25311b4525e03b635091ed1 Mon Sep 17 00:00:00 2001
From: Fabrizio Tappero <fabrizio.tappero@xxxxxxxxx>
Date: Wed, 7 Jun 2017 16:43:16 +0200
Subject: [PATCH] default pdf reader is now properly detected unider Linux

---
 common/gestfich.cpp | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/common/gestfich.cpp b/common/gestfich.cpp
index 3a09576..b68ec68 100644
--- a/common/gestfich.cpp
+++ b/common/gestfich.cpp
@@ -344,7 +344,7 @@ wxString KicadDatasPath()

 bool OpenPDF( const wxString& file )
 {
-    wxString command;
+    wxString command = "";
     wxString filename = file;

     Pgm().ReadPdfBrowserInfos();
@@ -356,12 +356,9 @@ bool OpenPDF( const wxString& file )
     }
     else
     {
-        wxFileType* filetype =
wxTheMimeTypesManager->GetFileTypeFromExtension( wxT( "pdf" ) );
-
-        if( filetype )
-            command = filetype->GetOpenCommand( filename );
-
-        delete filetype;
+        AddDelimiterString( filename );
+        wxLaunchDefaultApplication( filename );
+        return true;
     }

     if( !command.IsEmpty() )
-- 
2.7.4

Follow ups