From ef7cc49c646cadbd1782247875490a1d77cbd210 Mon Sep 17 00:00:00 2001 From: Nyall Dawson Date: Thu, 16 Nov 2017 07:33:46 +1000 Subject: [PATCH] Don't require a connection to a geopackage for data item 'create new layer' to function --- src/providers/ogr/qgsgeopackagedataitems.cpp | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/src/providers/ogr/qgsgeopackagedataitems.cpp b/src/providers/ogr/qgsgeopackagedataitems.cpp index df415548069..d523fdd5a3c 100644 --- a/src/providers/ogr/qgsgeopackagedataitems.cpp +++ b/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( mPath ); + dialog.setCrs( QgsProject::instance()->defaultCrsForNewLayers() ); + if ( dialog.exec() == QDialog::Accepted ) { - dialog.setDatabasePath( connection.path() ); - dialog.setCrs( QgsProject::instance()->defaultCrsForNewLayers() ); - if ( dialog.exec() == QDialog::Accepted ) - { - refreshConnections(); - } - } - else - { - QgsDebugMsg( QStringLiteral( "Cannot add Table: connection %1 does not exist or the path is empty!" ).arg( connName ) ); + refreshConnections(); } }