summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swift/Controllers/ShowProfileController.cpp')
-rw-r--r--Swift/Controllers/ShowProfileController.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/Swift/Controllers/ShowProfileController.cpp b/Swift/Controllers/ShowProfileController.cpp
index b379141..a7d7d04 100644
--- a/Swift/Controllers/ShowProfileController.cpp
+++ b/Swift/Controllers/ShowProfileController.cpp
@@ -5,7 +5,7 @@
*/
/*
- * Copyright (c) 2014-2016 Isode Limited.
+ * Copyright (c) 2014-2017 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -17,6 +17,7 @@
#include <Swiften/VCards/VCardManager.h>
+#include <Swift/Controllers/Intl.h>
#include <Swift/Controllers/UIEvents/ShowProfileForRosterItemUIEvent.h>
#include <Swift/Controllers/UIEvents/UIEventStream.h>
#include <Swift/Controllers/UIInterfaces/ProfileWindowFactory.h>
@@ -26,6 +27,7 @@ namespace Swift {
ShowProfileController::ShowProfileController(VCardManager* vcardManager, ProfileWindowFactory* profileWindowFactory, UIEventStream* uiEventStream) : vcardManager(vcardManager), profileWindowFactory(profileWindowFactory), uiEventStream(uiEventStream) {
uiEventStream->onUIEvent.connect(boost::bind(&ShowProfileController::handleUIEvent, this, _1));
vcardManager->onVCardChanged.connect(boost::bind(&ShowProfileController::handleVCardChanged, this, _1, _2));
+ vcardManager->onVCardRetrievalError.connect(boost::bind(&ShowProfileController::handleVCardRetrievalError, this, _1, _2));
}
ShowProfileController::~ShowProfileController() {
@@ -34,6 +36,7 @@ ShowProfileController::~ShowProfileController() {
delete jidWndPair.second;
}
+ vcardManager->onVCardRetrievalError.disconnect(boost::bind(&ShowProfileController::handleVCardRetrievalError, this, _1, _2));
vcardManager->onVCardChanged.disconnect(boost::bind(&ShowProfileController::handleVCardChanged, this, _1, _2));
uiEventStream->onUIEvent.disconnect(boost::bind(&ShowProfileController::handleUIEvent, this, _1));
}
@@ -55,6 +58,7 @@ void ShowProfileController::handleUIEvent(UIEvent::ref event) {
} else {
newProfileWindow->setProcessing(true);
}
+ newProfileWindow->setError("");
newProfileWindow->show();
} else {
openedProfileWindows[showProfileEvent->getJID()]->show();
@@ -76,4 +80,15 @@ void ShowProfileController::handleProfileWindowAboutToBeClosed(const JID& profil
openedProfileWindows.erase(profileJid);
}
+void ShowProfileController::handleVCardRetrievalError(const JID& jid, ErrorPayload::ref /* error */) {
+ if (openedProfileWindows.find(jid) == openedProfileWindows.end()) {
+ return;
+ }
+
+ auto profileWindow = openedProfileWindows[jid];
+ profileWindow->setError(QT_TRANSLATE_NOOP("", "Failed to retrieve recent profile for user."));
+ profileWindow->setProcessing(false);
+ profileWindow->show();
+}
+
}