@@ -29,6 +29,13 @@ QgsNewHttpConnection::QgsNewHttpConnection(
29
29
{
30
30
setupUi ( this );
31
31
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
+
32
39
if ( !connName.isEmpty () )
33
40
{
34
41
// populate the dialog with the information stored for the connection
@@ -37,7 +44,7 @@ QgsNewHttpConnection::QgsNewHttpConnection(
37
44
QSettings settings;
38
45
39
46
QString key = mBaseKey + connName;
40
- QString credentialsKey = " /Qgis/WMS /" + connName;
47
+ QString credentialsKey = " /Qgis/" + mCredentialsBaseKey + " /" + connName;
41
48
txtName->setText ( connName );
42
49
txtUrl->setText ( settings.value ( key + " /url" ).toString () );
43
50
@@ -72,7 +79,7 @@ void QgsNewHttpConnection::accept()
72
79
{
73
80
QSettings settings;
74
81
QString key = mBaseKey + txtName->text ();
75
- QString credentialsKey = " /Qgis/WMS /" + txtName->text ();
82
+ QString credentialsKey = " /Qgis/" + mCredentialsBaseKey + " /" + txtName->text ();
76
83
77
84
// warn if entry was renamed to an existing connection
78
85
if (( mOriginalConnName .isNull () || mOriginalConnName != txtName->text () ) &&
@@ -89,7 +96,7 @@ void QgsNewHttpConnection::accept()
89
96
if ( !mOriginalConnName .isNull () && mOriginalConnName != key )
90
97
{
91
98
settings.remove ( mBaseKey + mOriginalConnName );
92
- settings.remove ( " /Qgis/WMS /" + mOriginalConnName );
99
+ settings.remove ( " /Qgis/" + mCredentialsBaseKey + " /" + mOriginalConnName );
93
100
}
94
101
95
102
QUrl url ( txtUrl->text ().trimmed () );
0 commit comments