diff options
author | Kevin Smith <git@kismith.co.uk> | 2010-08-19 20:29:28 (GMT) |
---|---|---|
committer | Kevin Smith <git@kismith.co.uk> | 2010-08-19 20:29:28 (GMT) |
commit | aeb359c0c915631e97625f20e8aa648d95459131 (patch) | |
tree | e39ace8d050aaf38fc299938b90375e0315b7deb | |
parent | c2d879c9173758edbe555a7f4ed97e341dbcaff3 (diff) | |
download | swift-aeb359c0c915631e97625f20e8aa648d95459131.zip swift-aeb359c0c915631e97625f20e8aa648d95459131.tar.bz2 |
Rolling back accidental commit
-rw-r--r-- | Swift/QtUI/QtChatView.cpp | 19 | ||||
-rw-r--r-- | Swift/QtUI/QtChatView.h | 4 |
2 files changed, 8 insertions, 15 deletions
diff --git a/Swift/QtUI/QtChatView.cpp b/Swift/QtUI/QtChatView.cpp index 6b38309..3324108 100644 --- a/Swift/QtUI/QtChatView.cpp +++ b/Swift/QtUI/QtChatView.cpp @@ -68,14 +68,6 @@ void QtChatView::handleKeyPressEvent(QKeyEvent* event) { } void QtChatView::addMessage(const ChatSnippet& snippet) { - if (viewReady_) { - appendToView(snippet); - } else { - queuedSnippets_.append(snippet); - } -} - -void QtChatView::appendToView(const ChatSnippet& snippet) { //bool wasScrolledToBottom = isScrolledToBottom(); QString content = snippet.getContent(); @@ -90,7 +82,12 @@ void QtChatView::appendToView(const ChatSnippet& snippet) { else { command = "appendNextMessage(\"" + content + "\");"; } - webPage_->mainFrame()->evaluateJavaScript(command); + if (viewReady_) { + webPage_->mainFrame()->evaluateJavaScript(command); + } + else { + queuedMessages_ += command; + } //qDebug() << webPage_->mainFrame()->toHtml(); previousContinuationElementID_ = snippet.getContinuationElementID(); @@ -121,9 +118,7 @@ void QtChatView::handleLinkClicked(const QUrl& url) { void QtChatView::handleViewLoadFinished(bool ok) { Q_ASSERT(ok); viewReady_ = true; - foreach (const ChatSnippet& snippet, queuedSnippets_) { - appendToView(snippet); - } + webPage_->mainFrame()->evaluateJavaScript(queuedMessages_); queuedMessages_.clear(); } diff --git a/Swift/QtUI/QtChatView.h b/Swift/QtUI/QtChatView.h index a5b6b4a..ea64265 100644 --- a/Swift/QtUI/QtChatView.h +++ b/Swift/QtUI/QtChatView.h @@ -9,7 +9,6 @@ #include <QString> #include <QWidget> -#include <QList> #include "ChatSnippet.h" @@ -36,12 +35,11 @@ namespace Swift { void handleViewLoadFinished(bool); private: - void appendToView(const ChatSnippet& snippet); bool viewReady_; QtWebView* webView_; QWebPage* webPage_; QString previousContinuationElementID_; - QList<ChatSnippet> queuedSnippets_; + QString queuedMessages_; }; } |