@@ -34,10 +34,10 @@ QgsNewConnection::QgsNewConnection( QWidget *parent, const QString& connName, Qt
34
34
{
35
35
setupUi ( this );
36
36
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 );
41
41
42
42
if ( !connName.isEmpty () )
43
43
{
@@ -66,7 +66,7 @@ QgsNewConnection::QgsNewConnection( QWidget *parent, const QString& connName, Qt
66
66
// Ensure that cb_plublicSchemaOnly is set correctly
67
67
on_cb_geometryColumnsOnly_clicked ();
68
68
69
- cbxSSLmode->setCurrentIndex ( settings.value ( key + " /sslmode" , QgsDataSourceURI::SSLprefer ).toInt () );
69
+ cbxSSLmode->setCurrentIndex ( cbxSSLmode-> findData ( settings.value ( key + " /sslmode" , QgsDataSourceURI::SSLprefer ).toInt () ) );
70
70
71
71
if ( settings.value ( key + " /save" ).toString () == " true" )
72
72
{
@@ -110,7 +110,7 @@ void QgsNewConnection::accept()
110
110
settings.setValue ( baseKey + " /publicOnly" , cb_publicSchemaOnly->isChecked () );
111
111
settings.setValue ( baseKey + " /geometryColumnsOnly" , cb_geometryColumnsOnly->isChecked () );
112
112
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 () );
114
114
115
115
QDialog::accept ();
116
116
}
@@ -137,7 +137,7 @@ QgsNewConnection::~QgsNewConnection()
137
137
void QgsNewConnection::testConnection ()
138
138
{
139
139
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 () );
141
141
142
142
QgsDebugMsg ( " PQconnectdb(" + uri.connectionInfo () + " );" );
143
143
0 commit comments