Commit 2a4370b2 authored by kenneth@webkit.org's avatar kenneth@webkit.org

Rubberstamped by Simon Hausmann

[Qt] Refactor the code in the QtLauncher dealing with HTTP proxy.

* QtLauncher/main.cpp:
(MainWindow::MainWindow):
* QtLauncher/webpage.cpp:
(WebPage::WebPage):
(WebPage::applyProxy):
* QtLauncher/webpage.h:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@53919 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent ebb1aca8
2010-01-27 Kenneth Rohde Christiansen <kenneth@webkit.org>
Rubberstamped by Simon Hausmann
[Qt] Refactor the code in the QtLauncher dealing with HTTP proxy.
* QtLauncher/main.cpp:
(MainWindow::MainWindow):
* QtLauncher/webpage.cpp:
(WebPage::WebPage):
(WebPage::applyProxy):
* QtLauncher/webpage.h:
2010-01-26 Jocelyn Turcotte <jocelyn.turcotte@nokia.com>
Reviewed by Tor Arne Vestbø.
......
......@@ -31,7 +31,6 @@
*/
#include <QtGui>
#include <QtNetwork/QNetworkProxy>
#include <QtNetwork/QNetworkRequest>
#if !defined(QT_NO_PRINTER)
#include <QPrintPreviewDialog>
......@@ -138,14 +137,6 @@ public:
setupUI();
// set the proxy to the http_proxy env variable - if present
QUrl proxyUrl = urlFromUserInput(qgetenv("http_proxy"));
if (proxyUrl.isValid() && !proxyUrl.host().isEmpty()) {
int proxyPort = (proxyUrl.port() > 0) ? proxyUrl.port() : 8080;
page->networkAccessManager()->setProxy(QNetworkProxy(QNetworkProxy::HttpProxy, proxyUrl.host(), proxyPort));
}
QFileInfo fi(url);
if (fi.exists() && fi.isRelative())
url = fi.absoluteFilePath();
......
......@@ -35,6 +35,23 @@
#include <QDesktopServices>
#include <QtGui>
#include <QtNetwork/QNetworkRequest>
#include <QtNetwork/QNetworkProxy>
WebPage::WebPage(QObject* parent)
: QWebPage(parent)
{
applyProxy();
}
void WebPage::applyProxy()
{
QUrl proxyUrl(qgetenv("http_proxy"));
if (proxyUrl.isValid() && !proxyUrl.host().isEmpty()) {
int proxyPort = (proxyUrl.port() > 0) ? proxyUrl.port() : 8080;
networkAccessManager()->setProxy(QNetworkProxy(QNetworkProxy::HttpProxy, proxyUrl.host(), proxyPort));
}
}
bool WebPage::supportsExtension(QWebPage::Extension extension) const
{
......@@ -85,3 +102,5 @@ void WebPage::openUrlInDefaultBrowser(const QUrl& url)
else
QDesktopServices::openUrl(url);
}
......@@ -38,7 +38,7 @@
class WebPage : public QWebPage {
public:
WebPage(QWidget* parent) : QWebPage(parent) {}
WebPage(QObject* parent = 0);
virtual QWebPage* createWindow(QWebPage::WebWindowType);
virtual QObject* createPlugin(const QString&, const QUrl&, const QStringList&, const QStringList&);
......@@ -49,6 +49,9 @@ public:
public slots:
void openUrlInDefaultBrowser(const QUrl& url = QUrl());
private:
void applyProxy();
};
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment