Skip to content

Commit

Permalink
[Plugin manager] [need-docs] [FEATURE?] Add links to the plugin detai…
Browse files Browse the repository at this point in the history
…ls page to open the local directory of installed plugin and the download page/link of the available version (do not confuse with plugin homepage).
  • Loading branch information
borysiasty committed Sep 13, 2018
1 parent 23f1e43 commit 8394981
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 10 deletions.
1 change: 1 addition & 0 deletions images/images.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
1 change: 1 addition & 0 deletions images/themes/default/externalLink.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
33 changes: 23 additions & 10 deletions src/app/pluginmanager/qgspluginmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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>";

Expand Down Expand Up @@ -940,17 +940,30 @@ void QgsPluginManager::showPluginDetails( QStandardItem *item )
{
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 );
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( metadata->value( QStringLiteral( "library" ) ) ).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/" ), QStringLiteral( "" ) );
}

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() )
Expand Down

0 comments on commit 8394981

Please sign in to comment.