fix(Profile): Added menu to remove profile image

This commit is contained in:
Igor Sirotin 2022-08-08 00:05:25 +03:00 committed by Igor Sirotin
parent 980135fedf
commit 5c909cae6c
2 changed files with 27 additions and 1 deletions

View File

@ -68,6 +68,8 @@ ColumnLayout {
Layout.leftMargin: Style.current.padding
Layout.rightMargin: Style.current.padding
store: root.profileStore
displayName: profileStore.name
pubkey: profileStore.pubkey
icon: profileStore.profileLargeImage

View File

@ -7,6 +7,7 @@ import shared.controls 1.0
import StatusQ.Controls 0.1
import StatusQ.Components 0.1
import StatusQ.Popups 0.1
import StatusQ.Core.Utils 0.1 as StatusQUtils
Item {
@ -95,7 +96,12 @@ Item {
icon.width: d.getSize(8, 12, 20)
icon.height: d.getSize(8, 12, 20)
onClicked: Global.openChangeProfilePicPopup()
onClicked: {
if (!!root.store.profileLargeImage)
imageEditMenu.popup(this, mouse.x, mouse.y);
else
Global.openChangeProfilePicPopup();
}
}
}
@ -213,4 +219,22 @@ Item {
publicKey: root.pubkey
}
}
StatusPopupMenu {
id: imageEditMenu
StatusMenuItem {
text: qsTr("Upload a file")
icon.name: "download"
iconRotation: 180
onTriggered: Global.openChangeProfilePicPopup()
}
StatusMenuItem {
text: qsTr("Remove image")
type: StatusMenuItem.Danger
icon.name: "delete"
onTriggered: root.store.removeImage()
}
}
}