Skip to content

Commit

Permalink
Cleanup QgsOwsConnection
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Sep 12, 2017
1 parent 51922fc commit 4c87338
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 14 deletions.
36 changes: 28 additions & 8 deletions python/core/qgsowsconnection.sip
Expand Up @@ -28,6 +28,33 @@ class QgsOwsConnection : QObject
\param connName connection name
%End

QString connectionName() const;
%Docstring
Returns the connection name.
.. versionadded:: 3.0
:rtype: str
%End

QString connectionInfo() const;
%Docstring
Returns connection info string.
.. versionadded:: 3.0
:rtype: str
%End

QString service() const;
%Docstring
Returns a string representing the service type, e.g. "WMS".
.. versionadded:: 3.0
:rtype: str
%End

QgsDataSourceUri uri() const;
%Docstring
Returns the connection uri.
:rtype: QgsDataSourceUri
%End

static QStringList connectionList( const QString &service );
%Docstring
Returns the list of connections for the specified service
Expand All @@ -49,15 +76,8 @@ Retrieves the selected connection for the specified service
Marks the specified connection for the specified service as selected
%End

QString mConnName;
QgsDataSourceUri uri() const;
%Docstring
Returns the connection uri
:rtype: QgsDataSourceUri
%End
QString mConnectionInfo;

protected:

};


Expand Down
15 changes: 15 additions & 0 deletions src/core/qgsowsconnection.cpp
Expand Up @@ -106,6 +106,21 @@ QgsOwsConnection::QgsOwsConnection( const QString &service, const QString &connN
QgsDebugMsg( QString( "encoded uri: '%1'." ).arg( QString( mUri.encodedUri() ) ) );
}

QString QgsOwsConnection::connectionName() const
{
return mConnName;
}

QString QgsOwsConnection::connectionInfo() const
{
return mConnectionInfo;
}

QString QgsOwsConnection::service() const
{
return mService;
}

QgsDataSourceUri QgsOwsConnection::uri() const
{
return mUri;
Expand Down
34 changes: 29 additions & 5 deletions src/core/qgsowsconnection.h
Expand Up @@ -44,6 +44,29 @@ class CORE_EXPORT QgsOwsConnection : public QObject
*/
QgsOwsConnection( const QString &service, const QString &connName );

/**
* Returns the connection name.
* \since QGIS 3.0
*/
QString connectionName() const;

/**
* Returns connection info string.
* \since QGIS 3.0
*/
QString connectionInfo() const;

/**
* Returns a string representing the service type, e.g. "WMS".
* \since QGIS 3.0
*/
QString service() const;

/**
* Returns the connection uri.
*/
QgsDataSourceUri uri() const;

//! Returns the list of connections for the specified service
static QStringList connectionList( const QString &service );

Expand All @@ -55,14 +78,15 @@ class CORE_EXPORT QgsOwsConnection : public QObject
//! Marks the specified connection for the specified service as selected
static void setSelectedConnection( const QString &service, const QString &name );

QString mConnName;
//! Returns the connection uri
QgsDataSourceUri uri() const;
QString mConnectionInfo;

protected:
QgsDataSourceUri mUri;

private:

QString mConnName;
QString mService;
QString mConnectionInfo;

};


Expand Down
2 changes: 1 addition & 1 deletion src/providers/wfs/qgswfsconnection.cpp
Expand Up @@ -21,7 +21,7 @@
QgsWfsConnection::QgsWfsConnection( const QString &connName )
: QgsOwsConnection( QStringLiteral( "WFS" ), connName )
{
const QString &key = QgsWFSConstants::CONNECTIONS_WFS + mConnName;
const QString &key = QgsWFSConstants::CONNECTIONS_WFS + connectionName();

QgsSettings settings;

Expand Down

0 comments on commit 4c87338

Please sign in to comment.