Skip to content
Permalink
Browse files

fix #3614

git-svn-id: http://svn.osgeo.org/qgis/trunk@15477 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef
jef committed Mar 14, 2011
1 parent 36fc12a commit a197a6c5b31cd1b5f467aec5f8be1d19fa96cd95
@@ -928,25 +928,10 @@ void QgsPgSourceSelect::setConnectionListPosition()
QSettings settings;
// If possible, set the item currently displayed database
QString toSelect = settings.value( "/PostgreSQL/connections/selected" ).toString();
// Does toSelect exist in cmbConnections?
bool set = false;
for ( int i = 0; i < cmbConnections->count(); ++i )
if ( cmbConnections->itemText( i ) == toSelect )
{
cmbConnections->setCurrentIndex( i );
set = true;
break;
}
// If we couldn't find the stored item, but there are some,
// default to the last item (this makes some sense when deleting
// items as it allows the user to repeatidly click on delete to
// remove a whole lot of items).
if ( !set && cmbConnections->count() > 0 )
cmbConnections->setCurrentIndex( cmbConnections->findText( toSelect ) );

if ( cmbConnections->currentIndex() < 0 )
{
// If toSelect is null, then the selected connection wasn't found
// by QSettings, which probably means that this is the first time
// the user has used qgis with database connections, so default to
// the first in the list of connetions. Otherwise default to the last.
if ( toSelect.isNull() )
cmbConnections->setCurrentIndex( 0 );
else
@@ -92,5 +92,7 @@ void QgsNewHttpConnection::accept()
settings.setValue( credentialsKey + "/username", txtUserName->text() );
settings.setValue( credentialsKey + "/password", txtPassword->text() );

settings.setValue( mBaseKey + "/selected", txtName->text() );

QDialog::accept();
}
@@ -1008,31 +1008,18 @@ void QgsWMSSourceSelect::setConnectionListPosition()
{
QSettings settings;
QString toSelect = settings.value( "/Qgis/connections-wms/selected" ).toString();
// Does toSelect exist in cmbConnections?
bool set = false;
for ( int i = 0; i < cmbConnections->count(); ++i )
if ( cmbConnections->itemText( i ) == toSelect )
{
cmbConnections->setCurrentIndex( i );
set = true;
break;
}
// If we couldn't find the stored item, but there are some,
// default to the last item (this makes some sense when deleting
// items as it allows the user to repeatidly click on delete to
// remove a whole lot of items).
if ( !set && cmbConnections->count() > 0 )
{
// If toSelect is null, then the selected connection wasn't found
// by QSettings, which probably means that this is the first time
// the user has used qgis with database connections, so default to
// the first in the list of connetions. Otherwise default to the last.

cmbConnections->setCurrentIndex( cmbConnections->findText( toSelect ) );

if ( cmbConnections->currentIndex() < 0 )
{
if ( toSelect.isNull() )
cmbConnections->setCurrentIndex( 0 );
else
cmbConnections->setCurrentIndex( cmbConnections->count() - 1 );
}
}

void QgsWMSSourceSelect::showStatusMessage( QString const &theMessage )
{
labelStatus->setText( theMessage );
@@ -295,7 +295,7 @@ bool QgsNewSpatialiteLayerDialog::createDb()

if ( !settings.contains( key ) )
{
settings.setValue( "/SpatiaLite/connections/selected", fi.fileName() );
settings.setValue( "/SpatiaLite/connections/selected", fi.fileName() + tr( "@" ) + fi.canonicalFilePath() );
settings.setValue( key, fi.canonicalFilePath() );

QMessageBox::information( 0, tr( "SpatiaLite Database" ), tr( "Registered new database!" ) );
@@ -887,25 +887,11 @@ void QgsSpatiaLiteSourceSelect::setConnectionListPosition()
QSettings settings;
// If possible, set the item currently displayed database
QString toSelect = settings.value( "/SpatiaLite/connections/selected" ).toString();
// Does toSelect exist in cmbConnections?
bool set = false;
for ( int i = 0; i < cmbConnections->count(); ++i )
if ( cmbConnections->itemText( i ) == toSelect )
{
cmbConnections->setCurrentIndex( i );
set = true;
break;
}
// If we couldn't find the stored item, but there are some,
// default to the last item (this makes some sense when deleting
// items as it allows the user to repeatidly click on delete to
// remove a whole lot of items).
if ( !set && cmbConnections->count() > 0 )
{
// If toSelect is null, then the selected connection wasn't found
// by QSettings, which probably means that this is the first time
// the user has used qgis with database connections, so default to
// the first in the list of connetions. Otherwise default to the last.

cmbConnections->setCurrentIndex( cmbConnections->findText( toSelect ) );

if ( cmbConnections->currentIndex() < 0 )
{
if ( toSelect.isNull() )
cmbConnections->setCurrentIndex( 0 );
else

0 comments on commit a197a6c

Please sign in to comment.
You can’t perform that action at this time.