fix(@chat): only show reaction to emoji right click

fixes #5764
This commit is contained in:
Anthony Laibe 2022-05-17 12:40:27 +02:00 committed by Anthony Laibe
parent fdb1f375ab
commit c673f8302a
6 changed files with 35 additions and 33 deletions

View File

@ -131,7 +131,7 @@ QtObject {
return [] return []
} }
} }
property var clickMessage: function(isProfileClick, isSticker = false, isImage = false, image = null, emojiOnly = false, hideEmojiPicker = false, isReply = false, isRightClickOnImage = false, imageSource = "") { property var clickMessage: function(isProfileClick, isSticker = false, isImage = false, image = null, isEmoji = false, hideEmojiPicker = false, isReply = false, isRightClickOnImage = false, imageSource = "") {
if (placeholderMessage || activityCenterMessage) { if (placeholderMessage || activityCenterMessage) {
return return
} }
@ -147,7 +147,7 @@ QtObject {
messageContextMenu.isCurrentUser = isCurrentUser messageContextMenu.isCurrentUser = isCurrentUser
messageContextMenu.isText = isText messageContextMenu.isText = isText
messageContextMenu.isSticker = isSticker; messageContextMenu.isSticker = isSticker;
messageContextMenu.emojiOnly = emojiOnly; messageContextMenu.isEmoji = isEmoji;
messageContextMenu.hideEmojiPicker = hideEmojiPicker; messageContextMenu.hideEmojiPicker = hideEmojiPicker;
messageContextMenu.pinnedMessage = pinnedMessage; messageContextMenu.pinnedMessage = pinnedMessage;
messageContextMenu.isCurrentUser = isCurrentUser; messageContextMenu.isCurrentUser = isCurrentUser;

View File

@ -23,7 +23,7 @@ Rectangle {
signal replyClicked(string messageId, string author) signal replyClicked(string messageId, string author)
signal hoverChanged(bool hovered) signal hoverChanged(bool hovered)
signal setMessageActive(string messageId, bool active) signal setMessageActive(string messageId, bool active)
signal clickMessage(bool isProfileClick, bool isSticker, bool isImage, var image, bool emojiOnly, bool hideEmojiPicker) signal clickMessage(bool isProfileClick, bool isSticker, bool isImage, var image, bool isEmoji, bool hideEmojiPicker)
visible: !buttonsContainer.isChatBlocked && visible: !buttonsContainer.isChatBlocked &&
!buttonsContainer.placeholderMsg && !buttonsContainer.activityCenterMsg && !buttonsContainer.placeholderMsg && !buttonsContainer.activityCenterMsg &&

View File

@ -34,7 +34,7 @@ Loader {
property int chatHorizontalPadding property int chatHorizontalPadding
property string stickerData property string stickerData
signal clickMessage(bool isProfileClick, bool isSticker, bool isImage, var image, bool emojiOnly, bool hideEmojiPicker, bool isReply) signal clickMessage(bool isProfileClick, bool isSticker, bool isImage, var image, bool isEmoji, bool hideEmojiPicker, bool isReply)
signal scrollToBottom(bool isit, var container) signal scrollToBottom(bool isit, var container)
sourceComponent: Component { sourceComponent: Component {

View File

@ -67,11 +67,21 @@ Item {
property var transactionParams property var transactionParams
signal openStickerPackPopup(string stickerPackId) signal openStickerPackPopup(string stickerPackId)
signal addEmoji(bool isProfileClick, bool isSticker, bool isImage , var image, bool emojiOnly, bool hideEmojiPicker) signal addEmoji(bool isProfileClick, bool isSticker, bool isImage , var image, bool isEmoji, bool hideEmojiPicker)
signal clickMessage(bool isProfileClick, bool isSticker, bool isImage, var image, bool emojiOnly, bool hideEmojiPicker, bool isReply, bool isRightClickOnImage, string imageSource) signal clickMessage(bool isProfileClick, bool isSticker, bool isImage, var image, bool isEmoji, bool hideEmojiPicker, bool isReply, bool isRightClickOnImage, string imageSource)
signal replyClicked(string messageId, string author) signal replyClicked(string messageId, string author)
signal imageClicked(var image) signal imageClicked(var image)
function setMessageActive(messageId, active) {
if (active) {
activeMessage = messageId;
} else if (activeMessage === messageId) {
activeMessage = "";
}
}
width: parent.width width: parent.width
height: messageContainer.height + messageContainer.anchors.topMargin height: messageContainer.height + messageContainer.anchors.topMargin
+ (dateGroupLbl.visible ? dateGroupLbl.height + dateGroupLbl.anchors.topMargin : 0) + (dateGroupLbl.visible ? dateGroupLbl.height + dateGroupLbl.anchors.topMargin : 0)
@ -104,7 +114,7 @@ Item {
isActivityCenterMessage: activityCenterMessage isActivityCenterMessage: activityCenterMessage
stickersLoaded: root.stickersLoaded stickersLoaded: root.stickersLoaded
onClickMessage: { onClickMessage: {
root.clickMessage(isProfileClick, isSticker, isImage, null, false, false, false, false, ""); root.clickMessage(isProfileClick, isSticker, isImage, null, isEmoji, false, false, false, "");
} }
} }
@ -128,7 +138,7 @@ Item {
activityCenterMsg: activityCenterMessage activityCenterMsg: activityCenterMessage
placeholderMsg: placeholderMessage placeholderMsg: placeholderMessage
onClickMessage: { onClickMessage: {
root.clickMessage(isProfileClick, isSticker, isImage, image, emojiOnly, hideEmojiPicker, false, false, ""); root.clickMessage(isProfileClick, isSticker, isImage, image, isEmoji, hideEmojiPicker, false, false, "");
} }
onReplyClicked: { onReplyClicked: {
root.replyClicked(messageId, author) root.replyClicked(messageId, author)
@ -141,7 +151,7 @@ Item {
Connections { Connections {
enabled: isMessageActive enabled: isMessageActive
target: root.messageContextMenu target: root.messageContextMenu
onClosed: setMessageActive(messageId, false) onClosed: root.setMessageActive(messageId, false)
} }
} }
} }
@ -322,7 +332,7 @@ Item {
} }
onClickMessage: { onClickMessage: {
root.clickMessage(isProfileClick, isSticker, isImage, image, emojiOnly, hideEmojiPicker, isReply, false, "") root.clickMessage(isProfileClick, isSticker, isImage, image, isEmoji, hideEmojiPicker, isReply, false, "")
} }
} }
@ -600,7 +610,7 @@ Item {
} }
onSetMessageActive: { onSetMessageActive: {
setMessageActive(messageId, active); root.setMessageActive(messageId, active);
} }
} }
@ -749,7 +759,7 @@ Item {
} }
onSetMessageActive: { onSetMessageActive: {
setMessageActive(messageId, active);; root.setMessageActive(messageId, active);
} }
} }
} }

View File

@ -41,7 +41,7 @@ StatusPopupMenu {
property bool isRightClickOnImage: false property bool isRightClickOnImage: false
property bool pinnedPopup: false property bool pinnedPopup: false
property bool isDebugEnabled: false property bool isDebugEnabled: false
property bool emojiOnly: false property bool isEmoji: false
property bool hideEmojiPicker: true property bool hideEmojiPicker: true
property bool pinnedMessage: false property bool pinnedMessage: false
property bool canPin: false property bool canPin: false
@ -83,7 +83,7 @@ StatusPopupMenu {
/* // copy link feature not ready yet /* // copy link feature not ready yet
const numLinkUrls = root.linkUrls.split(" ").length const numLinkUrls = root.linkUrls.split(" ").length
copyLinkMenu.enabled = numLinkUrls > 1 copyLinkMenu.enabled = numLinkUrls > 1
copyLinkAction.enabled = !!root.linkUrls && numLinkUrls === 1 && !emojiOnly && !root.isProfile copyLinkAction.enabled = !!root.linkUrls && numLinkUrls === 1 && !isEmoji && !root.isProfile
*/ */
popup() popup()
} }
@ -92,13 +92,13 @@ StatusPopupMenu {
id: emojiContainer id: emojiContainer
width: emojiRow.width width: emojiRow.width
height: visible ? emojiRow.height : 0 height: visible ? emojiRow.height : 0
visible: !root.hideEmojiPicker && (root.emojiOnly || !root.isProfile) && !root.pinnedPopup visible: !root.hideEmojiPicker && (root.isEmoji || !root.isProfile) && !root.pinnedPopup
Row { Row {
id: emojiRow id: emojiRow
spacing: Style.current.halfPadding spacing: Style.current.halfPadding
leftPadding: Style.current.halfPadding leftPadding: Style.current.halfPadding
rightPadding: Style.current.halfPadding rightPadding: Style.current.halfPadding
bottomPadding: root.emojiOnly ? 0 : Style.current.padding bottomPadding: root.isEmoji ? 0 : Style.current.padding
Repeater { Repeater {
model: root.reactionModel model: root.reactionModel
@ -131,7 +131,7 @@ StatusPopupMenu {
Separator { Separator {
anchors.bottom: viewProfileAction.top anchors.bottom: viewProfileAction.top
visible: !root.emojiOnly && !root.hideEmojiPicker && !pinnedPopup visible: !root.isEmoji && !root.hideEmojiPicker && !pinnedPopup
} }
StatusMenuItem { StatusMenuItem {
@ -188,7 +188,7 @@ StatusPopupMenu {
icon.name: "chat" icon.name: "chat"
enabled: root.isProfile && root.store.contactsStore.isMyMutualContact(root.selectedUserPublicKey) || enabled: root.isProfile && root.store.contactsStore.isMyMutualContact(root.selectedUserPublicKey) ||
(!root.hideEmojiPicker && (!root.hideEmojiPicker &&
!root.emojiOnly && !root.isEmoji &&
!root.isProfile && !root.isProfile &&
!root.pinnedPopup && !root.pinnedPopup &&
!root.isRightClickOnImage) !root.isRightClickOnImage)
@ -204,7 +204,7 @@ StatusPopupMenu {
icon.name: "edit" icon.name: "edit"
enabled: root.isMyMessage && enabled: root.isMyMessage &&
!root.hideEmojiPicker && !root.hideEmojiPicker &&
!root.emojiOnly && !root.isEmoji &&
!root.isProfile && !root.isProfile &&
!root.pinnedPopup && !root.pinnedPopup &&
!root.isRightClickOnImage !root.isRightClickOnImage
@ -248,7 +248,7 @@ StatusPopupMenu {
} }
icon.name: "pin" icon.name: "pin"
enabled: { enabled: {
if(root.isProfile || root.emojiOnly || root.isRightClickOnImage) if(root.isProfile || root.isEmoji || root.isRightClickOnImage)
return false return false
switch (root.chatType) { switch (root.chatType) {
@ -280,7 +280,7 @@ StatusPopupMenu {
id: deleteMessageAction id: deleteMessageAction
enabled: root.isMyMessage && enabled: root.isMyMessage &&
!root.isProfile && !root.isProfile &&
!root.emojiOnly && !root.isEmoji &&
!root.pinnedPopup && !root.pinnedPopup &&
!root.isRightClickOnImage && !root.isRightClickOnImage &&
(root.messageContentType === Constants.messageContentType.messageType || (root.messageContentType === Constants.messageContentType.messageType ||

View File

@ -83,14 +83,6 @@ Column {
} }
} }
function setMessageActive(messageId, active) {
if (active) {
activeMessage = messageId;
} else if (activeMessage === messageId) {
activeMessage = "";
}
}
// Legacy // Legacy
property string responseTo: responseToMessageWithId property string responseTo: responseToMessageWithId
property bool isCurrentUser: amISender property bool isCurrentUser: amISender
@ -159,7 +151,7 @@ Column {
isSticker = false, isSticker = false,
isImage = false, isImage = false,
image = null, image = null,
emojiOnly = false, isEmoji = false,
hideEmojiPicker = false, hideEmojiPicker = false,
isReply = false, isReply = false,
isRightClickOnImage = false, isRightClickOnImage = false,
@ -187,7 +179,7 @@ Column {
messageContextMenu.isProfile = !!isProfileClick messageContextMenu.isProfile = !!isProfileClick
messageContextMenu.isRightClickOnImage = isRightClickOnImage messageContextMenu.isRightClickOnImage = isRightClickOnImage
messageContextMenu.emojiOnly = emojiOnly messageContextMenu.isEmoji = isEmoji
messageContextMenu.hideEmojiPicker = hideEmojiPicker messageContextMenu.hideEmojiPicker = hideEmojiPicker
if(isReply){ if(isReply){
@ -363,11 +355,11 @@ Column {
transactionParams: root.transactionParams transactionParams: root.transactionParams
onAddEmoji: { onAddEmoji: {
root.clickMessage(isProfileClick, isSticker, isImage , image, emojiOnly, hideEmojiPicker) root.clickMessage(isProfileClick, isSticker, isImage , image, isEmoji, hideEmojiPicker)
} }
onClickMessage: { onClickMessage: {
root.clickMessage(isProfileClick, isSticker, isImage, image, emojiOnly, hideEmojiPicker, isReply, isRightClickOnImage, imageSource) root.clickMessage(isProfileClick, isSticker, isImage, image, isEmoji, hideEmojiPicker, isReply, isRightClickOnImage, imageSource)
} }
onOpenStickerPackPopup: { onOpenStickerPackPopup: {