summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMateusz Piekos <mateuszpiekos@gmail.com>2012-05-30 12:40:27 (GMT)
committerMateusz Piekos <mateuszpiekos@gmail.com>2012-08-18 10:46:13 (GMT)
commit124d81ccdde6d37a0ad9ec2643afb4228bd56e1d (patch)
tree75779d1864fcd36b8b15cf2ea6797fc3e9aedf8f /Swift/QtUI/ChatList/ChatListModel.cpp
parent6856199274e9c5e581220fccf520b8f011519d17 (diff)
downloadswift-contrib-pielas/whiteboardnew.zip
swift-contrib-pielas/whiteboardnew.tar.bz2
Support whiteboarding.pielas/whiteboardnew
License: This patch is BSD-licensed, see http://www.opensource.org/licenses/bsd-license.php
Diffstat (limited to 'Swift/QtUI/ChatList/ChatListModel.cpp')
-rw-r--r--Swift/QtUI/ChatList/ChatListModel.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/Swift/QtUI/ChatList/ChatListModel.cpp b/Swift/QtUI/ChatList/ChatListModel.cpp
index 681c1c2..15f4dfe 100644
--- a/Swift/QtUI/ChatList/ChatListModel.cpp
+++ b/Swift/QtUI/ChatList/ChatListModel.cpp
@@ -8,6 +8,7 @@
#include <Swift/QtUI/ChatList/ChatListMUCItem.h>
#include <Swift/QtUI/ChatList/ChatListRecentItem.h>
+#include <Swift/QtUI/ChatList/ChatListWhiteboardItem.h>
namespace Swift {
@@ -15,8 +16,10 @@ ChatListModel::ChatListModel() {
root_ = new ChatListGroupItem("", NULL, false);
mucBookmarks_ = new ChatListGroupItem(tr("Bookmarked Rooms"), root_);
recents_ = new ChatListGroupItem(tr("Recent Chats"), root_, false);
+ whiteboards_ = new ChatListGroupItem(tr("Opened Whiteboards"), root_, false);
root_->addItem(recents_);
root_->addItem(mucBookmarks_);
+ root_->addItem(whiteboards_);
}
void ChatListModel::clearBookmarks() {
@@ -46,11 +49,30 @@ void ChatListModel::removeMUCBookmark(const Swift::MUCBookmark& bookmark) {
}
}
+void ChatListModel::addWhiteboardSession(const ChatListWindow::Chat& chat) {
+ emit layoutAboutToBeChanged();
+ whiteboards_->addItem(new ChatListWhiteboardItem(chat, whiteboards_));
+ emit layoutChanged();
+}
+
+void ChatListModel::removeWhiteboardSession(const JID& jid) {
+ for (int i = 0; i < whiteboards_->rowCount(); i++) {
+ ChatListWhiteboardItem* item = dynamic_cast<ChatListWhiteboardItem*>(whiteboards_->item(i));
+ if (item->getChat().jid == jid) {
+ emit layoutAboutToBeChanged();
+ whiteboards_->remove(i);
+ emit layoutChanged();
+ break;
+ }
+ }
+}
+
void ChatListModel::setRecents(const std::list<ChatListWindow::Chat>& recents) {
emit layoutAboutToBeChanged();
recents_->clear();
foreach (const ChatListWindow::Chat chat, recents) {
recents_->addItem(new ChatListRecentItem(chat, recents_));
+//whiteboards_->addItem(new ChatListRecentItem(chat, whiteboards_));
}
emit layoutChanged();
}