[QGIS Commit] r12915 - trunk/qgis/src/plugins/grass
svn_qgis at osgeo.org
svn_qgis at osgeo.org
Wed Feb 10 07:53:04 EST 2010
Author: rblazek
Date: 2010-02-10 07:53:01 -0500 (Wed, 10 Feb 2010)
New Revision: 12915
Added:
trunk/qgis/src/plugins/grass/qgis.g.browser.cpp
Modified:
trunk/qgis/src/plugins/grass/CMakeLists.txt
trunk/qgis/src/plugins/grass/qgsgrassmodule.cpp
Log:
default browser starter
Modified: trunk/qgis/src/plugins/grass/CMakeLists.txt
===================================================================
--- trunk/qgis/src/plugins/grass/CMakeLists.txt 2010-02-10 11:05:28 UTC (rev 12914)
+++ trunk/qgis/src/plugins/grass/CMakeLists.txt 2010-02-10 12:53:01 UTC (rev 12915)
@@ -110,6 +110,7 @@
SET (GRASS_PLUGIN_RCCS qgsgrass_plugin.qrc)
+SET (GRASS_BROWSER_SRCS qgis.g.browser.cpp)
########################################################
# Build
@@ -153,7 +154,13 @@
${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 @@
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
+)
Added: trunk/qgis/src/plugins/grass/qgis.g.browser.cpp
===================================================================
--- trunk/qgis/src/plugins/grass/qgis.g.browser.cpp (rev 0)
+++ trunk/qgis/src/plugins/grass/qgis.g.browser.cpp 2010-02-10 12:53:01 UTC (rev 12915)
@@ -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 );
+}
Modified: trunk/qgis/src/plugins/grass/qgsgrassmodule.cpp
===================================================================
--- trunk/qgis/src/plugins/grass/qgsgrassmodule.cpp 2010-02-10 11:05:28 UTC (rev 12914)
+++ trunk/qgis/src/plugins/grass/qgsgrassmodule.cpp 2010-02-10 12:53:01 UTC (rev 12915)
@@ -1273,13 +1273,14 @@
commandHtml.replace( ">", ">" );
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 );
More information about the QGIS-commit
mailing list