Skip to content

Commit

Permalink
fix renaming of db/http connections (fixes #10632)
Browse files Browse the repository at this point in the history
  • Loading branch information
jef-n committed Jun 11, 2015
1 parent d3c4da0 commit 5bf316f
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 22 deletions.
3 changes: 2 additions & 1 deletion src/gui/qgsnewhttpconnection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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" ),
Expand All @@ -182,6 +182,7 @@ void QgsNewHttpConnection::accept()
{
settings.remove( mBaseKey + mOriginalConnName );
settings.remove( "/Qgis/" + mCredentialsBaseKey + "/" + mOriginalConnName );
settings.sync();
}

QUrl url( txtUrl->text().trimmed() );
Expand Down
16 changes: 2 additions & 14 deletions src/providers/mssql/qgsmssqlnewconnection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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,
Expand All @@ -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();
Expand Down
7 changes: 2 additions & 5 deletions src/providers/oracle/qgsoraclenewconnection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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();
Expand All @@ -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();
}

Expand Down
4 changes: 2 additions & 2 deletions src/providers/postgres/qgspgnewconnection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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();
Expand Down

0 comments on commit 5bf316f

Please sign in to comment.