otherinbox-capybara-webkit 0.12.0 → 0.12.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (110) hide show
  1. data/GOALS +9 -0
  2. data/README.md +1 -1
  3. data/capybara-webkit.gemspec +1 -1
  4. data/lib/capybara/webkit.rb +11 -4
  5. data/lib/capybara/{driver/webkit → webkit}/browser.rb +27 -3
  6. data/lib/capybara/{driver/webkit → webkit}/connection.rb +45 -47
  7. data/lib/capybara/{driver/webkit → webkit}/cookie_jar.rb +1 -1
  8. data/lib/capybara/webkit/driver.rb +150 -0
  9. data/lib/capybara/webkit/errors.rb +10 -0
  10. data/lib/capybara/{driver/webkit → webkit}/node.rb +2 -2
  11. data/lib/capybara/{driver/webkit → webkit}/socket_debugger.rb +1 -1
  12. data/lib/capybara/{driver/webkit → webkit}/version.rb +1 -1
  13. data/lib/capybara_webkit_builder.rb +17 -3
  14. data/spec/browser_spec.rb +38 -25
  15. data/spec/connection_spec.rb +5 -5
  16. data/spec/cookie_jar_spec.rb +3 -3
  17. data/spec/driver_rendering_spec.rb +19 -26
  18. data/spec/driver_resize_window_spec.rb +3 -3
  19. data/spec/driver_spec.rb +907 -829
  20. data/spec/integration/driver_spec.rb +4 -3
  21. data/spec/spec_helper.rb +14 -6
  22. data/spec/support/app_runner.rb +91 -0
  23. data/src/Authenticate.cpp +18 -0
  24. data/src/Authenticate.h +12 -0
  25. data/src/Body.h +3 -5
  26. data/src/ClearCookies.cpp +3 -5
  27. data/src/ClearCookies.h +3 -5
  28. data/src/Command.cpp +4 -15
  29. data/src/Command.h +3 -14
  30. data/src/CommandFactory.cpp +10 -6
  31. data/src/CommandFactory.h +3 -2
  32. data/src/CommandParser.cpp +1 -1
  33. data/src/Connection.cpp +22 -11
  34. data/src/Connection.h +4 -2
  35. data/src/ConsoleMessages.cpp +2 -1
  36. data/src/ConsoleMessages.h +3 -5
  37. data/src/CurrentUrl.cpp +2 -1
  38. data/src/CurrentUrl.h +3 -5
  39. data/src/EnableLogging.cpp +10 -0
  40. data/src/EnableLogging.h +12 -0
  41. data/src/Evaluate.cpp +2 -1
  42. data/src/Evaluate.h +3 -5
  43. data/src/Execute.cpp +2 -1
  44. data/src/Execute.h +3 -5
  45. data/src/Find.cpp +3 -2
  46. data/src/Find.h +3 -5
  47. data/src/FrameFocus.cpp +3 -2
  48. data/src/FrameFocus.h +3 -4
  49. data/src/GetCookies.cpp +3 -4
  50. data/src/GetCookies.h +3 -5
  51. data/src/GetWindowHandle.cpp +11 -0
  52. data/src/GetWindowHandle.h +10 -0
  53. data/src/GetWindowHandles.cpp +20 -0
  54. data/src/GetWindowHandles.h +10 -0
  55. data/src/Header.cpp +2 -1
  56. data/src/Header.h +3 -5
  57. data/src/Headers.cpp +2 -1
  58. data/src/Headers.h +3 -5
  59. data/src/IgnoreSslErrors.cpp +4 -3
  60. data/src/IgnoreSslErrors.h +3 -5
  61. data/src/JavascriptInvocation.cpp +1 -1
  62. data/src/JavascriptInvocation.h +1 -1
  63. data/src/NetworkAccessManager.cpp +19 -1
  64. data/src/NetworkAccessManager.h +10 -0
  65. data/src/Node.cpp +6 -1
  66. data/src/Node.h +4 -5
  67. data/src/NullCommand.cpp +5 -2
  68. data/src/NullCommand.h +4 -3
  69. data/src/PageLoadingCommand.cpp +12 -7
  70. data/src/PageLoadingCommand.h +6 -9
  71. data/src/Render.cpp +2 -1
  72. data/src/Render.h +3 -5
  73. data/src/RequestedUrl.cpp +2 -1
  74. data/src/RequestedUrl.h +3 -5
  75. data/src/Reset.cpp +3 -17
  76. data/src/Reset.h +3 -8
  77. data/src/ResizeWindow.cpp +2 -1
  78. data/src/ResizeWindow.h +3 -5
  79. data/src/Server.cpp +2 -3
  80. data/src/Server.h +0 -2
  81. data/src/SetCookie.cpp +3 -4
  82. data/src/SetCookie.h +3 -5
  83. data/src/SetProxy.cpp +2 -1
  84. data/src/SetProxy.h +3 -5
  85. data/src/SetSkipImageLoading.cpp +3 -2
  86. data/src/SetSkipImageLoading.h +3 -5
  87. data/src/SocketCommand.cpp +21 -0
  88. data/src/SocketCommand.h +29 -0
  89. data/src/Source.cpp +2 -1
  90. data/src/Source.h +3 -4
  91. data/src/Status.cpp +2 -1
  92. data/src/Status.h +3 -5
  93. data/src/UnsupportedContentHandler.cpp +1 -1
  94. data/src/Url.cpp +2 -1
  95. data/src/Url.h +3 -5
  96. data/src/Visit.cpp +3 -2
  97. data/src/Visit.h +3 -5
  98. data/src/WebPage.cpp +86 -39
  99. data/src/WebPage.h +22 -8
  100. data/src/WebPageManager.cpp +117 -0
  101. data/src/WebPageManager.h +56 -0
  102. data/src/WindowFocus.cpp +32 -0
  103. data/src/WindowFocus.h +15 -0
  104. data/src/body.cpp +2 -1
  105. data/src/find_command.h +6 -2
  106. data/src/webkit_server.pro +14 -0
  107. data/templates/Command.cpp +2 -4
  108. data/templates/Command.h +3 -3
  109. metadata +29 -10
  110. data/lib/capybara/driver/webkit.rb +0 -135
data/src/Connection.h CHANGED
@@ -8,12 +8,13 @@ class Response;
8
8
  class CommandParser;
9
9
  class CommandFactory;
10
10
  class PageLoadingCommand;
11
+ class WebPageManager;
11
12
 
12
13
  class Connection : public QObject {
13
14
  Q_OBJECT
14
15
 
15
16
  public:
16
- Connection(QTcpSocket *socket, WebPage *page, QObject *parent = 0);
17
+ Connection(QTcpSocket *socket, WebPageManager *manager, QObject *parent = 0);
17
18
 
18
19
  public slots:
19
20
  void commandReady(Command *command);
@@ -27,11 +28,12 @@ class Connection : public QObject {
27
28
 
28
29
  QTcpSocket *m_socket;
29
30
  Command *m_queuedCommand;
30
- WebPage *m_page;
31
+ WebPageManager *m_manager;
31
32
  CommandParser *m_commandParser;
32
33
  CommandFactory *m_commandFactory;
33
34
  PageLoadingCommand *m_runningCommand;
34
35
  bool m_pageSuccess;
35
36
  bool m_commandWaiting;
37
+ WebPage *currentPage();
36
38
  };
37
39
 
@@ -1,7 +1,8 @@
1
1
  #include "ConsoleMessages.h"
2
2
  #include "WebPage.h"
3
+ #include "WebPageManager.h"
3
4
 
4
- ConsoleMessages::ConsoleMessages(WebPage *page, QStringList &arguments, QObject *parent) : Command(page, arguments, parent) {
5
+ ConsoleMessages::ConsoleMessages(WebPageManager *manager, QStringList &arguments, QObject *parent) : SocketCommand(manager, arguments, parent) {
5
6
  }
6
7
 
7
8
  void ConsoleMessages::start() {
@@ -1,12 +1,10 @@
1
- #include "Command.h"
1
+ #include "SocketCommand.h"
2
2
 
3
- class WebPage;
4
-
5
- class ConsoleMessages : public Command {
3
+ class ConsoleMessages : public SocketCommand {
6
4
  Q_OBJECT
7
5
 
8
6
  public:
9
- ConsoleMessages(WebPage *page, QStringList &arguments, QObject *parent = 0);
7
+ ConsoleMessages(WebPageManager *, QStringList &arguments, QObject *parent = 0);
10
8
  virtual void start();
11
9
  };
12
10
 
data/src/CurrentUrl.cpp CHANGED
@@ -1,7 +1,8 @@
1
1
  #include "CurrentUrl.h"
2
2
  #include "WebPage.h"
3
+ #include "WebPageManager.h"
3
4
 
4
- CurrentUrl::CurrentUrl(WebPage *page, QStringList &arguments, QObject *parent) : Command(page, arguments, parent) {
5
+ CurrentUrl::CurrentUrl(WebPageManager *manager, QStringList &arguments, QObject *parent) : SocketCommand(manager, arguments, parent) {
5
6
  }
6
7
 
7
8
  /*
data/src/CurrentUrl.h CHANGED
@@ -1,12 +1,10 @@
1
- #include "Command.h"
1
+ #include "SocketCommand.h"
2
2
 
3
- class WebPage;
4
-
5
- class CurrentUrl : public Command {
3
+ class CurrentUrl : public SocketCommand {
6
4
  Q_OBJECT
7
5
 
8
6
  public:
9
- CurrentUrl(WebPage *page, QStringList &arguments, QObject *parent = 0);
7
+ CurrentUrl(WebPageManager *, QStringList &arguments, QObject *parent = 0);
10
8
  virtual void start();
11
9
 
12
10
  private:
@@ -0,0 +1,10 @@
1
+ #include "EnableLogging.h"
2
+ #include "WebPageManager.h"
3
+
4
+ EnableLogging::EnableLogging(WebPageManager *manager, QStringList &arguments, QObject *parent) : SocketCommand(manager, arguments, parent) {
5
+ }
6
+
7
+ void EnableLogging::start() {
8
+ manager()->enableLogging();
9
+ emit finished(new Response(true));
10
+ }
@@ -0,0 +1,12 @@
1
+ #include "SocketCommand.h"
2
+
3
+ class WebPageManager;
4
+
5
+ class EnableLogging : public SocketCommand {
6
+ Q_OBJECT
7
+
8
+ public:
9
+ EnableLogging(WebPageManager *, QStringList &arguments, QObject *parent = 0);
10
+ virtual void start();
11
+ };
12
+
data/src/Evaluate.cpp CHANGED
@@ -1,8 +1,9 @@
1
1
  #include "Evaluate.h"
2
2
  #include "WebPage.h"
3
+ #include "WebPageManager.h"
3
4
  #include <iostream>
4
5
 
5
- Evaluate::Evaluate(WebPage *page, QStringList &arguments, QObject *parent) : Command(page, arguments, parent) {
6
+ Evaluate::Evaluate(WebPageManager *manager, QStringList &arguments, QObject *parent) : SocketCommand(manager, arguments, parent) {
6
7
  m_buffer = "";
7
8
  }
8
9
 
data/src/Evaluate.h CHANGED
@@ -1,14 +1,12 @@
1
- #include "Command.h"
1
+ #include "SocketCommand.h"
2
2
 
3
3
  #include <QVariantList>
4
4
 
5
- class WebPage;
6
-
7
- class Evaluate : public Command {
5
+ class Evaluate : public SocketCommand {
8
6
  Q_OBJECT
9
7
 
10
8
  public:
11
- Evaluate(WebPage *page, QStringList &arguments, QObject *parent = 0);
9
+ Evaluate(WebPageManager *, QStringList &arguments, QObject *parent = 0);
12
10
  virtual void start();
13
11
 
14
12
  private:
data/src/Execute.cpp CHANGED
@@ -1,7 +1,8 @@
1
1
  #include "Execute.h"
2
2
  #include "WebPage.h"
3
+ #include "WebPageManager.h"
3
4
 
4
- Execute::Execute(WebPage *page, QStringList &arguments, QObject *parent) : Command(page, arguments, parent) {
5
+ Execute::Execute(WebPageManager *manager, QStringList &arguments, QObject *parent) : SocketCommand(manager, arguments, parent) {
5
6
  }
6
7
 
7
8
  void Execute::start() {
data/src/Execute.h CHANGED
@@ -1,12 +1,10 @@
1
- #include "Command.h"
1
+ #include "SocketCommand.h"
2
2
 
3
- class WebPage;
4
-
5
- class Execute : public Command {
3
+ class Execute : public SocketCommand {
6
4
  Q_OBJECT
7
5
 
8
6
  public:
9
- Execute(WebPage *page, QStringList &arguments, QObject *parent = 0);
7
+ Execute(WebPageManager *, QStringList &arguments, QObject *parent = 0);
10
8
  virtual void start();
11
9
  };
12
10
 
data/src/Find.cpp CHANGED
@@ -1,8 +1,9 @@
1
1
  #include "Find.h"
2
- #include "Command.h"
2
+ #include "SocketCommand.h"
3
3
  #include "WebPage.h"
4
+ #include "WebPageManager.h"
4
5
 
5
- Find::Find(WebPage *page, QStringList &arguments, QObject *parent) : Command(page, arguments, parent) {
6
+ Find::Find(WebPageManager *manager, QStringList &arguments, QObject *parent) : SocketCommand(manager, arguments, parent) {
6
7
  }
7
8
 
8
9
  void Find::start() {
data/src/Find.h CHANGED
@@ -1,12 +1,10 @@
1
- #include "Command.h"
1
+ #include "SocketCommand.h"
2
2
 
3
- class WebPage;
4
-
5
- class Find : public Command {
3
+ class Find : public SocketCommand {
6
4
  Q_OBJECT
7
5
 
8
6
  public:
9
- Find(WebPage *page, QStringList &arguments, QObject *parent = 0);
7
+ Find(WebPageManager *, QStringList &arguments, QObject *parent = 0);
10
8
  virtual void start();
11
9
  };
12
10
 
data/src/FrameFocus.cpp CHANGED
@@ -1,8 +1,9 @@
1
1
  #include "FrameFocus.h"
2
- #include "Command.h"
2
+ #include "SocketCommand.h"
3
3
  #include "WebPage.h"
4
+ #include "WebPageManager.h"
4
5
 
5
- FrameFocus::FrameFocus(WebPage *page, QStringList &arguments, QObject *parent) : Command(page, arguments, parent) {
6
+ FrameFocus::FrameFocus(WebPageManager *manager, QStringList &arguments, QObject *parent) : SocketCommand(manager, arguments, parent) {
6
7
  }
7
8
 
8
9
  void FrameFocus::start() {
data/src/FrameFocus.h CHANGED
@@ -1,13 +1,12 @@
1
- #include "Command.h"
1
+ #include "SocketCommand.h"
2
2
 
3
- class WebPage;
4
3
  class QWebFrame;
5
4
 
6
- class FrameFocus : public Command {
5
+ class FrameFocus : public SocketCommand {
7
6
  Q_OBJECT
8
7
 
9
8
  public:
10
- FrameFocus(WebPage *page, QStringList &arguments, QObject *parent = 0);
9
+ FrameFocus(WebPageManager *, QStringList &arguments, QObject *parent = 0);
11
10
  virtual void start();
12
11
 
13
12
  private:
data/src/GetCookies.cpp CHANGED
@@ -1,17 +1,16 @@
1
1
  #include "GetCookies.h"
2
2
  #include "WebPage.h"
3
+ #include "WebPageManager.h"
3
4
  #include "NetworkCookieJar.h"
4
5
 
5
- GetCookies::GetCookies(WebPage *page, QStringList &arguments, QObject *parent) : Command(page, arguments, parent)
6
+ GetCookies::GetCookies(WebPageManager *manager, QStringList &arguments, QObject *parent) : SocketCommand(manager, arguments, parent)
6
7
  {
7
8
  m_buffer = "";
8
9
  }
9
10
 
10
11
  void GetCookies::start()
11
12
  {
12
- NetworkCookieJar *jar = qobject_cast<NetworkCookieJar*>(page()
13
- ->networkAccessManager()
14
- ->cookieJar());
13
+ NetworkCookieJar *jar = manager()->cookieJar();
15
14
  foreach (QNetworkCookie cookie, jar->getAllCookies()) {
16
15
  m_buffer.append(cookie.toRawForm());
17
16
  m_buffer.append("\n");
data/src/GetCookies.h CHANGED
@@ -1,12 +1,10 @@
1
- #include "Command.h"
1
+ #include "SocketCommand.h"
2
2
 
3
- class WebPage;
4
-
5
- class GetCookies : public Command {
3
+ class GetCookies : public SocketCommand {
6
4
  Q_OBJECT;
7
5
 
8
6
  public:
9
- GetCookies(WebPage *page, QStringList &arguments, QObject *parent = 0);
7
+ GetCookies(WebPageManager *, QStringList &arguments, QObject *parent = 0);
10
8
  virtual void start();
11
9
 
12
10
  private:
@@ -0,0 +1,11 @@
1
+ #include "GetWindowHandle.h"
2
+ #include "WebPage.h"
3
+ #include "WebPageManager.h"
4
+ #include <QStringList>
5
+
6
+ GetWindowHandle::GetWindowHandle(WebPageManager *manager, QStringList &arguments, QObject *parent) : SocketCommand(manager, arguments, parent) {
7
+ }
8
+
9
+ void GetWindowHandle::start() {
10
+ emit finished(new Response(true, page()->uuid()));
11
+ }
@@ -0,0 +1,10 @@
1
+ #include "SocketCommand.h"
2
+
3
+ class GetWindowHandle : public SocketCommand {
4
+ Q_OBJECT
5
+
6
+ public:
7
+ GetWindowHandle(WebPageManager *, QStringList &arguments, QObject *parent = 0);
8
+ virtual void start();
9
+ };
10
+
@@ -0,0 +1,20 @@
1
+ #include "GetWindowHandles.h"
2
+ #include "WebPageManager.h"
3
+ #include "CommandFactory.h"
4
+ #include "WebPage.h"
5
+ #include <QStringList>
6
+
7
+ GetWindowHandles::GetWindowHandles(WebPageManager *manager, QStringList &arguments, QObject *parent) : SocketCommand(manager, arguments, parent) {
8
+ }
9
+
10
+ void GetWindowHandles::start() {
11
+ QString handles = "[";
12
+ QStringList stringList;
13
+
14
+ foreach(WebPage *page, manager()->pages())
15
+ stringList.append("\"" + page->uuid() + "\"");
16
+
17
+ handles += stringList.join(",") + "]";
18
+
19
+ emit finished(new Response(true, handles));
20
+ }
@@ -0,0 +1,10 @@
1
+ #include "SocketCommand.h"
2
+
3
+ class GetWindowHandles : public SocketCommand {
4
+ Q_OBJECT
5
+
6
+ public:
7
+ GetWindowHandles(WebPageManager *, QStringList &arguments, QObject *parent = 0);
8
+ virtual void start();
9
+ };
10
+
data/src/Header.cpp CHANGED
@@ -1,8 +1,9 @@
1
1
  #include "Header.h"
2
2
  #include "WebPage.h"
3
+ #include "WebPageManager.h"
3
4
  #include "NetworkAccessManager.h"
4
5
 
5
- Header::Header(WebPage *page, QStringList &arguments, QObject *parent) : Command(page, arguments, parent) {
6
+ Header::Header(WebPageManager *manager, QStringList &arguments, QObject *parent) : SocketCommand(manager, arguments, parent) {
6
7
  }
7
8
 
8
9
  void Header::start() {
data/src/Header.h CHANGED
@@ -1,11 +1,9 @@
1
- #include "Command.h"
1
+ #include "SocketCommand.h"
2
2
 
3
- class WebPage;
4
-
5
- class Header : public Command {
3
+ class Header : public SocketCommand {
6
4
  Q_OBJECT
7
5
 
8
6
  public:
9
- Header(WebPage *page, QStringList &arguments, QObject *parent = 0);
7
+ Header(WebPageManager *, QStringList &arguments, QObject *parent = 0);
10
8
  virtual void start();
11
9
  };
data/src/Headers.cpp CHANGED
@@ -1,7 +1,8 @@
1
1
  #include "Headers.h"
2
2
  #include "WebPage.h"
3
+ #include "WebPageManager.h"
3
4
 
4
- Headers::Headers(WebPage *page, QStringList &arguments, QObject *parent) : Command(page, arguments, parent) {
5
+ Headers::Headers(WebPageManager *manager, QStringList &arguments, QObject *parent) : SocketCommand(manager, arguments, parent) {
5
6
  }
6
7
 
7
8
  void Headers::start() {
data/src/Headers.h CHANGED
@@ -1,12 +1,10 @@
1
- #include "Command.h"
1
+ #include "SocketCommand.h"
2
2
 
3
- class WebPage;
4
-
5
- class Headers : public Command {
3
+ class Headers : public SocketCommand {
6
4
  Q_OBJECT
7
5
 
8
6
  public:
9
- Headers(WebPage *page, QStringList &arguments, QObject *parent = 0);
7
+ Headers(WebPageManager *, QStringList &arguments, QObject *parent = 0);
10
8
  virtual void start();
11
9
  };
12
10
 
@@ -1,12 +1,13 @@
1
1
  #include "IgnoreSslErrors.h"
2
2
  #include "WebPage.h"
3
+ #include "WebPageManager.h"
3
4
 
4
- IgnoreSslErrors::IgnoreSslErrors(WebPage *page, QStringList &arguments, QObject *parent) :
5
- Command(page, arguments, parent) {
5
+ IgnoreSslErrors::IgnoreSslErrors(WebPageManager *manager, QStringList &arguments, QObject *parent) :
6
+ SocketCommand(manager, arguments, parent) {
6
7
  }
7
8
 
8
9
  void IgnoreSslErrors::start() {
9
- page()->ignoreSslErrors();
10
+ manager()->setIgnoreSslErrors(true);
10
11
  emit finished(new Response(true));
11
12
  }
12
13
 
@@ -1,12 +1,10 @@
1
- #include "Command.h"
1
+ #include "SocketCommand.h"
2
2
 
3
- class WebPage;
4
-
5
- class IgnoreSslErrors : public Command {
3
+ class IgnoreSslErrors : public SocketCommand {
6
4
  Q_OBJECT
7
5
 
8
6
  public:
9
- IgnoreSslErrors(WebPage *page, QStringList &arguments, QObject *parent = 0);
7
+ IgnoreSslErrors(WebPageManager *manager, QStringList &arguments, QObject *parent = 0);
10
8
  virtual void start();
11
9
  };
12
10
 
@@ -1,6 +1,6 @@
1
1
  #include "JavascriptInvocation.h"
2
2
 
3
- JavascriptInvocation::JavascriptInvocation(QString &functionName, QStringList &arguments, QObject *parent) : QObject(parent) {
3
+ JavascriptInvocation::JavascriptInvocation(const QString &functionName, const QStringList &arguments, QObject *parent) : QObject(parent) {
4
4
  m_functionName = functionName;
5
5
  m_arguments = arguments;
6
6
  }
@@ -8,7 +8,7 @@ class JavascriptInvocation : public QObject {
8
8
  Q_PROPERTY(QStringList arguments READ arguments)
9
9
 
10
10
  public:
11
- JavascriptInvocation(QString &functionName, QStringList &arguments, QObject *parent = 0);
11
+ JavascriptInvocation(const QString &functionName, const QStringList &arguments, QObject *parent = 0);
12
12
  QString &functionName();
13
13
  QStringList &arguments();
14
14
 
@@ -1,9 +1,11 @@
1
1
  #include "NetworkAccessManager.h"
2
2
  #include "WebPage.h"
3
3
  #include <iostream>
4
+ #include <fstream>
4
5
 
5
6
 
6
7
  NetworkAccessManager::NetworkAccessManager(QObject *parent):QNetworkAccessManager(parent) {
8
+ connect(this, SIGNAL(authenticationRequired(QNetworkReply*,QAuthenticator*)), SLOT(provideAuthentication(QNetworkReply*,QAuthenticator*)));
7
9
  }
8
10
 
9
11
  QNetworkReply* NetworkAccessManager::createRequest(QNetworkAccessManager::Operation operation, const QNetworkRequest &request, QIODevice * outgoingData = 0) {
@@ -16,7 +18,9 @@ QNetworkReply* NetworkAccessManager::createRequest(QNetworkAccessManager::Operat
16
18
  item.next();
17
19
  new_request.setRawHeader(item.key().toAscii(), item.value().toAscii());
18
20
  }
19
- return QNetworkAccessManager::createRequest(operation, new_request, outgoingData);
21
+ QNetworkReply *reply = QNetworkAccessManager::createRequest(operation, new_request, outgoingData);
22
+ emit requestCreated(reply);
23
+ return reply;
20
24
  };
21
25
 
22
26
  void NetworkAccessManager::addHeader(QString key, QString value) {
@@ -27,3 +31,17 @@ void NetworkAccessManager::resetHeaders() {
27
31
  m_headers.clear();
28
32
  };
29
33
 
34
+ void NetworkAccessManager::setUserName(const QString &userName) {
35
+ m_userName = userName;
36
+ }
37
+
38
+ void NetworkAccessManager::setPassword(const QString &password) {
39
+ m_password = password;
40
+ }
41
+
42
+
43
+ void NetworkAccessManager::provideAuthentication(QNetworkReply *reply, QAuthenticator *authenticator) {
44
+ Q_UNUSED(reply);
45
+ authenticator->setUser(m_userName);
46
+ authenticator->setPassword(m_password);
47
+ }