summaryrefslogtreecommitdiff
path: root/src/frontend/display/bthtmlreaddisplay.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/frontend/display/bthtmlreaddisplay.cpp')
-rw-r--r--src/frontend/display/bthtmlreaddisplay.cpp22
1 files changed, 20 insertions, 2 deletions
diff --git a/src/frontend/display/bthtmlreaddisplay.cpp b/src/frontend/display/bthtmlreaddisplay.cpp
index 7f016cd..6cb959c 100644
--- a/src/frontend/display/bthtmlreaddisplay.cpp
+++ b/src/frontend/display/bthtmlreaddisplay.cpp
@@ -213,10 +213,19 @@ const QString BtHtmlReadDisplay::text( const CDisplay::TextType format, const CD
return QString();
}
+#include <QTextStream>
// Puts html text and javascript into QWebView
void BtHtmlReadDisplay::setText( const QString& newText )
{
QString jsText = newText;
+
+ QFile file("out.txt");
+ if (!file.open(QIODevice::WriteOnly | QIODevice::Text))
+ return;
+
+ QTextStream out(&file);
+ out << newText << "\n";
+
jsText.replace(body,jsBegin+javascript+jsEnd+body);
// Disconnect any previous connect and connect to slot that loads the javascript object
@@ -284,8 +293,8 @@ void BtHtmlReadDisplay::slotLoadFinished(bool)
emit completed();
}
-// For debugging javascript
-#if 0
+// For debugging javascript - set breakpoint in this function to catch javascript error messages
+#if DEBUG_JS
void BtHtmlReadDisplay::javaScriptConsoleMessage (const QString& message, int lineNumber, const QString& sourceID )
{
}
@@ -362,3 +371,12 @@ void BtHtmlReadDisplayView::dragMoveEvent( QDragMoveEvent* e )
e->ignore();
}
+bool BtHtmlReadDisplayView::event(QEvent* e)
+{
+ // If the mouse leaves the widget clear the previous attribute
+ // in bthtmljsobject. This cancels any time out event that
+ // is in progress.
+ if ( e->type() == QEvent::Leave )
+ m_display->m_jsObject->clearPrevAttribute();
+ return QWidget::event(e);
+} \ No newline at end of file