Skip to content
Permalink
Browse files
[ui][spatialite] Fix the browser panel's new connection action
  • Loading branch information
nirvn committed Nov 5, 2021
1 parent 83b92e9 commit eb3d50508fa4e5b78a54ede9d468d5d4c7913e0e
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 eb3d505

Please sign in to comment.