summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Smith <git@kismith.co.uk>2010-06-07 20:44:44 (GMT)
committerKevin Smith <git@kismith.co.uk>2010-06-07 20:44:44 (GMT)
commitc34ba0618c794fca2d9a656670f5ae980dfcd629 (patch)
tree8e0e587040c217ee506cf98e2ee85dce744e87c2 /Swift/QtUI
parent49d27079117c6b2763ff7c582815bc2a7b083a7f (diff)
downloadswift-contrib-c34ba0618c794fca2d9a656670f5ae980dfcd629.zip
swift-contrib-c34ba0618c794fca2d9a656670f5ae980dfcd629.tar.bz2
Make MUC groups open on single click too.
Resolves: #403
Diffstat (limited to 'Swift/QtUI')
-rw-r--r--Swift/QtUI/ChatList/QtChatListWindow.cpp10
-rw-r--r--Swift/QtUI/ChatList/QtChatListWindow.h1
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);