Skip to content
Permalink
Browse files

fix renaming of db/http connections (fixes #10632)

  • Loading branch information
jef-n committed Jun 11, 2015
1 parent d3c4da0 commit 5bf316fec6ab3b727e7ed4c97cda2c6cfc52f623
@@ -158,7 +158,7 @@ void QgsNewHttpConnection::accept()
QString credentialsKey = "/Qgis/" + mCredentialsBaseKey + "/" + txtName->text();

// warn if entry was renamed to an existing connection
if (( mOriginalConnName.isNull() || mOriginalConnName != txtName->text() ) &&
if (( mOriginalConnName.isNull() || mOriginalConnName.compare( txtName->text(), Qt::CaseInsensitive ) != 0 ) &&
settings.contains( key + "/url" ) &&
QMessageBox::question( this,
tr( "Save connection" ),
@@ -182,6 +182,7 @@ void QgsNewHttpConnection::accept()
{
settings.remove( mBaseKey + mOriginalConnName );
settings.remove( "/Qgis/" + mCredentialsBaseKey + "/" + mOriginalConnName );
settings.sync();
}

QUrl url( txtUrl->text().trimmed() );
@@ -58,18 +58,6 @@ QgsMssqlNewConnection::QgsMssqlNewConnection( QWidget *parent, const QString& co
chkStorePassword->setChecked( true );
}

// Old save setting
if ( settings.contains( key + "/save" ) )
{
txtUsername->setText( settings.value( key + "/username" ).toString() );
chkStoreUsername->setChecked( !txtUsername->text().isEmpty() );

if ( settings.value( key + "/save" ).toString() == "true" )
txtPassword->setText( settings.value( key + "/password" ).toString() );

chkStorePassword->setChecked( true );
}

txtName->setText( connName );
}
on_cb_trustedConnection_clicked();
@@ -91,7 +79,7 @@ void QgsMssqlNewConnection::accept()
}

// warn if entry was renamed to an existing connection
if (( mOriginalConnName.isNull() || mOriginalConnName != txtName->text() ) &&
if (( mOriginalConnName.isNull() || mOriginalConnName.compare( txtName->text(), Qt::CaseInsensitive ) != 0 ) &&
( settings.contains( baseKey + txtName->text() + "/service" ) ||
settings.contains( baseKey + txtName->text() + "/host" ) ) &&
QMessageBox::question( this,
@@ -105,8 +93,8 @@ void QgsMssqlNewConnection::accept()
// on rename delete the original entry first
if ( !mOriginalConnName.isNull() && mOriginalConnName != txtName->text() )
{

settings.remove( baseKey + mOriginalConnName );
settings.sync();
}

baseKey += txtName->text();
@@ -95,7 +95,7 @@ void QgsOracleNewConnection::accept()
}

// warn if entry was renamed to an existing connection
if (( mOriginalConnName.isNull() || mOriginalConnName != txtName->text() ) &&
if (( mOriginalConnName.isNull() || mOriginalConnName.compare( txtName->text(), Qt::CaseInsensitive ) != 0 ) &&
( settings.contains( baseKey + txtName->text() + "/service" ) ||
settings.contains( baseKey + txtName->text() + "/host" ) ) &&
QMessageBox::question( this,
@@ -109,8 +109,8 @@ void QgsOracleNewConnection::accept()
// on rename delete the original entry first
if ( !mOriginalConnName.isNull() && mOriginalConnName != txtName->text() )
{

settings.remove( baseKey + mOriginalConnName );
settings.sync();
}

baseKey += txtName->text();
@@ -128,9 +128,6 @@ void QgsOracleNewConnection::accept()
settings.setValue( baseKey + "/savePassword", chkStorePassword->isChecked() ? "true" : "false" );
settings.setValue( baseKey + "/dboptions", txtOptions->text() );

// remove old save setting
settings.remove( baseKey + "/save" );

QDialog::accept();
}

@@ -105,7 +105,7 @@ void QgsPgNewConnection::accept()
}

// warn if entry was renamed to an existing connection
if (( mOriginalConnName.isNull() || mOriginalConnName != txtName->text() ) &&
if (( mOriginalConnName.isNull() || mOriginalConnName.compare( txtName->text(), Qt::CaseInsensitive ) != 0 ) &&
( settings.contains( baseKey + txtName->text() + "/service" ) ||
settings.contains( baseKey + txtName->text() + "/host" ) ) &&
QMessageBox::question( this,
@@ -119,8 +119,8 @@ void QgsPgNewConnection::accept()
// on rename delete the original entry first
if ( !mOriginalConnName.isNull() && mOriginalConnName != txtName->text() )
{

settings.remove( baseKey + mOriginalConnName );
settings.sync();
}

baseKey += txtName->text();

0 comments on commit 5bf316f

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