[QGIS Commit] r12520 - trunk/qgis/src/app

svn_qgis at osgeo.org svn_qgis at osgeo.org
Sat Dec 19 11:27:18 EST 2009


Author: jef
Date: 2009-12-19 11:27:18 -0500 (Sat, 19 Dec 2009)
New Revision: 12520

Modified:
   trunk/qgis/src/app/qgsnewconnection.cpp
Log:
fix #2296

Modified: trunk/qgis/src/app/qgsnewconnection.cpp
===================================================================
--- trunk/qgis/src/app/qgsnewconnection.cpp	2009-12-19 16:12:55 UTC (rev 12519)
+++ trunk/qgis/src/app/qgsnewconnection.cpp	2009-12-19 16:27:18 UTC (rev 12520)
@@ -34,10 +34,10 @@
 {
   setupUi( this );
 
-  cbxSSLmode->insertItem( QgsDataSourceURI::SSLprefer, tr( "prefer" ) );
-  cbxSSLmode->insertItem( QgsDataSourceURI::SSLrequire, tr( "require" ) );
-  cbxSSLmode->insertItem( QgsDataSourceURI::SSLallow, tr( "allow" ) );
-  cbxSSLmode->insertItem( QgsDataSourceURI::SSLdisable, tr( "disable" ) );
+  cbxSSLmode->addItem( tr( "disable" ), QgsDataSourceURI::SSLdisable );
+  cbxSSLmode->addItem( tr( "allow" ), QgsDataSourceURI::SSLallow );
+  cbxSSLmode->addItem( tr( "prefer" ), QgsDataSourceURI::SSLprefer );
+  cbxSSLmode->addItem( tr( "require" ), QgsDataSourceURI::SSLrequire );
 
   if ( !connName.isEmpty() )
   {
@@ -66,7 +66,7 @@
     // Ensure that cb_plublicSchemaOnly is set correctly
     on_cb_geometryColumnsOnly_clicked();
 
-    cbxSSLmode->setCurrentIndex( settings.value( key + "/sslmode", QgsDataSourceURI::SSLprefer ).toInt() );
+    cbxSSLmode->setCurrentIndex( cbxSSLmode->findData( settings.value( key + "/sslmode", QgsDataSourceURI::SSLprefer ).toInt() ) );
 
     if ( settings.value( key + "/save" ).toString() == "true" )
     {
@@ -110,7 +110,7 @@
   settings.setValue( baseKey + "/publicOnly", cb_publicSchemaOnly->isChecked() );
   settings.setValue( baseKey + "/geometryColumnsOnly", cb_geometryColumnsOnly->isChecked() );
   settings.setValue( baseKey + "/save", chkStorePassword->isChecked() ? "true" : "false" );
-  settings.setValue( baseKey + "/sslmode", cbxSSLmode->currentIndex() );
+  settings.setValue( baseKey + "/sslmode", cbxSSLmode->itemData( cbxSSLmode->currentIndex() ).toInt() );
 
   QDialog::accept();
 }
@@ -137,7 +137,7 @@
 void QgsNewConnection::testConnection()
 {
   QgsDataSourceURI uri;
-  uri.setConnection( txtHost->text(), txtPort->text(), txtDatabase->text(), txtUsername->text(), txtPassword->text(), ( QgsDataSourceURI::SSLmode ) cbxSSLmode->currentIndex() );
+  uri.setConnection( txtHost->text(), txtPort->text(), txtDatabase->text(), txtUsername->text(), txtPassword->text(), ( QgsDataSourceURI::SSLmode ) cbxSSLmode->itemData( cbxSSLmode->currentIndex() ).toInt() );
 
   QgsDebugMsg( "PQconnectdb(" + uri.connectionInfo() + ");" );
 



More information about the QGIS-commit mailing list