/* * Copyright (c) 2012 Catalin Badea * Licensed under the simplified BSD license. * See Documentation/Licenses/BSD-simplified.txt for more information. */ #include #include #include namespace Swift { HistoryViewController::HistoryViewController(UIEventStream* uiEventStream, HistoryWindowFactory* historyWindowFactory) : uiEventStream_(uiEventStream), historyWindowFactory_(historyWindowFactory), historyWindow_(NULL) { uiEventStream_->onUIEvent.connect(boost::bind(&HistoryViewController::handleUIEvent, this, _1)); } HistoryViewController::~HistoryViewController() { uiEventStream_->onUIEvent.disconnect(boost::bind(&HistoryViewController::handleUIEvent, this, _1)); delete historyWindow_; delete roster_; } void HistoryViewController::handleUIEvent(boost::shared_ptr rawEvent) { boost::shared_ptr event = boost::dynamic_pointer_cast(rawEvent); if (event != NULL) { if (historyWindow_ == NULL) { historyWindow_ = historyWindowFactory_->createHistoryWindow(uiEventStream_); roster_ = new Roster(false, true); historyWindow_->setRosterModel(roster_); JID putin("vputin@karla.com"); JID medvedev("dmedvedev@karla.com"); JID kev("kevin@doomsong.co.uk"); const std::set none; roster_->addContact(putin, putin, "Vladimir Putin", "Recent", ""); roster_->addContact(medvedev, medvedev, "Dmitri Medvedev", "Recent", ""); roster_->addContact(kev, kev, "Kev", "Recent", ""); } historyWindow_->activate(); } } }