Skip to content

Commit

Permalink
Don't require a connection to a geopackage for data item
Browse files Browse the repository at this point in the history
'create new layer' to function
  • Loading branch information
nyalldawson committed Nov 15, 2017
1 parent 581d0d3 commit ef7cc49
Showing 1 changed file with 4 additions and 14 deletions.
18 changes: 4 additions & 14 deletions src/providers/ogr/qgsgeopackagedataitems.cpp
Expand Up @@ -505,21 +505,11 @@ void QgsGeoPackageCollectionItem::deleteConnection()
void QgsGeoPackageCollectionItem::addTable()
{
QgsNewGeoPackageLayerDialog dialog( nullptr );
QFileInfo fileInfo( mPath );
QString connName = fileInfo.fileName();
QgsOgrDbConnection connection( connName, QStringLiteral( "GPKG" ) );
if ( ! connection.path().isEmpty() )
{
dialog.setDatabasePath( connection.path() );
dialog.setCrs( QgsProject::instance()->defaultCrsForNewLayers() );
if ( dialog.exec() == QDialog::Accepted )
{
refreshConnections();
}
}
else
dialog.setDatabasePath( mPath );
dialog.setCrs( QgsProject::instance()->defaultCrsForNewLayers() );
if ( dialog.exec() == QDialog::Accepted )
{
QgsDebugMsg( QStringLiteral( "Cannot add Table: connection %1 does not exist or the path is empty!" ).arg( connName ) );
refreshConnections();
}
}

Expand Down

0 comments on commit ef7cc49

Please sign in to comment.