Skip to content
Permalink
Browse files

Merge pull request #7891 from borysiasty/plugin_links

[Plugin manager] [needs-docs] [FEATUR?] Open the local directory of installed plugin and the download page/link of the available version from the plugin details view.
  • Loading branch information
borysiasty committed Sep 14, 2018
2 parents 8288deb + fc3b673 commit 6058e662623e9391271c63d624e4fe17ef793026
Showing with 35 additions and 11 deletions.
  1. +1 −0 images/images.qrc
  2. +1 −0 images/themes/default/externalLink.svg
  3. +33 −11 src/app/pluginmanager/qgspluginmanager.cpp
@@ -148,6 +148,7 @@
<file>themes/default/copyright_label.svg</file>
<file>themes/default/dbmanager.svg</file>
<file>themes/default/extents.svg</file>
<file>themes/default/externalLink.svg</file>
<file>themes/default/gpsicons/barchart.svg</file>
<file>themes/default/gpsicons/polarchart.svg</file>
<file>themes/default/grass_location.svg</file>
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -256 1850 1850"><path d="M1504 819v320q0 119-88 203t-213 84H332q-124 0-213-84-88-84-88-203V307q0-119 88-203t213-84h737q15 0 24 9t9 23v64q0 14-9 23t-24 9H332q-69 0-118 47t-49 113v832q0 66 49 113t118 47h871q69 0 118-47t49-113V820q0-14 9-23t24-9h67q15 0 24 9t9 23z" fill="currentColor"/><path d="M400 1003l130 151 964-829 174 182V23h-436l130 151" fill="currentColor"/></svg>
@@ -677,8 +677,8 @@ void QgsPluginManager::showPluginDetails( QStandardItem *item )
" padding-right:10px;"
" text-align:right;"
" }"
" td.version {"
" cursor:pointer;"
" td.version img {"
" height:0.8em;"
" }"
"</style>";

@@ -939,18 +939,40 @@ void QgsPluginManager::showPluginDetails( QStandardItem *item )
if ( ! metadata->value( QStringLiteral( "version_installed" ) ).isEmpty() )
{
QString ver = metadata->value( QStringLiteral( "version_installed" ) );
if ( ver == QLatin1String( "-1" ) ) ver = '?';
html += QStringLiteral( "<tr><td class='key'>%1 </td><td class='version' title='%2 %3'> %4 </td></tr>" ).arg( tr( "Installed version" ),
tr( "in" ),
metadata->value( QStringLiteral( "library" ) ),
ver );
if ( ver == QLatin1String( "-1" ) )
{
ver = '?';
}
QString localDir = metadata->value( QStringLiteral( "library" ) );
if ( QFileInfo( localDir ).isFile() )
{
localDir = QFileInfo( localDir ).absolutePath();
}

html += QStringLiteral( "<tr><td class='key'>%1 </td><td class='version' title='%2 %3'> %4 <a href=\"%5\">"
"<img src=\"qrc:/images/themes/default/externalLink.svg\"></a></td></tr>"
).arg( tr( "Installed version" ),
tr( "in" ),
metadata->value( QStringLiteral( "library" ) ),
ver,
QUrl::fromLocalFile( localDir ).toString() );
}
if ( ! metadata->value( QStringLiteral( "version_available" ) ).isEmpty() )
{
html += QStringLiteral( "<tr><td class='key'>%1 </td><td class='version' title='%2 %3'> %4 </td></tr>" ).arg( tr( "Available version" ),
tr( "in" ),
metadata->value( QStringLiteral( "zip_repository" ) ),
metadata->value( QStringLiteral( "version_available" ) ) );
QString downloadUrl = metadata->value( QStringLiteral( "download_url" ) );
if ( downloadUrl.contains( QStringLiteral( "plugins.qgis.org" ) ) )
{
// For the main repo, open the plugin version page instead of the download link. For other repositories the download link is the only known endpoint.
downloadUrl = downloadUrl.replace( QStringLiteral( "download/" ), QString() );
}

html += QStringLiteral( "<tr><td class='key'>%1 </td><td class='version' title='%2 %3'> %4 <a href=\"%5\">"
"<img src=\"qrc:/images/themes/default/externalLink.svg\"></a></td></tr>"
).arg( tr( "Available version" ),
tr( "in" ),
metadata->value( QStringLiteral( "zip_repository" ) ),
metadata->value( QStringLiteral( "version_available" ) ),
downloadUrl );
}

if ( ! metadata->value( QStringLiteral( "changelog" ) ).isEmpty() )

0 comments on commit 6058e66

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