fix #LINQT-1632 contact edition not closed when saving changes
This commit is contained in:
parent
db6fc41480
commit
b91c3842a1
2 changed files with 13 additions and 1 deletions
|
|
@ -258,6 +258,7 @@ void FriendCore::setFullName(const QString &name) {
|
||||||
if (mFullName != name) {
|
if (mFullName != name) {
|
||||||
mFullName = name;
|
mFullName = name;
|
||||||
emit fullNameChanged(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) {
|
void FriendCore::removePhoneNumber(int index) {
|
||||||
if (index != -1) mPhoneNumberList.remove(index);
|
if (index != -1) mPhoneNumberList.remove(index);
|
||||||
emit phoneNumberChanged();
|
emit phoneNumberChanged();
|
||||||
|
setIsSaved(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FriendCore::appendPhoneNumber(const QString &label, const QString &number) {
|
void FriendCore::appendPhoneNumber(const QString &label, const QString &number) {
|
||||||
mPhoneNumberList.append(Utils::createFriendAddressVariant(label, number));
|
mPhoneNumberList.append(Utils::createFriendAddressVariant(label, number));
|
||||||
emit phoneNumberChanged();
|
emit phoneNumberChanged();
|
||||||
|
setIsSaved(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FriendCore::resetPhoneNumbers(QList<QVariant> newList) {
|
void FriendCore::resetPhoneNumbers(QList<QVariant> newList) {
|
||||||
|
|
@ -399,6 +402,7 @@ void FriendCore::removeAddress(int index) {
|
||||||
if (map["address"].toString() == mDefaultFullAddress) mDefaultFullAddress.clear();
|
if (map["address"].toString() == mDefaultFullAddress) mDefaultFullAddress.clear();
|
||||||
mAddressList.remove(index);
|
mAddressList.remove(index);
|
||||||
emit addressChanged();
|
emit addressChanged();
|
||||||
|
setIsSaved(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FriendCore::appendAddress(const QString &addr) {
|
void FriendCore::appendAddress(const QString &addr) {
|
||||||
|
|
@ -412,6 +416,7 @@ void FriendCore::appendAddress(const QString &addr) {
|
||||||
mAddressList.append(Utils::createFriendAddressVariant(_addressLabel, interpretedAddress));
|
mAddressList.append(Utils::createFriendAddressVariant(_addressLabel, interpretedAddress));
|
||||||
if (mDefaultFullAddress.isEmpty()) mDefaultFullAddress = interpretedAddress;
|
if (mDefaultFullAddress.isEmpty()) mDefaultFullAddress = interpretedAddress;
|
||||||
emit addressChanged();
|
emit addressChanged();
|
||||||
|
setIsSaved(false);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
@ -514,6 +519,7 @@ void FriendCore::setPictureUri(const QString &uri) {
|
||||||
if (mPictureUri != uri) {
|
if (mPictureUri != uri) {
|
||||||
mPictureUri = uri;
|
mPictureUri = uri;
|
||||||
emit pictureUriChanged();
|
emit pictureUriChanged();
|
||||||
|
setIsSaved(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,13 @@ MainRightPanel {
|
||||||
icon.width: 24 * DefaultStyle.dp
|
icon.width: 24 * DefaultStyle.dp
|
||||||
icon.height: 24 * DefaultStyle.dp
|
icon.height: 24 * DefaultStyle.dp
|
||||||
onClicked: {
|
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('')
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue