Exemple #1
0
void ChatListModel::removeMUCBookmark(const Swift::MUCBookmark& bookmark) {
    for (int i = 0; i < mucBookmarks_->rowCount(); i++) {
        ChatListMUCItem* item = dynamic_cast<ChatListMUCItem*>(mucBookmarks_->item(i));
        if (item->getBookmark() == bookmark) {
            emit layoutAboutToBeChanged();
            mucBookmarks_->remove(i);
            emit layoutChanged();
            break;
        }
    }
}
void QtChatListWindow::handleItemActivated(const QModelIndex& index) {
	if (!bookmarksEnabled_) {
		return;
	}
	ChatListItem* item = model_->getItemForIndex(index);
	ChatListMUCItem* mucItem = dynamic_cast<ChatListMUCItem*>(item);
	if (mucItem) {
		boost::shared_ptr<UIEvent> event(new JoinMUCUIEvent(mucItem->getBookmark().getRoom(), mucItem->getBookmark().getNick()));
		eventStream_->send(event);
	}
}
void QtChatListWindow::handleEditBookmark() {
	ChatListMUCItem* mucItem = dynamic_cast<ChatListMUCItem*>(contextMenuItem_);
	if (!mucItem) return;
	QtEditBookmarkWindow* window = new QtEditBookmarkWindow(eventStream_, mucItem->getBookmark());
	window->show();
}
void QtChatListWindow::handleRemoveBookmark() {
	ChatListMUCItem* mucItem = dynamic_cast<ChatListMUCItem*>(contextMenuItem_);
	if (!mucItem) return;
	eventStream_->send(boost::shared_ptr<UIEvent>(new RemoveMUCBookmarkUIEvent(mucItem->getBookmark())));
}