Skip to content
Permalink
Browse files

Don't require a connection to a geopackage for data item

'create new layer' to function
  • Loading branch information
nyalldawson committed Nov 15, 2017
1 parent 581d0d3 commit ef7cc49c646cadbd1782247875490a1d77cbd210
Showing with 4 additions and 14 deletions.
  1. +4 −14 src/providers/ogr/qgsgeopackagedataitems.cpp
@@ -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();
}
}

0 comments on commit ef7cc49

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