feat: allow message context menu to render emojis only

Closes #1492
This commit is contained in:
Pascal Precht 2020-12-08 13:34:02 +01:00 committed by Pascal Precht
parent 2baf56f505
commit 066fd9f7e5
2 changed files with 8 additions and 4 deletions

View File

@ -56,7 +56,7 @@ Item {
}
}
function clickMessage(isProfileClick, isSticker = false, isImage = false, image = null) {
function clickMessage(isProfileClick, isSticker = false, isImage = false, image = null, emojiOnly = false) {
if (isImage) {
imageClick(image);
return;
@ -77,6 +77,7 @@ Item {
}
messageContextMenu.isProfile = !!isProfileClick
messageContextMenu.isSticker = isSticker
messageContextMenu.emojiOnly = emojiOnly
messageContextMenu.show(userName, fromAuthor, identicon, "", nickname)
// Position the center of the menu where the mouse is
messageContextMenu.x = messageContextMenu.x - messageContextMenu.width / 2

View File

@ -10,6 +10,7 @@ import "./"
PopupMenu {
property bool isProfile: false
property bool isSticker: false
property bool emojiOnly: false
id: messageContextMenu
width: messageContextMenu.isProfile ? profileHeader.width : emojiContainer.width
@ -31,7 +32,7 @@ PopupMenu {
Item {
id: emojiContainer
visible: !messageContextMenu.isProfile
visible: messageContextMenu.emojiOnly || !messageContextMenu.isProfile
width: emojiRow.width
height: visible ? emojiRow.height : 0
@ -40,7 +41,7 @@ PopupMenu {
spacing: Style.current.smallPadding
leftPadding: Style.current.smallPadding
rightPadding: Style.current.smallPadding
bottomPadding: Style.current.padding
bottomPadding: messageContextMenu.emojiOnly ? 0 : Style.current.padding
Repeater {
model: reactionModel
@ -106,6 +107,7 @@ PopupMenu {
Separator {
anchors.bottom: viewProfileAction.top
visible: !messageContextMenu.emojiOnly
}
Action {
@ -119,6 +121,7 @@ PopupMenu {
icon.source: "../../../img/profileActive.svg"
icon.width: 16
icon.height: 16
enabled: !emojiOnly
}
Action {
text: messageContextMenu.isProfile ?
@ -133,6 +136,6 @@ PopupMenu {
icon.source: "../../../img/messageActive.svg"
icon.width: 16
icon.height: 16
enabled: !isSticker
enabled: !isSticker && !emojiOnly
}
}