diff --git a/Linphone/core/friend/FriendCore.cpp b/Linphone/core/friend/FriendCore.cpp index bc9a63905..1bad6dc94 100644 --- a/Linphone/core/friend/FriendCore.cpp +++ b/Linphone/core/friend/FriendCore.cpp @@ -258,6 +258,7 @@ void FriendCore::setFullName(const QString &name) { if (mFullName != name) { mFullName = name; emit fullNameChanged(name); + setIsSaved(false); } } @@ -347,11 +348,13 @@ void FriendCore::setPhoneNumberAt(int index, const QString &label, const QString void FriendCore::removePhoneNumber(int index) { if (index != -1) mPhoneNumberList.remove(index); emit phoneNumberChanged(); + setIsSaved(false); } void FriendCore::appendPhoneNumber(const QString &label, const QString &number) { mPhoneNumberList.append(Utils::createFriendAddressVariant(label, number)); emit phoneNumberChanged(); + setIsSaved(false); } void FriendCore::resetPhoneNumbers(QList newList) { @@ -399,6 +402,7 @@ void FriendCore::removeAddress(int index) { if (map["address"].toString() == mDefaultFullAddress) mDefaultFullAddress.clear(); mAddressList.remove(index); emit addressChanged(); + setIsSaved(false); } void FriendCore::appendAddress(const QString &addr) { @@ -412,6 +416,7 @@ void FriendCore::appendAddress(const QString &addr) { mAddressList.append(Utils::createFriendAddressVariant(_addressLabel, interpretedAddress)); if (mDefaultFullAddress.isEmpty()) mDefaultFullAddress = interpretedAddress; emit addressChanged(); + setIsSaved(false); } }); }); @@ -514,6 +519,7 @@ void FriendCore::setPictureUri(const QString &uri) { if (mPictureUri != uri) { mPictureUri = uri; emit pictureUriChanged(); + setIsSaved(false); } } diff --git a/Linphone/view/Page/Form/Contact/ContactEdition.qml b/Linphone/view/Page/Form/Contact/ContactEdition.qml index 6f8638208..a356dc6ec 100644 --- a/Linphone/view/Page/Form/Contact/ContactEdition.qml +++ b/Linphone/view/Page/Form/Contact/ContactEdition.qml @@ -60,7 +60,13 @@ MainRightPanel { icon.width: 24 * DefaultStyle.dp icon.height: 24 * DefaultStyle.dp onClicked: { - confirmDialog.open() + if (contact.core.isSaved) mainItem.closeEdition('') + else showConfirmationLambdaPopup("", qsTr("Les changements seront annulés. Souhaitez-vous continuer ?"), "", function(confirmed) { + if (confirmed) { + mainItem.contact.core.undo() + mainItem.closeEdition('') + } + }) } } ]