Skip to content

Commit bfcfa8e

Browse files
author
jef
committed
fix #2296
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@12520 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 32fe182 commit bfcfa8e

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/app/qgsnewconnection.cpp

+7-7
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ QgsNewConnection::QgsNewConnection( QWidget *parent, const QString& connName, Qt
3434
{
3535
setupUi( this );
3636

37-
cbxSSLmode->insertItem( QgsDataSourceURI::SSLprefer, tr( "prefer" ) );
38-
cbxSSLmode->insertItem( QgsDataSourceURI::SSLrequire, tr( "require" ) );
39-
cbxSSLmode->insertItem( QgsDataSourceURI::SSLallow, tr( "allow" ) );
40-
cbxSSLmode->insertItem( QgsDataSourceURI::SSLdisable, tr( "disable" ) );
37+
cbxSSLmode->addItem( tr( "disable" ), QgsDataSourceURI::SSLdisable );
38+
cbxSSLmode->addItem( tr( "allow" ), QgsDataSourceURI::SSLallow );
39+
cbxSSLmode->addItem( tr( "prefer" ), QgsDataSourceURI::SSLprefer );
40+
cbxSSLmode->addItem( tr( "require" ), QgsDataSourceURI::SSLrequire );
4141

4242
if ( !connName.isEmpty() )
4343
{
@@ -66,7 +66,7 @@ QgsNewConnection::QgsNewConnection( QWidget *parent, const QString& connName, Qt
6666
// Ensure that cb_plublicSchemaOnly is set correctly
6767
on_cb_geometryColumnsOnly_clicked();
6868

69-
cbxSSLmode->setCurrentIndex( settings.value( key + "/sslmode", QgsDataSourceURI::SSLprefer ).toInt() );
69+
cbxSSLmode->setCurrentIndex( cbxSSLmode->findData( settings.value( key + "/sslmode", QgsDataSourceURI::SSLprefer ).toInt() ) );
7070

7171
if ( settings.value( key + "/save" ).toString() == "true" )
7272
{
@@ -110,7 +110,7 @@ void QgsNewConnection::accept()
110110
settings.setValue( baseKey + "/publicOnly", cb_publicSchemaOnly->isChecked() );
111111
settings.setValue( baseKey + "/geometryColumnsOnly", cb_geometryColumnsOnly->isChecked() );
112112
settings.setValue( baseKey + "/save", chkStorePassword->isChecked() ? "true" : "false" );
113-
settings.setValue( baseKey + "/sslmode", cbxSSLmode->currentIndex() );
113+
settings.setValue( baseKey + "/sslmode", cbxSSLmode->itemData( cbxSSLmode->currentIndex() ).toInt() );
114114

115115
QDialog::accept();
116116
}
@@ -137,7 +137,7 @@ QgsNewConnection::~QgsNewConnection()
137137
void QgsNewConnection::testConnection()
138138
{
139139
QgsDataSourceURI uri;
140-
uri.setConnection( txtHost->text(), txtPort->text(), txtDatabase->text(), txtUsername->text(), txtPassword->text(), ( QgsDataSourceURI::SSLmode ) cbxSSLmode->currentIndex() );
140+
uri.setConnection( txtHost->text(), txtPort->text(), txtDatabase->text(), txtUsername->text(), txtPassword->text(), ( QgsDataSourceURI::SSLmode ) cbxSSLmode->itemData( cbxSSLmode->currentIndex() ).toInt() );
141141

142142
QgsDebugMsg( "PQconnectdb(" + uri.connectionInfo() + ");" );
143143

0 commit comments

Comments
 (0)