Navigation Menu

Skip to content

Commit

Permalink
back to wms only
Browse files Browse the repository at this point in the history
  • Loading branch information
Stefan Ziegler committed Mar 29, 2013
1 parent ade381f commit 1b7d94b
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 36 deletions.
6 changes: 0 additions & 6 deletions src/core/qgsowsconnection.cpp
Expand Up @@ -93,12 +93,6 @@ QgsOWSConnection::QgsOWSConnection( const QString & theService, const QString &
mUri.setParam( "password", password );
}

QString referer = settings.value( key + "/referer" ).toString();
if ( !referer.isEmpty() )
{
mUri.setParam( "referer", referer );
}

bool ignoreGetMap = settings.value( key + "/ignoreGetMapURI", false ).toBool();
bool ignoreGetFeatureInfo = settings.value( key + "/ignoreGetFeatureInfoURI", false ).toBool();
bool ignoreAxisOrientation = settings.value( key + "/ignoreAxisOrientation", false ).toBool();
Expand Down
4 changes: 1 addition & 3 deletions src/gui/qgsmanageconnectionsdialog.cpp
Expand Up @@ -345,10 +345,9 @@ QDomDocument QgsManageConnectionsDialog::saveOWSConnections( const QStringList &
el.setAttribute( "ignoreGetFeatureInfoURI", settings.value( path + connections[i] + "/ignoreGetFeatureInfoURI", false ).toBool() ? "true" : "false" );
el.setAttribute( "ignoreAxisOrientation", settings.value( path + connections[i] + "/ignoreAxisOrientation", false ).toBool() ? "true" : "false" );
el.setAttribute( "invertAxisOrientation", settings.value( path + connections[i] + "/invertAxisOrientation", false ).toBool() ? "true" : "false" );
el.setAttribute( "referer", settings.value( path + connections[ i ] + "/referer", "" ).toString() );
}

el.setAttribute( "referer", settings.value( path + connections[ i ] + "/referer", "" ).toString() );

path = "/Qgis/" + service.toUpper() + "/";
el.setAttribute( "username", settings.value( path + connections[ i ] + "/username", "" ).toString() );
el.setAttribute( "password", settings.value( path + connections[ i ] + "/password", "" ).toString() );
Expand Down Expand Up @@ -661,7 +660,6 @@ void QgsManageConnectionsDialog::loadWFSConnections( const QDomDocument &doc, co
// no dups detected or overwrite is allowed
settings.beginGroup( "/Qgis/connections-wfs" );
settings.setValue( QString( "/" + connectionName + "/url" ) , child.attribute( "url" ) );
settings.setValue( QString( "/" + connectionName + "/referer" ), child.attribute( "referer" ) );
settings.endGroup();

if ( !child.attribute( "username" ).isEmpty() )
Expand Down
5 changes: 5 additions & 0 deletions src/gui/qgsnewhttpconnection.cpp
Expand Up @@ -81,6 +81,11 @@ QgsNewHttpConnection::QgsNewHttpConnection(

cbxIgnoreGetFeatureInfoURI->setVisible( false );
mGroupBox->layout()->removeWidget( cbxIgnoreGetFeatureInfoURI );

txtReferer->setVisible( false );
mGroupBox->layout()->removeWidget( txtReferer );
lblReferer->setVisible( false );
mGroupBox->layout()->removeWidget( lblReferer );

// Adjust height
int w = width();
Expand Down
12 changes: 1 addition & 11 deletions src/providers/wfs/qgswfscapabilities.cpp
Expand Up @@ -36,7 +36,7 @@ QgsWFSCapabilities::QgsWFSCapabilities( QString theUri ) :
mBaseUrl = prepareUri( mUri.param( "url" ) );

QgsDebugMsg( "mBaseUrl = " + mBaseUrl );

//find out the server URL
/*
QSettings settings;
Expand Down Expand Up @@ -142,20 +142,10 @@ void QgsWFSCapabilities::requestCapabilities()

QNetworkRequest request( uriGetCapabilities() );
request.setAttribute( QNetworkRequest::CacheSaveControlAttribute, true );
setReferer( request );
mCapabilitiesReply = QgsNetworkAccessManager::instance()->get( request );
connect( mCapabilitiesReply, SIGNAL( finished() ), this, SLOT( capabilitiesReplyFinished() ) );
}

void QgsWFSCapabilities::setReferer( QNetworkRequest &request ) const
{
QString referer = mUri.param( "referer" );
if ( !referer.isNull() )
{
request.setRawHeader( "Referer", QString( "%1" ).arg( referer ).toAscii() );
}
}

void QgsWFSCapabilities::capabilitiesReplyFinished()
{
// handle network errors
Expand Down
6 changes: 1 addition & 5 deletions src/providers/wfs/qgswfscapabilities.h
Expand Up @@ -21,7 +21,6 @@
#include "qgsdatasourceuri.h"

class QNetworkReply;
class QNetworkRequest;

class QgsWFSCapabilities : public QObject
{
Expand All @@ -48,10 +47,7 @@ class QgsWFSCapabilities : public QObject

//! start network connection to get capabilities
void requestCapabilities();

//! set referer header
void setReferer( QNetworkRequest &request ) const;


//! description of a vector layer
struct FeatureType
{
Expand Down
16 changes: 8 additions & 8 deletions src/providers/wms/qgswmsprovider.cpp
Expand Up @@ -1522,7 +1522,7 @@ int QgsWmsProvider::bandCount() const
void QgsWmsProvider::capabilitiesReplyProgress( qint64 bytesReceived, qint64 bytesTotal )
{
QString msg = tr( "%1 of %2 bytes of capabilities downloaded." ).arg( bytesReceived ).arg( bytesTotal < 0 ? QString( "unknown number of" ) : QString::number( bytesTotal ) );
//QgsDebugMsg( msg );
QgsDebugMsg( msg );
emit statusChanged( msg );
}

Expand Down Expand Up @@ -1601,7 +1601,7 @@ bool QgsWmsProvider::parseCapabilitiesDom( QByteArray const &xml, QgsWmsCapabili
QDomElement e = n.toElement(); // try to convert the node to an element.
if ( !e.isNull() )
{
//QgsDebugMsg(e.tagName() ); // the node really is an element.
QgsDebugMsg(e.tagName() ); // the node really is an element.

if ( e.tagName() == "Service" || e.tagName() == "ows:ServiceProvider" || e.tagName() == "ows:ServiceIdentification" )
{
Expand Down Expand Up @@ -2236,7 +2236,7 @@ void QgsWmsProvider::parseLayer( QDomElement const & e, QgsWmsLayerProperty& lay
QDomElement e1 = n1.toElement(); // try to convert the node to an element.
if ( !e1.isNull() )
{
//QgsDebugMsg( " " + e1.tagName() ); // the node really is an element.
QgsDebugMsg( " " + e1.tagName() ); // the node really is an element.

QString tagName = e1.tagName();
if ( tagName.startsWith( "wms:" ) )
Expand Down Expand Up @@ -2718,13 +2718,13 @@ void QgsWmsProvider::parseWMTSContents( QDomElement const &e )

double res = m.scaleDenom * 0.00028 / metersPerUnit;

/*QgsDebugMsg( QString( " %1: scale=%2 res=%3 tile=%4x%5 matrix=%6x%7 topLeft=%8" )
QgsDebugMsg( QString( " %1: scale=%2 res=%3 tile=%4x%5 matrix=%6x%7 topLeft=%8" )
.arg( m.identifier )
.arg( m.scaleDenom ).arg( res )
.arg( m.tileWidth ).arg( m.tileHeight )
.arg( m.matrixWidth ).arg( m.matrixHeight )
.arg( m.topLeft.toString() )
);*/
);

s.tileMatrices.insert( res, m );
}
Expand All @@ -2742,7 +2742,7 @@ void QgsWmsProvider::parseWMTSContents( QDomElement const &e )
e0 = e0.nextSiblingElement( "Layer" ) )
{
QString id = e0.firstChildElement( "ows:Identifier" ).text();
//QgsDebugMsg( QString( "Layer %1" ).arg( id ) );
QgsDebugMsg( QString( "Layer %1" ).arg( id ) );

QgsWmtsTileLayer l;
l.tileMode = WMTS;
Expand Down Expand Up @@ -2940,7 +2940,7 @@ void QgsWmsProvider::parseWMTSContents( QDomElement const &e )
}
}

//QgsDebugMsg( QString( "add layer %1" ).arg( id ) );
QgsDebugMsg( QString( "add layer %1" ).arg( id ) );
mTileLayersSupported << l;
}

Expand Down Expand Up @@ -3010,7 +3010,7 @@ bool QgsWmsProvider::parseServiceExceptionReportDom( QByteArray const & xml )
QDomElement e = n.toElement(); // try to convert the node to an element.
if ( !e.isNull() )
{
//QgsDebugMsg(e.tagName() ); // the node really is an element.
QgsDebugMsg(e.tagName() ); // the node really is an element.

QString tagName = e.tagName();
if ( tagName.startsWith( "wms:" ) )
Expand Down
6 changes: 3 additions & 3 deletions src/ui/qgsnewhttpconnectionbase.ui
Expand Up @@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>475</width>
<height>400</height>
<height>415</height>
</rect>
</property>
<property name="windowTitle">
Expand Down Expand Up @@ -55,7 +55,7 @@
</sizepolicy>
</property>
<property name="text">
<string>If the service requires basic authentication, enter a user name, an optional password and an optional referer</string>
<string>If the service requires basic authentication, enter a user name and optional password</string>
</property>
<property name="textFormat">
<enum>Qt::PlainText</enum>
Expand Down Expand Up @@ -166,7 +166,7 @@
<widget class="QLineEdit" name="txtReferer"/>
</item>
<item row="7" column="0">
<widget class="QLabel" name="label_4">
<widget class="QLabel" name="lblReferer">
<property name="text">
<string>Referer</string>
</property>
Expand Down

0 comments on commit 1b7d94b

Please sign in to comment.