2020-08-03 17:17:03 +00:00
|
|
|
import QtQuick 2.12
|
|
|
|
import QtQuick.Controls 2.3
|
|
|
|
import QtQuick.Layouts 1.3
|
|
|
|
import QtQml.Models 2.3
|
2021-08-16 09:11:43 +00:00
|
|
|
import QtQuick.Dialogs 1.0
|
2021-08-06 15:44:57 +00:00
|
|
|
|
|
|
|
import StatusQ.Popups 0.1
|
2021-10-20 22:47:23 +00:00
|
|
|
import StatusQ.Components 0.1
|
2021-09-28 15:04:06 +00:00
|
|
|
|
|
|
|
import utils 1.0
|
2021-10-27 21:27:49 +00:00
|
|
|
import shared 1.0
|
|
|
|
import shared.panels 1.0
|
|
|
|
import shared.popups 1.0
|
|
|
|
import shared.status 1.0
|
2021-10-28 20:23:30 +00:00
|
|
|
import shared.controls.chat 1.0
|
2022-06-10 11:12:03 +00:00
|
|
|
import shared.controls.chat.menuItems 1.0
|
2020-08-03 17:17:03 +00:00
|
|
|
|
2021-08-06 15:44:57 +00:00
|
|
|
StatusPopupMenu {
|
2021-10-21 00:41:54 +00:00
|
|
|
id: root
|
2021-07-16 15:02:47 +00:00
|
|
|
|
2022-01-19 15:59:08 +00:00
|
|
|
property var store
|
2021-12-14 14:19:55 +00:00
|
|
|
property var reactionModel
|
|
|
|
property alias emojiContainer: emojiContainer
|
|
|
|
|
|
|
|
property string myPublicKey: ""
|
2022-01-05 15:50:03 +00:00
|
|
|
property bool amIChatAdmin: false
|
2022-07-06 19:27:04 +00:00
|
|
|
|
|
|
|
property string selectedUserPublicKey: ""
|
|
|
|
property string selectedUserDisplayName: ""
|
|
|
|
property string selectedUserIcon: ""
|
2021-12-14 14:19:55 +00:00
|
|
|
|
|
|
|
property int chatType: Constants.chatType.publicChat
|
|
|
|
property string messageId: ""
|
|
|
|
property string messageSenderId: ""
|
|
|
|
property int messageContentType: Constants.messageContentType.unknownContentType
|
|
|
|
property string imageSource: ""
|
|
|
|
|
2020-08-03 17:17:03 +00:00
|
|
|
property bool isProfile: false
|
2021-12-14 14:19:55 +00:00
|
|
|
property bool isRightClickOnImage: false
|
|
|
|
property bool pinnedPopup: false
|
2022-07-06 19:27:04 +00:00
|
|
|
property bool pinMessageAllowedForMembers: false
|
2021-12-14 14:19:55 +00:00
|
|
|
property bool isDebugEnabled: false
|
2022-05-17 10:40:27 +00:00
|
|
|
property bool isEmoji: false
|
2022-05-17 13:09:00 +00:00
|
|
|
property bool isSticker: false
|
2021-12-14 14:19:55 +00:00
|
|
|
property bool hideEmojiPicker: true
|
2021-05-25 19:34:46 +00:00
|
|
|
property bool pinnedMessage: false
|
2021-12-14 14:19:55 +00:00
|
|
|
property bool canPin: false
|
|
|
|
|
2022-06-20 14:48:38 +00:00
|
|
|
readonly property bool isMyMessage: {
|
2022-07-06 19:27:04 +00:00
|
|
|
return root.messageSenderId !== "" && root.messageSenderId === root.myPublicKey;
|
2022-06-20 14:48:38 +00:00
|
|
|
}
|
|
|
|
readonly property bool isMe: {
|
2022-07-06 19:27:04 +00:00
|
|
|
return root.selectedUserPublicKey === root.store.contactsStore.myPublicKey;
|
2022-06-20 14:48:38 +00:00
|
|
|
}
|
2022-07-06 19:27:04 +00:00
|
|
|
readonly property var contactDetails: {
|
|
|
|
if (root.selectedUserPublicKey === "" || isMe) {
|
|
|
|
return {}
|
|
|
|
}
|
|
|
|
return Utils.getContactDetailsAsJson(root.selectedUserPublicKey);
|
|
|
|
}
|
|
|
|
readonly property bool isContact: {
|
|
|
|
return root.selectedUserPublicKey !== "" && !!contactDetails.isContact
|
2022-06-20 14:48:38 +00:00
|
|
|
}
|
2022-07-21 11:02:31 +00:00
|
|
|
readonly property bool isBlockedContact: d.contactDetails && d.contactDetails.isBlocked
|
2022-07-07 19:44:54 +00:00
|
|
|
|
2022-07-06 19:27:04 +00:00
|
|
|
readonly property int outgoingVerificationStatus: {
|
|
|
|
if (root.selectedUserPublicKey === "" || root.isMe || !root.isContact) {
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
return contactDetails.verificationStatus
|
|
|
|
}
|
2022-07-07 19:44:54 +00:00
|
|
|
readonly property int incomingVerificationStatus: {
|
|
|
|
if (root.selectedUserPublicKey === "" || root.isMe || !root.isContact) {
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
return contactDetails.incomingVerificationStatus
|
|
|
|
}
|
2022-06-20 14:48:38 +00:00
|
|
|
readonly property bool hasPendingContactRequest: {
|
2022-07-06 19:27:04 +00:00
|
|
|
return !root.isMe && root.selectedUserPublicKey !== "" &&
|
|
|
|
root.store.contactsStore.hasPendingContactRequest(root.selectedUserPublicKey);
|
|
|
|
}
|
|
|
|
readonly property bool hasReceivedVerificationRequestFrom: {
|
|
|
|
if (!root.selectedUserPublicKey || root.isMe || !root.isContact) {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
return root.store.contactsStore.hasReceivedVerificationRequestFrom(root.selectedUserPublicKey)
|
|
|
|
}
|
|
|
|
readonly property bool isVerificationRequestSent: {
|
|
|
|
if (!root.selectedUserPublicKey || root.isMe || !root.isContact) {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
return root.outgoingVerificationStatus !== Constants.verificationStatus.unverified
|
2022-06-20 14:48:38 +00:00
|
|
|
}
|
2022-07-07 19:44:54 +00:00
|
|
|
readonly property bool isTrusted: {
|
|
|
|
if (!root.selectedUserPublicKey || root.isMe || !root.isContact) {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
return root.verificationStatus === Constants.verificationStatus.trusted ||
|
|
|
|
root.incomingVerificationStatus === Constants.verificationStatus.trusted
|
|
|
|
}
|
2022-06-20 14:48:38 +00:00
|
|
|
|
2022-07-21 11:02:31 +00:00
|
|
|
readonly property bool userTrustIsUnknown: d.contactDetails && d.contactDetails.trustStatus === Constants.trustStatus.unknown
|
|
|
|
readonly property bool userIsUntrustworthy: d.contactDetails && d.contactDetails.trustStatus === Constants.trustStatus.untrustworthy
|
|
|
|
|
2021-08-25 20:31:00 +00:00
|
|
|
property var setXPosition: function() {return 0}
|
|
|
|
property var setYPosition: function() {return 0}
|
2021-12-14 14:19:55 +00:00
|
|
|
|
2022-01-05 15:50:03 +00:00
|
|
|
property var emojiReactionsReactedByUser: []
|
|
|
|
|
2022-06-20 14:48:38 +00:00
|
|
|
signal openProfileClicked(string publicKey, string state)
|
2021-12-14 14:19:55 +00:00
|
|
|
signal pinMessage(string messageId)
|
|
|
|
signal unpinMessage(string messageId)
|
|
|
|
signal pinnedMessagesLimitReached(string messageId)
|
|
|
|
signal jumpToMessage(string messageId)
|
|
|
|
signal shouldCloseParentPopup()
|
2022-02-15 21:00:05 +00:00
|
|
|
signal createOneToOneChat(string communityId, string chatId, string ensName)
|
2021-12-14 14:19:55 +00:00
|
|
|
signal showReplyArea()
|
2021-12-20 14:21:35 +00:00
|
|
|
signal toggleReaction(string messageId, int emojiId)
|
2022-01-13 15:14:34 +00:00
|
|
|
signal deleteMessage(string messageId)
|
2022-01-17 18:46:46 +00:00
|
|
|
signal editClicked(string messageId)
|
2021-06-29 14:49:32 +00:00
|
|
|
|
2021-12-08 21:20:43 +00:00
|
|
|
function show(userNameParam, fromAuthorParam, identiconParam, textParam, nicknameParam, emojiReactionsModel) {
|
|
|
|
let newEmojiReactions = []
|
|
|
|
if (!!emojiReactionsModel) {
|
|
|
|
emojiReactionsModel.forEach(function (emojiReaction) {
|
|
|
|
newEmojiReactions[emojiReaction.emojiId] = emojiReaction.currentUserReacted
|
|
|
|
})
|
|
|
|
}
|
2022-01-05 15:50:03 +00:00
|
|
|
root.emojiReactionsReactedByUser = newEmojiReactions;
|
2021-12-08 21:20:43 +00:00
|
|
|
|
|
|
|
/* // copy link feature not ready yet
|
|
|
|
const numLinkUrls = root.linkUrls.split(" ").length
|
|
|
|
copyLinkMenu.enabled = numLinkUrls > 1
|
2022-05-17 10:40:27 +00:00
|
|
|
copyLinkAction.enabled = !!root.linkUrls && numLinkUrls === 1 && !isEmoji && !root.isProfile
|
2021-12-08 21:20:43 +00:00
|
|
|
*/
|
|
|
|
popup()
|
|
|
|
}
|
|
|
|
|
2022-07-06 16:51:56 +00:00
|
|
|
onClosed: {
|
|
|
|
// Reset selectedUserPublicKey so that associated properties get recalculated on re-open
|
|
|
|
selectedUserPublicKey = ""
|
2022-07-21 11:02:31 +00:00
|
|
|
d.contactDetails = {}
|
2022-07-06 16:51:56 +00:00
|
|
|
}
|
|
|
|
|
2022-06-20 14:48:38 +00:00
|
|
|
onHeightChanged: { root.y = setYPosition(); }
|
|
|
|
onWidthChanged: { root.x = setXPosition(); }
|
2022-07-11 11:50:21 +00:00
|
|
|
onOpened: {
|
|
|
|
// Trigger x and y position:
|
|
|
|
x = setXPosition()
|
|
|
|
y = setYPosition()
|
|
|
|
}
|
2022-06-20 14:48:38 +00:00
|
|
|
|
2022-07-21 11:02:31 +00:00
|
|
|
width: Math.max(emojiContainer.visible ? emojiContainer.width : 0, 230)
|
|
|
|
|
|
|
|
onAboutToShow: {
|
|
|
|
if (root.isProfile && root.selectedUserPublicKey !== "") {
|
|
|
|
d.contactDetails = Utils.getContactDetailsAsJson(root.selectedUserPublicKey)
|
|
|
|
} else {
|
|
|
|
d.contactDetails = {}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
QtObject {
|
|
|
|
id: d
|
|
|
|
property var contactDetails: ({})
|
|
|
|
}
|
2022-06-20 14:48:38 +00:00
|
|
|
|
2020-08-03 17:17:03 +00:00
|
|
|
Item {
|
|
|
|
id: emojiContainer
|
|
|
|
width: emojiRow.width
|
|
|
|
height: visible ? emojiRow.height : 0
|
2022-05-17 10:40:27 +00:00
|
|
|
visible: !root.hideEmojiPicker && (root.isEmoji || !root.isProfile) && !root.pinnedPopup
|
2020-08-03 17:17:03 +00:00
|
|
|
Row {
|
|
|
|
id: emojiRow
|
2021-08-06 15:44:57 +00:00
|
|
|
spacing: Style.current.halfPadding
|
|
|
|
leftPadding: Style.current.halfPadding
|
|
|
|
rightPadding: Style.current.halfPadding
|
2022-05-17 10:40:27 +00:00
|
|
|
bottomPadding: root.isEmoji ? 0 : Style.current.padding
|
2020-08-03 17:17:03 +00:00
|
|
|
|
|
|
|
Repeater {
|
2021-10-21 00:41:54 +00:00
|
|
|
model: root.reactionModel
|
2020-08-03 17:17:03 +00:00
|
|
|
delegate: EmojiReaction {
|
2021-09-28 15:04:06 +00:00
|
|
|
source: Style.svg(filename)
|
2020-08-03 17:17:03 +00:00
|
|
|
emojiId: model.emojiId
|
2021-10-21 00:41:54 +00:00
|
|
|
reactedByUser: !!root.emojiReactionsReactedByUser[model.emojiId]
|
2021-10-01 15:58:36 +00:00
|
|
|
onCloseModal: {
|
2021-12-20 14:21:35 +00:00
|
|
|
root.toggleReaction(root.messageId, emojiId)
|
2020-08-12 17:58:19 +00:00
|
|
|
}
|
2020-08-03 17:17:03 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-03-09 10:27:32 +00:00
|
|
|
ProfileHeader {
|
2021-08-06 15:44:57 +00:00
|
|
|
width: parent.width
|
2022-03-09 10:27:32 +00:00
|
|
|
visible: root.isProfile
|
2020-08-03 17:17:03 +00:00
|
|
|
|
2022-07-21 11:02:31 +00:00
|
|
|
displayNameVisible: false
|
|
|
|
displayNamePlusIconsVisible: true
|
|
|
|
editButtonVisible: false
|
2022-03-09 10:27:32 +00:00
|
|
|
displayName: root.selectedUserDisplayName
|
|
|
|
pubkey: root.selectedUserPublicKey
|
|
|
|
icon: root.selectedUserIcon
|
2022-07-21 11:02:31 +00:00
|
|
|
trustStatus: d.contactDetails.trustStatus
|
|
|
|
isContact: root.isMyMutualContact
|
|
|
|
isCurrentUser: root.isMe
|
2022-03-09 10:27:32 +00:00
|
|
|
}
|
2020-08-03 17:17:03 +00:00
|
|
|
|
2022-03-09 10:27:32 +00:00
|
|
|
Item {
|
|
|
|
visible: root.isProfile
|
|
|
|
height: root.topPadding
|
2020-08-03 17:17:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Separator {
|
|
|
|
anchors.bottom: viewProfileAction.top
|
2022-05-17 10:40:27 +00:00
|
|
|
visible: !root.isEmoji && !root.hideEmojiPicker && !pinnedPopup
|
2020-08-03 17:17:03 +00:00
|
|
|
}
|
|
|
|
|
2021-08-16 09:11:43 +00:00
|
|
|
StatusMenuItem {
|
|
|
|
id: copyImageAction
|
|
|
|
text: qsTr("Copy image")
|
|
|
|
onTriggered: {
|
2022-01-19 15:59:08 +00:00
|
|
|
if (root.imageSource) {
|
2022-03-28 22:16:56 +00:00
|
|
|
root.store.copyImageToClipboardByUrl(root.imageSource)
|
2022-01-19 15:59:08 +00:00
|
|
|
}
|
2021-10-21 00:41:54 +00:00
|
|
|
root.close()
|
2021-08-16 09:11:43 +00:00
|
|
|
}
|
|
|
|
icon.name: "copy"
|
2022-02-01 18:45:28 +00:00
|
|
|
enabled: root.isRightClickOnImage && !root.pinnedPopup
|
2021-08-16 09:11:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
StatusMenuItem {
|
|
|
|
id: downloadImageAction
|
|
|
|
text: qsTr("Download image")
|
|
|
|
onTriggered: {
|
|
|
|
fileDialog.open()
|
2021-10-21 00:41:54 +00:00
|
|
|
root.close()
|
2021-08-16 09:11:43 +00:00
|
|
|
}
|
|
|
|
icon.name: "download"
|
2022-02-01 18:45:28 +00:00
|
|
|
enabled: root.isRightClickOnImage && !root.pinnedPopup
|
2021-08-16 09:11:43 +00:00
|
|
|
}
|
|
|
|
|
2022-06-10 11:12:03 +00:00
|
|
|
ViewProfileMenuItem {
|
2020-08-03 17:17:03 +00:00
|
|
|
id: viewProfileAction
|
2022-06-20 14:48:38 +00:00
|
|
|
enabled: root.isProfile && !root.pinnedPopup
|
2020-09-17 14:26:26 +00:00
|
|
|
onTriggered: {
|
2022-06-20 14:48:38 +00:00
|
|
|
root.openProfileClicked(root.selectedUserPublicKey, "")
|
2021-10-21 00:41:54 +00:00
|
|
|
root.close()
|
2020-09-17 14:26:26 +00:00
|
|
|
}
|
2020-08-03 17:17:03 +00:00
|
|
|
}
|
2021-06-29 14:49:32 +00:00
|
|
|
|
2022-06-10 11:12:03 +00:00
|
|
|
SendMessageMenuItem {
|
|
|
|
id: sendMessageMenuItem
|
2022-07-06 19:27:04 +00:00
|
|
|
enabled: root.isProfile && root.isContact && !root.isBlockedContact
|
2020-09-17 14:26:26 +00:00
|
|
|
onTriggered: {
|
2022-06-10 11:12:03 +00:00
|
|
|
root.createOneToOneChat("", root.selectedUserPublicKey, "")
|
2021-10-21 00:41:54 +00:00
|
|
|
root.close()
|
2020-09-17 14:26:26 +00:00
|
|
|
}
|
2022-06-10 11:12:03 +00:00
|
|
|
}
|
|
|
|
|
2022-06-20 14:48:38 +00:00
|
|
|
SendContactRequestMenuItem {
|
2022-07-06 19:27:04 +00:00
|
|
|
enabled: root.isProfile && !root.isMe && !root.isContact
|
2022-06-20 14:48:38 +00:00
|
|
|
&& !root.isBlockedContact && !root.hasPendingContactRequest
|
|
|
|
onTriggered: {
|
2022-07-07 19:44:54 +00:00
|
|
|
root.openProfileClicked(root.selectedUserPublicKey,
|
|
|
|
Constants.profilePopupStates.contactRequest)
|
2022-06-20 14:48:38 +00:00
|
|
|
root.close()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
StatusMenuItem {
|
2022-07-07 19:44:54 +00:00
|
|
|
text: qsTr("Verify Identity")
|
|
|
|
icon.name: "checkmark-circle"
|
|
|
|
enabled: root.isProfile && !root.isMe && root.isContact
|
|
|
|
&& !root.isBlockedContact && !root.isVerificationRequestSent
|
|
|
|
&& !root.hasReceivedVerificationRequestFrom
|
2022-06-20 14:48:38 +00:00
|
|
|
onTriggered: {
|
2022-07-07 19:44:54 +00:00
|
|
|
root.openProfileClicked(root.selectedUserPublicKey,
|
|
|
|
Constants.profilePopupStates.verifyIdentity)
|
2022-06-20 14:48:38 +00:00
|
|
|
root.close()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-07-06 19:27:04 +00:00
|
|
|
StatusMenuItem {
|
2022-07-07 19:44:54 +00:00
|
|
|
text: isVerificationRequestSent ||
|
|
|
|
root.incomingVerificationStatus === Constants.verificationStatus.verified ?
|
|
|
|
qsTr("ID Request Pending....") :
|
|
|
|
qsTr("Respond to ID Request...")
|
2022-07-06 19:27:04 +00:00
|
|
|
icon.name: "checkmark-circle"
|
|
|
|
enabled: root.isProfile && !root.isMe && root.isContact
|
2022-07-07 19:44:54 +00:00
|
|
|
&& !root.isBlockedContact && !root.isTrusted
|
|
|
|
&& (root.hasReceivedVerificationRequestFrom
|
|
|
|
|| root.isVerificationRequestSent)
|
|
|
|
onTriggered: {
|
|
|
|
if (hasReceivedVerificationRequestFrom) {
|
|
|
|
root.openProfileClicked(root.selectedUserPublicKey,
|
|
|
|
Constants.profilePopupStates.respondToPendingRequest)
|
|
|
|
} else if (root.isVerificationRequestSent) {
|
|
|
|
root.openProfileClicked(root.selectedUserPublicKey,
|
|
|
|
Constants.profilePopupStates.showVerificationPendingSection)
|
|
|
|
}
|
|
|
|
|
|
|
|
root.close()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
StatusMenuItem {
|
|
|
|
text: qsTr("Rename")
|
|
|
|
icon.name: "edit_pencil"
|
|
|
|
enabled: root.isProfile && !root.isMe
|
2022-07-06 19:27:04 +00:00
|
|
|
onTriggered: {
|
2022-07-07 19:44:54 +00:00
|
|
|
root.openProfileClicked(root.selectedUserPublicKey,
|
|
|
|
Constants.profilePopupStates.openNickname)
|
2022-07-06 19:27:04 +00:00
|
|
|
root.close()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-06-20 14:48:38 +00:00
|
|
|
StatusMenuItem {
|
|
|
|
text: qsTr("Unblock User")
|
2022-07-21 11:02:31 +00:00
|
|
|
icon.name: "remove-circle"
|
2022-06-20 14:48:38 +00:00
|
|
|
enabled: root.isProfile && !root.isMe && root.isBlockedContact
|
2022-07-21 11:02:31 +00:00
|
|
|
onTriggered: root.store.contactsStore.unblockContact(root.selectedUserPublicKey)
|
|
|
|
}
|
|
|
|
|
|
|
|
StatusMenuSeparator {
|
|
|
|
visible: blockMenuItem.enabled || markUntrustworthyMenuItem.enabled || removeUntrustworthyMarkMenuItem.enabled
|
2022-06-20 14:48:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
StatusMenuItem {
|
2022-07-21 11:02:31 +00:00
|
|
|
id: markUntrustworthyMenuItem
|
|
|
|
text: qsTr("Mark as Untrustworthy")
|
|
|
|
icon.name: "warning"
|
|
|
|
type: StatusMenuItem.Type.Danger
|
|
|
|
enabled: root.isProfile && !root.isMe && root.userTrustIsUnknown
|
|
|
|
onTriggered: root.store.contactsStore.markUntrustworthy(root.selectedUserPublicKey)
|
|
|
|
}
|
|
|
|
|
|
|
|
StatusMenuItem {
|
|
|
|
id: removeUntrustworthyMarkMenuItem
|
|
|
|
text: qsTr("Remove Untrustworthy Mark")
|
|
|
|
icon.name: "warning"
|
|
|
|
enabled: root.isProfile && !root.isMe && root.userIsUntrustworthy
|
|
|
|
onTriggered: root.store.contactsStore.removeTrustStatus(root.selectedUserPublicKey)
|
|
|
|
}
|
|
|
|
|
|
|
|
StatusMenuItem {
|
|
|
|
id: blockMenuItem
|
|
|
|
text: qsTr("Block User")
|
|
|
|
icon.name: "cancel"
|
|
|
|
type: StatusMenuItem.Type.Danger
|
|
|
|
enabled: root.isProfile && !root.isMe && !root.isBlockedContact
|
|
|
|
onTriggered: root.store.contactsStore.blockContact(root.selectedUserPublicKey)
|
2022-06-20 14:48:38 +00:00
|
|
|
}
|
|
|
|
|
2022-06-10 11:12:03 +00:00
|
|
|
StatusMenuItem {
|
|
|
|
id: replyToMenuItem
|
|
|
|
text: qsTr("Reply to")
|
2021-08-06 15:44:57 +00:00
|
|
|
icon.name: "chat"
|
2022-06-10 11:12:03 +00:00
|
|
|
onTriggered: {
|
|
|
|
root.showReplyArea()
|
|
|
|
root.close()
|
|
|
|
}
|
|
|
|
enabled: (!root.hideEmojiPicker &&
|
2022-05-17 10:40:27 +00:00
|
|
|
!root.isEmoji &&
|
2021-12-14 14:19:55 +00:00
|
|
|
!root.isProfile &&
|
2022-02-01 18:45:28 +00:00
|
|
|
!root.pinnedPopup &&
|
2021-12-14 14:19:55 +00:00
|
|
|
!root.isRightClickOnImage)
|
2020-08-03 17:17:03 +00:00
|
|
|
}
|
2021-07-22 07:47:15 +00:00
|
|
|
|
2021-08-06 15:44:57 +00:00
|
|
|
StatusMenuItem {
|
|
|
|
id: editMessageAction
|
2022-04-04 11:26:30 +00:00
|
|
|
text: qsTr("Edit message")
|
2021-08-06 15:44:57 +00:00
|
|
|
onTriggered: {
|
2022-01-17 18:46:46 +00:00
|
|
|
editClicked(messageId)
|
2021-08-06 15:44:57 +00:00
|
|
|
}
|
|
|
|
icon.name: "edit"
|
2021-12-14 14:19:55 +00:00
|
|
|
enabled: root.isMyMessage &&
|
|
|
|
!root.hideEmojiPicker &&
|
2022-05-17 10:40:27 +00:00
|
|
|
!root.isEmoji &&
|
2022-05-17 13:09:00 +00:00
|
|
|
!root.isSticker &&
|
2021-12-14 14:19:55 +00:00
|
|
|
!root.isProfile &&
|
2022-02-01 18:45:28 +00:00
|
|
|
!root.pinnedPopup &&
|
2021-12-14 14:19:55 +00:00
|
|
|
!root.isRightClickOnImage
|
2021-07-16 15:06:52 +00:00
|
|
|
}
|
|
|
|
|
2021-11-11 16:22:03 +00:00
|
|
|
StatusMenuItem {
|
|
|
|
id: copyMessageIdAction
|
|
|
|
text: qsTr("Copy Message Id")
|
|
|
|
icon.name: "chat"
|
2022-02-01 18:45:28 +00:00
|
|
|
enabled: root.isDebugEnabled && !pinnedPopup
|
2021-11-11 16:22:03 +00:00
|
|
|
onTriggered: {
|
2022-01-19 15:59:08 +00:00
|
|
|
root.store.copyToClipboard(SelectedMessage.messageId)
|
2021-11-11 16:22:03 +00:00
|
|
|
close()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-08-06 15:44:57 +00:00
|
|
|
StatusMenuItem {
|
|
|
|
id: pinAction
|
|
|
|
text: {
|
2021-12-14 14:19:55 +00:00
|
|
|
if (root.pinnedMessage) {
|
2022-04-04 11:26:30 +00:00
|
|
|
return qsTr("Unpin")
|
2021-08-06 15:44:57 +00:00
|
|
|
}
|
2022-04-04 11:26:30 +00:00
|
|
|
return qsTr("Pin")
|
2021-08-06 15:44:57 +00:00
|
|
|
|
|
|
|
}
|
2021-07-22 07:47:15 +00:00
|
|
|
onTriggered: {
|
2021-12-14 14:19:55 +00:00
|
|
|
if (root.pinnedMessage) {
|
|
|
|
root.unpinMessage(root.messageId)
|
2021-08-06 15:44:57 +00:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2021-12-14 14:19:55 +00:00
|
|
|
if (!root.canPin) {
|
|
|
|
root.pinnedMessagesLimitReached(root.messageId)
|
2021-08-06 15:44:57 +00:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2021-12-14 14:19:55 +00:00
|
|
|
root.pinMessage(root.messageId)
|
2021-10-21 00:41:54 +00:00
|
|
|
root.close()
|
2021-07-22 07:47:15 +00:00
|
|
|
}
|
2021-08-06 15:44:57 +00:00
|
|
|
icon.name: "pin"
|
|
|
|
enabled: {
|
2022-05-17 10:40:27 +00:00
|
|
|
if(root.isProfile || root.isEmoji || root.isRightClickOnImage)
|
2021-08-06 15:44:57 +00:00
|
|
|
return false
|
|
|
|
|
2021-12-14 14:19:55 +00:00
|
|
|
switch (root.chatType) {
|
|
|
|
case Constants.chatType.publicChat:
|
|
|
|
return false
|
|
|
|
case Constants.chatType.profile:
|
|
|
|
return false
|
|
|
|
case Constants.chatType.oneToOne:
|
|
|
|
return true
|
|
|
|
case Constants.chatType.privateGroupChat:
|
2022-01-05 15:50:03 +00:00
|
|
|
return root.amIChatAdmin
|
2021-12-14 14:19:55 +00:00
|
|
|
case Constants.chatType.communityChat:
|
2022-05-10 16:13:36 +00:00
|
|
|
return root.amIChatAdmin || root.pinMessageAllowedForMembers
|
2021-12-14 14:19:55 +00:00
|
|
|
default:
|
|
|
|
return false
|
|
|
|
}
|
2021-08-06 15:44:57 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
StatusMenuSeparator {
|
2021-12-14 14:19:55 +00:00
|
|
|
visible: deleteMessageAction.enabled &&
|
2022-01-05 15:50:03 +00:00
|
|
|
(viewProfileAction.enabled ||
|
2022-06-10 11:12:03 +00:00
|
|
|
sendMessageMenuItem.enabled ||
|
|
|
|
replyToMenuItem.enabled ||
|
2022-01-05 15:50:03 +00:00
|
|
|
editMessageAction.enabled ||
|
|
|
|
pinAction.enabled)
|
2021-07-22 07:47:15 +00:00
|
|
|
}
|
2021-08-06 15:44:57 +00:00
|
|
|
|
|
|
|
StatusMenuItem {
|
2021-07-26 18:44:25 +00:00
|
|
|
id: deleteMessageAction
|
2021-12-14 14:19:55 +00:00
|
|
|
enabled: root.isMyMessage &&
|
|
|
|
!root.isProfile &&
|
2022-05-17 10:40:27 +00:00
|
|
|
!root.isEmoji &&
|
2021-12-14 14:19:55 +00:00
|
|
|
!root.pinnedPopup &&
|
|
|
|
!root.isRightClickOnImage &&
|
|
|
|
(root.messageContentType === Constants.messageContentType.messageType ||
|
|
|
|
root.messageContentType === Constants.messageContentType.stickerType ||
|
|
|
|
root.messageContentType === Constants.messageContentType.emojiType ||
|
|
|
|
root.messageContentType === Constants.messageContentType.imageType ||
|
|
|
|
root.messageContentType === Constants.messageContentType.audioType)
|
2022-04-04 11:26:30 +00:00
|
|
|
text: qsTr("Delete message")
|
2021-07-26 18:44:25 +00:00
|
|
|
onTriggered: {
|
2021-10-20 09:50:50 +00:00
|
|
|
if (!localAccountSensitiveSettings.showDeleteMessageWarning) {
|
2022-01-13 15:14:34 +00:00
|
|
|
deleteMessage(messageId)
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
Global.openPopup(deleteMessageConfirmationDialogComponent)
|
2021-07-26 18:44:25 +00:00
|
|
|
}
|
|
|
|
}
|
2021-08-06 15:44:57 +00:00
|
|
|
icon.name: "delete"
|
|
|
|
type: StatusMenuItem.Type.Danger
|
2021-07-26 18:44:25 +00:00
|
|
|
}
|
2021-08-16 12:35:24 +00:00
|
|
|
|
|
|
|
StatusMenuItem {
|
2021-12-14 14:19:55 +00:00
|
|
|
id: jumpToAction
|
2021-10-21 00:41:54 +00:00
|
|
|
enabled: root.pinnedPopup
|
2021-08-16 12:35:24 +00:00
|
|
|
text: qsTr("Jump to")
|
|
|
|
onTriggered: {
|
2021-12-14 14:19:55 +00:00
|
|
|
root.jumpToMessage(root.messageId)
|
2021-10-21 00:41:54 +00:00
|
|
|
root.close()
|
|
|
|
root.shouldCloseParentPopup()
|
2021-08-16 12:35:24 +00:00
|
|
|
}
|
2022-06-20 19:14:33 +00:00
|
|
|
icon.name: "arrow-up"
|
2021-08-16 12:35:24 +00:00
|
|
|
}
|
2021-08-16 09:11:43 +00:00
|
|
|
|
|
|
|
FileDialog {
|
|
|
|
id: fileDialog
|
|
|
|
title: qsTr("Please choose a directory")
|
|
|
|
selectFolder: true
|
|
|
|
modality: Qt.NonModal
|
|
|
|
onAccepted: {
|
2022-01-19 15:59:08 +00:00
|
|
|
if (root.imageSource) {
|
2022-03-28 22:16:56 +00:00
|
|
|
root.store.downloadImageByUrl(root.imageSource, fileDialog.fileUrls)
|
2022-01-19 15:59:08 +00:00
|
|
|
}
|
2021-08-16 09:11:43 +00:00
|
|
|
fileDialog.close()
|
|
|
|
}
|
|
|
|
onRejected: {
|
|
|
|
fileDialog.close()
|
|
|
|
}
|
|
|
|
}
|
2022-01-13 15:14:34 +00:00
|
|
|
|
|
|
|
Component {
|
|
|
|
id: deleteMessageConfirmationDialogComponent
|
|
|
|
ConfirmationDialog {
|
2022-04-04 11:26:30 +00:00
|
|
|
header.title: qsTr("Confirm deleting this message")
|
|
|
|
confirmationText: qsTr("Are you sure you want to delete this message? Be aware that other clients are not guaranteed to delete the message as well.")
|
2022-01-13 15:14:34 +00:00
|
|
|
height: 260
|
|
|
|
checkbox.visible: true
|
|
|
|
executeConfirm: function () {
|
|
|
|
if (checkbox.checked) {
|
|
|
|
localAccountSensitiveSettings.showDeleteMessageWarning = false
|
|
|
|
}
|
|
|
|
|
|
|
|
close()
|
|
|
|
root.deleteMessage(messageId)
|
|
|
|
}
|
|
|
|
onClosed: {
|
|
|
|
destroy()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-08-03 17:17:03 +00:00
|
|
|
}
|