From 5aadc44a6f11c277a26865c7c908e3f356158fa0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C4=83t=C4=83lin=20Badea?= Date: Fri, 17 Aug 2012 00:10:45 +0300 Subject: Reverse next/previous buttons and fix adding to the top bug. 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 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("
"); - 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("
"); + chatElement.prependInside(topInsertPoint_); } } -- cgit v0.10.2-6-g49f6