summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swift/Controllers/BlockListController.cpp')
-rw-r--r--Swift/Controllers/BlockListController.cpp30
1 files changed, 27 insertions, 3 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
@@ -5,4 +5,10 @@
*/
+/*
+ * 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>
@@ -58,4 +64,5 @@ void BlockListController::handleUIEvent(boost::shared_ptr<UIEvent> rawEvent) {
blockListBeforeEdit = blockListManager_->getBlockList()->getItems();
blockListEditorWidget_->setCurrentBlockList(blockListBeforeEdit);
+ blockListEditorWidget_->setError("");
blockListEditorWidget_->show();
return;
@@ -86,10 +93,17 @@ void BlockListController::handleBlockResponse(GenericRequest<BlockPayload>::ref
errorMessage = str(format(QT_TRANSLATE_NOOP("", "%1%: %2%.")) % errorMessage % error->getText());
}
+ if (blockListEditorWidget_ && originEditor) {
+ blockListEditorWidget_->setError(errorMessage);
+ blockListEditorWidget_->setBusy(false);
+ }
+ else {
eventController_->handleIncomingEvent(boost::make_shared<ErrorEvent>(request->getReceiver(), errorMessage));
}
+ }
if (originEditor) {
remainingRequests_--;
- if (blockListEditorWidget_ && (remainingRequests_ == 0)) {
+ if (blockListEditorWidget_ && (remainingRequests_ == 0) && !error) {
blockListEditorWidget_->setBusy(false);
+ blockListEditorWidget_->hide();
}
}
@@ -104,10 +118,17 @@ void BlockListController::handleUnblockResponse(GenericRequest<UnblockPayload>::
errorMessage = str(format(QT_TRANSLATE_NOOP("", "%1%: %2%.")) % errorMessage % error->getText());
}
+ if (blockListEditorWidget_ && originEditor) {
+ blockListEditorWidget_->setError(errorMessage);
+ blockListEditorWidget_->setBusy(false);
+ }
+ else {
eventController_->handleIncomingEvent(boost::make_shared<ErrorEvent>(request->getReceiver(), errorMessage));
}
+ }
if (originEditor) {
remainingRequests_--;
- if (blockListEditorWidget_ && (remainingRequests_ == 0)) {
+ if (blockListEditorWidget_ && (remainingRequests_ == 0) && !error) {
blockListEditorWidget_->setBusy(false);
+ blockListEditorWidget_->hide();
}
}
@@ -132,7 +153,10 @@ void BlockListController::handleSetNewBlockList(const std::vector<JID> &newBlock
unblockRequest->send();
}
- if (!jidsToBlock.empty() || jidsToUnblock.empty()) {
+ if (!jidsToBlock.empty() || !jidsToUnblock.empty()) {
assert(blockListEditorWidget_);
blockListEditorWidget_->setBusy(true);
+ blockListEditorWidget_->setError("");
+ } else {
+ blockListEditorWidget_->hide();
}
}