From: gdd Date: Tue, 12 Feb 2013 17:02:56 +0000 (+0000) Subject: 0020512: EDF 1113 OTHER : Using webkit to display documentation X-Git-Tag: V6_main_FINAL~53 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=1762b7ec09c758b7a9a1f59fca3790f59700fb74;p=modules%2Fgui.git 0020512: EDF 1113 OTHER : Using webkit to display documentation This is a patch on a fix concerning an unresolved symbol while opening a pdf file from the integrated webkit browser. The previous fix was useful in the case where the system Qt version was higher than the Salome one. Now the case is reversed (Salome Qt version is higher than the system one) and the fix must not be used. Both cases are now handled. --- diff --git a/src/Qtx/QtxWebBrowser.cxx b/src/Qtx/QtxWebBrowser.cxx index abd715030..119c012d7 100644 --- a/src/Qtx/QtxWebBrowser.cxx +++ b/src/Qtx/QtxWebBrowser.cxx @@ -405,11 +405,18 @@ void QtxWebBrowser::linkClicked( const QUrl& url ) // special processing of PDF files QStringList readers; readers << "xdg-open" << "acroread" << "kpdf" << "kghostview" << "xpdf"; + int i; foreach ( QString r, readers ) { QString reader = QString( "/usr/bin/%1" ).arg( r ); if ( QFileInfo( reader ).exists() ) { - ::system( QString( "unset LD_LIBRARY_PATH; %1 %2 &" ).arg( reader ).arg( url.toLocalFile() ).toLatin1().constData() ); - break; + i = ::system( QString( "%1 %2" ).arg( reader ).arg( url.toLocalFile() ).toLatin1().constData() ); + // If Salome Qt version is lower than the system one, on KDE an unresolved symbol is raised + // In this case, we try to launch the pdf viewer after unsetting the LD_LIBRARY_PATH environnement variable + // Warning: the test on the return value of ::system does not work if the command ends with '&' + if (i != 0) + i = ::system( QString( "unset LD_LIBRARY_PATH ; %1 %2" ).arg( reader ).arg( url.toLocalFile() ).toLatin1().constData() ); + if (i == 0) + break; } } #endif // WIN32