Skip to content

Commit

Permalink
implement #6128
Browse files Browse the repository at this point in the history
  • Loading branch information
jef-n committed Aug 1, 2012
1 parent 0968589 commit 539b7cb
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/app/qgsidentifyresults.cpp
Expand Up @@ -41,6 +41,8 @@
#include <QMenuBar>
#include <QPushButton>
#include <QWebView>
#include <QDesktopServices>
#include <QMessageBox>

#include "qgslogger.h"

Expand Down Expand Up @@ -277,6 +279,8 @@ void QgsIdentifyResults::addFeature( QgsRasterLayer *layer,

QWebView *wv = new QWebView( attrItem->treeWidget() );
wv->setHtml( attributes.begin().value() );
wv->page()->setLinkDelegationPolicy( QWebPage::DelegateAllLinks );
connect( wv, SIGNAL( linkClicked( const QUrl & ) ), this, SLOT( openUrl( const QUrl & ) ) );
attrItem->treeWidget()->setItemWidget( attrItem, 1, wv );
}
else
Expand Down Expand Up @@ -980,3 +984,11 @@ void QgsIdentifyResults::copyFeatureAttributes()
QgsDebugMsg( QString( "set clipboard: %1" ).arg( text ) );
clipboard->setText( text );
}

void QgsIdentifyResults::openUrl( const QUrl &url )
{
if ( !QDesktopServices::openUrl( url ) )
{
QMessageBox::warning( this, tr( "Could not open url" ), tr( "Could not open URL '%1'" ).arg( url.toString() ) );
}
}
2 changes: 2 additions & 0 deletions src/app/qgsidentifyresults.h
Expand Up @@ -112,6 +112,8 @@ class QgsIdentifyResults: public QDialog, private Ui::QgsIdentifyResultsBase

void on_buttonBox_helpRequested() { QgsContextHelp::run( metaObject()->className() ); }

void openUrl( const QUrl &url );

private:
QMenu *mActionPopup;
QMap<QTreeWidgetItem *, QgsHighlight * > mHighlights;
Expand Down

0 comments on commit 539b7cb

Please sign in to comment.