summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swift/Controllers')
-rw-r--r--Swift/Controllers/HistoryViewController.cpp28
-rw-r--r--Swift/Controllers/HistoryViewController.h6
-rw-r--r--Swift/Controllers/UIInterfaces/HistoryWindow.h2
3 files changed, 29 insertions, 7 deletions
diff --git a/Swift/Controllers/HistoryViewController.cpp b/Swift/Controllers/HistoryViewController.cpp
index 6ec8a3e..baa7ebf 100644
--- a/Swift/Controllers/HistoryViewController.cpp
+++ b/Swift/Controllers/HistoryViewController.cpp
@@ -46,6 +46,8 @@ HistoryViewController::~HistoryViewController() {
historyWindow_->onReturnPressed.disconnect(boost::bind(&HistoryViewController::handleReturnPressed, this, _1));
historyWindow_->onScrollReachedTop.disconnect(boost::bind(&HistoryViewController::handleScrollReachedTop, this, _1));
historyWindow_->onScrollReachedBottom.disconnect(boost::bind(&HistoryViewController::handleScrollReachedBottom, this, _1));
+ historyWindow_->onPreviousButtonClicked.disconnect(boost::bind(&HistoryViewController::handlePreviousButtonClicked, this));
+ historyWindow_->onNextButtonClicked.disconnect(boost::bind(&HistoryViewController::handleNextButtonClicked, this));
delete historyWindow_;
}
delete roster_;
@@ -61,6 +63,8 @@ void HistoryViewController::handleUIEvent(boost::shared_ptr<UIEvent> rawEvent) {
historyWindow_->onReturnPressed.connect(boost::bind(&HistoryViewController::handleReturnPressed, this, _1));
historyWindow_->onScrollReachedTop.connect(boost::bind(&HistoryViewController::handleScrollReachedTop, this, _1));
historyWindow_->onScrollReachedBottom.connect(boost::bind(&HistoryViewController::handleScrollReachedBottom, this, _1));
+ historyWindow_->onPreviousButtonClicked.connect(boost::bind(&HistoryViewController::handlePreviousButtonClicked, this));
+ historyWindow_->onNextButtonClicked.connect(boost::bind(&HistoryViewController::handleNextButtonClicked, this));
historyWindow_->setRosterModel(roster_);
}
@@ -149,12 +153,7 @@ void HistoryViewController::addNewMessage(const HistoryMessage& message, bool ad
}
void HistoryViewController::handleReturnPressed(const std::string& keyword) {
- roster_->removeAll();
- rooms_.clear();
- contacts_.clear();
- roomPrivateContacts_.clear();
- selectedItem_ = NULL;
- historyWindow_->resetConversationView();
+ reset();
// MUCs
rooms_ = historyController_->getContacts(selfJID_, HistoryMessage::Groupchat, keyword);
@@ -194,4 +193,21 @@ void HistoryViewController::handleScrollReachedBottom(const boost::gregorian::da
}
}
+void HistoryViewController::handlePreviousButtonClicked() {
+ reset();
+}
+
+void HistoryViewController::handleNextButtonClicked() {
+ reset();
+}
+
+void HistoryViewController::reset() {
+ roster_->removeAll();
+ rooms_.clear();
+ contacts_.clear();
+ roomPrivateContacts_.clear();
+ selectedItem_ = NULL;
+ historyWindow_->resetConversationView();
+}
+
}
diff --git a/Swift/Controllers/HistoryViewController.h b/Swift/Controllers/HistoryViewController.h
index 5c4dc96..b4ae19d 100644
--- a/Swift/Controllers/HistoryViewController.h
+++ b/Swift/Controllers/HistoryViewController.h
@@ -35,10 +35,14 @@ namespace Swift {
void handleUIEvent(boost::shared_ptr<UIEvent> event);
void handleSelectedContactChanged(RosterItem* item);
void handleNewMessage(const HistoryMessage& message);
- void addNewMessage(const HistoryMessage& message, bool addAtTheTop);
void handleReturnPressed(const std::string& keyword);
void handleScrollReachedTop(const boost::gregorian::date& date);
void handleScrollReachedBottom(const boost::gregorian::date& date);
+ void handlePreviousButtonClicked();
+ void handleNextButtonClicked();
+
+ void addNewMessage(const HistoryMessage& message, bool addAtTheTop);
+ void reset();
private:
JID selfJID_;
diff --git a/Swift/Controllers/UIInterfaces/HistoryWindow.h b/Swift/Controllers/UIInterfaces/HistoryWindow.h
index 03f4886..cb8225b 100644
--- a/Swift/Controllers/UIInterfaces/HistoryWindow.h
+++ b/Swift/Controllers/UIInterfaces/HistoryWindow.h
@@ -23,5 +23,7 @@ namespace Swift {
boost::signal<void (const std::string&)> onReturnPressed;
boost::signal<void (const boost::gregorian::date&)> onScrollReachedTop;
boost::signal<void (const boost::gregorian::date&)> onScrollReachedBottom;
+ boost::signal<void ()> onPreviousButtonClicked();
+ boost::signal<void ()> onNextButtonClicked();
};
}