Skip to content
Permalink
Browse files
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
  • Loading branch information
blazek committed Feb 15, 2012
1 parent 3f2e340 commit df5ba53d4abdc4a87dc4477c46f5e8675722eb0c
Showing with 12 additions and 3 deletions.
  1. +10 −3 src/gui/qgsnewhttpconnection.cpp
  2. +1 −0 src/gui/qgsnewhttpconnection.h
  3. +1 −0 src/providers/wfs/qgswfsconnection.cpp
@@ -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
@@ -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() );

@@ -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() ) &&
@@ -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() );
@@ -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
};

@@ -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.