Skip to content
Permalink
Browse files
add configuration to metadataprovider
  • Loading branch information
speillet authored and nyalldawson committed Jun 21, 2021
1 parent a864034 commit 07c90b726ba12ea452c114efd10eb822f87d731f
Showing with 20 additions and 0 deletions.
  1. +8 −0 src/providers/oracle/qgsoraclenewconnection.cpp
  2. +12 −0 src/providers/postgres/qgspgnewconnection.cpp
@@ -159,8 +159,16 @@ void QgsOracleNewConnection::accept()
settings.setValue( baseKey + QStringLiteral( "/dbworkspace" ), txtWorkspace->text() );
settings.setValue( baseKey + QStringLiteral( "/schema" ), txtSchema->text() );

QVariantMap configuration;
configuration.insert("geometryColumnsOnly", cb_geometryColumnsOnly->isChecked() );
configuration.insert("allowGeometrylessTables", cb_allowGeometrylessTables->isChecked() );
configuration.insert("onlyExistingTypes", cb_onlyExistingTypes->isChecked() ? QStringLiteral( "true" ) : QStringLiteral( "false" ) );
configuration.insert("saveUsername", mAuthSettings->storeUsernameIsChecked( ) ? "true" : "false" );
configuration.insert("savePassword", mAuthSettings->storePasswordIsChecked( ) && !hasAuthConfigID ? "true" : "false" );

QgsProviderMetadata *providerMetadata = QgsProviderRegistry::instance()->providerMetadata( QStringLiteral( "oracle" ) );
QgsOracleProviderConnection *providerConnection = static_cast<QgsOracleProviderConnection *>( providerMetadata->createConnection( txtName->text() ) );
providerConnection->setConfiguration(configuration);
providerMetadata->saveConnection( providerConnection, txtName->text() );

QDialog::accept();
@@ -177,8 +177,20 @@ void QgsPgNewConnection::accept()
// remove old save setting
settings.remove( baseKey + "/save" );

QVariantMap configuration;
configuration.insert("publicOnly", cb_publicSchemaOnly->isChecked() );
configuration.insert("geometryColumnsOnly", cb_geometryColumnsOnly->isChecked() );
configuration.insert("dontResolveType", cb_dontResolveType->isChecked() );
configuration.insert("allowGeometrylessTables", cb_allowGeometrylessTables->isChecked() );
configuration.insert("sslmode", cbxSSLmode->currentData().toInt() );
configuration.insert("saveUsername", mAuthSettings->storeUsernameIsChecked( ) ? "true" : "false" );
configuration.insert("savePassword", mAuthSettings->storePasswordIsChecked( ) && !hasAuthConfigID ? "true" : "false" );
configuration.insert("estimatedMetadata", cb_useEstimatedMetadata->isChecked() );
configuration.insert("projectsInDatabase", cb_projectsInDatabase->isChecked() );

QgsProviderMetadata *providerMetadata = QgsProviderRegistry::instance()->providerMetadata( QStringLiteral( "postgres" ) );
QgsPostgresProviderConnection *providerConnection = static_cast<QgsPostgresProviderConnection *>( providerMetadata->createConnection( txtName->text() ) );
providerConnection->setConfiguration(configuration);
providerMetadata->saveConnection( providerConnection, txtName->text() );

QDialog::accept();

0 comments on commit 07c90b7

Please sign in to comment.