diff options
Diffstat (limited to 'Swift/Controllers/HistoryViewController.cpp')
| -rw-r--r-- | Swift/Controllers/HistoryViewController.cpp | 28 | 
1 files changed, 22 insertions, 6 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(); +} +  }  | 
 Swift