Fix anchors in layout error and eventId is not defined

This commit is contained in:
Carl Schwan
2020-11-08 12:08:18 +01:00
parent 041d97a233
commit bf8c54c987
3 changed files with 67 additions and 57 deletions

View File

@@ -5,7 +5,7 @@
* SPDX-LicenseIdentifier: GPL-3.0-or-later * SPDX-LicenseIdentifier: GPL-3.0-or-later
*/ */
import QtQuick 2.12 import QtQuick 2.12
import QtQuick.Controls 2.12 as Controls import QtQuick.Controls 2.12 as QQC2
import QtQuick.Layouts 1.12 import QtQuick.Layouts 1.12
import QtGraphicalEffects 1.12 import QtGraphicalEffects 1.12
@@ -25,6 +25,8 @@ RowLayout {
readonly property color authorColor: eventType == "notice" ? MPalette.primary : author.color readonly property color authorColor: eventType == "notice" ? MPalette.primary : author.color
readonly property color replyAuthorColor: replyVisible ? reply.author.color : MPalette.accent readonly property color replyAuthorColor: replyVisible ? reply.author.color : MPalette.accent
property alias mouseArea: controlContainer.children
signal saveFileAs() signal saveFileAs()
signal openExternally() signal openExternally()
@@ -55,12 +57,15 @@ RowLayout {
visible: !showAuthor visible: !showAuthor
} }
ColumnLayout {
id: column QQC2.Control {
id: controlContainer
Layout.fillWidth: true Layout.fillWidth: true
contentItem: ColumnLayout {
id: column
spacing: Kirigami.Units.smallSpacing spacing: Kirigami.Units.smallSpacing
Controls.Label { QQC2.Label {
Layout.fillWidth: true Layout.fillWidth: true
visible: showAuthor visible: showAuthor
@@ -96,11 +101,11 @@ RowLayout {
ColumnLayout { ColumnLayout {
Layout.fillWidth: true Layout.fillWidth: true
Controls.Label { QQC2.Label {
Layout.fillWidth: true Layout.fillWidth: true
text: replyVisible ? reply.author.displayName : "" text: replyVisible ? reply.author.displayName : ""
color: reply.author.color color: replyVisible ? reply.author.color: null
wrapMode: Text.Wrap wrapMode: Text.Wrap
} }
@@ -117,3 +122,4 @@ RowLayout {
} }
} }
} }
}

View File

@@ -16,6 +16,7 @@ Kirigami.OverlaySheet {
required property var author; required property var author;
required property string message; required property string message;
required property string eventId;
signal viewSource() signal viewSource()
signal reply(var author, string message) signal reply(var author, string message)
@@ -72,9 +73,13 @@ Kirigami.OverlaySheet {
font.pixelSize: 16 font.pixelSize: 16
font.family: "emoji" font.family: "emoji"
text: modelData text: modelData
} }
onClicked: currentRoom.toggleReaction(eventId, modelData) onClicked: {
currentRoom.toggleReaction(eventId, modelData)
root.close();
}
} }
} }
} }

View File

@@ -184,16 +184,14 @@ Kirigami.ScrollablePage {
roleValue: "message" roleValue: "message"
delegate: TimelineContainer { delegate: TimelineContainer {
width: messageListView.width width: messageListView.width
MouseArea { innerObject: MessageDelegate {
Layout.fillWidth: true
Layout.maximumWidth: messageListView.width
mouseArea: MouseArea {
acceptedButtons: Qt.RightButton acceptedButtons: Qt.RightButton
anchors.fill: parent anchors.fill: parent
onClicked: openMessageContext(author, display, eventId, toolTip); onClicked: openMessageContext(author, display, eventId, toolTip);
} }
innerObject: MessageDelegate {
Layout.fillWidth: true
Layout.maximumWidth: messageListView.width
innerObject: TextDelegate { innerObject: TextDelegate {
Layout.fillWidth: true Layout.fillWidth: true
} }
@@ -304,7 +302,8 @@ Kirigami.ScrollablePage {
function openMessageContext(author, message, eventId, toolTip, model) { function openMessageContext(author, message, eventId, toolTip, model) {
const contextMenu = messageDelegateContextMenu.createObject(root, { const contextMenu = messageDelegateContextMenu.createObject(root, {
'author': author, 'author': author,
'message': message 'message': message,
'eventId': eventId,
}); });
contextMenu.viewSource.connect(function() { contextMenu.viewSource.connect(function() {
messageSourceDialog.createObject(root, { messageSourceDialog.createObject(root, {