Skip to content

Commit

Permalink
WMS and WFS credential separated, credentials not yet used in WFS, it…
Browse files Browse the repository at this point in the history
… would be just another hack until we get a common class for uri encoding
  • Loading branch information
blazek committed Feb 15, 2012
1 parent 3f2e340 commit df5ba53
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/gui/qgsnewhttpconnection.cpp
Expand Up @@ -29,6 +29,13 @@ QgsNewHttpConnection::QgsNewHttpConnection(
{
setupUi( this );

// It would be obviously much better to use mBaseKey also for credentials,
// but for some strange reason a different hardcoded key was used instead.
// WFS and WMS credentials were mixed with the same key WMS.
// Only WMS and WFS providers are using QgsNewHttpConnection at this moment
// using connection-wms and connection-wfs -> parse credential key fro it.
mCredentialsBaseKey = mBaseKey.split( '-' ).last().toUpper();

if ( !connName.isEmpty() )
{
// populate the dialog with the information stored for the connection
Expand All @@ -37,7 +44,7 @@ QgsNewHttpConnection::QgsNewHttpConnection(
QSettings settings;

QString key = mBaseKey + connName;
QString credentialsKey = "/Qgis/WMS/" + connName;
QString credentialsKey = "/Qgis/" + mCredentialsBaseKey + "/" + connName;
txtName->setText( connName );
txtUrl->setText( settings.value( key + "/url" ).toString() );

Expand Down Expand Up @@ -72,7 +79,7 @@ void QgsNewHttpConnection::accept()
{
QSettings settings;
QString key = mBaseKey + txtName->text();
QString credentialsKey = "/Qgis/WMS/" + txtName->text();
QString credentialsKey = "/Qgis/" + mCredentialsBaseKey + "/" + txtName->text();

// warn if entry was renamed to an existing connection
if (( mOriginalConnName.isNull() || mOriginalConnName != txtName->text() ) &&
Expand All @@ -89,7 +96,7 @@ void QgsNewHttpConnection::accept()
if ( !mOriginalConnName.isNull() && mOriginalConnName != key )
{
settings.remove( mBaseKey + mOriginalConnName );
settings.remove( "/Qgis/WMS/" + mOriginalConnName );
settings.remove( "/Qgis/" + mCredentialsBaseKey + "/" + mOriginalConnName );
}

QUrl url( txtUrl->text().trimmed() );
Expand Down
1 change: 1 addition & 0 deletions src/gui/qgsnewhttpconnection.h
Expand Up @@ -42,6 +42,7 @@ class GUI_EXPORT QgsNewHttpConnection : public QDialog, private Ui::QgsNewHttpCo

private:
QString mBaseKey;
QString mCredentialsBaseKey;
QString mOriginalConnName; //store initial name to delete entry in case of rename
};

Expand Down
1 change: 1 addition & 0 deletions src/providers/wfs/qgswfsconnection.cpp
Expand Up @@ -252,4 +252,5 @@ void QgsWFSConnection::deleteConnection( QString name )
{
QSettings settings;
settings.remove( "/Qgis/connections-wfs/" + name );
settings.remove( "/Qgis/WFS/" + name );
}

0 comments on commit df5ba53

Please sign in to comment.