diff options
author | Tobias Markmann <tm@ayena.de> | 2015-06-20 16:26:26 (GMT) |
---|---|---|
committer | Kevin Smith <kevin.smith@isode.com> | 2015-07-08 07:08:50 (GMT) |
commit | 0e6beadc1b4427e8ab5109e52872f99a5f85c3d8 (patch) | |
tree | c395e5d9eac735d0e0a596969e17cca589a36edb /Swift/Controllers | |
parent | 5c55a79de95c11cecc0c98b57dfa1ff81ec7fb95 (diff) | |
download | swift-0e6beadc1b4427e8ab5109e52872f99a5f85c3d8.zip swift-0e6beadc1b4427e8ab5109e52872f99a5f85c3d8.tar.bz2 |
React to file transfer cancellation before the transfer started
Connect FileTransfer::onStateChanged signal earler to slot in
FileTransferController, so the slot will be called for state changes
that occur before a transfer started.
Test-Information:
Tested with two Swift instances and cancelling the sender side and
receiver side. Without this patch the receiver side UI does not change
if the receiver side cancels the transfer.
Change-Id: I1d4d3e1ac78689a16120bfa9ccdec30ab1191ee3
Diffstat (limited to 'Swift/Controllers')
-rw-r--r-- | Swift/Controllers/FileTransfer/FileTransferController.cpp | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/Swift/Controllers/FileTransfer/FileTransferController.cpp b/Swift/Controllers/FileTransfer/FileTransferController.cpp index 0160a7a..076d3c0 100644 --- a/Swift/Controllers/FileTransfer/FileTransferController.cpp +++ b/Swift/Controllers/FileTransfer/FileTransferController.cpp @@ -4,18 +4,26 @@ * See Documentation/Licenses/BSD-simplified.txt for more information. */ -#include "FileTransferController.h" -#include "Swiften/FileTransfer/OutgoingJingleFileTransfer.h" -#include "Swiften/FileTransfer/FileTransferManager.h" -#include <Swiften/FileTransfer/FileReadBytestream.h> -#include <Swiften/Base/boost_bsignals.h> +/* + * Copyright (c) 2015 Isode Limited. + * All rights reserved. + * See the COPYING file for more information. + */ + +#include <Swift/Controllers/FileTransfer/FileTransferController.h> + #include <boost/bind.hpp> #include <boost/filesystem.hpp> -#include "Swift/Controllers/UIInterfaces/ChatWindow.h" +#include <boost/smart_ptr/make_shared.hpp> + +#include <Swiften/FileTransfer/FileTransferManager.h> +#include <Swiften/FileTransfer/OutgoingJingleFileTransfer.h> #include <Swiften/Base/Log.h> -#include <Swift/Controllers/Intl.h> +#include <Swiften/Base/boost_bsignals.h> +#include <Swiften/FileTransfer/FileReadBytestream.h> -#include <boost/smart_ptr/make_shared.hpp> +#include <Swift/Controllers/UIInterfaces/ChatWindow.h> +#include <Swift/Controllers/Intl.h> namespace Swift { @@ -26,11 +34,12 @@ FileTransferController::FileTransferController(const JID& receipient, const std: FileTransferController::FileTransferController(IncomingFileTransfer::ref transfer) : sending(false), otherParty(transfer->getSender()), filename(transfer->getFileName()), transfer(transfer), ftManager(0), ftProgressInfo(0), chatWindow(0), currentState(FileTransfer::State::WaitingForStart) { - + transfer->onStateChanged.connect(boost::bind(&FileTransferController::handleFileTransferStateChange, this, _1)); } FileTransferController::~FileTransferController() { delete ftProgressInfo; + transfer->onStateChanged.disconnect(boost::bind(&FileTransferController::handleFileTransferStateChange, this, _1)); } const JID &FileTransferController::getOtherParty() const { @@ -95,7 +104,6 @@ void FileTransferController::accept(std::string& file) { ftProgressInfo = new FileTransferProgressInfo(transfer->getFileSizeInBytes()); ftProgressInfo->onProgressPercentage.connect(boost::bind(&FileTransferController::handleProgressPercentageChange, this, _1)); - transfer->onStateChanged.connect(boost::bind(&FileTransferController::handleFileTransferStateChange, this, _1)); transfer->onProcessedBytes.connect(boost::bind(&FileTransferProgressInfo::setBytesProcessed, ftProgressInfo, _1)); incomingTransfer->accept(fileWriteStream); } else { |