Put hover actions in the RowLayouts
Simplify the code compared to use an ActionToolBar and this should makes it more reliable.
This commit is contained in:
@@ -69,9 +69,12 @@ QQC2.Control {
|
|||||||
onDelegateChanged: updatePosition()
|
onDelegateChanged: updatePosition()
|
||||||
|
|
||||||
contentItem: RowLayout {
|
contentItem: RowLayout {
|
||||||
|
spacing: Kirigami.Units.smallSpacing
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
}
|
}
|
||||||
|
|
||||||
Kirigami.Icon {
|
Kirigami.Icon {
|
||||||
source: "security-high"
|
source: "security-high"
|
||||||
width: height
|
width: height
|
||||||
@@ -80,67 +83,83 @@ QQC2.Control {
|
|||||||
HoverHandler {
|
HoverHandler {
|
||||||
id: hover
|
id: hover
|
||||||
}
|
}
|
||||||
|
|
||||||
QQC2.ToolTip.text: i18n("This message was sent from a verified device")
|
QQC2.ToolTip.text: i18n("This message was sent from a verified device")
|
||||||
QQC2.ToolTip.visible: hover.hovered
|
QQC2.ToolTip.visible: hover.hovered
|
||||||
QQC2.ToolTip.delay: Kirigami.Units.toolTipDelay
|
QQC2.ToolTip.delay: Kirigami.Units.toolTipDelay
|
||||||
}
|
}
|
||||||
Kirigami.ActionToolBar {
|
|
||||||
Layout.maximumWidth: maximumContentWidth + Kirigami.Units.largeSpacing
|
QQC2.Button {
|
||||||
rightPadding: Kirigami.Units.largeSpacing
|
text: i18n("React")
|
||||||
alignment: Qt.AlignRight
|
icon.name: "preferences-desktop-emoticons"
|
||||||
flat: false
|
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
|
display: QQC2.Button.IconOnly
|
||||||
|
|
||||||
actions: [
|
onClicked: {
|
||||||
Kirigami.Action {
|
root.currentRoom.editCache.editId = root.delegate.eventId;
|
||||||
text: i18n("React")
|
root.currentRoom.mainCache.replyId = "";
|
||||||
icon.name: "preferences-desktop-emoticons"
|
root.currentRoom.mainCache.threadId = "";
|
||||||
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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|
||||||
EmojiDialog {
|
QQC2.ToolTip.text: text
|
||||||
id: emojiDialog
|
QQC2.ToolTip.visible: hovered
|
||||||
currentRoom: root.currentRoom
|
QQC2.ToolTip.delay: Kirigami.Units.toolTipDelay
|
||||||
showQuickReaction: true
|
}
|
||||||
onChosen: emoji => {
|
|
||||||
root.currentRoom.toggleReaction(root.delegate.eventId, emoji);
|
QQC2.Button {
|
||||||
if (!Kirigami.Settings.isMobile) {
|
visible: !root.currentRoom.readOnly
|
||||||
root.focusChatBar();
|
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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user