diff options
author | Kevin Smith <git@kismith.co.uk> | 2010-09-12 20:36:48 (GMT) |
---|---|---|
committer | Kevin Smith <git@kismith.co.uk> | 2010-09-12 20:36:48 (GMT) |
commit | 0da93507bea788cf6bd8f327478caddf3ea679e5 (patch) | |
tree | 1e0e0609eea3a594b78fdad401282354db640fa6 /Swift/QtUI/ChatList | |
parent | 536df08ad0646a95ab1352fb9e2b49b00aaaaf2b (diff) | |
download | swift-0da93507bea788cf6bd8f327478caddf3ea679e5.zip swift-0da93507bea788cf6bd8f327478caddf3ea679e5.tar.bz2 |
Block MUC bookmarks until the server has responded.
Else there could be bookmarks overwritten in an infeasibly unlikely race condition.
Resolves: #340
Diffstat (limited to 'Swift/QtUI/ChatList')
-rw-r--r-- | Swift/QtUI/ChatList/QtChatListWindow.cpp | 8 | ||||
-rw-r--r-- | Swift/QtUI/ChatList/QtChatListWindow.h | 2 |
2 files changed, 10 insertions, 0 deletions
diff --git a/Swift/QtUI/ChatList/QtChatListWindow.cpp b/Swift/QtUI/ChatList/QtChatListWindow.cpp index 5943078..86dfa8f 100644 --- a/Swift/QtUI/ChatList/QtChatListWindow.cpp +++ b/Swift/QtUI/ChatList/QtChatListWindow.cpp @@ -21,6 +21,7 @@ namespace Swift { QtChatListWindow::QtChatListWindow(UIEventStream *uiEventStream, QWidget* parent) : QTreeView(parent) { eventStream_ = uiEventStream; + bookmarksEnabled_ = false; model_ = new ChatListModel(); setModel(model_); delegate_ = new ChatListDelegate(); @@ -45,6 +46,10 @@ QtChatListWindow::~QtChatListWindow() { delete emptyMenu_; } +void QtChatListWindow::setBookmarksEnabled(bool enabled) { + bookmarksEnabled_ = enabled; +} + void QtChatListWindow::handleClicked(const QModelIndex& index) { ChatListGroupItem* item = dynamic_cast<ChatListGroupItem*>(static_cast<ChatListItem*>(index.internalPointer())); if (item) { @@ -99,6 +104,9 @@ void QtChatListWindow::handleEditBookmark() { void QtChatListWindow::contextMenuEvent(QContextMenuEvent* event) { + if (!bookmarksEnabled_) { + return; + } QModelIndex index = indexAt(event->pos()); ChatListItem* baseItem = index.isValid() ? static_cast<ChatListItem*>(index.internalPointer()) : NULL; contextMenuItem_ = baseItem; diff --git a/Swift/QtUI/ChatList/QtChatListWindow.h b/Swift/QtUI/ChatList/QtChatListWindow.h index 1215f83..2c13300 100644 --- a/Swift/QtUI/ChatList/QtChatListWindow.h +++ b/Swift/QtUI/ChatList/QtChatListWindow.h @@ -23,6 +23,7 @@ namespace Swift { virtual ~QtChatListWindow(); void addMUCBookmark(const MUCBookmark& bookmark); void removeMUCBookmark(const MUCBookmark& bookmark); + void setBookmarksEnabled(bool enabled); private slots: void handleItemActivated(const QModelIndex&); void handleAddBookmark(); @@ -34,6 +35,7 @@ namespace Swift { void contextMenuEvent(QContextMenuEvent* event); private: void setupContextMenus(); + bool bookmarksEnabled_; UIEventStream* eventStream_; ChatListModel* model_; ChatListDelegate* delegate_; |