chore: refactor/improve/optimize StatusMessage & friends

- drop dead code
- reduce number of direct bindings
- use Loaders whenever possible

Fixes #8744
This commit is contained in:
Lukáš Tinkl 2023-01-06 16:43:54 +01:00 committed by Lukáš Tinkl
parent 1a468a144b
commit 9e396f7344
17 changed files with 110 additions and 267 deletions

View File

@ -19,12 +19,6 @@ ListView {
id: delegate
width: ListView.view.width
audioMessageInfoText: "Audio Message"
cancelButtonText: "Cancel"
saveButtonText: "Save"
loadingImageText: "Loading image..."
errorLoadingImageText: "Error loading the image"
resendText: "Resend"
pinnedMsgInfoText: "Pinned by"
timestamp: model.timestamp

View File

@ -24,31 +24,18 @@ Control {
}
property alias quickActions: quickActionsPanel.items
property alias statusChatInput: editComponent.inputComponent
property var statusChatInput
property alias linksComponent: linksLoader.sourceComponent
property alias transcationComponent: transactionBubbleLoader.sourceComponent
property alias invitationComponent: invitationBubbleLoader.sourceComponent
property alias mouseArea: mouseArea
property string resendText: ""
property string cancelButtonText: ""
property string saveButtonText: ""
property string loadingImageText: ""
property string errorLoadingImageText: ""
property string audioMessageInfoText: ""
property string pinnedMsgInfoText: ""
property string messageAttachments: ""
property var reactionIcons: [
Emoji.iconSource("❤"),
Emoji.iconSource("👍"),
Emoji.iconSource("👎"),
Emoji.iconSource("🤣"),
Emoji.iconSource("😥"),
Emoji.iconSource("😠")
]
property var reactionIcons: []
property string messageId: ""
property bool isAppWindowActive: false
property bool editMode: false
property bool isAReply: false
property bool isEdited: false
@ -76,8 +63,8 @@ Control {
property StatusMessageDetails messageDetails: StatusMessageDetails {}
property StatusMessageDetails replyDetails: StatusMessageDetails {}
property string timestampString: new Date(timestamp).toLocaleTimeString(Qt.locale(), Locale.ShortFormat)
property string timestampTooltipString: new Date(timestamp).toLocaleString()
property string timestampString: Qt.formatTime(new Date(timestamp), Qt.locale(), Locale.ShortFormat)
property string timestampTooltipString: Qt.formatDateTime(new Date(timestamp), Qt.locale(), Locale.LongFormat)
signal clicked(var sender, var mouse)
signal profilePictureClicked(var sender, var mouse)
@ -148,19 +135,9 @@ Control {
left: parent.left
}
width: 2
visible: root.isPinned
color: Theme.palette.pinColor1
}
Rectangle {
anchors {
top: parent.top
bottom: parent.bottom
left: parent.left
}
width: 2
visible: root.hasMention
color: Theme.palette.mentionColor1
visible: root.isPinned || root.hasMention
color: root.isPinned ? Theme.palette.pinColor1 : root.hasMention ? Theme.palette.mentionColor1
: "transparent" // not visible really
}
}
@ -219,7 +196,6 @@ Control {
objectName: "StatusMessage_replyDetails"
replyDetails: root.replyDetails
profileClickable: root.profileClickable
audioMessageInfoText: root.audioMessageInfoText
onReplyProfileClicked: root.replyProfileClicked(sender, mouse)
onMessageClicked: root.replyMessageClicked(mouse)
}
@ -231,25 +207,21 @@ Control {
Layout.rightMargin: 16
spacing: 8
Item {
implicitWidth: root.messageDetails.sender.profileImage.assetSettings.width
implicitHeight: profileImage.visible ? profileImage.height : 0
StatusSmartIdenticon {
id: profileImage
Layout.alignment: Qt.AlignTop
StatusSmartIdenticon {
id: profileImage
active: root.showHeader
visible: active
name: root.messageDetails.sender.displayName
asset: root.messageDetails.sender.profileImage.assetSettings
ringSettings: root.messageDetails.sender.profileImage.ringSettings
active: root.showHeader
visible: active
name: root.messageDetails.sender.displayName
asset: root.messageDetails.sender.profileImage.assetSettings
ringSettings: root.messageDetails.sender.profileImage.ringSettings
MouseArea {
cursorShape: enabled ? Qt.PointingHandCursor : Qt.ArrowCursor
acceptedButtons: Qt.LeftButton | Qt.RightButton
anchors.fill: parent
enabled: root.profileClickable
onClicked: root.profilePictureClicked(this, mouse)
}
MouseArea {
cursorShape: enabled ? Qt.PointingHandCursor : Qt.ArrowCursor
acceptedButtons: Qt.LeftButton | Qt.RightButton
anchors.fill: parent
enabled: root.profileClickable
onClicked: root.profilePictureClicked(this, mouse)
}
}
@ -257,30 +229,31 @@ Control {
spacing: 2
Layout.alignment: Qt.AlignTop
Layout.fillWidth: true
Layout.leftMargin: profileImage.visible ? 0 : root.messageDetails.sender.profileImage.assetSettings.width + parent.spacing
Loader {
StatusPinMessageDetails {
active: root.isPinned && !editMode
visible: active
sourceComponent: StatusPinMessageDetails {
pinnedMsgInfoText: root.pinnedMsgInfoText
pinnedBy: root.pinnedBy
}
pinnedMsgInfoText: root.pinnedMsgInfoText
pinnedBy: root.pinnedBy
}
StatusMessageHeader {
Loader {
Layout.fillWidth: true
sender: root.messageDetails.sender
amISender: root.messageDetails.amISender
messageOriginInfo: root.messageDetails.messageOriginInfo
resendText: root.resendText
showResendButton: root.hasExpired && root.messageDetails.amISender && !editMode
showSendingLoader: root.isSending && root.messageDetails.amISender && !editMode
resendError: root.messageDetails.amISender && !editMode ? root.resendError : ""
onClicked: root.senderNameClicked(sender, mouse)
onResendClicked: root.resendClicked()
visible: root.showHeader && !editMode
timestamp.text: root.timestampString
timestamp.tooltip.text: root.timestampTooltipString
displayNameClickable: root.profileClickable
active: root.showHeader && !editMode
visible: active
sourceComponent: StatusMessageHeader {
sender: root.messageDetails.sender
amISender: root.messageDetails.amISender
messageOriginInfo: root.messageDetails.messageOriginInfo
showResendButton: root.hasExpired && root.messageDetails.amISender && !editMode
showSendingLoader: root.isSending && root.messageDetails.amISender && !editMode
resendError: root.messageDetails.amISender && !editMode ? root.resendError : ""
onClicked: root.senderNameClicked(sender, mouse)
onResendClicked: root.resendClicked()
timestamp.text: root.timestampString
timestamp.tooltip.text: root.timestampTooltipString
displayNameClickable: root.profileClickable
}
}
Loader {
Layout.fillWidth: true
@ -307,7 +280,7 @@ Control {
}
Loader {
active: !!root.messageAttachments && !editMode
active: root.messageAttachments && !editMode
visible: active
sourceComponent: Column {
spacing: 4
@ -341,7 +314,6 @@ Control {
sourceComponent: StatusAudioMessage {
audioSource: root.messageDetails.messageContent
hovered: root.hovered
audioMessageInfoText: root.audioMessageInfoText
}
}
Loader {
@ -359,17 +331,17 @@ Control {
active: root.messageDetails.contentType === StatusMessage.ContentType.Invitation && !editMode
visible: active
}
StatusEditMessage {
id: editComponent
Loader {
Layout.fillWidth: true
Layout.rightMargin: 16
active: root.editMode
visible: active
messageText: root.messageDetails.messageText
saveButtonText: root.saveButtonText
cancelButtonText: root.cancelButtonText
onEditCancelled: root.editCancelled()
onEditCompleted: root.editCompleted(newMsgText)
sourceComponent: StatusEditMessage {
inputComponent: root.statusChatInput
messageText: root.messageDetails.messageText
onEditCancelled: root.editCancelled()
onEditCompleted: root.editCompleted(newMsgText)
}
}
Loader {
active: root.reactionsModel.count > 0

View File

@ -20,7 +20,7 @@ Item {
property alias timestamp: timestampText
property string tertiaryDetail: sender.id
property string resendText: ""
property string resendText: qsTr("Resend")
property bool showResendButton: false
property bool showSendingLoader: false
property string resendError: ""

View File

@ -10,7 +10,6 @@ import StatusQ.Core.Theme 0.1
Rectangle {
id: audioChatMessage
property string audioMessageInfoText: ""
property bool isPreview: false
property bool hovered: false
property string audioSource: ""
@ -43,7 +42,7 @@ Rectangle {
StatusBaseText {
Layout.alignment: Qt.AlignVCenter
color: Theme.palette.baseColor1
text: audioMessageInfoText
text: qsTr("Audio Message")
font.pixelSize: 13
}
}
@ -68,7 +67,6 @@ Rectangle {
} else {
audioMessage.play();
}
}
}

View File

@ -11,8 +11,6 @@ Item {
property alias inputComponent: chatInputLoader.sourceComponent
property alias active: chatInputLoader.active
property string cancelButtonText: ""
property string saveButtonText: ""
property string messageText: ""
signal editCancelled()
@ -49,7 +47,7 @@ Item {
spacing: 4
StatusFlatButton {
id: cancelBtn
text: cancelButtonText
text: qsTr("Cancel")
size: StatusBaseButton.Size.Small
onClicked: {
editCancelled()
@ -57,7 +55,7 @@ Item {
}
StatusButton {
id: saveBtn
text: saveButtonText
text: qsTr("Save")
size: StatusBaseButton.Size.Small
enabled: !!chatInputLoader.item && chatInputLoader.item.messageText.trim().length > 0
onClicked: {

View File

@ -11,7 +11,6 @@ Item {
id: root
property StatusMessageDetails replyDetails
property string audioMessageInfoText: ""
property bool profileClickable: true
signal replyProfileClicked(var sender, var mouse)
@ -59,7 +58,6 @@ Item {
Item {
Layout.fillWidth: true
Layout.alignment: Qt.AlignTop
Layout.topMargin: 4
implicitHeight: messageLayout.implicitHeight
implicitWidth: messageLayout.implicitWidth
@ -83,24 +81,20 @@ Item {
onClicked: replyProfileClicked(this, mouse)
}
}
TextEdit {
StatusBaseText {
Layout.alignment: Qt.AlignVCenter
color: Theme.palette.baseColor1
selectionColor: Theme.palette.primaryColor3
selectedTextColor: Theme.palette.directColor1
font.pixelSize: Theme.secondaryTextFontSize
font.weight: Font.Medium
selectByMouse: true
readOnly: true
text: replyDetails.amISender ? qsTr("You") : replyDetails.sender.displayName
}
}
// FIXME OPTIMIZE by using Loaders
StatusTextMessage {
objectName: "StatusMessage_replyDetails_textMessage"
Layout.fillWidth: true
textField.font.pixelSize: Theme.secondaryTextFontSize
textField.color: Theme.palette.baseColor1
clip: true
visible: !!replyDetails.messageText && replyDetails.contentType !== StatusMessage.ContentType.Sticker
allowShowMore: false
stripHtmlTags: true
@ -138,7 +132,6 @@ Item {
height: 22
isPreview: true
audioSource: replyDetails.messageContent
audioMessageInfoText: root.audioMessageInfoText
}
}
}
@ -152,7 +145,6 @@ Item {
}
}
}
}
}

View File

@ -10,8 +10,6 @@ Loader {
property string pinnedMsgInfoText: ""
property string pinnedBy: ""
active: visible
sourceComponent: Control {
verticalPadding: 3
leftPadding: 2

View File

@ -2,7 +2,6 @@ import QtQuick 2.14
import QtQuick.Layouts 1.14
import StatusQ.Core 0.1
import StatusQ.Core.Backpressure 1.0
import StatusQ.Core.Theme 0.1
import StatusQ.Controls 0.1
import StatusQ.Controls.Validators 0.1
@ -444,8 +443,8 @@ Item {
if (!text)
return false;
if ((root.validationMode == StatusInput.ValidationMode.OnlyWhenDirty && statusBaseInput.dirty) ||
root.validationMode == StatusInput.ValidationMode.Always)
if ((root.validationMode === StatusInput.ValidationMode.OnlyWhenDirty && statusBaseInput.dirty) ||
root.validationMode === StatusInput.ValidationMode.Always)
return !statusBaseInput.valid;
return false;

View File

@ -20,8 +20,6 @@ StackLayout {
signal importCommunityClicked()
signal createCommunityClicked()
clip: true
onCurrentIndexChanged: {
Global.closeCreateChatView()
}

View File

@ -106,7 +106,7 @@ QtObject {
chatContentModule.inputAreaModule.sendImages(JSON.stringify(fileUrlsAndSources));
}
let msg = globalUtils.plainText(StatusQUtils.Emoji.deparse(text))
let msg = globalUtilsInst.plainText(StatusQUtils.Emoji.deparse(text))
if (msg.length > 0) {
msg = interpretMessage(msg)
@ -301,11 +301,11 @@ QtObject {
}
function generateAlias(pk) {
return globalUtils.generateAlias(pk);
return globalUtilsInst.generateAlias(pk);
}
function plainText(text) {
return globalUtils.plainText(text)
return globalUtilsInst.plainText(text)
}
function removeCommunityChat(chatId) {
@ -551,11 +551,11 @@ QtObject {
}
function getWei2Eth(wei) {
return globalUtils.wei2Eth(wei,18)
return globalUtilsInst.wei2Eth(wei,18)
}
function getEth2Wei(eth) {
return globalUtils.eth2Wei(eth, 18)
return globalUtilsInst.eth2Wei(eth, 18)
}
function switchAccount(newIndex) {
@ -570,7 +570,7 @@ QtObject {
}
function hex2Eth(value) {
return globalUtils.hex2Eth(value)
return globalUtilsInst.hex2Eth(value)
}
readonly property Connections communitiesModuleConnections: Connections {

View File

@ -34,54 +34,18 @@ Item {
property var emojiPopup
property var stickersPopup
// Not Refactored Yet
//property int chatGroupsListViewCount: 0
property bool isReply: false
property bool isImage: false
property bool isExtendedInput: isReply || isImage
property string contactToRemove: ""
property bool isSectionActive: mainModule.activeSection.id === parentModule.getMySectionId()
property string activeChatId: parentModule && parentModule.activeItem.id
property string activeSubItemId: parentModule && parentModule.activeItem.activeSubItem.id
property int chatsCount: parentModule && parentModule.model ? parentModule.model.count : 0
property string activeChatType: parentModule && parentModule.activeItem.type
property string currentNotificationChatId
property string currentNotificationCommunityId
property var currentTime: 0
property var idMap: ({})
property bool stickersLoaded: false
property Timer timer: Timer { }
property var userList
property var contactDetails: Utils.getContactDetailsAsJson(root.activeChatId, false)
property bool isUserAdded: root.contactDetails.isAdded
signal openAppSearch()
signal openStickerPackPopup(string stickerPackId)
// Not Refactored Yet
// function hideChatInputExtendedArea () {
// if(stackLayoutChatMessages.currentIndex >= 0 && stackLayoutChatMessages.currentIndex < stackLayoutChatMessages.children.length)
// stackLayoutChatMessages.children[stackLayoutChatMessages.currentIndex].chatInput.hideExtendedArea()
// }
function showReplyArea() {
isReply = true;
isImage = false;
// Not Refactored Yet
// let replyMessageIndex = root.rootStore.chatsModelInst.messageView.messageList.getMessageIndex(SelectedMessage.messageId);
// if (replyMessageIndex === -1) return;
// let userName = root.rootStore.chatsModelInst.messageView.messageList.getMessageData(replyMessageIndex, "userName")
// let message = root.rootStore.chatsModelInst.messageView.messageList.getMessageData(replyMessageIndex, "message")
// let identicon = root.rootStore.chatsModelInst.messageView.messageList.getMessageData(replyMessageIndex, "identicon")
// let image = root.rootStore.chatsModelInst.messageView.messageList.getMessageData(replyMessageIndex, "image")
// let sticker = root.rootStore.chatsModelInst.messageView.messageList.getMessageData(replyMessageIndex, "sticker")
// let contentType = root.rootStore.chatsModelInst.messageView.messageList.getMessageData(replyMessageIndex, "contentType")
// Not Refactored Yet
// if(stackLayoutChatMessages.currentIndex >= 0 && stackLayoutChatMessages.currentIndex < stackLayoutChatMessages.children.length)
// stackLayoutChatMessages.children[stackLayoutChatMessages.currentIndex].chatInput.showReplyArea(userName, message, identicon, contentType, image, sticker)
}
function requestAddressForTransaction(address, amount, tokenAddress, tokenDecimals = 18) {
amount = globalUtils.eth2Wei(amount.toString(), tokenDecimals)
@ -142,16 +106,6 @@ Item {
root.rootStore.createChatStickerPackId = "";
}
Timer {
interval: 60000; // 1 min
running: true
repeat: true
triggeredOnStart: true
onTriggered: {
root.currentTime = Date.now()
}
}
EmptyChatPanel {
anchors.fill: parent
visible: root.activeChatId === "" || root.chatsCount == 0
@ -182,16 +136,12 @@ Item {
id: categoryChatLoader
// Channels are not loaded by default and only load when first put active
active: model.active
visible: model.active
visible: active
width: parent.width
height: parent.height
// Removing the binding in order not to unload the content
onStatusChanged: if (status == Loader.Ready) active = true
sourceComponent: ChatContentView {
visible: !root.rootStore.openCreateChat && isActiveChannel
clip: true
rootStore: root.rootStore
contactsStore: root.contactsStore
emojiPopup: root.emojiPopup
@ -222,16 +172,12 @@ Item {
id: chatLoader
// Channels are not loaded by default and only load when first put active
active: model.active
visible: model.active
visible: active
width: parent.width
height: parent.height
// Removing the binding in order not to unload the content
onStatusChanged: if (status == Loader.Ready) active = true
sourceComponent: ChatContentView {
visible: !root.rootStore.openCreateChat && isActiveChannel
clip: true
rootStore: root.rootStore
contactsStore: root.contactsStore
emojiPopup: root.emojiPopup
@ -261,9 +207,8 @@ Item {
}
ChatRequestMessagePanel {
Layout.alignment: Qt.AlignHCenter | Qt.AlignBottom
Layout.fillWidth: true
Layout.bottomMargin: Style.current.bigPadding
anchors.fill: parent
anchors.bottomMargin: Style.current.bigPadding
isUserAdded: root.isUserAdded
visible: root.activeChatType === Constants.chatType.oneToOne && !root.isUserAdded
onAddContactClicked: {

View File

@ -66,11 +66,14 @@ ColumnLayout {
}
}
StatusBanner {
Loader {
Layout.fillWidth: true
visible: root.isBlocked
type: StatusBanner.Type.Danger
statusText: qsTr("Blocked")
active: root.isBlocked
visible: active
sourceComponent: StatusBanner {
type: StatusBanner.Type.Danger
statusText: qsTr("Blocked")
}
}
MessageStore {

View File

@ -1,9 +1,6 @@
import QtQuick 2.13
import QtQuick.Controls 2.13
import QtQuick.Window 2.13
import QtQuick.Layouts 1.13
import QtQml.Models 2.13
import QtGraphicalEffects 1.13
import QtQuick.Dialogs 1.3
import StatusQ.Core 0.1
@ -217,7 +214,7 @@ Item {
MouseArea {
cursorShape: Qt.PointingHandCursor
anchors.fill: parent
onPressed: mouse.accepted = false
acceptedButtons: Qt.NoButton
}
}
@ -260,7 +257,6 @@ Item {
isChatBlocked: root.isChatBlocked
messageContextMenu: root.messageContextMenu
itemIndex: index
messageId: model.id
communityId: model.communityId
responseToMessageWithId: model.responseToMessageWithId

View File

@ -151,7 +151,7 @@ Item {
Loader {
id: membershipRequests
property int nbRequests: root.communityData.pendingRequestsToJoin.count || 0
readonly property int nbRequests: root.communityData.pendingRequestsToJoin.count || 0
anchors.top: joinCommunityButton.visible ? joinCommunityButton.bottom : communityHeader.bottom
anchors.topMargin: active ? 8 : 0

View File

@ -44,7 +44,6 @@ Column {
id: linkMessageLoader
property bool fetched: false
property var linkData
property int linkWidth: linksRepeater.width
readonly property string uuid: Utils.uuid()
property bool loadingFailed: false

View File

@ -35,7 +35,6 @@ Loader {
// without an explicit need to fetch those details via message store/module.
property bool isChatBlocked: false
property int itemIndex: -1
property string messageId: ""
property string communityId: ""
property string responseToMessageWithId: ""
@ -66,8 +65,6 @@ Loader {
property bool isInPinnedPopup: false // The pinned popup limits the number of buttons shown
property bool disableHover: false // Used to force the HoverHandler to be active (useful for messages in popups)
property bool placeholderMessage: false
property bool activityCenterMessage: false
property bool activityCenterMessageRead: true
property int gapFrom: 0
property int gapTo: 0
@ -112,7 +109,6 @@ Loader {
readonly property bool isExpired: d.getIsExpired(messageOutgoingStatus, messageTimestamp)
readonly property bool isSending: messageOutgoingStatus === Constants.sending && !isExpired
property int statusAgeEpoch: 0
signal imageClicked(var image)
@ -128,8 +124,7 @@ Loader {
isRightClickOnImage = false,
imageSource = "") {
if (placeholderMessage || activityCenterMessage ||
!(root.rootStore.mainModuleInst.activeSection.joined || isProfileClick)) {
if (placeholderMessage || !(root.rootStore.mainModuleInst.activeSection.joined || isProfileClick)) {
return
}
@ -174,34 +169,11 @@ Loader {
signal showReplyArea(string messageId, string author)
// function showReactionAuthors(fromAccounts, emojiId) {
// return root.rootStore.showReactionAuthors(fromAccounts, emojiId)
// }
function startMessageFoundAnimation() {
root.item.startMessageFoundAnimation();
}
/////////////////////////////////////////////
signal openStickerPackPopup(string stickerPackId)
// Not Refactored Yet
// Connections {
// enabled: (!placeholderMessage && !!root.rootStore)
// target: !!root.rootStore ? root.rootStore.allContacts : null
// onContactChanged: {
// if (pubkey === fromAuthor) {
// const img = appMain.getProfileImage(userPubKey, isCurrentUser, useLargeImage)
// if (img) {
// profileImageSource = img
// }
// } else if (replyMessageIndex > -1 && pubkey === repliedMessageAuthorPubkey) {
// const imgReply = appMain.getProfileImage(repliedMessageAuthorPubkey, repliedMessageAuthorIsCurrentUser, false)
// if (imgReply) {
// repliedMessageUserImage = imgReply
// }
// }
// }
// }
z: (typeof chatLogView === "undefined") ? 1 : (chatLogView.count - index)
@ -251,7 +223,7 @@ Loader {
property int unfurledLinksCount: 0
property string activeMessage
readonly property bool isMessageActive: typeof activeMessage !== "undefined" && activeMessage === messageId
readonly property bool isMessageActive: d.activeMessage === root.messageId
function setMessageActive(messageId, active) {
@ -336,8 +308,8 @@ Loader {
chatEmoji: root.channelEmoji
amIChatAdmin: root.amIChatAdmin
chatIcon: {
if ((root.messageStore.getChatType() === Constants.chatType.privateGroupChat) &&
root.messageStore.getChatIcon() !== "") {
if (root.messageStore.getChatType() === Constants.chatType.privateGroupChat &&
root.messageStore.getChatIcon() !== "") {
return root.messageStore.getChatIcon()
}
return root.senderIcon
@ -481,12 +453,6 @@ Loader {
root.nextMessageAsJsonObj.responseToMessageWithId !== ""
}
audioMessageInfoText: qsTr("Audio Message")
cancelButtonText: qsTr("Cancel")
saveButtonText: qsTr("Save")
loadingImageText: qsTr("Loading image...")
errorLoadingImageText: qsTr("Error loading the image")
resendText: qsTr("Resend")
pinnedMsgInfoText: root.isDiscordMessage ? qsTr("Pinned") : qsTr("Pinned by")
reactionIcons: [
Style.svg("emojiReactions/heart"),
@ -522,26 +488,19 @@ Loader {
bottomPadding: showHeader && nextMessageHasHeader() ? Style.current.halfPadding : 2
disableHover: root.disableHover ||
(root.chatLogView && root.chatLogView.flickingVertically) ||
activityCenterMessage ||
(root.messageContextMenu && root.messageContextMenu.opened) ||
!!Global.profilePopupOpened ||
!!Global.popupOpened
Global.profilePopupOpened ||
Global.popupOpened
hideQuickActions: root.isChatBlocked ||
root.placeholderMessage ||
root.activityCenterMessage ||
root.isInPinnedPopup ||
root.editModeOn ||
!root.rootStore.mainModuleInst.activeSection.joined
hideMessage: d.isSingleImage && d.unfurledLinksCount === 1
overrideBackground: root.activityCenterMessage || root.placeholderMessage
overrideBackgroundColor: {
if (root.activityCenterMessage && root.activityCenterMessageRead)
return Utils.setColorAlpha(Style.current.blue, 0.1);
return "transparent";
}
overrideBackground: root.placeholderMessage
profileClickable: !root.isDiscordMessage
messageAttachments: root.messageAttachments
@ -628,7 +587,7 @@ Loader {
}
mouseArea {
acceptedButtons: root.activityCenterMessage ? Qt.LeftButton : Qt.RightButton
acceptedButtons: Qt.RightButton
enabled: !root.isChatBlocked &&
!root.placeholderMessage &&
delegate.contentType !== StatusMessage.ContentType.Image
@ -711,46 +670,42 @@ Loader {
}
}
statusChatInput: StatusChatInput {
id: editTextInput
objectName: "editMessageInput"
statusChatInput: Component {
StatusChatInput {
id: editTextInput
objectName: "editMessageInput"
readonly property string messageText: editTextInput.textInput.text
readonly property string messageText: editTextInput.textInput.text
// TODO: Move this property and Escape handler to StatusChatInput
property bool suggestionsOpened: false
// TODO: Move this property and Escape handler to StatusChatInput
property bool suggestionsOpened: false
width: parent.width
width: parent.width
Keys.onEscapePressed: {
if (!suggestionsOpened) {
delegate.editCancelled()
Keys.onEscapePressed: {
if (!suggestionsOpened) {
delegate.editCancelled()
}
suggestionsOpened = false
}
suggestionsOpened = false
}
store: root.rootStore
usersStore: root.usersStore
emojiPopup: root.emojiPopup
stickersPopup: root.stickersPopup
messageContextMenu: root.messageContextMenu
store: root.rootStore
usersStore: root.usersStore
emojiPopup: root.emojiPopup
stickersPopup: root.stickersPopup
messageContextMenu: root.messageContextMenu
chatType: root.messageStore.getChatType()
isEdit: true
chatType: root.messageStore.getChatType()
isEdit: true
onSendMessage: {
delegate.editCompletedHandler(editTextInput.textInput.text)
}
suggestions.onVisibleChanged: {
if (suggestions.visible) {
suggestionsOpened = true
onSendMessage: {
delegate.editCompletedHandler(editTextInput.textInput.text)
}
}
Component.onCompleted: {
parseMessage(root.messageText);
delegate.originalMessageText = editTextInput.textInput.text
Component.onCompleted: {
parseMessage(root.messageText);
delegate.originalMessageText = editTextInput.textInput.text
}
}
}
@ -884,7 +839,6 @@ Loader {
return false;
if (!root.messageStore)
return false;
const chatType = root.messageStore.getChatType();
return (root.amISender || root.amIChatAdmin) &&
(messageContentType === Constants.messageContentType.messageType ||
messageContentType === Constants.messageContentType.stickerType ||

View File

@ -714,9 +714,6 @@ QtObject {
readonly property string ens_connected: "connected"
readonly property string ens_connected_dkey: "connected-different-key"
// WARNING: Remove later. Moved to StatusQ.
readonly property string editLabel: ` <span class="isEdited">` + qsTr("(edited)") + `</span>`
readonly property string newBookmark: " "
readonly property var ensState: {