summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCătălin Badea <catalin.badea392@gmail.com>2012-08-16 21:10:45 (GMT)
committerCătălin Badea <catalin.badea392@gmail.com>2012-08-16 21:10:45 (GMT)
commit5aadc44a6f11c277a26865c7c908e3f356158fa0 (patch)
tree38966fb5ec688da87019ecf453740688ad4d7eb8
parent4222febfac52106ae4a208228fbe269c0c28679c (diff)
downloadswift-contrib-5aadc44a6f11c277a26865c7c908e3f356158fa0.zip
swift-contrib-5aadc44a6f11c277a26865c7c908e3f356158fa0.tar.bz2
Reverse next/previous buttons and fix adding to the top bug.
-rw-r--r--Swift/Controllers/HistoryViewController.cpp4
-rw-r--r--Swift/QtUI/QtChatView.cpp12
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_);
}
}