diff options
author | Mateusz Piekos <mateuszpiekos@gmail.com> | 2012-05-30 12:40:27 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2012-09-08 16:14:27 (GMT) |
commit | fe8a8aa031da734f3112184420b372021d9e10c7 (patch) | |
tree | 9f8e0b7d11d7612eb25a8682cf940fa647ca67f2 /Swift/QtUI/ChatList/ChatListModel.cpp | |
parent | 0174723efbc1f612433d45c6916a2ad4596b96ba (diff) | |
download | swift-contrib-fe8a8aa031da734f3112184420b372021d9e10c7.zip swift-contrib-fe8a8aa031da734f3112184420b372021d9e10c7.tar.bz2 |
Support whiteboarding.
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.cpp | 22 |
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(); } |