Skip to content

Commit

Permalink
Merge pull request #7891 from borysiasty/plugin_links
Browse files Browse the repository at this point in the history
[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 6058e66
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 11 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.
44 changes: 33 additions & 11 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 @@ -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() )
Expand Down

0 comments on commit 6058e66

Please sign in to comment.