diff options
| author | Tobias Markmann <tm@ayena.de> | 2015-06-09 21:29:20 (GMT) |
|---|---|---|
| committer | Kevin Smith <kevin.smith@isode.com> | 2015-07-07 13:00:23 (GMT) |
| commit | 2598ef4efcd74d5e9e701c62337bf84829572508 (patch) | |
| tree | c60d7337a9f8932ed4a1d70e606d1ce2787f866f /Swift/Controllers/ProfileController.cpp | |
| parent | f10c9618f8ccd9e44c9a45a69179883b39a445f5 (diff) | |
| download | swift-2598ef4efcd74d5e9e701c62337bf84829572508.zip swift-2598ef4efcd74d5e9e701c62337bf84829572508.tar.bz2 | |
Show old vCard in UI if vCard update is rejected by server
Previously QtVCardWidget would work on a shared copy of a VCard and
modify the shared version. Now when setting the vCard on the widget
it creates its own copy and works on that.
The ProfileController holds a reference to the VCard it sets on the UI.
If the server rejects an update it can reset the UI to this VCard.
Test-Information:
Tested against a XMPP server that rejects all vCard updates
(mod_readonly).
Change-Id: Iaa8eed6406f2dc6cc7ac5434194a7dae4f879b33
Diffstat (limited to 'Swift/Controllers/ProfileController.cpp')
| -rw-r--r-- | Swift/Controllers/ProfileController.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/Swift/Controllers/ProfileController.cpp b/Swift/Controllers/ProfileController.cpp index be7b72c..7df8036 100644 --- a/Swift/Controllers/ProfileController.cpp +++ b/Swift/Controllers/ProfileController.cpp | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * Copyright (c) 2010 Isode Limited. | 2 | * Copyright (c) 2010-2015 Isode Limited. |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * See the COPYING file for more information. | 4 | * See the COPYING file for more information. |
| 5 | */ | 5 | */ |
| @@ -8,12 +8,12 @@ | |||
| 8 | 8 | ||
| 9 | #include <boost/bind.hpp> | 9 | #include <boost/bind.hpp> |
| 10 | 10 | ||
| 11 | #include <Swiften/VCards/VCardManager.h> | ||
| 12 | |||
| 13 | #include <Swift/Controllers/Intl.h> | ||
| 11 | #include <Swift/Controllers/UIEvents/RequestProfileEditorUIEvent.h> | 14 | #include <Swift/Controllers/UIEvents/RequestProfileEditorUIEvent.h> |
| 12 | #include <Swift/Controllers/UIEvents/UIEventStream.h> | 15 | #include <Swift/Controllers/UIEvents/UIEventStream.h> |
| 13 | #include <Swift/Controllers/UIInterfaces/ProfileWindowFactory.h> | 16 | #include <Swift/Controllers/UIInterfaces/ProfileWindowFactory.h> |
| 14 | #include <Swiften/VCards/VCardManager.h> | ||
| 15 | #include <Swift/Controllers/Intl.h> | ||
| 16 | |||
| 17 | 17 | ||
| 18 | namespace Swift { | 18 | namespace Swift { |
| 19 | 19 | ||
| @@ -61,6 +61,7 @@ void ProfileController::handleSetVCardResponse(ErrorPayload::ref error) { | |||
| 61 | pendingSetVCardRequest.reset(); | 61 | pendingSetVCardRequest.reset(); |
| 62 | updateDialogStatus(); | 62 | updateDialogStatus(); |
| 63 | if (error) { | 63 | if (error) { |
| 64 | profileWindow->setVCard(vcardBeforeEdit); | ||
| 64 | profileWindow->setError(QT_TRANSLATE_NOOP("", "There was an error publishing your profile data")); | 65 | profileWindow->setError(QT_TRANSLATE_NOOP("", "There was an error publishing your profile data")); |
| 65 | } | 66 | } |
| 66 | else { | 67 | else { |
| @@ -72,6 +73,7 @@ void ProfileController::handleSetVCardResponse(ErrorPayload::ref error) { | |||
| 72 | void ProfileController::handleOwnVCardChanged(VCard::ref vcard) { | 73 | void ProfileController::handleOwnVCardChanged(VCard::ref vcard) { |
| 73 | if (profileWindow) { | 74 | if (profileWindow) { |
| 74 | profileWindow->setVCard(vcard); | 75 | profileWindow->setVCard(vcard); |
| 76 | vcardBeforeEdit = vcard; | ||
| 75 | gettingVCard = false; | 77 | gettingVCard = false; |
| 76 | updateDialogStatus(); | 78 | updateDialogStatus(); |
| 77 | } | 79 | } |
Swift