summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swift/QtUI/Roster/QtTreeWidget.cpp')
-rw-r--r--Swift/QtUI/Roster/QtTreeWidget.cpp21
1 files changed, 7 insertions, 14 deletions
diff --git a/Swift/QtUI/Roster/QtTreeWidget.cpp b/Swift/QtUI/Roster/QtTreeWidget.cpp
index 325edef..fbe85de 100644
--- a/Swift/QtUI/Roster/QtTreeWidget.cpp
+++ b/Swift/QtUI/Roster/QtTreeWidget.cpp
@@ -139,22 +139,15 @@ void QtTreeWidget::currentChanged(const QModelIndex& current, const QModelIndex&
void QtTreeWidget::handleItemActivated(const QModelIndex& index) {
- switch (messageTarget_) {
- case MessageDisplayJID: {
- QString indexJID = index.data(DisplayJIDRole).toString();
- if (!indexJID.isEmpty()) {
- JID target = JID(Q2PSTRING(indexJID)).toBare();
- eventStream_->send(boost::shared_ptr<UIEvent>(new RequestChatUIEvent(target)));
- break;
+ JID target;
+ if (messageTarget_ == MessageDisplayJID) {
+ target = JID(Q2PSTRING(index.data(DisplayJIDRole).toString()));
+ target = target.toBare();
}
+ if (!target.isValid()) {
+ target = JID(Q2PSTRING(index.data(JIDRole).toString()));
}
- case MessageDefaultJID: {
- QString indexJID = index.data(JIDRole).toString();
- if (!indexJID.isEmpty()) {
- JID target = JID(Q2PSTRING(indexJID));
+ if (target.isValid()) {
eventStream_->send(boost::shared_ptr<UIEvent>(new RequestChatUIEvent(target)));
}
- break;
- }
- }
}