diff options
author | Kevin Smith <git@kismith.co.uk> | 2010-06-07 20:44:44 (GMT) |
---|---|---|
committer | Kevin Smith <git@kismith.co.uk> | 2010-06-07 20:44:44 (GMT) |
commit | c34ba0618c794fca2d9a656670f5ae980dfcd629 (patch) | |
tree | 8e0e587040c217ee506cf98e2ee85dce744e87c2 | |
parent | 49d27079117c6b2763ff7c582815bc2a7b083a7f (diff) | |
download | swift-c34ba0618c794fca2d9a656670f5ae980dfcd629.zip swift-c34ba0618c794fca2d9a656670f5ae980dfcd629.tar.bz2 |
Make MUC groups open on single click too.
Resolves: #403
-rw-r--r-- | Swift/QtUI/ChatList/QtChatListWindow.cpp | 10 | ||||
-rw-r--r-- | Swift/QtUI/ChatList/QtChatListWindow.h | 1 |
2 files changed, 10 insertions, 1 deletions
diff --git a/Swift/QtUI/ChatList/QtChatListWindow.cpp b/Swift/QtUI/ChatList/QtChatListWindow.cpp index 8dbb501..5943078 100644 --- a/Swift/QtUI/ChatList/QtChatListWindow.cpp +++ b/Swift/QtUI/ChatList/QtChatListWindow.cpp @@ -26,7 +26,7 @@ QtChatListWindow::QtChatListWindow(UIEventStream *uiEventStream, QWidget* parent delegate_ = new ChatListDelegate(); setItemDelegate(delegate_); setHeaderHidden(true); - #ifdef SWIFT_PLATFORM_MACOSX +#ifdef SWIFT_PLATFORM_MACOSX setAlternatingRowColors(true); #endif expandAll(); @@ -35,6 +35,7 @@ QtChatListWindow::QtChatListWindow(UIEventStream *uiEventStream, QWidget* parent setRootIsDecorated(true); setupContextMenus(); connect(this, SIGNAL(activated(const QModelIndex&)), this, SLOT(handleItemActivated(const QModelIndex&))); + connect(this, SIGNAL(clicked(const QModelIndex&)), this, SLOT(handleClicked(const QModelIndex&))); } QtChatListWindow::~QtChatListWindow() { @@ -44,6 +45,13 @@ QtChatListWindow::~QtChatListWindow() { delete emptyMenu_; } +void QtChatListWindow::handleClicked(const QModelIndex& index) { + ChatListGroupItem* item = dynamic_cast<ChatListGroupItem*>(static_cast<ChatListItem*>(index.internalPointer())); + if (item) { + setExpanded(index, !isExpanded(index)); + } +} + void QtChatListWindow::setupContextMenus() { mucMenu_ = new QMenu(); mucMenu_->addAction("Add New Bookmark", this, SLOT(handleAddBookmark())); diff --git a/Swift/QtUI/ChatList/QtChatListWindow.h b/Swift/QtUI/ChatList/QtChatListWindow.h index 7d0dbb1..1215f83 100644 --- a/Swift/QtUI/ChatList/QtChatListWindow.h +++ b/Swift/QtUI/ChatList/QtChatListWindow.h @@ -28,6 +28,7 @@ namespace Swift { void handleAddBookmark(); void handleEditBookmark(); void handleRemoveBookmark(); + void handleClicked(const QModelIndex& index); protected: void contextMenuEvent(QContextMenuEvent* event); |