summaryrefslogtreecommitdiffstats
path: root/Swift
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2016-03-01 08:45:36 (GMT)
committerKevin Smith <kevin.smith@isode.com>2016-03-09 16:48:50 (GMT)
commit4da2f1c85f2eeac9fb98d5dcc9097eeed9b34e8b (patch)
tree3d3d512818b2fe3ae3265c559bfac143eefdc93a /Swift
parentb792712c9a406a7913935c23d535f214bfd758e8 (diff)
downloadswift-4da2f1c85f2eeac9fb98d5dcc9097eeed9b34e8b.zip
swift-4da2f1c85f2eeac9fb98d5dcc9097eeed9b34e8b.tar.bz2
Improve profile editing UX when vCard is not supported
Previously, when editing your own vCard and the server responded with an error, the user would indefinitely see a spinner. With this commit, the user will see an error message instead. Test-Information: Tested on OS X 10.11.3, with a XMPP server with enabled and disabled vCards. The enabled case still works as expected and in the disabled case the error message is shown, instead of the indefinite spinner. Change-Id: Ic9167ee633a2f9a9fa3b520f6067dc2c94857c07
Diffstat (limited to 'Swift')
-rw-r--r--Swift/Controllers/ProfileController.cpp13
-rw-r--r--Swift/Controllers/ProfileController.h7
2 files changed, 16 insertions, 4 deletions
diff --git a/Swift/Controllers/ProfileController.cpp b/Swift/Controllers/ProfileController.cpp
index 49818b0..a1aa5f9 100644
--- a/Swift/Controllers/ProfileController.cpp
+++ b/Swift/Controllers/ProfileController.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010-2015 Isode Limited.
+ * Copyright (c) 2010-2016 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -24,6 +24,7 @@ ProfileController::ProfileController(VCardManager* vcardManager, ProfileWindowFa
ProfileController::~ProfileController() {
if (profileWindow) {
vcardManager->onOwnVCardChanged.disconnect(boost::bind(&ProfileController::handleOwnVCardChanged, this, _1));
+ vcardManager->onVCardRetrievalError.disconnect(boost::bind(&ProfileController::handleVCardRetrievalError, this, _1, _2));
profileWindow->onVCardChangeRequest.disconnect(boost::bind(&ProfileController::handleVCardChangeRequest, this, _1));
profileWindow->onWindowAboutToBeClosed.disconnect(boost::bind(&ProfileController::handleProfileWindowAboutToBeClosed, this, _1));
}
@@ -42,6 +43,7 @@ void ProfileController::handleUIEvent(UIEvent::ref event) {
profileWindow->onVCardChangeRequest.connect(boost::bind(&ProfileController::handleVCardChangeRequest, this, _1));
profileWindow->onWindowAboutToBeClosed.connect(boost::bind(&ProfileController::handleProfileWindowAboutToBeClosed, this, _1));
vcardManager->onOwnVCardChanged.connect(boost::bind(&ProfileController::handleOwnVCardChanged, this, _1));
+ vcardManager->onVCardRetrievalError.connect(boost::bind(&ProfileController::handleVCardRetrievalError, this, _1, _2));
}
gettingVCard = true;
updateDialogStatus();
@@ -71,6 +73,15 @@ void ProfileController::handleSetVCardResponse(ErrorPayload::ref error) {
}
}
+void ProfileController::handleVCardRetrievalError(const JID& jid, ErrorPayload::ref /* error */) {
+ if ((jid == JID()) && profileWindow) {
+ profileWindow->setProcessing(false);
+ profileWindow->setEnabled(false);
+ profileWindow->setVCard(boost::make_shared<VCard>());
+ profileWindow->setError(QT_TRANSLATE_NOOP("", "There was an error fetching your current profile data"));
+ }
+}
+
void ProfileController::handleOwnVCardChanged(VCard::ref vcard) {
if (profileWindow) {
profileWindow->setVCard(vcard);
diff --git a/Swift/Controllers/ProfileController.h b/Swift/Controllers/ProfileController.h
index c6f5420..ebb569d 100644
--- a/Swift/Controllers/ProfileController.h
+++ b/Swift/Controllers/ProfileController.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010-2015 Isode Limited.
+ * Copyright (c) 2010-2016 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -13,9 +13,9 @@
#include <Swift/Controllers/UIEvents/UIEvent.h>
namespace Swift {
- class UIEventStream;
- class ProfileWindowFactory;
class ProfileWindow;
+ class ProfileWindowFactory;
+ class UIEventStream;
class VCardManager;
class ProfileController {
@@ -30,6 +30,7 @@ namespace Swift {
void handleVCardChangeRequest(VCard::ref vcard);
void handleSetVCardResponse(ErrorPayload::ref);
void handleOwnVCardChanged(VCard::ref vcard);
+ void handleVCardRetrievalError(const JID& jid, ErrorPayload::ref error);
void handleProfileWindowAboutToBeClosed(const JID&);
void updateDialogStatus();