Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- From 460c475666740a88fe774f924e0faaaaff9e5705 Mon Sep 17 00:00:00 2001
- From: Thiago Macieira <thiago.macieira@nokia.com>
- Date: Wed, 14 Jul 2010 12:58:04 +0200
- Subject: [PATCH] Expose the QAuthenticator map of options in the API.
- Task-number: QT-3573
- Reviewed-By: pending
- ---
- src/network/kernel/qauthenticator.cpp | 45 +++++++++++++++++++++++++++++++-
- src/network/kernel/qauthenticator.h | 5 +++
- 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;
- --
- 1.7.1.572.gbd87c
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement