From 494fbd58cfde0ed3cfe0304ce40ceb363378caf2 Mon Sep 17 00:00:00 2001
From: Vlad Voicu <vladvoic@gmail.com>
Date: Mon, 23 May 2011 19:05:31 +0300
Subject: fixes after code review


diff --git a/Swift/Controllers/MainController.cpp b/Swift/Controllers/MainController.cpp
index ce3847c..61f9584 100644
--- a/Swift/Controllers/MainController.cpp
+++ b/Swift/Controllers/MainController.cpp
@@ -274,7 +274,7 @@ void MainController::handleConnected() {
 		rosterController_->onSignOutRequest.connect(boost::bind(&MainController::signOut, this));
 
 		contactEditController_ = new ContactEditController(rosterController_, uiFactory_, uiEventStream_);
-		viewHistoryController_ = new ViewHistoryController(rosterController_, uiFactory_, uiEventStream_);
+		viewHistoryController_ = new ViewHistoryController(uiFactory_, uiEventStream_);
 
 		chatsManager_ = new ChatsManager(jid_, client_->getStanzaChannel(), client_->getIQRouter(), eventController_, uiFactory_, uiFactory_, client_->getNickResolver(), client_->getPresenceOracle(), client_->getPresenceSender(), uiEventStream_, uiFactory_, useDelayForLatency_, networkFactories_->getTimerFactory(), client_->getMUCRegistry(), client_->getEntityCapsProvider(), client_->getMUCManager(), uiFactory_, profileSettings_);
 		client_->onMessageReceived.connect(boost::bind(&ChatsManager::handleIncomingMessage, chatsManager_, _1));
diff --git a/Swift/Controllers/UIEvents/RequestViewHistoryUIEvent.h b/Swift/Controllers/UIEvents/RequestViewHistoryUIEvent.h
index 22ad2d8..884adfd 100644
--- a/Swift/Controllers/UIEvents/RequestViewHistoryUIEvent.h
+++ b/Swift/Controllers/UIEvents/RequestViewHistoryUIEvent.h
@@ -13,7 +13,7 @@ namespace Swift {
 	class RequestViewHistoryUIEvent : public UIEvent {
 		public:
 			typedef boost::shared_ptr <RequestViewHistoryUIEvent> ref;
-			RequestViewHistoryUIEvent(const JID& jid = NULL) : jid(jid) {
+			RequestViewHistoryUIEvent(const JID& jid = "") : jid(jid) {
 			}
 
 			const JID& getJID() const {
diff --git a/Swift/Controllers/UIInterfaces/ViewHistoryWindow.h b/Swift/Controllers/UIInterfaces/ViewHistoryWindow.h
index 18ac86e..b5d8a69 100644
--- a/Swift/Controllers/UIInterfaces/ViewHistoryWindow.h
+++ b/Swift/Controllers/UIInterfaces/ViewHistoryWindow.h
@@ -12,8 +12,7 @@ namespace Swift {
 	class ViewHistoryWindow {
 		public:
 			virtual ~ViewHistoryWindow() {};
-			virtual void setEnabled(bool b) = 0;
+			virtual void setEnabled(bool enabled) = 0;
 			virtual void show() = 0;
-			virtual void hide() = 0;
 	};
 }
diff --git a/Swift/Controllers/ViewHistoryController.cpp b/Swift/Controllers/ViewHistoryController.cpp
index 0aaacdf..19b4abb 100644
--- a/Swift/Controllers/ViewHistoryController.cpp
+++ b/Swift/Controllers/ViewHistoryController.cpp
@@ -12,11 +12,10 @@
 #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) {
+ViewHistoryController::ViewHistoryController(ViewHistoryWindowFactory* viewHistoryWindowFactory, UIEventStream* uiEventStream): rosterController(rosterController), viewHistoryWindowFactory(viewHistoryWindowFactory), uiEventStream(uiEventStream), viewHistoryWindow(NULL) {
 	uiEventStream->onUIEvent.connect(boost::bind(&ViewHistoryController::handleUIEvent, this, _1));
 }
 
@@ -26,15 +25,14 @@ ViewHistoryController::~ViewHistoryController() {
 
 void ViewHistoryController::handleUIEvent(UIEvent::ref event) {
 	RequestViewHistoryUIEvent::ref viewHistoryEvent = boost::dynamic_pointer_cast<RequestViewHistoryUIEvent>(event);
-	if (!viewHistoryWindow) {
+	if (viewHistoryEvent) {
 		viewHistoryWindow = viewHistoryWindowFactory->createViewHistoryWindow();
 	}
 }
 
-void ViewHistoryController::setAvailable(bool b) {
-	if (viewHistoryWindow) {
-		viewHistoryWindow->setEnabled(b);
-	}
+void ViewHistoryController::setAvailable(bool enabled) {
+	/* This will disable some function when the time comes */
+	enabled = false; /* only to avoid warnings for now */
 }
 
 }
diff --git a/Swift/Controllers/ViewHistoryController.h b/Swift/Controllers/ViewHistoryController.h
index f306d19..1e806f9 100644
--- a/Swift/Controllers/ViewHistoryController.h
+++ b/Swift/Controllers/ViewHistoryController.h
@@ -15,7 +15,7 @@ namespace Swift {
 	class RosterController;
 	class ViewHistoryController {
 		public:
-			ViewHistoryController(RosterController* rosterController, ViewHistoryWindowFactory* viewHistoryWindowFactory, UIEventStream* uiEventStream);
+			ViewHistoryController(ViewHistoryWindowFactory* viewHistoryWindowFactory, UIEventStream* uiEventStream);
 			~ViewHistoryController();
 			void setAvailable(bool b);
 
diff --git a/Swift/QtUI/QtViewHistoryWindow.cpp b/Swift/QtUI/QtViewHistoryWindow.cpp
index 2f3bd9e..be83036 100644
--- a/Swift/QtUI/QtViewHistoryWindow.cpp
+++ b/Swift/QtUI/QtViewHistoryWindow.cpp
@@ -20,12 +20,8 @@ void QtViewHistoryWindow::show() {
 	QWidget::activateWindow();
 }
 
-void QtViewHistoryWindow::hide() {
-	QWidget::hide();
-}
-
-void QtViewHistoryWindow::setEnabled(bool b) {
-	QWidget::setEnabled(b);
+void QtViewHistoryWindow::setEnabled(bool enabled) {
+	QWidget::setEnabled(enabled);
 }
 
 }
diff --git a/Swift/QtUI/QtViewHistoryWindow.h b/Swift/QtUI/QtViewHistoryWindow.h
index 3fcd7e4..2d1ca57 100644
--- a/Swift/QtUI/QtViewHistoryWindow.h
+++ b/Swift/QtUI/QtViewHistoryWindow.h
@@ -18,8 +18,7 @@ namespace Swift {
 		public:
 			QtViewHistoryWindow();
 			void show();
-			void hide();
-			void setEnabled(bool b);
+			void setEnabled(bool enabled);
 
 		private:
 			JID jid_;
-- 
cgit v0.10.2-6-g49f6