Advertisement
Guest User

Untitled

a guest
Jun 4th, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 3.53 KB | None | 0 0
  1. From 460c475666740a88fe774f924e0faaaaff9e5705 Mon Sep 17 00:00:00 2001
  2. From: Thiago Macieira <thiago.macieira@nokia.com>
  3. Date: Wed, 14 Jul 2010 12:58:04 +0200
  4. Subject: [PATCH] Expose the QAuthenticator map of options in the API.
  5.  
  6. Task-number: QT-3573
  7. Reviewed-By: pending
  8. ---
  9. src/network/kernel/qauthenticator.cpp |   45 +++++++++++++++++++++++++++++++-
  10.  src/network/kernel/qauthenticator.h   |    5 +++
  11.  src/network/kernel/qauthenticator_p.h |    3 +-
  12.  3 files changed, 50 insertions(+), 3 deletions(-)
  13.  
  14. diff --git a/src/network/kernel/qauthenticator.cpp b/src/network/kernel/qauthenticator.cpp
  15. index 0ea4fd4..ca8ec1c 100644
  16. --- a/src/network/kernel/qauthenticator.cpp
  17. +++ b/src/network/kernel/qauthenticator.cpp
  18. @@ -140,7 +140,8 @@ bool QAuthenticator::operator==(const QAuthenticator &other) const
  19.      return d->user == other.d->user
  20.          && d->password == other.d->password
  21.          && d->realm == other.d->realm
  22. -        && d->method == other.d->method;
  23. +        && d->method == other.d->method
  24. +        && d->options == other.d->options;
  25.  }
  26.  
  27.  /*!
  28. @@ -218,9 +219,49 @@ QString QAuthenticator::realm() const
  29.      return d ? d->realm : QString();
  30.  }
  31.  
  32. +/*!
  33. +    \since 4.7
  34. +    Returns the value related to option \a opt if it was set by the server.
  35. +    See \l{QAuthenticator#Options} for more information on incoming options.
  36. +    If option \a opt isn't found, an invalid QVariant will be returned.
  37. +
  38. +    \sa options(), QAuthenticator#Options
  39. +*/
  40. +QVariant QAuthenticator::option(const QString &opt) const
  41. +{
  42. +    return d ? d->options.value(opt) : QVariant();
  43. +}
  44. +
  45. +/*!
  46. +    \since 4.7
  47. +    Returns all incoming options set in this QAuthenticator object by parsing
  48. +    the server reply. See \l{QAuthenticator#Options} for more information
  49. +    on incoming options.
  50. +
  51. +    \sa option(), QAuthenticator#Options
  52. +*/
  53. +QVariantHash QAuthenticator::options() const
  54. +{
  55. +    return d ? d->options : QVariantHash();
  56. +}
  57. +
  58. +/*!
  59. +    \since 4.7
  60. +
  61. +    Sets the outgoing option \a opt to value \a value.
  62. +    See \l{QAuthenticator#Options} for more information on outgoing options.
  63. +
  64. +    \sa options(), option(), QAuthenticator#Options
  65. +*/
  66. +void QAuthenticator::setOption(const QString &opt, const QVariant &value)
  67. +{
  68. +    detach();
  69. +    d->options.insert(opt, value);
  70. +}
  71. +
  72.  
  73.  /*!
  74. -  returns true if the authenticator is null.
  75. +    Returns true if the authenticator is null.
  76.  */
  77.  bool QAuthenticator::isNull() const
  78.  {
  79. diff --git a/src/network/kernel/qauthenticator.h b/src/network/kernel/qauthenticator.h
  80. index 13ce593..983b7c0 100644
  81. --- a/src/network/kernel/qauthenticator.h
  82. +++ b/src/network/kernel/qauthenticator.h
  83. @@ -43,6 +43,7 @@
  84.  #define QAUTHENTICATOR_H
  85.  
  86.  #include <QtCore/qstring.h>
  87. +#include <QtCore/qvariant.h>
  88.  
  89.  QT_BEGIN_HEADER
  90.  
  91. @@ -73,6 +74,10 @@ public:
  92.  
  93.      QString realm() const;
  94.  
  95. +    QVariant option(const QString &opt) const;
  96. +    QVariantHash options() const;
  97. +    void setOption(const QString &opt, const QVariant &value);
  98. +
  99.      bool isNull() const;
  100.      void detach();
  101.  private:
  102. diff --git a/src/network/kernel/qauthenticator_p.h b/src/network/kernel/qauthenticator_p.h
  103. index abb1cda..665afef 100644
  104. --- a/src/network/kernel/qauthenticator_p.h
  105. +++ b/src/network/kernel/qauthenticator_p.h
  106. @@ -57,6 +57,7 @@
  107.  #include <qbytearray.h>
  108.  #include <qstring.h>
  109.  #include <qauthenticator.h>
  110. +#include <qvariant.h>
  111.  
  112.  QT_BEGIN_NAMESPACE
  113.  
  114. @@ -71,7 +72,7 @@ public:
  115.      QAtomicInt ref;
  116.      QString user;
  117.      QString password;
  118. -    QHash<QByteArray, QByteArray> options;
  119. +    QVariantHash options;
  120.      Method method;
  121.      QString realm;
  122.      QByteArray challenge;
  123. --
  124. 1.7.1.572.gbd87c
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement