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

View File

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