summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Smith <git@kismith.co.uk>2010-04-30 16:56:33 (GMT)
committerKevin Smith <git@kismith.co.uk>2010-04-30 16:56:33 (GMT)
commitb566cac68d7bb91f726b5353318b3a5eddd8f3c2 (patch)
tree6b9e7cdaf3273cde638dbfe9cbec0405c5708113 /Swift/Controllers
parent499f41d456203837b1ab8eb558a2855238957593 (diff)
downloadswift-contrib-b566cac68d7bb91f726b5353318b3a5eddd8f3c2.zip
swift-contrib-b566cac68d7bb91f726b5353318b3a5eddd8f3c2.tar.bz2
Support adding/removing bookmarks from the UI
Doesn't support editing meaningfully, nor do changes get saved.
Diffstat (limited to 'Swift/Controllers')
-rw-r--r--Swift/Controllers/Chat/ChatsManager.cpp20
-rw-r--r--Swift/Controllers/UIEvents/AddMUCBookmarkUIEvent.h22
-rw-r--r--Swift/Controllers/UIEvents/EditMUCBookmarkUIEvent.h24
-rw-r--r--Swift/Controllers/UIEvents/RemoveMUCBookmarkUIEvent.h22
4 files changed, 88 insertions, 0 deletions
diff --git a/Swift/Controllers/Chat/ChatsManager.cpp b/Swift/Controllers/Chat/ChatsManager.cpp
index 6aacdbd..d0b4716 100644
--- a/Swift/Controllers/Chat/ChatsManager.cpp
+++ b/Swift/Controllers/Chat/ChatsManager.cpp
@@ -15,6 +15,9 @@
#include "Swift/Controllers/Chat/MUCController.h"
#include "Swift/Controllers/UIEvents/RequestChatUIEvent.h"
#include "Swift/Controllers/UIEvents/JoinMUCUIEvent.h"
+#include "Swift/Controllers/UIEvents/AddMUCBookmarkUIEvent.h"
+#include "Swift/Controllers/UIEvents/RemoveMUCBookmarkUIEvent.h"
+#include "Swift/Controllers/UIEvents/EditMUCBookmarkUIEvent.h"
#include "Swift/Controllers/UIInterfaces/ChatListWindowFactory.h"
#include "Swiften/Presence/PresenceSender.h"
#include "Swiften/Elements/ChatState.h"
@@ -83,10 +86,27 @@ void ChatsManager::handleUIEvent(boost::shared_ptr<UIEvent> event) {
boost::shared_ptr<RequestChatUIEvent> chatEvent = boost::dynamic_pointer_cast<RequestChatUIEvent>(event);
if (chatEvent) {
handleChatRequest(chatEvent->getContact());
+ return;
}
boost::shared_ptr<JoinMUCUIEvent> joinMUCEvent = boost::dynamic_pointer_cast<JoinMUCUIEvent>(event);
if (joinMUCEvent) {
handleJoinMUCRequest(joinMUCEvent->getJID(), joinMUCEvent->getNick());
+ return;
+ }
+ boost::shared_ptr<RemoveMUCBookmarkUIEvent> removeMUCBookmarkEvent = boost::dynamic_pointer_cast<RemoveMUCBookmarkUIEvent>(event);
+ if (removeMUCBookmarkEvent) {
+ mucBookmarkManager_->removeBookmark(removeMUCBookmarkEvent->getBookmark());
+ return;
+ }
+ boost::shared_ptr<AddMUCBookmarkUIEvent> addMUCBookmarkEvent = boost::dynamic_pointer_cast<AddMUCBookmarkUIEvent>(event);
+ if (addMUCBookmarkEvent) {
+ mucBookmarkManager_->addBookmark(addMUCBookmarkEvent->getBookmark());
+ return;
+ }
+ boost::shared_ptr<EditMUCBookmarkUIEvent> editMUCBookmarkEvent = boost::dynamic_pointer_cast<EditMUCBookmarkUIEvent>(event);
+ if (editMUCBookmarkEvent) {
+ mucBookmarkManager_->replaceBookmark(editMUCBookmarkEvent->getOldBookmark(), editMUCBookmarkEvent->getNewBookmark());
+ return;
}
}
diff --git a/Swift/Controllers/UIEvents/AddMUCBookmarkUIEvent.h b/Swift/Controllers/UIEvents/AddMUCBookmarkUIEvent.h
new file mode 100644
index 0000000..715798b
--- /dev/null
+++ b/Swift/Controllers/UIEvents/AddMUCBookmarkUIEvent.h
@@ -0,0 +1,22 @@
+/*
+ * Copyright (c) 2010 Kevin Smith
+ * Licensed under the GNU General Public License v3.
+ * See Documentation/Licenses/GPLv3.txt for more information.
+ */
+
+#pragma once
+
+#include <boost/shared_ptr.hpp>
+
+#include "Swift/Controllers/UIEvents/UIEvent.h"
+#include "Swiften/MUC/MUCBookmark.h"
+
+namespace Swift {
+ class AddMUCBookmarkUIEvent : public UIEvent {
+ public:
+ AddMUCBookmarkUIEvent(const boost::shared_ptr<MUCBookmark> bookmark) : bookmark_(bookmark) {};
+ boost::shared_ptr<MUCBookmark> getBookmark() {return bookmark_;};
+ private:
+ boost::shared_ptr<MUCBookmark> bookmark_;
+ };
+}
diff --git a/Swift/Controllers/UIEvents/EditMUCBookmarkUIEvent.h b/Swift/Controllers/UIEvents/EditMUCBookmarkUIEvent.h
new file mode 100644
index 0000000..bcbcb76
--- /dev/null
+++ b/Swift/Controllers/UIEvents/EditMUCBookmarkUIEvent.h
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 2010 Kevin Smith
+ * Licensed under the GNU General Public License v3.
+ * See Documentation/Licenses/GPLv3.txt for more information.
+ */
+
+#pragma once
+
+#include <boost/shared_ptr.hpp>
+
+#include "Swift/Controllers/UIEvents/UIEvent.h"
+#include "Swiften/MUC/MUCBookmark.h"
+
+namespace Swift {
+ class EditMUCBookmarkUIEvent : public UIEvent {
+ public:
+ EditMUCBookmarkUIEvent(const boost::shared_ptr<MUCBookmark> oldBookmark, const boost::shared_ptr<MUCBookmark> newBookmark) : oldBookmark_(oldBookmark) , newBookmark_(newBookmark) {};
+ boost::shared_ptr<MUCBookmark> getOldBookmark() {return oldBookmark_;};
+ boost::shared_ptr<MUCBookmark> getNewBookmark() {return newBookmark_;};
+ private:
+ boost::shared_ptr<MUCBookmark> oldBookmark_;
+ boost::shared_ptr<MUCBookmark> newBookmark_;
+ };
+}
diff --git a/Swift/Controllers/UIEvents/RemoveMUCBookmarkUIEvent.h b/Swift/Controllers/UIEvents/RemoveMUCBookmarkUIEvent.h
new file mode 100644
index 0000000..4a59b2c
--- /dev/null
+++ b/Swift/Controllers/UIEvents/RemoveMUCBookmarkUIEvent.h
@@ -0,0 +1,22 @@
+/*
+ * Copyright (c) 2010 Kevin Smith
+ * Licensed under the GNU General Public License v3.
+ * See Documentation/Licenses/GPLv3.txt for more information.
+ */
+
+#pragma once
+
+#include <boost/shared_ptr.hpp>
+
+#include "Swift/Controllers/UIEvents/UIEvent.h"
+#include "Swiften/MUC/MUCBookmark.h"
+
+namespace Swift {
+ class RemoveMUCBookmarkUIEvent : public UIEvent {
+ public:
+ RemoveMUCBookmarkUIEvent(const boost::shared_ptr<MUCBookmark> bookmark) : bookmark_(bookmark) {};
+ boost::shared_ptr<MUCBookmark> getBookmark() {return bookmark_;};
+ private:
+ boost::shared_ptr<MUCBookmark> bookmark_;
+ };
+}