fix(@desktop/chat): show popup when image is clicked

This commit is contained in:
Patryk Osmaczko 2022-01-18 22:02:47 +01:00 committed by Sale Djenic
parent ed8f2d35ce
commit 75abaabb5d
4 changed files with 17 additions and 12 deletions

View File

@ -358,6 +358,8 @@ Item {
root.showReplyArea(messageId, author) root.showReplyArea(messageId, author)
} }
onImageClicked: Global.openImagePopup(image)
stickersLoaded: root.stickersLoaded stickersLoaded: root.stickersLoaded
onVisibleChanged: { onVisibleChanged: {

View File

@ -14,9 +14,11 @@ import StatusQ.Controls 0.1 as StatusQControls
Item { Item {
id: root id: root
property var messageStore
property var contactsStore
property var messageContextMenu property var messageContextMenu
property var container property var container
property var contactsStore
property int contentType property int contentType
property int chatHorizontalPadding: Style.current.halfPadding property int chatHorizontalPadding: Style.current.halfPadding
@ -52,6 +54,8 @@ Item {
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 emojiOnly, 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 emojiOnly, bool hideEmojiPicker, bool isReply, bool isRightClickOnImage, string imageSource)
signal replyClicked(string messageId, string author) signal replyClicked(string messageId, string author)
signal imageClicked(var image)
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)
@ -497,7 +501,7 @@ Item {
imageWidth: 200 imageWidth: 200
onClicked: { onClicked: {
if (mouse.button === Qt.LeftButton) { if (mouse.button === Qt.LeftButton) {
messageStore.imageClick(image) root.imageClicked(image)
} }
else if (mouse.button === Qt.RightButton) { else if (mouse.button === Qt.RightButton) {
// Set parent, X & Y positions for the messageContextMenu // Set parent, X & Y positions for the messageContextMenu

View File

@ -72,11 +72,6 @@ StatusPopupMenu {
} }
function show(userNameParam, fromAuthorParam, identiconParam, textParam, nicknameParam, emojiReactionsModel) { function show(userNameParam, fromAuthorParam, identiconParam, textParam, nicknameParam, emojiReactionsModel) {
userName = userNameParam || ""
nickname = nicknameParam || ""
fromAuthor = fromAuthorParam || ""
identicon = identiconParam || ""
text = textParam || ""
let newEmojiReactions = [] let newEmojiReactions = []
if (!!emojiReactionsModel) { if (!!emojiReactionsModel) {
emojiReactionsModel.forEach(function (emojiReaction) { emojiReactionsModel.forEach(function (emojiReaction) {

View File

@ -12,6 +12,7 @@ import shared.controls.chat 1.0
Column { Column {
id: root id: root
width: parent.width width: parent.width
anchors.right: !isCurrentUser ? undefined : parent.right anchors.right: !isCurrentUser ? undefined : parent.right
z: (typeof chatLogView === "undefined") ? 1 : (chatLogView.count - index) z: (typeof chatLogView === "undefined") ? 1 : (chatLogView.count - index)
@ -127,7 +128,7 @@ Column {
property bool isStatusUpdate: false property bool isStatusUpdate: false
property int statusAgeEpoch: 0 property int statusAgeEpoch: 0
signal imageClick(var image) signal imageClicked(var image)
property var scrollToBottom: function () {} property var scrollToBottom: function () {}
property var clickMessage: function(isProfileClick, property var clickMessage: function(isProfileClick,
@ -320,10 +321,8 @@ Column {
onAddEmoji: { onAddEmoji: {
root.clickMessage(isProfileClick, isSticker, isImage , image, emojiOnly, hideEmojiPicker); root.clickMessage(isProfileClick, isSticker, isImage , image, emojiOnly, hideEmojiPicker);
} }
onChatImageClicked: { onChatImageClicked: root.imageClicked(image)
// Not Refactored Yet - Should do it via messageStore
// root.imageClick(image);
}
onUserNameClicked: { onUserNameClicked: {
// Not Refactored Yet - Should do it via messageStore // Not Refactored Yet - Should do it via messageStore
// root.parent.clickMessage(isProfileClick); // root.parent.clickMessage(isProfileClick);
@ -344,7 +343,9 @@ Column {
Component { Component {
id: compactMessageComponent id: compactMessageComponent
CompactMessageView { CompactMessageView {
messageStore: root.messageStore
contactsStore: root.contactsStore contactsStore: root.contactsStore
messageContextMenu: root.messageContextMenu messageContextMenu: root.messageContextMenu
contentType: root.messageContentType contentType: root.messageContentType
@ -364,6 +365,7 @@ Column {
onClickMessage: { onClickMessage: {
root.clickMessage(isProfileClick, isSticker, isImage, image, emojiOnly, hideEmojiPicker, isReply, isRightClickOnImage, imageSource) root.clickMessage(isProfileClick, isSticker, isImage, image, emojiOnly, hideEmojiPicker, isReply, isRightClickOnImage, imageSource)
} }
onOpenStickerPackPopup: { onOpenStickerPackPopup: {
root.openStickerPackPopup(stickerPackId); root.openStickerPackPopup(stickerPackId);
} }
@ -371,6 +373,8 @@ Column {
onReplyClicked: { onReplyClicked: {
root.showReplyArea(messageId, author) root.showReplyArea(messageId, author)
} }
onImageClicked: root.imageClicked(image)
} }
} }
} }