Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
deprecate reading/writing HttpHeaders in settings directly
  • Loading branch information
3nids committed Jan 16, 2023
1 parent 673f02d commit 5105e18
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
4 changes: 1 addition & 3 deletions src/core/network/qgshttpheaders.cpp
Expand Up @@ -35,7 +35,7 @@ const QString QgsHttpHeaders::KEY_REFERER = "referer";

QgsHttpHeaders::QgsHttpHeaders() = default;

QgsHttpHeaders::QgsHttpHeaders( const QMap<QString, QVariant> &headers )
QgsHttpHeaders::QgsHttpHeaders( const QVariantMap &headers )
: mHeaders( headers )
{
mHeaders.detach(); // clone like
Expand Down Expand Up @@ -135,8 +135,6 @@ bool QgsHttpHeaders::updateDomElement( QDomElement &el ) const
}




void QgsHttpHeaders::setFromSettings( const QgsSettings &settings, const QString &key )
{
QString keyFixed = sanitizeKey( key );
Expand Down
15 changes: 12 additions & 3 deletions src/core/network/qgshttpheaders.h
Expand Up @@ -25,6 +25,7 @@
#include "qgis_core.h"
#include "qgis_sip.h"
#include "qgssettingsentry.h"
#include "qgssettingsentryimpl.h"

class QNetworkRequest;
class QUrlQuery;
Expand Down Expand Up @@ -56,7 +57,7 @@ class CORE_EXPORT QgsHttpHeaders
* \brief Constructor from map
* \param headers
*/
QgsHttpHeaders( const QMap<QString, QVariant> &headers );
QgsHttpHeaders( const QVariantMap &headers );

/**
* \brief default constructor
Expand All @@ -67,8 +68,9 @@ class CORE_EXPORT QgsHttpHeaders
* \brief Constructor from QgsSettings \a settings object and root \a key
* \param settings
* \param key
* \deprecated since QGIS 3.30 use a variant map settings and the default constructor instead
*/
QgsHttpHeaders( const QgsSettings &settings, const QString &key = QString() );
Q_DECL_DEPRECATED QgsHttpHeaders( const QgsSettings &settings, const QString &key = QString() ) SIP_DEPRECATED;

/**
* \brief Constructor from default QgsSettings object and root \a key
Expand All @@ -85,6 +87,12 @@ class CORE_EXPORT QgsHttpHeaders
//! default detructor
virtual ~QgsHttpHeaders();

/**
* \brief reeturn the headers as a variant map
* \since QGIS 3.30
*/
QVariantMap headers() const {return mHeaders;}

/**
* \brief Updates the \a settings by adding all the http headers in the path "key/PATH_PREFIX/"
*
Expand All @@ -93,8 +101,9 @@ class CORE_EXPORT QgsHttpHeaders
* \param settings
* \param key sub group path
* \return TRUE if the update succeed
* \deprecated since QGIS 3.30 directly use a variant setting instead
*/
bool updateSettings( QgsSettings &settings, const QString &key = QString() ) const;
Q_DECL_DEPRECATED bool updateSettings( QgsSettings &settings, const QString &key = QString() ) const SIP_DEPRECATED;

/**
* \brief Updates a \a request by adding all the HTTP headers
Expand Down

0 comments on commit 5105e18

Please sign in to comment.