diff options
author | Tobias Markmann <tm@ayena.de> | 2015-07-09 08:30:11 (GMT) |
---|---|---|
committer | Tobias Markmann <tm@ayena.de> | 2015-07-10 14:00:16 (GMT) |
commit | 7af21fdd59af3b3112cff69996301605859af84c (patch) | |
tree | 5a1c79ac5d8c3a5521b098f68ae6c190a291455c /Swift/QtUI/EventViewer/QtEventWindow.cpp | |
parent | a23d903d67f05257f0e9376a212b83045ea768f1 (diff) | |
download | swift-7af21fdd59af3b3112cff69996301605859af84c.zip swift-7af21fdd59af3b3112cff69996301605859af84c.tar.bz2 |
Create notice events for incoming file-transfers
Test-Information:
Send a file from one Swift instance to another. The UX is similar to
that of a MUC invite, clicking the notice will bring the relevant chat
in front.
Change-Id: Ief3cd7371ae01b2b38b6d1af36189df961eacef4
Diffstat (limited to 'Swift/QtUI/EventViewer/QtEventWindow.cpp')
-rw-r--r-- | Swift/QtUI/EventViewer/QtEventWindow.cpp | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/Swift/QtUI/EventViewer/QtEventWindow.cpp b/Swift/QtUI/EventViewer/QtEventWindow.cpp index 3072497..f92cd07 100644 --- a/Swift/QtUI/EventViewer/QtEventWindow.cpp +++ b/Swift/QtUI/EventViewer/QtEventWindow.cpp @@ -1,30 +1,30 @@ - /* * Copyright (c) 2010-2015 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ -#include "Swift/QtUI/EventViewer/QtEventWindow.h" +#include <Swift/QtUI/EventViewer/QtEventWindow.h> -#include <QtDebug> #include <QBoxLayout> -#include <QPushButton> #include <QMessageBox> +#include <QPushButton> +#include <QtDebug> -#include "Swift/Controllers/XMPPEvents/MessageEvent.h" -#include "Swift/Controllers/XMPPEvents/ErrorEvent.h" -#include "Swift/QtUI/QtSubscriptionRequestWindow.h" -#include "Swift/Controllers/XMPPEvents/SubscriptionRequestEvent.h" -#include "Swift/Controllers/XMPPEvents/MUCInviteEvent.h" -#include "Swift/Controllers/UIEvents/RequestChatUIEvent.h" -#include "Swift/Controllers/UIEvents/JoinMUCUIEvent.h" +#include <Swiften/Base/Platform.h> +#include <Swift/Controllers/UIEvents/JoinMUCUIEvent.h> +#include <Swift/Controllers/UIEvents/RequestChatUIEvent.h> +#include <Swift/Controllers/XMPPEvents/ErrorEvent.h> +#include <Swift/Controllers/XMPPEvents/IncomingFileTransferEvent.h> +#include <Swift/Controllers/XMPPEvents/MUCInviteEvent.h> +#include <Swift/Controllers/XMPPEvents/MessageEvent.h> +#include <Swift/Controllers/XMPPEvents/SubscriptionRequestEvent.h> -#include "Swiften/Base/Platform.h" +#include <Swift/QtUI/QtSubscriptionRequestWindow.h> namespace Swift { QtEventWindow::QtEventWindow(UIEventStream* eventStream) : EventWindow(false) { QBoxLayout* layout = new QBoxLayout(QBoxLayout::TopToBottom, this); layout->setContentsMargins(0,0,0,0); @@ -73,12 +73,13 @@ void QtEventWindow::handleReadClicked() { 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<MUCInviteEvent> mucInviteEvent = boost::dynamic_pointer_cast<MUCInviteEvent>(event->getEvent()); + boost::shared_ptr<IncomingFileTransferEvent> incomingFTEvent = boost::dynamic_pointer_cast<IncomingFileTransferEvent>(event->getEvent()); boost::shared_ptr<ErrorEvent> errorEvent = boost::dynamic_pointer_cast<ErrorEvent>(event->getEvent()); if (messageEvent) { if (messageEvent->getStanza()->getType() == Message::Groupchat) { eventStream_->send(boost::shared_ptr<UIEvent>(new JoinMUCUIEvent(messageEvent->getStanza()->getFrom().toBare(), messageEvent->getStanza()->getTo().getResource()))); } else { @@ -87,12 +88,15 @@ void QtEventWindow::handleItemActivated(const QModelIndex& item) { } else if (subscriptionEvent) { QtSubscriptionRequestWindow* window = QtSubscriptionRequestWindow::getWindow(subscriptionEvent, this); window->show(); } else if (mucInviteEvent) { eventStream_->send(boost::shared_ptr<UIEvent>(new RequestChatUIEvent(mucInviteEvent->getInviter()))); mucInviteEvent->conclude(); + } else if (incomingFTEvent) { + eventStream_->send(boost::shared_ptr<UIEvent>(new RequestChatUIEvent(incomingFTEvent->getSender()))); + incomingFTEvent->conclude(); } else { if (errorEvent) { errorEvent->conclude(); } QMessageBox msgBox; msgBox.setText(model_->data(item, Qt::DisplayRole).toString()); |