Skip to content
Permalink
Browse files
[ui][spatialite] Fix the browser panel's new connection action
  • Loading branch information
nirvn authored and nyalldawson committed Nov 6, 2021
1 parent 70c2ef1 commit 3f12f40ddc7a77f6943c5a55f277ed59dc5788a1
Showing with 5 additions and 2 deletions.
  1. +5 −2 src/providers/spatialite/qgsspatialitesourceselect.cpp
@@ -311,11 +311,14 @@ bool QgsSpatiaLiteSourceSelect::newConnection( QWidget *parent )

// Persist last used SpatiaLite dir
settings.setValue( QStringLiteral( "UI/lastSpatiaLiteDir" ), myPath );

QgsDataSourceUri dsUri;
dsUri.setDatabase( myFile );

// inserting this SQLite DB path
QgsProviderMetadata *providerMetadata = QgsProviderRegistry::instance()->providerMetadata( QStringLiteral( "spatialite" ) );
QgsSpatiaLiteProviderConnection *providerConnection = static_cast<QgsSpatiaLiteProviderConnection *>( providerMetadata->createConnection( savedName ) );
QgsSpatiaLiteProviderConnection *providerConnection = static_cast<QgsSpatiaLiteProviderConnection *>( providerMetadata->createConnection( dsUri.uri(), QVariantMap() ) );
providerMetadata->saveConnection( providerConnection, savedName );

return true;
}

0 comments on commit 3f12f40

Please sign in to comment.