@@ -29,6 +29,13 @@ QgsNewHttpConnection::QgsNewHttpConnection(
2929{
3030 setupUi ( this );
3131
32+ // It would be obviously much better to use mBaseKey also for credentials,
33+ // but for some strange reason a different hardcoded key was used instead.
34+ // WFS and WMS credentials were mixed with the same key WMS.
35+ // Only WMS and WFS providers are using QgsNewHttpConnection at this moment
36+ // using connection-wms and connection-wfs -> parse credential key fro it.
37+ mCredentialsBaseKey = mBaseKey .split ( ' -' ).last ().toUpper ();
38+
3239 if ( !connName.isEmpty () )
3340 {
3441 // populate the dialog with the information stored for the connection
@@ -37,7 +44,7 @@ QgsNewHttpConnection::QgsNewHttpConnection(
3744 QSettings settings;
3845
3946 QString key = mBaseKey + connName;
40- QString credentialsKey = " /Qgis/WMS /" + connName;
47+ QString credentialsKey = " /Qgis/" + mCredentialsBaseKey + " /" + connName;
4148 txtName->setText ( connName );
4249 txtUrl->setText ( settings.value ( key + " /url" ).toString () );
4350
@@ -72,7 +79,7 @@ void QgsNewHttpConnection::accept()
7279{
7380 QSettings settings;
7481 QString key = mBaseKey + txtName->text ();
75- QString credentialsKey = " /Qgis/WMS /" + txtName->text ();
82+ QString credentialsKey = " /Qgis/" + mCredentialsBaseKey + " /" + txtName->text ();
7683
7784 // warn if entry was renamed to an existing connection
7885 if (( mOriginalConnName .isNull () || mOriginalConnName != txtName->text () ) &&
@@ -89,7 +96,7 @@ void QgsNewHttpConnection::accept()
8996 if ( !mOriginalConnName .isNull () && mOriginalConnName != key )
9097 {
9198 settings.remove ( mBaseKey + mOriginalConnName );
92- settings.remove ( " /Qgis/WMS /" + mOriginalConnName );
99+ settings.remove ( " /Qgis/" + mCredentialsBaseKey + " /" + mOriginalConnName );
93100 }
94101
95102 QUrl url ( txtUrl->text ().trimmed () );
0 commit comments