diff options
Diffstat (limited to 'Swift/QtUI')
-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"; } |