Index: src/app/qgsnewhttpconnection.cpp =================================================================== --- src/app/qgsnewhttpconnection.cpp (revision 12347) +++ src/app/qgsnewhttpconnection.cpp (working copy) @@ -17,6 +17,7 @@ /* $Id$ */ #include "qgsnewhttpconnection.h" #include "qgscontexthelp.h" +#include #include QgsNewHttpConnection::QgsNewHttpConnection( @@ -51,6 +52,23 @@ void QgsNewHttpConnection::accept() { QSettings settings; + + // check for existing coection with the same name + settings.beginGroup( "/Qgis/connections-wms" ); + QStringList keys = settings.childGroups(); + if ( keys.contains( txtName->text() ) ) + { + int res = QMessageBox::question( this, + tr( "Save connection" ), + tr( "Conection with name %1 already exists. Overwrite?" ).arg( txtName->text() ), + QMessageBox::Yes | QMessageBox::No ); + if ( res != QMessageBox::Yes ) + { + return; + } + } + settings.endGroup(); + QString key = mBaseKey + txtName->text(); QString credentialsKey = "/Qgis/WMS/" + txtName->text();