summaryrefslogtreecommitdiffstats
blob: 19b4abbe11cc13137a7fe7832882c7fbaab7ccb6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/*
 * Copyright (c) 2011 Vlad Voicu
 * Licensed under the Simplified BSD license.
 * See Documentation/Licenses/BSD-simplified.txt for more information.
 */

#include <Swift/Controllers/ViewHistoryController.h>

#include <boost/bind.hpp>
#include <boost/smart_ptr/make_shared.hpp>  

#include <Swift/Controllers/UIEvents/RequestViewHistoryUIEvent.h>
#include <Swift/Controllers/UIEvents/UIEventStream.h>
#include <Swift/Controllers/UIInterfaces/ViewHistoryWindowFactory.h>

namespace Swift {

ViewHistoryController::ViewHistoryController(ViewHistoryWindowFactory* viewHistoryWindowFactory, UIEventStream* uiEventStream): rosterController(rosterController), viewHistoryWindowFactory(viewHistoryWindowFactory), uiEventStream(uiEventStream), viewHistoryWindow(NULL) {
	uiEventStream->onUIEvent.connect(boost::bind(&ViewHistoryController::handleUIEvent, this, _1));
}

ViewHistoryController::~ViewHistoryController() {

}

void ViewHistoryController::handleUIEvent(UIEvent::ref event) {
	RequestViewHistoryUIEvent::ref viewHistoryEvent = boost::dynamic_pointer_cast<RequestViewHistoryUIEvent>(event);
	if (viewHistoryEvent) {
		viewHistoryWindow = viewHistoryWindowFactory->createViewHistoryWindow();
	}
}

void ViewHistoryController::setAvailable(bool enabled) {
	/* This will disable some function when the time comes */
	enabled = false; /* only to avoid warnings for now */
}

}