Verified Commit 88045194 authored by Jonah Brüchert's avatar Jonah Brüchert 🌳

Fix context menu warnings

parent 4bb02d1f
Pipeline #17106 passed with stages
in 71 minutes and 43 seconds
......@@ -427,34 +427,34 @@ ChatPageBase {
Controls.Menu {
id: contextMenu
property ChatMessage message
property ChatMessage message: null
Controls.MenuItem {
text: qsTr("Copy Message")
enabled: bodyLabel.visible
enabled: contextMenu.message && contextMenu.message.bodyLabel.visible
onTriggered: {
if (!contextMenu.message.isSpoiler || contextMenu.message.isShowingSpoiler)
Utils.copyToClipboard(contextMenu.message.messageBody);
if (contextMenu.message && !contextMenu.message.isSpoiler || message && contextMenu.message.isShowingSpoiler)
Utils.copyToClipboard(contextMenu.message && contextMenu.message.messageBody);
else
Utils.copyToClipboard(contextMenu.message.spoilerHint);
Utils.copyToClipboard(contextMenu.message && contextMenu.message.spoilerHint);
}
}
Controls.MenuItem {
text: qsTr("Edit Message")
enabled: Kaidan.messageModel.canCorrectMessage(contextMenu.message.msgId)
onTriggered: root.messageEditRequested(message.msgId, contextMenu.message.messageBody)
enabled: Kaidan.messageModel.canCorrectMessage(contextMenu.message && contextMenu.message.msgId)
onTriggered: contextMenu.message.messageEditRequested(contextMenu.message.msgId, contextMenu.message.messageBody)
}
Controls.MenuItem {
text: qsTr("Copy download URL")
enabled: mediaGetUrl
enabled: contextMenu.message && contextMenu.message.mediaGetUrl
onTriggered: Utils.copyToClipboard(contextMenu.message.mediaGetUrl)
}
Controls.MenuItem {
text: qsTr("Quote")
onTriggered: {
root.quoteRequested(contextMenu.message.messageBody)
contextMenu.message.quoteRequested(contextMenu.message.messageBody)
}
}
}
......
......@@ -66,6 +66,8 @@ RowLayout {
property bool isShowingSpoiler: false
property string avatarUrl: Kaidan.avatarStorage.getAvatarUrl(sender)
property alias bodyLabel: bodyLabel
signal messageEditRequested(string id, string body)
signal quoteRequested(string body)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment