added hooks for opening url relative to the documentation base directory or an absolute url

git-svn-id: http://svn.osgeo.org/qgis/trunk@742 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
gsherman 2004-02-07 23:32:47 +00:00
parent 1f3e57c7a4
commit 2f8507509b
5 changed files with 29 additions and 1 deletions

View File

@ -1505,7 +1505,13 @@ void QgisApp::options(){
optionsDialog->exec();
}
void QgisApp::helpContents(){
openURL("index.html");
}
void QgisApp::openURL(QString url, bool useQgisDocDirectory){
// open help in user browser
if(useQgisDocDirectory){
url = appDir +"/share/doc/" + url;
}
// find a browser
QSettings settings;
QString browser = settings.readEntry("/qgis/browser");
@ -1530,7 +1536,7 @@ void QgisApp::helpContents(){
// open index.html using browser
QProcess *helpProcess = new QProcess(this);
helpProcess->addArgument(browser);
helpProcess->addArgument(appDir +"/share/doc/index.html");
helpProcess->addArgument(url);
helpProcess->start();
}
/* helpViewer = new QgsHelpViewer(this,"helpviewer",false);

View File

@ -155,6 +155,8 @@ private:
QString activeLayerSource();
//! Open the help contents in a browser
void helpContents();
//! Open a url in the users configured browser
void openURL(QString url, bool useQgisDocDirectory=true);
//! Check qgis version against the qgis version server
void checkQgisVersion();
//! options dialog slot

View File

@ -44,3 +44,7 @@ int QgisIface::addMenu(QString menuText, QPopupMenu *menu){
#endif
return mainMenu->insertItem(menuText, menu,-1, mainMenu->count() -1);
}
void QgisIface::openURL(QString url, bool useQgisDocDirectory){
qgis->openURL(url,useQgisDocDirectory);
}

View File

@ -35,6 +35,14 @@ class QgisIface : public QgisInterface{
int addMenu(QString menuText, QPopupMenu *menu);
//! Get an integer from the QgisApp object. This is a test function with no real utility
int getInt();
/** Open a url in the users browser. By default the QGIS doc directory is used
* as the base for the URL. To open a URL that is not relative to the installed
* QGIS documentation, set useQgisDocDirectory to false.
* @param url URL to open
* @param useQgisDocDirectory If true, the URL will be formed by concatenating
* url to the QGIS documentation directory path (<prefix>/share/doc)
*/
void openURL(QString url, bool useQgisDocDirectory=true);
private:
//! Pointer to the QgisApp object
QgisApp *qgis;

View File

@ -26,6 +26,14 @@ public:
virtual QgsMapLayer *activeLayer()=0;
//! add a menu item to the main menu, postioned to the left of the Help menu
virtual int addMenu(QString menuText, QPopupMenu *menu) =0;
/** Open a url in the users browser. By default the QGIS doc directory is used
* as the base for the URL. To open a URL that is not relative to the installed
* QGIS documentation, set useQgisDocDirectory to false.
* @param url URL to open
* @param useQgisDocDirectory If true, the URL will be formed by concatenating
* url to the QGIS documentation directory path (<prefix>/share/doc)
*/
virtual void openURL(QString url, bool useQgisDocDirectory=true)=0;
private:
//QgisApp *qgis;
};