diff options
Diffstat (limited to 'Swift')
-rw-r--r-- | Swift/Controllers/HistoryViewController.cpp | 4 | ||||
-rw-r--r-- | Swift/QtUI/QtChatView.cpp | 12 |
2 files changed, 11 insertions, 5 deletions
diff --git a/Swift/Controllers/HistoryViewController.cpp b/Swift/Controllers/HistoryViewController.cpp index f32447d..d94b8d6 100644 --- a/Swift/Controllers/HistoryViewController.cpp +++ b/Swift/Controllers/HistoryViewController.cpp @@ -213,7 +213,7 @@ void HistoryViewController::handleScrollReachedBottom(const boost::gregorian::da } } -void HistoryViewController::handlePreviousButtonClicked() { +void HistoryViewController::handleNextButtonClicked() { if (!selectedItem_) { return; } @@ -234,7 +234,7 @@ void HistoryViewController::handlePreviousButtonClicked() { } } -void HistoryViewController::handleNextButtonClicked() { +void HistoryViewController::handlePreviousButtonClicked() { if (!selectedItem_) { return; } 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_); } } |