2021-05-25 19:34:46 +00:00
|
|
|
import QtQuick 2.13
|
|
|
|
import "../../../../imports"
|
|
|
|
import "../../../../shared"
|
|
|
|
import "../../../../shared/status"
|
2021-07-22 07:47:15 +00:00
|
|
|
import "../data"
|
2021-05-25 19:34:46 +00:00
|
|
|
import "../ChatColumn"
|
|
|
|
|
|
|
|
ModalPopup {
|
|
|
|
id: popup
|
|
|
|
|
|
|
|
header: Item {
|
|
|
|
height: childrenRect.height
|
|
|
|
width: parent.width
|
|
|
|
|
|
|
|
StyledText {
|
|
|
|
id: title
|
2021-07-16 20:22:50 +00:00
|
|
|
//% "Pinned messages"
|
|
|
|
text: qsTrId("pinned-messages")
|
2021-05-25 19:34:46 +00:00
|
|
|
anchors.top: parent.top
|
|
|
|
anchors.left: parent.left
|
|
|
|
font.bold: true
|
|
|
|
font.pixelSize: 17
|
|
|
|
}
|
|
|
|
|
|
|
|
StyledText {
|
2021-05-25 19:38:18 +00:00
|
|
|
property int nbMessages: pinnedMessageListView.count
|
|
|
|
|
2021-05-25 19:34:46 +00:00
|
|
|
id: nbPinnedMessages
|
2021-07-16 20:22:50 +00:00
|
|
|
//% "%1 messages"
|
|
|
|
text: nbMessages > 1 ? qsTrId("-1-messages").arg(nbMessages) :
|
|
|
|
//% "%1 message"
|
|
|
|
qsTrId("-1-message").arg(nbMessages)
|
2021-05-25 19:34:46 +00:00
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.top: title.bottom
|
|
|
|
anchors.topMargin: 2
|
|
|
|
font.pixelSize: 15
|
|
|
|
color: Style.current.secondaryText
|
|
|
|
}
|
|
|
|
|
|
|
|
Separator {
|
|
|
|
anchors.top: nbPinnedMessages.bottom
|
|
|
|
anchors.topMargin: Style.current.padding
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.leftMargin: -Style.current.padding
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.rightMargin: -Style.current.padding
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-05-25 19:38:18 +00:00
|
|
|
Item {
|
|
|
|
anchors.fill: parent
|
2021-05-25 19:34:46 +00:00
|
|
|
|
2021-05-25 19:38:18 +00:00
|
|
|
StyledText {
|
|
|
|
visible: pinnedMessageListView.count === 0
|
2021-07-16 20:22:50 +00:00
|
|
|
//% "Pinned messages will appear here."
|
|
|
|
text: qsTrId("pinned-messages-will-appear-here-")
|
2021-05-25 19:38:18 +00:00
|
|
|
anchors.centerIn: parent
|
|
|
|
color: Style.current.secondaryText
|
|
|
|
}
|
|
|
|
|
|
|
|
ListView {
|
|
|
|
id: pinnedMessageListView
|
2021-06-21 19:35:32 +00:00
|
|
|
model: chatsModel.messageView.pinnedMessagesList
|
2021-05-25 19:38:18 +00:00
|
|
|
height: parent.height
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.leftMargin: -Style.current.padding
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.rightMargin: -Style.current.padding
|
|
|
|
topMargin: Style.current.halfPadding
|
|
|
|
anchors.top: parent.top
|
|
|
|
anchors.topMargin: -Style.current.halfPadding
|
|
|
|
clip: true
|
|
|
|
|
2021-07-22 07:47:15 +00:00
|
|
|
function closePopup() {
|
|
|
|
popup.close()
|
|
|
|
}
|
|
|
|
|
2021-05-25 19:38:18 +00:00
|
|
|
delegate: Message {
|
2021-07-22 07:47:15 +00:00
|
|
|
id: messageItem
|
|
|
|
property var view: ListView.view
|
2021-05-25 19:38:18 +00:00
|
|
|
fromAuthor: model.fromAuthor
|
|
|
|
chatId: model.chatId
|
|
|
|
userName: model.userName
|
|
|
|
alias: model.alias
|
|
|
|
localName: model.localName
|
|
|
|
message: model.message
|
|
|
|
plainText: model.plainText
|
|
|
|
identicon: model.identicon
|
|
|
|
isCurrentUser: model.isCurrentUser
|
|
|
|
timestamp: model.timestamp
|
|
|
|
sticker: model.sticker
|
|
|
|
contentType: model.contentType
|
|
|
|
outgoingStatus: model.outgoingStatus
|
|
|
|
responseTo: model.responseTo
|
|
|
|
imageClick: imagePopup.openPopup.bind(imagePopup)
|
|
|
|
messageId: model.messageId
|
|
|
|
emojiReactions: model.emojiReactions
|
|
|
|
linkUrls: model.linkUrls
|
|
|
|
communityId: model.communityId
|
|
|
|
hasMention: model.hasMention
|
|
|
|
stickerPackId: model.stickerPackId
|
|
|
|
timeout: model.timeout
|
|
|
|
pinnedMessage: true
|
|
|
|
pinnedBy: model.pinnedBy
|
|
|
|
forceHoverHandler: true
|
2021-07-22 07:47:15 +00:00
|
|
|
activityCenterMessage: false
|
2021-07-01 20:58:57 +00:00
|
|
|
isEdited: model.isEdited
|
2021-07-09 14:18:45 +00:00
|
|
|
showEdit: false
|
2021-07-22 07:47:15 +00:00
|
|
|
messageContextMenu: MessageContextMenu {
|
|
|
|
showJumpTo: true
|
|
|
|
pinnedMessage: true
|
|
|
|
reactionModel: EmojiReactions { }
|
|
|
|
|
|
|
|
onCloseParentPopup: {
|
|
|
|
messageItem.view.closePopup()
|
|
|
|
}
|
|
|
|
}
|
2021-05-25 19:38:18 +00:00
|
|
|
}
|
2021-05-25 19:34:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-05-25 19:38:18 +00:00
|
|
|
|
2021-05-25 19:34:46 +00:00
|
|
|
footer: StatusRoundButton {
|
|
|
|
id: btnBack
|
|
|
|
anchors.left: parent.left
|
|
|
|
icon.name: "arrow-right"
|
|
|
|
icon.width: 20
|
|
|
|
icon.height: 16
|
|
|
|
rotation: 180
|
|
|
|
onClicked: popup.close()
|
|
|
|
}
|
|
|
|
}
|