From 6d7c3ed028d080c1b8ea2c233c61435afcaacbb6 Mon Sep 17 00:00:00 2001
From: Catalin Badea <catalin.badea392@gmail.com>
Date: Tue, 17 Jul 2012 14:05:23 +0300
Subject: Added signal handlers in history window.


diff --git a/Swift/Controllers/HistoryController.cpp b/Swift/Controllers/HistoryController.cpp
index fe54e79..d52e2b2 100644
--- a/Swift/Controllers/HistoryController.cpp
+++ b/Swift/Controllers/HistoryController.cpp
@@ -29,8 +29,8 @@ std::vector<HistoryMessage> HistoryController::getMessages(const JID& selfJID, c
 	return localHistory_->getMessages(selfJID, contactJID, type);
 }
 
-std::set<JID> HistoryController::getContacts(const JID& selfJID, HistoryMessage::Type type) const {
-	return localHistory_->getContacts(selfJID, type);
+std::set<JID> HistoryController::getContacts(const JID& selfJID, HistoryMessage::Type type, const std::string& keyword) const {
+	return localHistory_->getContacts(selfJID, type, keyword);
 }
 
 }
diff --git a/Swift/Controllers/HistoryController.h b/Swift/Controllers/HistoryController.h
index c08e112..ef832c9 100644
--- a/Swift/Controllers/HistoryController.h
+++ b/Swift/Controllers/HistoryController.h
@@ -24,7 +24,7 @@ namespace Swift {
 
 			void addMessage(const std::string& message, const JID& fromJID, const JID& toJID, HistoryMessage::Type type, const boost::posix_time::ptime& timeStamp);
 			std::vector<HistoryMessage> getMessages(const JID& selfJID, const JID& contactJID, HistoryMessage::Type type) const;
-			std::set<JID> getContacts(const JID& selfJID, HistoryMessage::Type type) const;
+			std::set<JID> getContacts(const JID& selfJID, HistoryMessage::Type type, const std::string& keyword = std::string()) const;
 
 			boost::signal<void (const HistoryMessage&)> onNewMessage;
 
diff --git a/Swift/QtUI/QtHistoryWindow.cpp b/Swift/QtUI/QtHistoryWindow.cpp
index 36c899c..51dd1d5 100644
--- a/Swift/QtUI/QtHistoryWindow.cpp
+++ b/Swift/QtUI/QtHistoryWindow.cpp
@@ -20,6 +20,7 @@
 #include <QTextDocument>
 #include <QDateTime>
 #include <Swift/QtUI/QtScaledAvatarCache.h>
+#include <QLineEdit>
 
 #include <boost/smart_ptr/make_shared.hpp>
 
@@ -56,10 +57,16 @@ QtHistoryWindow::QtHistoryWindow(SettingsProvider* settings, UIEventStream* even
 	connect(conversation_, SIGNAL(scrollRequested(int)), this, SLOT(handleScrollRequested(int)));
 	connect(conversation_, SIGNAL(scrollReachedTop()), this, SLOT(handleScrollReachedTop()));
 	connect(conversation_, SIGNAL(scrollReachedBottom()), this, SLOT(handleScrollReachedBottom()));
+	connect(ui_.searchBox_->lineEdit(), SIGNAL(returnPressed()), this, SLOT(handleReturnPressed()));
+	connect(ui_.calendarWidget_, SIGNAL(clicked(const QDate&)), this, SLOT(handleCalendarClicked(const QDate&)));
 }
 
 QtHistoryWindow::~QtHistoryWindow() {
 	disconnect(conversation_, SIGNAL(scrollRequested(int)), this, SLOT(handleScrollRequested(int)));
+	disconnect(conversation_, SIGNAL(scrollReachedTop()), this, SLOT(handleScrollReachedTop()));
+	disconnect(conversation_, SIGNAL(scrollReachedBottom()), this, SLOT(handleScrollReachedBottom()));
+	disconnect(ui_.searchBox_->lineEdit(), SIGNAL(returnPressed()), this, SLOT(handleReturnPressed()));
+	disconnect(ui_.calendarWidget_, SIGNAL(clicked(const QDate&)), this, SLOT(handleCalendarClicked(const QDate&)));
 
 	delete theme_;
 	delete conversation_;
@@ -133,10 +140,17 @@ void QtHistoryWindow::handleScrollRequested(int pos) {
 		ui_.calendarWidget_->setSelectedDate(currentDate_);
 	}
 }
+
 void QtHistoryWindow::handleScrollReachedTop() {
 }
 
 void QtHistoryWindow::handleScrollReachedBottom() {
 }
 
+void QtHistoryWindow::handleReturnPressed() {
+}
+
+void QtHistoryWindow::handleCalendarClicked(const QDate& date) {
+}
+
 }
diff --git a/Swift/QtUI/QtHistoryWindow.h b/Swift/QtUI/QtHistoryWindow.h
index f9d9a30..9a887bf 100644
--- a/Swift/QtUI/QtHistoryWindow.h
+++ b/Swift/QtUI/QtHistoryWindow.h
@@ -33,6 +33,8 @@ namespace Swift {
 			void handleScrollRequested(int pos);
 			void handleScrollReachedTop();
 			void handleScrollReachedBottom();
+			void handleReturnPressed();
+			void handleCalendarClicked(const QDate& date);
 
 		private:
 			void handleSomethingSelectedChanged(RosterItem* item);
diff --git a/Swiften/History/HistoryManager.h b/Swiften/History/HistoryManager.h
index bc1680b..51039e4 100644
--- a/Swiften/History/HistoryManager.h
+++ b/Swiften/History/HistoryManager.h
@@ -19,6 +19,6 @@ namespace Swift {
 			virtual void addMessage(const HistoryMessage& message) = 0;
 
 			virtual std::vector<HistoryMessage> getMessages(const JID& selfJID, const JID& contactJID, HistoryMessage::Type type) const = 0;
-			virtual std::set<JID> getContacts(const JID& selfJID, HistoryMessage::Type type) const = 0;
+			virtual std::set<JID> getContacts(const JID& selfJID, HistoryMessage::Type type, const std::string& keyword) const = 0;
 	};
 }
diff --git a/Swiften/History/SQLiteHistoryManager.cpp b/Swiften/History/SQLiteHistoryManager.cpp
index 3304a07..0a14b99 100644
--- a/Swiften/History/SQLiteHistoryManager.cpp
+++ b/Swiften/History/SQLiteHistoryManager.cpp
@@ -190,7 +190,7 @@ boost::optional<int> SQLiteHistoryManager::getIDFromJID(const JID& jid) const {
 	return result;
 }
 
-std::set<JID> SQLiteHistoryManager::getContacts(const JID& selfJID, HistoryMessage::Type type) const {
+std::set<JID> SQLiteHistoryManager::getContacts(const JID& selfJID, HistoryMessage::Type type, const std::string& keyword) const {
 	std::set<JID> result;
 	sqlite3_stmt* selectStatement;
 
diff --git a/Swiften/History/SQLiteHistoryManager.h b/Swiften/History/SQLiteHistoryManager.h
index fce30f8..a02ecc3 100644
--- a/Swiften/History/SQLiteHistoryManager.h
+++ b/Swiften/History/SQLiteHistoryManager.h
@@ -20,7 +20,7 @@ namespace Swift {
 
 			void addMessage(const HistoryMessage& message);
 			std::vector<HistoryMessage> getMessages(const JID& selfJID, const JID& contactJID, HistoryMessage::Type type) const;
-			std::set<JID> getContacts(const JID& selfJID, HistoryMessage::Type type) const;
+			std::set<JID> getContacts(const JID& selfJID, HistoryMessage::Type type, const std::string& keyword) const;
 
 		private:
 			int getIDForJID(const JID&);
-- 
cgit v0.10.2-6-g49f6