diff options
Diffstat (limited to 'Swift/Controllers/BlockListController.cpp')
-rw-r--r-- | Swift/Controllers/BlockListController.cpp | 34 |
1 files changed, 29 insertions, 5 deletions
diff --git a/Swift/Controllers/BlockListController.cpp b/Swift/Controllers/BlockListController.cpp index d778883..9cd42f0 100644 --- a/Swift/Controllers/BlockListController.cpp +++ b/Swift/Controllers/BlockListController.cpp @@ -6,2 +6,8 @@ +/* + * Copyright (c) 2014 Kevin Smith and Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + #include <Swift/Controllers/BlockListController.h> @@ -59,2 +65,3 @@ void BlockListController::handleUIEvent(boost::shared_ptr<UIEvent> rawEvent) { blockListEditorWidget_->setCurrentBlockList(blockListBeforeEdit); + blockListEditorWidget_->setError(""); blockListEditorWidget_->show(); @@ -87,3 +94,9 @@ void BlockListController::handleBlockResponse(GenericRequest<BlockPayload>::ref } - eventController_->handleIncomingEvent(boost::make_shared<ErrorEvent>(request->getReceiver(), errorMessage)); + if (blockListEditorWidget_ && originEditor) { + blockListEditorWidget_->setError(errorMessage); + blockListEditorWidget_->setBusy(false); + } + else { + eventController_->handleIncomingEvent(boost::make_shared<ErrorEvent>(request->getReceiver(), errorMessage)); + } } @@ -91,4 +104,5 @@ void BlockListController::handleBlockResponse(GenericRequest<BlockPayload>::ref remainingRequests_--; - if (blockListEditorWidget_ && (remainingRequests_ == 0)) { + if (blockListEditorWidget_ && (remainingRequests_ == 0) && !error) { blockListEditorWidget_->setBusy(false); + blockListEditorWidget_->hide(); } @@ -105,3 +119,9 @@ void BlockListController::handleUnblockResponse(GenericRequest<UnblockPayload>:: } - eventController_->handleIncomingEvent(boost::make_shared<ErrorEvent>(request->getReceiver(), errorMessage)); + if (blockListEditorWidget_ && originEditor) { + blockListEditorWidget_->setError(errorMessage); + blockListEditorWidget_->setBusy(false); + } + else { + eventController_->handleIncomingEvent(boost::make_shared<ErrorEvent>(request->getReceiver(), errorMessage)); + } } @@ -109,4 +129,5 @@ void BlockListController::handleUnblockResponse(GenericRequest<UnblockPayload>:: remainingRequests_--; - if (blockListEditorWidget_ && (remainingRequests_ == 0)) { + if (blockListEditorWidget_ && (remainingRequests_ == 0) && !error) { blockListEditorWidget_->setBusy(false); + blockListEditorWidget_->hide(); } @@ -133,5 +154,8 @@ void BlockListController::handleSetNewBlockList(const std::vector<JID> &newBlock } - if (!jidsToBlock.empty() || jidsToUnblock.empty()) { + if (!jidsToBlock.empty() || !jidsToUnblock.empty()) { assert(blockListEditorWidget_); blockListEditorWidget_->setBusy(true); + blockListEditorWidget_->setError(""); + } else { + blockListEditorWidget_->hide(); } |