diff options
author | Kevin Smith <git@kismith.co.uk> | 2010-04-16 15:09:23 (GMT) |
---|---|---|
committer | Kevin Smith <git@kismith.co.uk> | 2010-04-16 15:09:23 (GMT) |
commit | e51448532f837d3ac28ea3c9b03f711df1940803 (patch) | |
tree | ad8582a7a311384002e16e706dcc376c50fd7e2d /Swift/QtUI/EventViewer/QtEvent.cpp | |
parent | 1e42aa0003876f5416f723d535ca27e7b2f6dc68 (diff) | |
download | swift-contrib-e51448532f837d3ac28ea3c9b03f711df1940803.zip swift-contrib-e51448532f837d3ac28ea3c9b03f711df1940803.tar.bz2 |
Slighly better rendering for the Event view.
Diffstat (limited to 'Swift/QtUI/EventViewer/QtEvent.cpp')
-rw-r--r-- | Swift/QtUI/EventViewer/QtEvent.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/Swift/QtUI/EventViewer/QtEvent.cpp b/Swift/QtUI/EventViewer/QtEvent.cpp index 76875ae..844a7f7 100644 --- a/Swift/QtUI/EventViewer/QtEvent.cpp +++ b/Swift/QtUI/EventViewer/QtEvent.cpp @@ -24,6 +24,7 @@ QVariant QtEvent::data(int role) { case Qt::DisplayRole: return QVariant(text()); case Qt::TextColorRole: return active_ ? Qt::black : Qt::darkGray; case Qt::BackgroundColorRole: return active_ ? Qt::white : Qt::lightGray; + case SenderRole: return QVariant(sender()); /*case StatusTextRole: return statusText_; case AvatarRole: return avatar_; case PresenceIconRole: return getPresenceIcon();*/ @@ -31,6 +32,22 @@ QVariant QtEvent::data(int role) { } } +QString QtEvent::sender() { + boost::shared_ptr<MessageEvent> messageEvent = boost::dynamic_pointer_cast<MessageEvent>(event_); + if (messageEvent) { + return P2QSTRING(messageEvent->getStanza()->getFrom().toString()); + } + boost::shared_ptr<SubscriptionRequestEvent> subscriptionRequestEvent = boost::dynamic_pointer_cast<SubscriptionRequestEvent>(event_); + if (subscriptionRequestEvent) { + return P2QSTRING(subscriptionRequestEvent->getJID().toBare().toString()); + } + boost::shared_ptr<ErrorEvent> errorEvent = boost::dynamic_pointer_cast<ErrorEvent>(event_); + if (errorEvent) { + return P2QSTRING(errorEvent->getJID().toBare().toString()); + } + return ""; +} + QString QtEvent::text() { boost::shared_ptr<MessageEvent> messageEvent = boost::dynamic_pointer_cast<MessageEvent>(event_); if (messageEvent) { |