From 2969d20a92802433d46d0671ca71091e0e855b69 Mon Sep 17 00:00:00 2001 From: Carl Schwan Date: Fri, 20 Sep 2024 17:27:50 +0200 Subject: [PATCH] Put hover actions in the RowLayouts Simplify the code compared to use an ActionToolBar and this should makes it more reliable. --- src/qml/HoverActions.qml | 127 ++++++++++++++++++++++----------------- 1 file changed, 73 insertions(+), 54 deletions(-) diff --git a/src/qml/HoverActions.qml b/src/qml/HoverActions.qml index a2fd20cac..d90cbe22e 100644 --- a/src/qml/HoverActions.qml +++ b/src/qml/HoverActions.qml @@ -69,9 +69,12 @@ QQC2.Control { onDelegateChanged: updatePosition() contentItem: RowLayout { + spacing: Kirigami.Units.smallSpacing + Item { Layout.fillWidth: true } + Kirigami.Icon { source: "security-high" width: height @@ -80,67 +83,83 @@ QQC2.Control { HoverHandler { id: hover } + QQC2.ToolTip.text: i18n("This message was sent from a verified device") QQC2.ToolTip.visible: hover.hovered QQC2.ToolTip.delay: Kirigami.Units.toolTipDelay } - Kirigami.ActionToolBar { - Layout.maximumWidth: maximumContentWidth + Kirigami.Units.largeSpacing - rightPadding: Kirigami.Units.largeSpacing - alignment: Qt.AlignRight - flat: false + + QQC2.Button { + text: i18n("React") + icon.name: "preferences-desktop-emoticons" + onClicked: emojiDialog.open() + display: QQC2.ToolButton.IconOnly + + QQC2.ToolTip.text: text + QQC2.ToolTip.visible: hovered + QQC2.ToolTip.delay: Kirigami.Units.toolTipDelay + } + + QQC2.Button { + visible: root.delegate && root.delegate.isEditable && !root.currentRoom.readOnly + text: i18n("Edit") + icon.name: "document-edit" display: QQC2.Button.IconOnly - actions: [ - Kirigami.Action { - text: i18n("React") - icon.name: "preferences-desktop-emoticons" - onTriggered: emojiDialog.open() - }, - Kirigami.Action { - visible: root.delegate && root.delegate.isEditable && !root.currentRoom.readOnly - text: i18n("Edit") - icon.name: "document-edit" - onTriggered: { - root.currentRoom.editCache.editId = root.delegate.eventId; - root.currentRoom.mainCache.replyId = ""; - root.currentRoom.mainCache.threadId = ""; - } - }, - Kirigami.Action { - visible: !root.currentRoom.readOnly - text: i18n("Reply") - icon.name: "mail-replied-symbolic" - onTriggered: { - root.currentRoom.mainCache.replyId = root.delegate.eventId; - root.currentRoom.editCache.editId = ""; - root.currentRoom.mainCache.threadId = ""; - root.focusChatBar(); - } - }, - Kirigami.Action { - visible: NeoChatConfig.threads && !root.currentRoom.readOnly - text: i18n("Reply in Thread") - icon.name: "dialog-messages" - onTriggered: { - root.currentRoom.threadCache.replyId = ""; - root.currentRoom.threadCache.threadId = root.delegate.isThreaded ? root.delegate.threadRoot : root.delegate.eventId; - root.currentRoom.mainCache.clearRelations(); - root.currentRoom.editCache.clearRelations(); - root.focusChatBar(); - } - } - ] + onClicked: { + root.currentRoom.editCache.editId = root.delegate.eventId; + root.currentRoom.mainCache.replyId = ""; + root.currentRoom.mainCache.threadId = ""; + } - EmojiDialog { - id: emojiDialog - currentRoom: root.currentRoom - showQuickReaction: true - onChosen: emoji => { - root.currentRoom.toggleReaction(root.delegate.eventId, emoji); - if (!Kirigami.Settings.isMobile) { - root.focusChatBar(); - } + QQC2.ToolTip.text: text + QQC2.ToolTip.visible: hovered + QQC2.ToolTip.delay: Kirigami.Units.toolTipDelay + } + + QQC2.Button { + visible: !root.currentRoom.readOnly + text: i18n("Reply") + icon.name: "mail-replied-symbolic" + display: QQC2.Button.IconOnly + onClicked: { + root.currentRoom.mainCache.replyId = root.delegate.eventId; + root.currentRoom.editCache.editId = ""; + root.currentRoom.mainCache.threadId = ""; + root.focusChatBar(); + } + + QQC2.ToolTip.text: text + QQC2.ToolTip.visible: hovered + QQC2.ToolTip.delay: Kirigami.Units.toolTipDelay + } + + QQC2.Button { + visible: NeoChatConfig.threads && !root.currentRoom.readOnly + text: i18n("Reply in Thread") + icon.name: "dialog-messages" + display: QQC2.Button.IconOnly + onClicked: { + root.currentRoom.threadCache.replyId = ""; + root.currentRoom.threadCache.threadId = root.delegate.isThreaded ? root.delegate.threadRoot : root.delegate.eventId; + root.currentRoom.mainCache.clearRelations(); + root.currentRoom.editCache.clearRelations(); + root.focusChatBar(); + } + + QQC2.ToolTip.text: text + QQC2.ToolTip.visible: hovered + QQC2.ToolTip.delay: Kirigami.Units.toolTipDelay + } + + EmojiDialog { + id: emojiDialog + currentRoom: root.currentRoom + showQuickReaction: true + onChosen: emoji => { + root.currentRoom.toggleReaction(root.delegate.eventId, emoji); + if (!Kirigami.Settings.isMobile) { + root.focusChatBar(); } } }