diff options
Diffstat (limited to 'resources')
-rw-r--r-- | resources/qml/Completer.qml | 7 | ||||
-rw-r--r-- | resources/qml/MessageInput.qml | 11 | ||||
-rw-r--r-- | resources/qml/MessageInputWarning.qml | 23 | ||||
-rw-r--r-- | resources/qml/TimelineDefaultMessageStyle.qml | 24 | ||||
-rw-r--r-- | resources/qml/TimelineView.qml | 13 | ||||
-rw-r--r-- | resources/qml/dialogs/RoomSettingsDialog.qml | 2 |
6 files changed, 64 insertions, 16 deletions
diff --git a/resources/qml/Completer.qml b/resources/qml/Completer.qml index 965789bc..c6fea98e 100644 --- a/resources/qml/Completer.qml +++ b/resources/qml/Completer.qml @@ -42,6 +42,13 @@ Control { else return null; } + function currentUserid() { + if (popup.completerName == "user") { + return listView.itemAtIndex(currentIndex).modelData.userid; + } else { + return ""; + } + } function down() { if (bottomToTop) up_(); diff --git a/resources/qml/MessageInput.qml b/resources/qml/MessageInput.qml index 4396f1d3..8b6af57a 100644 --- a/resources/qml/MessageInput.qml +++ b/resources/qml/MessageInput.qml @@ -114,6 +114,10 @@ Rectangle { function insertCompletion(completion) { messageInput.remove(completerTriggeredAt, cursorPosition); messageInput.insert(cursorPosition, completion); + let userid = completer.currentUserid(); + if (userid) { + room.input.addMention(userid, completion); + } } function openCompleter(pos, type) { if (popup.opened) @@ -176,10 +180,17 @@ Rectangle { } else if (event.matches(StandardKey.InsertParagraphSeparator)) { if (popup.opened) { var currentCompletion = completer.currentCompletion(); + let userid = completer.currentUserid(); + completer.completerName = ""; popup.close(); + if (currentCompletion) { messageInput.insertCompletion(currentCompletion); + if (userid) { + console.log(userid); + room.input.addMention(userid, currentCompletion); + } event.accepted = true; return; } diff --git a/resources/qml/MessageInputWarning.qml b/resources/qml/MessageInputWarning.qml index 4d5578b3..82658f58 100644 --- a/resources/qml/MessageInputWarning.qml +++ b/resources/qml/MessageInputWarning.qml @@ -12,6 +12,9 @@ Rectangle { property color bubbleColor: Nheko.theme.error required property string text + property bool showRemove: false + + signal removeClicked(); Layout.fillWidth: true color: palette.window // required to hide the timeline behind this warning @@ -35,10 +38,30 @@ Rectangle { id: warningDisplay anchors.left: parent.left + anchors.right: parent.right anchors.margins: Nheko.paddingSmall + anchors.rightMargin: warningRoot.showRemove ? (Nheko.paddingSmall*3 + removeButton.width) : Nheko.paddingSmall anchors.verticalCenter: parent.verticalCenter text: warningRoot.text textFormat: Text.PlainText } + + ImageButton { + id: removeButton + + visible: warningRoot.showRemove + + anchors.right: parent.right + anchors.margins: Nheko.paddingSmall + anchors.verticalCenter: parent.verticalCenter + + image: ":/icons/icons/ui/dismiss.svg" + hoverEnabled: true + ToolTip.visible: hovered + ToolTip.text: qsTr("Don't mention them in this message") + onClicked: { + warningRoot.removeClicked(); + } + } } } diff --git a/resources/qml/TimelineDefaultMessageStyle.qml b/resources/qml/TimelineDefaultMessageStyle.qml index 55c62b02..34808323 100644 --- a/resources/qml/TimelineDefaultMessageStyle.qml +++ b/resources/qml/TimelineDefaultMessageStyle.qml @@ -128,18 +128,6 @@ TimelineEvent { } } }, - Rectangle { - anchors.top: gridContainer.top - anchors.left: gridContainer.left - anchors.topMargin: -2 - anchors.leftMargin: -2 + (stateEventSpacing.visible ? (stateEventSpacing.width + gridContainer.spacing) : 0) - color: "transparent" - border.color: Nheko.theme.red - border.width: wrapper.notificationlevel == MtxEvent.Highlight ? 1 : 0 - radius: 4 - height: contentColumn.implicitHeight + 4 - width: contentColumn.implicitWidth + 4 + (wrapper.threadId ? (4 + gridContainer.spacing) : 0) - }, Row { id: gridContainer @@ -293,6 +281,18 @@ TimelineEvent { onDoubleTapped: wrapper.room.reply = wrapper.eventId } }, + Rectangle { + anchors.top: gridContainer.top + anchors.left: gridContainer.left + anchors.topMargin: -2 + anchors.leftMargin: -2 + (stateEventSpacing.visible ? (stateEventSpacing.width + gridContainer.spacing) : 0) + color: "transparent" + border.color: Nheko.theme.red + border.width: wrapper.notificationlevel == MtxEvent.Highlight ? 1 : 0 + radius: 4 + height: contentColumn.implicitHeight + 4 + width: contentColumn.implicitWidth + 4 + (wrapper.threadId ? (4 + gridContainer.spacing) : 0) + }, TimelineMetadata { id: metadata diff --git a/resources/qml/TimelineView.qml b/resources/qml/TimelineView.qml index 7bad53c4..085ca073 100644 --- a/resources/qml/TimelineView.qml +++ b/resources/qml/TimelineView.qml @@ -148,9 +148,16 @@ Item { } UploadBox { } - MessageInputWarning { - text: qsTr("You are about to notify the whole room") - visible: (room && room.permissions.canPingRoom() && room.input.containsAtRoom) + Repeater { + model: room ? room.input.mentions : null + + MessageInputWarning { + required property string modelData + bubbleColor: modelData == "@room" ? Nheko.theme.error : Nheko.theme.orange + text: modelData == "@room" ? qsTr("You are about to notify the whole room") : qsTr("You will be mentioning %1").arg(modelData) + showRemove: true + onRemoveClicked: room.input.removeMention(modelData); + } } MessageInputWarning { text: qsTr("The command /%1 is not recognized and will be sent as part of your message").arg(room ? room.input.currentCommand : "") diff --git a/resources/qml/dialogs/RoomSettingsDialog.qml b/resources/qml/dialogs/RoomSettingsDialog.qml index 9276a9d3..8e127567 100644 --- a/resources/qml/dialogs/RoomSettingsDialog.qml +++ b/resources/qml/dialogs/RoomSettingsDialog.qml @@ -273,7 +273,7 @@ ApplicationWindow { ComboBox { model: [qsTr("Muted"), qsTr("Mentions only"), qsTr("All messages")] currentIndex: roomSettings.notifications - onActivated: { + onActivated: (index) => { roomSettings.changeNotifications(index); } Layout.fillWidth: true |