diff options
author | Thiago Macieira <thiago.macieira@nokia.com> | 2010-07-14 10:58:04 (GMT) |
---|---|---|
committer | Jason McDonald <jason.mcdonald@nokia.com> | 2010-07-16 06:57:22 (GMT) |
commit | 977daf857c7e690c6c8b11e9e72e84963a004e66 (patch) | |
tree | 6121c2b9909bab97a58b56b2aae90996ffe0fa5f /src/network | |
parent | bf11d9223cc6948ed88848b5a51585df1a22d236 (diff) | |
download | Qt-977daf857c7e690c6c8b11e9e72e84963a004e66.zip Qt-977daf857c7e690c6c8b11e9e72e84963a004e66.tar.gz Qt-977daf857c7e690c6c8b11e9e72e84963a004e66.tar.bz2 |
Expose the QAuthenticator map of options in the API.
Task-number: QT-3573
Reviewed-By: Markus Goetz
(cherry picked from commit 69027cdb2ab9b89673edf29d5034bed33e614a05)
Diffstat (limited to 'src/network')
-rw-r--r-- | src/network/kernel/qauthenticator.cpp | 45 | ||||
-rw-r--r-- | src/network/kernel/qauthenticator.h | 5 | ||||
-rw-r--r-- | src/network/kernel/qauthenticator_p.h | 3 |
3 files changed, 50 insertions, 3 deletions
diff --git a/src/network/kernel/qauthenticator.cpp b/src/network/kernel/qauthenticator.cpp index 0ea4fd4..ca8ec1c 100644 --- a/src/network/kernel/qauthenticator.cpp +++ b/src/network/kernel/qauthenticator.cpp @@ -140,7 +140,8 @@ bool QAuthenticator::operator==(const QAuthenticator &other) const return d->user == other.d->user && d->password == other.d->password && d->realm == other.d->realm - && d->method == other.d->method; + && d->method == other.d->method + && d->options == other.d->options; } /*! @@ -218,9 +219,49 @@ QString QAuthenticator::realm() const return d ? d->realm : QString(); } +/*! + \since 4.7 + Returns the value related to option \a opt if it was set by the server. + See \l{QAuthenticator#Options} for more information on incoming options. + If option \a opt isn't found, an invalid QVariant will be returned. + + \sa options(), QAuthenticator#Options +*/ +QVariant QAuthenticator::option(const QString &opt) const +{ + return d ? d->options.value(opt) : QVariant(); +} + +/*! + \since 4.7 + Returns all incoming options set in this QAuthenticator object by parsing + the server reply. See \l{QAuthenticator#Options} for more information + on incoming options. + + \sa option(), QAuthenticator#Options +*/ +QVariantHash QAuthenticator::options() const +{ + return d ? d->options : QVariantHash(); +} + +/*! + \since 4.7 + + Sets the outgoing option \a opt to value \a value. + See \l{QAuthenticator#Options} for more information on outgoing options. + + \sa options(), option(), QAuthenticator#Options +*/ +void QAuthenticator::setOption(const QString &opt, const QVariant &value) +{ + detach(); + d->options.insert(opt, value); +} + /*! - returns true if the authenticator is null. + Returns true if the authenticator is null. */ bool QAuthenticator::isNull() const { diff --git a/src/network/kernel/qauthenticator.h b/src/network/kernel/qauthenticator.h index 13ce593..983b7c0 100644 --- a/src/network/kernel/qauthenticator.h +++ b/src/network/kernel/qauthenticator.h @@ -43,6 +43,7 @@ #define QAUTHENTICATOR_H #include <QtCore/qstring.h> +#include <QtCore/qvariant.h> QT_BEGIN_HEADER @@ -73,6 +74,10 @@ public: QString realm() const; + QVariant option(const QString &opt) const; + QVariantHash options() const; + void setOption(const QString &opt, const QVariant &value); + bool isNull() const; void detach(); private: diff --git a/src/network/kernel/qauthenticator_p.h b/src/network/kernel/qauthenticator_p.h index abb1cda..665afef 100644 --- a/src/network/kernel/qauthenticator_p.h +++ b/src/network/kernel/qauthenticator_p.h @@ -57,6 +57,7 @@ #include <qbytearray.h> #include <qstring.h> #include <qauthenticator.h> +#include <qvariant.h> QT_BEGIN_NAMESPACE @@ -71,7 +72,7 @@ public: QAtomicInt ref; QString user; QString password; - QHash<QByteArray, QByteArray> options; + QVariantHash options; Method method; QString realm; QByteArray challenge; |