Skip to content
Permalink
Browse files
use authcfgid
  • Loading branch information
speillet authored and nyalldawson committed Jun 21, 2021
1 parent 07c90b7 commit 4ca687242569b9f62f0bbf3187c4fda2b3fc23b1
Showing with 18 additions and 16 deletions.
  1. +7 −6 src/providers/oracle/qgsoraclenewconnection.cpp
  2. +11 −10 src/providers/postgres/qgspgnewconnection.cpp
@@ -160,15 +160,16 @@ void QgsOracleNewConnection::accept()
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" );
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);
providerConnection->setUri( QgsOracleConn::connUri( txtName->text() ).uri( false ) );
providerConnection->setConfiguration( configuration );
providerMetadata->saveConnection( providerConnection, txtName->text() );

QDialog::accept();
@@ -178,19 +178,20 @@ void QgsPgNewConnection::accept()
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() );
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);
providerConnection->setUri( QgsPostgresConn::connUri( txtName->text() ).uri( false ) );
providerConnection->setConfiguration( configuration );
providerMetadata->saveConnection( providerConnection, txtName->text() );

QDialog::accept();

0 comments on commit 4ca6872

Please sign in to comment.