Restore image editor

This commit is contained in:
James Graham
2026-02-08 16:53:21 +00:00
parent a9a73ab24d
commit dcc394677e

View File

@@ -60,11 +60,14 @@ Item {
implicitWidth: mediaSizeHelper.currentSize.width implicitWidth: mediaSizeHelper.currentSize.width
implicitHeight: mediaSizeHelper.currentSize.height implicitHeight: mediaSizeHelper.currentSize.height
QQC2.Button { RowLayout {
anchors.top: root.top anchors.top: root.top
anchors.topMargin: Kirigami.Units.smallSpacing anchors.topMargin: Kirigami.Units.smallSpacing
anchors.right: root.right anchors.right: root.right
anchors.rightMargin: root.rightAnchorMargin + Kirigami.Units.smallSpacing anchors.rightMargin: root.rightAnchorMargin + Kirigami.Units.smallSpacing
QQC2.Button {
visible: !_private.hideImage && !root.editable visible: !_private.hideImage && !root.editable
icon.name: "view-hidden" icon.name: "view-hidden"
text: i18nc("@action:button", "Hide Image") text: i18nc("@action:button", "Hide Image")
@@ -79,12 +82,32 @@ Item {
QQC2.ToolTip.visible: hovered QQC2.ToolTip.visible: hovered
QQC2.ToolTip.delay: Kirigami.Units.toolTipDelay QQC2.ToolTip.delay: Kirigami.Units.toolTipDelay
} }
QQC2.Button {
id: editImageButton
visible: root.editable
icon.name: "document-edit"
text: i18n("Edit")
display: QQC2.AbstractButton.IconOnly
Component {
id: imageEditorPage
ImageEditorPage {
imagePath: root.componentAttributes.source
}
}
onClicked: {
let imageEditor = (Kirigami.PageStack.pageStack as Kirigami.PageRow).pushDialogLayer(imageEditorPage);
imageEditor.newPathChanged.connect(function (newPath) {
imageEditor.closeDialog();
Message.contentModel?.addAttachment(newPath);
});
}
QQC2.ToolTip.text: text
QQC2.ToolTip.visible: hovered
}
QQC2.Button { QQC2.Button {
id: cancelButton id: cancelButton
anchors.top: root.top
anchors.topMargin: Kirigami.Units.smallSpacing
anchors.right: root.right
anchors.rightMargin: root.rightAnchorMargin + Kirigami.Units.smallSpacing
visible: root.editable visible: root.editable
display: QQC2.AbstractButton.IconOnly display: QQC2.AbstractButton.IconOnly
text: i18nc("@action:button", "Remove attachment") text: i18nc("@action:button", "Remove attachment")
@@ -94,6 +117,7 @@ Item {
QQC2.ToolTip.visible: hovered QQC2.ToolTip.visible: hovered
QQC2.ToolTip.delay: Kirigami.Units.toolTipDelay QQC2.ToolTip.delay: Kirigami.Units.toolTipDelay
} }
}
Loader { Loader {
id: imageLoader id: imageLoader