summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swift/QtUI/QtChatView.cpp')
-rw-r--r--Swift/QtUI/QtChatView.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/Swift/QtUI/QtChatView.cpp b/Swift/QtUI/QtChatView.cpp
index 37e34e9..cc5119f 100644
--- a/Swift/QtUI/QtChatView.cpp
+++ b/Swift/QtUI/QtChatView.cpp
@@ -119,7 +119,7 @@ void QtChatView::addMessageTop(boost::shared_ptr<ChatSnippet> snippet) {
continuationElement.replace(newElement);
} else {
continuationElement.removeFromDocument();
- topInsertPoint_.appendOutside(newElement);
+ topInsertPoint_.prependOutside(newElement);
}
firstElement_ = newElement;
@@ -356,11 +356,11 @@ void QtChatView::resetView() {
syncLoop.exec();
}
document_ = webPage_->mainFrame()->documentElement();
+
+ resetTopInsertPoint();
QWebElement chatElement = document_.findFirst("#Chat");
newInsertPoint_ = chatElement.clone();
newInsertPoint_.setOuterXml("<div id='swift_insert'/>");
- topInsertPoint_ = newInsertPoint_.clone();
- chatElement.appendInside(topInsertPoint_);
chatElement.appendInside(newInsertPoint_);
Q_ASSERT(!newInsertPoint_.isNull());
@@ -466,6 +466,12 @@ void QtChatView::resetTopInsertPoint() {
QWebElement continuationElement = firstElement_.findFirst("#insert");
continuationElement.removeFromDocument();
firstElement_ = QWebElement();
+
+ topInsertPoint_.removeFromDocument();
+ QWebElement chatElement = document_.findFirst("#Chat");
+ topInsertPoint_ = chatElement.clone();
+ topInsertPoint_.setOuterXml("<div id='swift_insert'/>");
+ chatElement.prependInside(topInsertPoint_);
}
}