Skip to content
Permalink
Browse files

If decoding a layer URI returns a url, then show a link to that url

in the layer's metadata
  • Loading branch information
nyalldawson committed Nov 7, 2018
1 parent 4b32e7c commit bcffc4406218f92d4f9ea02a5f941469854ef175
Showing with 10 additions and 0 deletions.
  1. +5 −0 src/core/qgsvectorlayer.cpp
  2. +5 −0 src/core/raster/qgsrasterlayer.cpp
@@ -4268,6 +4268,11 @@ QString QgsVectorLayer::htmlMetadata() const
if ( QFile::exists( path ) )
myMetadata += QStringLiteral( "<tr><td class=\"highlight\">" ) + tr( "Path" ) + QStringLiteral( "</td><td>%1" ).arg( QStringLiteral( "<a href=\"%1\">%2</a>" ).arg( QUrl::fromLocalFile( path ).toString(), QDir::toNativeSeparators( path ) ) ) + QStringLiteral( "</td></tr>\n" );
}
if ( uriComponents.contains( QStringLiteral( "url" ) ) )
{
const QString url = uriComponents[QStringLiteral( "url" )].toString();
myMetadata += QStringLiteral( "<tr><td class=\"highlight\">" ) + tr( "URL" ) + QStringLiteral( "</td><td>%1" ).arg( QStringLiteral( "<a href=\"%1\">%2</a>" ).arg( QUrl( url ).toString(), url ) ) + QStringLiteral( "</td></tr>\n" );
}

// data source
if ( publicSource() != path )
@@ -309,6 +309,11 @@ QString QgsRasterLayer::htmlMetadata() const
if ( QFile::exists( path ) )
myMetadata += QStringLiteral( "<tr><td class=\"highlight\">" ) + tr( "Path" ) + QStringLiteral( "</td><td>%1" ).arg( QStringLiteral( "<a href=\"%1\">%2</a>" ).arg( QUrl::fromLocalFile( path ).toString(), QDir::toNativeSeparators( path ) ) ) + QStringLiteral( "</td></tr>\n" );
}
if ( uriComponents.contains( QStringLiteral( "url" ) ) )
{
const QString url = uriComponents[QStringLiteral( "url" )].toString();
myMetadata += QStringLiteral( "<tr><td class=\"highlight\">" ) + tr( "URL" ) + QStringLiteral( "</td><td>%1" ).arg( QStringLiteral( "<a href=\"%1\">%2</a>" ).arg( QUrl( url ).toString(), url ) ) + QStringLiteral( "</td></tr>\n" );
}

// data source
if ( publicSource() != path )

0 comments on commit bcffc44

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