summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Smith <git@kismith.co.uk>2011-04-27 20:42:11 (GMT)
committerKevin Smith <git@kismith.co.uk>2011-04-27 20:58:17 (GMT)
commitf48dbee2fb5acf7c0abc9d7897d736233b1f0d2f (patch)
tree512879020dc60ecb0b0b5e70219bf588c5a2f5af /Swift/QtUI/ChatList/ChatListModel.cpp
parent73c97d9222040b6160321a32e55a5a3913923e5e (diff)
downloadswift-f48dbee2fb5acf7c0abc9d7897d736233b1f0d2f.zip
swift-f48dbee2fb5acf7c0abc9d7897d736233b1f0d2f.tar.bz2
Start on recent chats list
Diffstat (limited to 'Swift/QtUI/ChatList/ChatListModel.cpp')
-rw-r--r--Swift/QtUI/ChatList/ChatListModel.cpp20
1 files changed, 16 insertions, 4 deletions
diff --git a/Swift/QtUI/ChatList/ChatListModel.cpp b/Swift/QtUI/ChatList/ChatListModel.cpp
index ba7b766..dc60d65 100644
--- a/Swift/QtUI/ChatList/ChatListModel.cpp
+++ b/Swift/QtUI/ChatList/ChatListModel.cpp
@@ -1,22 +1,25 @@
/*
- * Copyright (c) 2010 Kevin Smith
+ * Copyright (c) 2010-2011 Kevin Smith
* Licensed under the GNU General Public License v3.
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-#include "Swift/QtUI/ChatList/ChatListModel.h"
+#include <Swift/QtUI/ChatList/ChatListModel.h>
-#include "Swift/QtUI/ChatList/ChatListMUCItem.h"
+#include <Swift/QtUI/ChatList/ChatListMUCItem.h>
+#include <Swift/QtUI/ChatList/ChatListRecentItem.h>
namespace Swift {
ChatListModel::ChatListModel() {
root_ = new ChatListGroupItem("", NULL);
mucBookmarks_ = new ChatListGroupItem(tr("Bookmarked Rooms"), root_);
+ recents_ = new ChatListGroupItem(tr("Recent Chats"), root_, false);
root_->addItem(mucBookmarks_);
+ root_->addItem(recents_);
}
-void ChatListModel::clear() {
+void ChatListModel::clearBookmarks() {
emit layoutAboutToBeChanged();
mucBookmarks_->clear();
emit layoutChanged();
@@ -43,6 +46,15 @@ void ChatListModel::removeMUCBookmark(const Swift::MUCBookmark& bookmark) {
}
}
+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_));
+ }
+ emit layoutChanged();
+}
+
int ChatListModel::columnCount(const QModelIndex& /*parent*/) const {
return 1;
}