diff options
author | Kevin Smith <git@kismith.co.uk> | 2010-04-12 13:47:07 (GMT) |
---|---|---|
committer | Kevin Smith <git@kismith.co.uk> | 2010-04-12 13:47:07 (GMT) |
commit | a65372d1a0a85d04329cd91bcf6bdff2de492c80 (patch) | |
tree | e9ac9af516f402aa4ee62027894a28da5cab98ec /Swift/QtUI/EventViewer | |
parent | ed38ddf609f1190ecb2aebb5e23ead115e6a6a8d (diff) | |
download | swift-a65372d1a0a85d04329cd91bcf6bdff2de492c80.zip swift-a65372d1a0a85d04329cd91bcf6bdff2de492c80.tar.bz2 |
Show ErrorEvent when roster push fails.
Resolves: #293
Diffstat (limited to 'Swift/QtUI/EventViewer')
-rw-r--r-- | Swift/QtUI/EventViewer/QtEvent.cpp | 5 | ||||
-rw-r--r-- | Swift/QtUI/EventViewer/QtEventWindow.cpp | 4 |
2 files changed, 9 insertions, 0 deletions
diff --git a/Swift/QtUI/EventViewer/QtEvent.cpp b/Swift/QtUI/EventViewer/QtEvent.cpp index 91df26f..76875ae 100644 --- a/Swift/QtUI/EventViewer/QtEvent.cpp +++ b/Swift/QtUI/EventViewer/QtEvent.cpp @@ -7,6 +7,7 @@ #include "Swift/QtUI/EventViewer/QtEvent.h" #include "Swiften/Events/MessageEvent.h" +#include "Swiften/Events/ErrorEvent.h" #include "Swiften/Events/SubscriptionRequestEvent.h" #include "Swift/QtUI/QtSwiftUtil.h" @@ -41,6 +42,10 @@ QString QtEvent::text() { String message = subscriptionRequestEvent->getJID().toBare().toString() + " would like to add you to their roster" + (reason.isEmpty() ? "." : ", saying '" + reason + "'."); return P2QSTRING(message); } + boost::shared_ptr<ErrorEvent> errorEvent = boost::dynamic_pointer_cast<ErrorEvent>(event_); + if (errorEvent) { + return P2QSTRING(errorEvent->getText()); + } return ""; } diff --git a/Swift/QtUI/EventViewer/QtEventWindow.cpp b/Swift/QtUI/EventViewer/QtEventWindow.cpp index 84758ae..65b946a 100644 --- a/Swift/QtUI/EventViewer/QtEventWindow.cpp +++ b/Swift/QtUI/EventViewer/QtEventWindow.cpp @@ -10,6 +10,7 @@ #include <QtDebug> #include "Swiften/Events/MessageEvent.h" +#include "Swiften/Events/ErrorEvent.h" #include "Swift/QtUI/QtSubscriptionRequestWindow.h" #include "Swiften/Events/SubscriptionRequestEvent.h" #include "Swift/Controllers/UIEvents/RequestChatUIEvent.h" @@ -44,12 +45,15 @@ void QtEventWindow::handleItemActivated(const QModelIndex& item) { QtEvent* event = model_->getItem(item.row()); boost::shared_ptr<MessageEvent> messageEvent = boost::dynamic_pointer_cast<MessageEvent>(event->getEvent()); boost::shared_ptr<SubscriptionRequestEvent> subscriptionEvent = boost::dynamic_pointer_cast<SubscriptionRequestEvent>(event->getEvent()); + boost::shared_ptr<ErrorEvent> errorEvent = boost::dynamic_pointer_cast<ErrorEvent>(event->getEvent()); if (messageEvent) { eventStream_->send(boost::shared_ptr<UIEvent>(new RequestChatUIEvent(messageEvent->getStanza()->getFrom()))); } else if (subscriptionEvent) { QtSubscriptionRequestWindow* window = QtSubscriptionRequestWindow::getWindow(subscriptionEvent, this); window->show(); + } else if (errorEvent) { + errorEvent->onConclusion(); } else { qWarning() << "Trying to activate an unexpected event"; } |