summaryrefslogtreecommitdiffstats
path: root/Swift
diff options
context:
space:
mode:
authorRichard Maudsley <richard.maudsley@isode.com>2014-04-17 08:20:32 (GMT)
committerSwift Review <review@swift.im>2014-05-27 13:56:47 (GMT)
commit67cc8dff4e80344c2d10e2691c562c2440fd8c1c (patch)
treeab06eb839c422e8c28f0324b934614f112537fba /Swift
parent8930bbfd434468a4f2c601400705e8a545310c6c (diff)
downloadswift-67cc8dff4e80344c2d10e2691c562c2440fd8c1c.zip
swift-67cc8dff4e80344c2d10e2691c562c2440fd8c1c.tar.bz2
Fix QtTreeWidget compiler warnings.
Change-Id: Ib15a950faca1d0fcc9c20809e63b531160995247
Diffstat (limited to 'Swift')
-rw-r--r--Swift/QtUI/Roster/QtTreeWidget.cpp23
-rw-r--r--Swift/QtUI/Roster/RosterModel.cpp6
2 files changed, 13 insertions, 16 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
@@ -138,23 +138,16 @@ 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();
}
- case MessageDefaultJID: {
- QString indexJID = index.data(JIDRole).toString();
- if (!indexJID.isEmpty()) {
- JID target = JID(Q2PSTRING(indexJID));
- eventStream_->send(boost::shared_ptr<UIEvent>(new RequestChatUIEvent(target)));
- }
- break;
+ if (!target.isValid()) {
+ target = JID(Q2PSTRING(index.data(JIDRole).toString()));
}
+ if (target.isValid()) {
+ eventStream_->send(boost::shared_ptr<UIEvent>(new RequestChatUIEvent(target)));
}
}
diff --git a/Swift/QtUI/Roster/RosterModel.cpp b/Swift/QtUI/Roster/RosterModel.cpp
index d8108ba..730ffbb 100644
--- a/Swift/QtUI/Roster/RosterModel.cpp
+++ b/Swift/QtUI/Roster/RosterModel.cpp
@@ -190,7 +190,11 @@ QString RosterModel::getJID(RosterItem* item) const {
QString RosterModel::getDisplayJID(RosterItem* item) const {
ContactRosterItem* contact = dynamic_cast<ContactRosterItem*>(item);
- return contact ? P2QSTRING(contact->getDisplayJID().toString()) : QString();
+ QString result = contact ? P2QSTRING(contact->getDisplayJID().toString()) : QString();
+ if (result.isEmpty()) {
+ result = getJID(item);
+ }
+ return result;
}
QIcon RosterModel::getPresenceIcon(RosterItem* item) const {