Skip to content
Permalink
Browse files

default browser starter

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@12915 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
rblazek
rblazek committed Feb 10, 2010
1 parent e1713f2 commit c777c8da7ef2729f5ed8a4f242c6ddac62891adf
Showing with 33 additions and 2 deletions.
  1. +12 −0 src/plugins/grass/CMakeLists.txt
  2. +18 −0 src/plugins/grass/qgis.g.browser.cpp
  3. +3 −2 src/plugins/grass/qgsgrassmodule.cpp
@@ -110,6 +110,7 @@ ENDIF(NOT WIN32)

SET (GRASS_PLUGIN_RCCS qgsgrass_plugin.qrc)

SET (GRASS_BROWSER_SRCS qgis.g.browser.cpp)

########################################################
# Build
@@ -153,6 +154,12 @@ TARGET_LINK_LIBRARIES(grassplugin
${OPENPTY_LIBRARY}
)

ADD_EXECUTABLE(qgis.g.browser ${GRASS_BROWSER_SRCS})

TARGET_LINK_LIBRARIES (qgis.g.browser
${QT_QTGUI_LIBRARY}
${QT_QTCORE_LIBRARY}
)

########################################################
# Install
@@ -165,3 +172,8 @@ INSTALL(TARGETS grassplugin
FILE (GLOB GMLS *.gml)
INSTALL (FILES ${GMLS} images/world.png
DESTINATION ${QGIS_DATA_DIR}/grass)

INSTALL(TARGETS qgis.g.browser
RUNTIME DESTINATION ${QGIS_DATA_DIR}/grass/bin
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
)
@@ -0,0 +1,18 @@
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <QUrl>
#include <QDesktopServices>

// Open a URL by default browser
int main(int argc, char **argv)
{
if ( argc < 2 )
{
fprintf ( stderr, "URL argument missing\n" );
exit (1);
}
QDesktopServices::openUrl ( QUrl ( argv[1] ) );
sleep(1); // not nice but if it exits immediately the page sometimes does not open
exit ( 0 );
}
@@ -1273,13 +1273,14 @@ void QgsGrassModule::run()
commandHtml.replace( ">", "&gt;" );
mOutputTextBrowser->append( "<B>" + commandHtml + "</B>" );

QStringList environment = QProcess::systemEnvironment();
environment.append( "GRASS_HTML_BROWSER=" + QgsApplication::pkgDataPath() + "/grass/bin/qgis.g.browser" );

// Warning: it is not useful to write requested region to WIND file and
// reset then to original beacuse it is reset before
// the region is read by a module even if waitForStarted() is used
// -> necessary to pass region as environment variable
// but the feature is available in GRASS 6.1 only since 23.3.2006

QStringList environment = QProcess::systemEnvironment();
if ( resetRegion )
{
QString reg = QgsGrass::regionString( &tempWindow );

0 comments on commit c777c8d

Please sign in to comment.
You can’t perform that action at this time.