summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Harrison <pharrison@mythtv.org>2011-08-17 12:52:14 (GMT)
committer Paul Harrison <pharrison@mythtv.org>2011-08-17 12:52:14 (GMT)
commit8028a5875f6a43ec83bff7c775ff2125f1a46a98 (patch)
tree6f790b76756bde07d6b5dd567e891c1f0e252a5d
parentc502e0d2b17482f75847b78a19c12eaa7fcb77d1 (diff)
MythBrowser: Change the user-agent string reported by the browser widget.
This replaces the name 'Safari' with 'MythBrowser' in the default user-agent string sent by MythBrowser. This fixes a problem with the BBC iPlayer thinking we are running on an unsupported mobile phone and refusing to do anything! This backports f19c6108ad4b9 from master.
-rw-r--r--mythtv/libs/libmythui/mythuiwebbrowser.cpp12
-rw-r--r--mythtv/libs/libmythui/mythuiwebbrowser.h11
2 files changed, 23 insertions, 0 deletions
diff --git a/mythtv/libs/libmythui/mythuiwebbrowser.cpp b/mythtv/libs/libmythui/mythuiwebbrowser.cpp
index 5ce103f..23925b2 100644
--- a/mythtv/libs/libmythui/mythuiwebbrowser.cpp
+++ b/mythtv/libs/libmythui/mythuiwebbrowser.cpp
@@ -31,6 +31,17 @@
#include "mythuihelper.h"
#include "mythcorecontext.h"
+
+MythWebPage::MythWebPage(QObject *parent)
+ : QWebPage(parent)
+{
+}
+
+QString MythWebPage::userAgentForUrl(const QUrl &url) const
+{
+ return QWebPage::userAgentForUrl(url).replace("Safari", "MythBrowser");
+}
+
/**
* @class MythWebView
* @brief Subclass of QWebView
@@ -39,6 +50,7 @@
MythWebView::MythWebView(QWidget *parent, MythUIWebBrowser *parentBrowser)
: QWebView(parent)
{
+ setPage(new MythWebPage(this));
m_parentBrowser = parentBrowser;
connect(this->page(), SIGNAL(unsupportedContent(QNetworkReply *)),
diff --git a/mythtv/libs/libmythui/mythuiwebbrowser.h b/mythtv/libs/libmythui/mythuiwebbrowser.h
index 04faf59..14eb7ba 100644
--- a/mythtv/libs/libmythui/mythuiwebbrowser.h
+++ b/mythtv/libs/libmythui/mythuiwebbrowser.h
@@ -17,6 +17,17 @@
class MythUIWebBrowser;
+class MythWebPage : public QWebPage
+{
+ Q_OBJECT
+
+ public:
+ MythWebPage(QObject *parent = 0);
+
+ protected:
+ virtual QString userAgentForUrl(const QUrl &url) const;
+};
+
class MythWebView : public QWebView
{
Q_OBJECT