Merge latest changes (edit/reply)
This commit is contained in:
commit
335b8ed0c9
2 changed files with 22 additions and 11 deletions
|
@ -28,6 +28,7 @@ ListItem {
|
|||
property var chatId
|
||||
property var messageId
|
||||
property var myMessage
|
||||
property bool canReplyToMessage
|
||||
readonly property var userInformation: tdLibWrapper.getUserInformation(myMessage.sender.user_id)
|
||||
property QtObject precalculatedValues: ListView.view.precalculatedValues
|
||||
readonly property color textColor: isOwnMessage ? Theme.highlightColor : Theme.primaryColor
|
||||
|
@ -42,6 +43,9 @@ ListItem {
|
|||
highlighted: (down || isSelected) && !menuOpen
|
||||
openMenuOnPressAndHold: !messageListItem.precalculatedValues.pageIsSelecting
|
||||
|
||||
signal replyToMessage()
|
||||
signal editMessage()
|
||||
|
||||
onClicked: {
|
||||
if(messageListItem.precalculatedValues.pageIsSelecting) {
|
||||
page.toggleMessageSelection(myMessage);
|
||||
|
@ -88,20 +92,14 @@ ListItem {
|
|||
}
|
||||
|
||||
MenuItem {
|
||||
onClicked: {
|
||||
newMessageInReplyToRow.inReplyToMessage = myMessage;
|
||||
newMessageTextField.focus = true;
|
||||
}
|
||||
visible: messageListItem.canReplyToMessage
|
||||
onClicked: messageListItem.replyToMessage()
|
||||
text: qsTr("Reply to Message")
|
||||
}
|
||||
MenuItem {
|
||||
onClicked: {
|
||||
newMessageColumn.editMessageId = messageId;
|
||||
newMessageTextField.text = Functions.getMessageText(myMessage, false, false, true);
|
||||
newMessageTextField.focus = true;
|
||||
}
|
||||
text: qsTr("Edit Message")
|
||||
visible: myMessage.can_be_edited
|
||||
onClicked: messageListItem.editMessage()
|
||||
text: qsTr("Edit Message")
|
||||
}
|
||||
MenuItem {
|
||||
onClicked: {
|
||||
|
|
|
@ -58,6 +58,8 @@ Page {
|
|||
)
|
||||
property var selectedMessages: []
|
||||
readonly property bool isSelecting: selectedMessages.length > 0
|
||||
readonly property bool canSendMessages: hasSendPrivilege("can_send_messages")
|
||||
|
||||
states: [
|
||||
State {
|
||||
name: "selectMessages"
|
||||
|
@ -77,6 +79,7 @@ Page {
|
|||
}
|
||||
|
||||
]
|
||||
|
||||
function toggleMessageSelection(message) {
|
||||
var selectionArray = selectedMessages;
|
||||
var foundIndex = -1
|
||||
|
@ -923,6 +926,16 @@ Page {
|
|||
myMessage: model.display
|
||||
messageId: model.message_id
|
||||
extraContentComponentName: chatView.contentComponentNames[model.content_type]
|
||||
canReplyToMessage: chatPage.canSendMessages
|
||||
onReplyToMessage: {
|
||||
newMessageInReplyToRow.inReplyToMessage = myMessage
|
||||
newMessageTextField.focus = true
|
||||
}
|
||||
onEditMessage: {
|
||||
newMessageColumn.editMessageId = messageId
|
||||
newMessageTextField.text = Functions.getMessageText(myMessage, false, false, true)
|
||||
newMessageTextField.focus = true
|
||||
}
|
||||
}
|
||||
}
|
||||
Component {
|
||||
|
@ -1048,7 +1061,7 @@ Page {
|
|||
height: isNeeded ? implicitHeight : 0
|
||||
Behavior on height { SmoothedAnimation { duration: 200 } }
|
||||
|
||||
readonly property bool isNeeded: !chatPage.isSelecting && chatPage.hasSendPrivilege("can_send_messages")
|
||||
readonly property bool isNeeded: !chatPage.isSelecting && chatPage.canSendMessages
|
||||
property string replyToMessageId: "0";
|
||||
property string editMessageId: "0";
|
||||
|
||||
|
|
Loading…
Reference in a new issue