Permalink
Browse files

Add an evaluateJavaScript() function to MythUIWebBrowser.

Patch by Jonatan <mythtv@comhem.se>. Refs #9301.
  • Loading branch information...
1 parent d6e784b commit a95968db5d3a1de9d1492eab37764744289aa487 Paul Harrison committed Dec 6, 2010
Showing with 15 additions and 0 deletions.
  1. +13 −0 mythtv/libs/libmythui/mythuiwebbrowser.cpp
  2. +2 −0 mythtv/libs/libmythui/mythuiwebbrowser.h
@@ -322,6 +322,7 @@ MythUIWebBrowser::~MythUIWebBrowser()
{
if (m_browser)
{
+ m_browser->hide();
m_browser->disconnect();
m_browser->deleteLater();
m_browser = NULL;
@@ -551,6 +552,18 @@ QUrl MythUIWebBrowser::GetUrl(void)
return QUrl();
}
+/** \fn MythUIWebBrowser::evaluateJavaScript(const QString& scriptSource)
+ * \brief Evaluates the JavaScript code in \a scriptSource.
+ * \return QVariant
+ */
+QVariant MythUIWebBrowser::evaluateJavaScript(const QString& scriptSource)
+{
+ if (m_browser)
+ return m_browser->page()->mainFrame()->evaluateJavaScript(scriptSource);
+ else
+ return QVariant();
+}
+
void MythUIWebBrowser::slotLoadStarted(void)
{
emit loadStarted();
@@ -72,6 +72,8 @@ class MPUBLIC MythUIWebBrowser : public MythUIType
bool CanGoForward(void);
bool CanGoBack(void);
+ QVariant evaluateJavaScript(const QString& scriptSource);
+
public slots:
void Back(void);
void Forward(void);

0 comments on commit a95968d

Please sign in to comment.