fix(desktop/profile): Does not apply avatar icon if quitted popup

Apply avatar icon only if the user accepts it.

Fix #5238
This commit is contained in:
Michal Iskierko 2022-04-04 14:45:27 +02:00 committed by Iuri Matias
parent 684a1ce913
commit 268f6ef4eb
3 changed files with 13 additions and 9 deletions

View File

@ -20,11 +20,10 @@ StatusModal {
property string selectedImage
property string uploadError
onSelectedImageChanged: {
if (!selectedImage) {
return;
}
cropImageModal.open();
signal accepted()
onOpened: {
selectedImage = ""
}
contentItem: Item {
@ -57,9 +56,9 @@ StatusModal {
ImageCropperModal {
id: cropImageModal
selectedImage: popup.selectedImage
ratio: "1:1"
onCropFinished: {
popup.selectedImage = selectedImage
OnboardingStore.uploadImage(selectedImage, aX, aY, bX, bY);
}
}
@ -71,6 +70,7 @@ StatusModal {
text: !!selectedImage ? qsTr("Done") : qsTr("Upload")
onClicked: {
if (!!selectedImage) {
popup.accepted()
close();
} else {
imageDialog.open();
@ -84,7 +84,8 @@ StatusModal {
qsTrId("image-files----jpg---jpeg---png-")
]
onAccepted: {
selectedImage = imageDialog.fileUrls[0];
cropImageModal.selectedImage = imageDialog.fileUrls[0];
cropImageModal.open()
}
}
}

View File

@ -81,7 +81,6 @@ Item {
icon.color: Theme.palette.miscColor5
icon.charactersLen: 2
image.isIdenticon: false
image.source: uploadProfilePicPopup.selectedImage
ringSettings { ringSpecModel: Utils.getColorHashAsJson(root.pubKey) }
}
StatusRoundButton {
@ -180,6 +179,9 @@ Item {
UploadProfilePicModal {
id: uploadProfilePicPopup
anchors.centerIn: parent
onAccepted: {
userImage.image.source = uploadProfilePicPopup.selectedImage
}
}
}

View File

@ -67,10 +67,11 @@ Popup {
objectName: "titleText"
anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left
anchors.right: parent.right
anchors.rightMargin: 44
font.bold: true
font.pixelSize: 17
height: visible ? 24 : 0
width: visible ? parent.width - 44 : 0
elide: Text.ElideRight
visible: !!title
verticalAlignment: Text.AlignVCenter