Skip to content

Commit df5ba53

Browse files
committed
WMS and WFS credential separated, credentials not yet used in WFS, it would be just another hack until we get a common class for uri encoding
1 parent 3f2e340 commit df5ba53

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

src/gui/qgsnewhttpconnection.cpp

+10-3
Original file line numberDiff line numberDiff line change
@@ -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() );

src/gui/qgsnewhttpconnection.h

+1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ class GUI_EXPORT QgsNewHttpConnection : public QDialog, private Ui::QgsNewHttpCo
4242

4343
private:
4444
QString mBaseKey;
45+
QString mCredentialsBaseKey;
4546
QString mOriginalConnName; //store initial name to delete entry in case of rename
4647
};
4748

src/providers/wfs/qgswfsconnection.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -252,4 +252,5 @@ void QgsWFSConnection::deleteConnection( QString name )
252252
{
253253
QSettings settings;
254254
settings.remove( "/Qgis/connections-wfs/" + name );
255+
settings.remove( "/Qgis/WFS/" + name );
255256
}

0 commit comments

Comments
 (0)