From c34ba0618c794fca2d9a656670f5ae980dfcd629 Mon Sep 17 00:00:00 2001 From: Kevin Smith Date: Mon, 7 Jun 2010 21:44:44 +0100 Subject: Make MUC groups open on single click too. Resolves: #403 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(static_cast(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); -- cgit v0.10.2-6-g49f6