Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Move the LLNetworkAccessManager class out to its own file

  • Loading branch information...
commit 7cd49ceb4f48a6eb81e7b0e319bd69d522d934a6 1 parent 6ad7352
Benjamin C Meyer authored
View
28 llmozlib2/llembeddedbrowser.cpp
@@ -41,12 +41,12 @@
#include "llembeddedbrowser_p.h"
#include "llembeddedbrowserwindow.h"
+#include "llnetworkaccessmanager.h"
#include "llstyle.h"
#include <qvariant.h>
#include <qwebsettings.h>
#include <qnetworkproxy.h>
-#include <qnetworkreply.h>
#include <qfile.h>
// singleton pattern - initialization
@@ -317,29 +317,3 @@ void LLNetworkCookieJar::clear()
setAllCookies(QList<QNetworkCookie>());
}
-LLNetworkAccessManager::LLNetworkAccessManager(LLEmbeddedBrowserPrivate* browser,QObject* parent)
- : QNetworkAccessManager(parent)
- , mBrowser(browser)
-{
- connect(this, SIGNAL(finished(QNetworkReply*)),
- this, SLOT(finishLoading(QNetworkReply*)));
-}
-
-void LLNetworkAccessManager::finishLoading(QNetworkReply* reply)
-{
- if (reply->error() == QNetworkReply::ContentNotFoundError)
- {
- QString url = QString(reply->url().toEncoded());
- if (mBrowser)
- {
- std::string current_url = url.toStdString();
- foreach (LLEmbeddedBrowserWindow *window, mBrowser->windows)
- {
- if (window->getCurrentUri() == current_url)
- window->load404RedirectUrl();
- }
- }
- }
-}
-
-
View
16 llmozlib2/llembeddedbrowser_p.h
@@ -59,21 +59,7 @@ class LLNetworkCookieJar : public NetworkCookieJar
bool mAllowCookies;
};
-class LLEmbeddedBrowserPrivate;
-class LLNetworkAccessManager: public QNetworkAccessManager
-{
- Q_OBJECT
-public:
- LLNetworkAccessManager(LLEmbeddedBrowserPrivate* browser, QObject* parent = 0);
-
-public slots:
- void finishLoading(QNetworkReply* reply);
-
-private:
- LLEmbeddedBrowserPrivate* mBrowser;
-
-};
-
+class LLNetworkAccessManager;
class LLEmbeddedBrowserPrivate
{
public:
View
2  llmozlib2/llembeddedbrowserwindow.cpp
@@ -44,6 +44,8 @@
#include "llembeddedbrowser.h"
#include "llembeddedbrowser_p.h"
+#include "llnetworkaccessmanager.h"
+
#include <qaction.h>
#include <qwebframe.h>
View
2  llmozlib2/llmozlib2.pri
@@ -20,12 +20,14 @@ HEADERS += llembeddedbrowser.h \
llembeddedbrowser_p.h \
llembeddedbrowserwindow.h \
llembeddedbrowserwindow_p.h \
+ llnetworkaccessmanager.h \
llmozlib2.h \
llwebpage.h \
llstyle.h
SOURCES += llembeddedbrowser.cpp \
llembeddedbrowserwindow.cpp \
+ llnetworkaccessmanager.cpp \
llmozlib2.cpp \
llwebpage.cpp \
llstyle.cpp
View
69 llmozlib2/llnetworkaccessmanager.cpp
@@ -0,0 +1,69 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Linden Lab Inc. (http://lindenlab.com) code.
+ *
+ * The Initial Developer of the Original Code is:
+ * Benjamin Meyer (benjamin.meyer@torchmobile.com)
+ *
+ * Portions created by the Initial Developer are Copyright (C) 2006
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+#include "llnetworkaccessmanager.h"
+
+#include <qnetworkreply.h>
+
+#include "llembeddedbrowserwindow.h"
+#include "llembeddedbrowser_p.h"
+
+LLNetworkAccessManager::LLNetworkAccessManager(LLEmbeddedBrowserPrivate* browser,QObject* parent)
+ : QNetworkAccessManager(parent)
+ , mBrowser(browser)
+{
+ connect(this, SIGNAL(finished(QNetworkReply*)),
+ this, SLOT(finishLoading(QNetworkReply*)));
+}
+
+void LLNetworkAccessManager::finishLoading(QNetworkReply* reply)
+{
+ if (reply->error() == QNetworkReply::ContentNotFoundError)
+ {
+ QString url = QString(reply->url().toEncoded());
+ if (mBrowser)
+ {
+ std::string current_url = url.toStdString();
+ foreach (LLEmbeddedBrowserWindow *window, mBrowser->windows)
+ {
+ if (window->getCurrentUri() == current_url)
+ window->load404RedirectUrl();
+ }
+ }
+ }
+}
+
View
59 llmozlib2/llnetworkaccessmanager.h
@@ -0,0 +1,59 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Linden Lab Inc. (http://lindenlab.com) code.
+ *
+ * The Initial Developer of the Original Code is:
+ * Benjamin Meyer (benjamin.meyer@torchmobile.com)
+ *
+ * Portions created by the Initial Developer are Copyright (C) 2006
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+#ifndef LLNETWORKACCESSMANAGER_H
+#define LLNETWORKACCESSMANAGER_H
+
+#include <qnetworkaccessmanager.h>
+
+class LLEmbeddedBrowserPrivate;
+class LLNetworkAccessManager: public QNetworkAccessManager
+{
+ Q_OBJECT
+public:
+ LLNetworkAccessManager(LLEmbeddedBrowserPrivate* browser, QObject* parent = 0);
+
+public slots:
+ void finishLoading(QNetworkReply* reply);
+
+private:
+ LLEmbeddedBrowserPrivate* mBrowser;
+
+};
+
+#endif // LLNETWORKACCESSMANAGER_H
+
Please sign in to comment.
Something went wrong with that request. Please try again.