summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swift/Controllers/ViewHistoryController.cpp')
-rw-r--r--Swift/Controllers/ViewHistoryController.cpp40
1 files changed, 40 insertions, 0 deletions
diff --git a/Swift/Controllers/ViewHistoryController.cpp b/Swift/Controllers/ViewHistoryController.cpp
new file mode 100644
index 0000000..0aaacdf
--- /dev/null
+++ b/Swift/Controllers/ViewHistoryController.cpp
@@ -0,0 +1,40 @@
+/*
+ * 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>
+#include <Swift/Controllers/Roster/RosterController.h>
+
+namespace Swift {
+
+ViewHistoryController::ViewHistoryController(RosterController* rosterController, 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 (!viewHistoryWindow) {
+ viewHistoryWindow = viewHistoryWindowFactory->createViewHistoryWindow();
+ }
+}
+
+void ViewHistoryController::setAvailable(bool b) {
+ if (viewHistoryWindow) {
+ viewHistoryWindow->setEnabled(b);
+ }
+}
+
+}