Skip to content

Commit

Permalink
Simplify calls when removing a stored GPKG connection
Browse files Browse the repository at this point in the history
  • Loading branch information
elpaso committed Jun 4, 2020
1 parent d7a33d3 commit 5c856b0
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/gui/providers/ogr/qgsgeopackageitemguiprovider.cpp
Expand Up @@ -177,8 +177,14 @@ void QgsGeoPackageItemGuiProvider::deleteGpkg()
if ( ! name.isEmpty() )
{
QgsProviderMetadata *md { QgsProviderRegistry::instance()->providerMetadata( QStringLiteral( "ogr" ) ) };
std::unique_ptr<QgsAbstractProviderConnection> conn { md->createConnection( name ) };
conn->remove( name );
try
{
md->deleteConnection( name );
}
catch ( QgsProviderConnectionException &ex )
{
QgsDebugMsg( QStringLiteral( "Could not remove GPKG connection %1: %2" ).arg( name, ex.what() ) );
}
}
if ( parent )
parent->refresh();
Expand Down

0 comments on commit 5c856b0

Please sign in to comment.