From 3528fe4e5dee1684f43e14fc9c6a50b4c1e25faf Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Thu, 2 Sep 2021 03:15:07 +0200 Subject: Warn the user before they ping the whole room --- resources/qml/MessageInput.qml | 2 +- resources/qml/NotificationWarning.qml | 38 +++++++++++++++++++++++++++++++++++ resources/qml/TimelineView.qml | 3 +++ resources/res.qrc | 1 + 4 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 resources/qml/NotificationWarning.qml (limited to 'resources') diff --git a/resources/qml/MessageInput.qml b/resources/qml/MessageInput.qml index e1bf3f06..c95929ce 100644 --- a/resources/qml/MessageInput.qml +++ b/resources/qml/MessageInput.qml @@ -268,7 +268,7 @@ Rectangle { function onRoomChanged() { messageInput.clear(); if (room) - messageInput.append(room.input.text()); + messageInput.append(room.input.text); popup.completerName = ""; messageInput.forceActiveFocus(); diff --git a/resources/qml/NotificationWarning.qml b/resources/qml/NotificationWarning.qml new file mode 100644 index 00000000..b606581b --- /dev/null +++ b/resources/qml/NotificationWarning.qml @@ -0,0 +1,38 @@ +// SPDX-FileCopyrightText: 2021 Nheko Contributors +// +// SPDX-License-Identifier: GPL-3.0-or-later + +import QtQuick 2.9 +import QtQuick.Controls 2.3 +import QtQuick.Layouts 1.2 +import im.nheko 1.0 + +Item { + implicitHeight: warningRect.visible ? warningDisplay.implicitHeight : 0 + height: implicitHeight + Layout.fillWidth: true + + Rectangle { + id: warningRect + + visible: (room && room.permissions.canPingRoom && room.input.containsAtRoom) + color: Nheko.colors.base + anchors.fill: parent + z: 3 + + Label { + id: warningDisplay + + anchors.left: parent.left + anchors.leftMargin: 10 + anchors.right: parent.right + anchors.rightMargin: 10 + anchors.bottom: parent.bottom + color: Nheko.theme.red + text: qsTr("You will be pinging the whole room") + textFormat: Text.PlainText + } + + } + +} diff --git a/resources/qml/TimelineView.qml b/resources/qml/TimelineView.qml index 9bc4bef0..f12060f2 100644 --- a/resources/qml/TimelineView.qml +++ b/resources/qml/TimelineView.qml @@ -123,6 +123,9 @@ Item { color: Nheko.theme.separator } + NotificationWarning { + } + ReplyPopup { } diff --git a/resources/res.qrc b/resources/res.qrc index b46b726c..3514ebca 100644 --- a/resources/res.qrc +++ b/resources/res.qrc @@ -138,6 +138,7 @@ qml/QuickSwitcher.qml qml/ForwardCompleter.qml qml/TypingIndicator.qml + qml/NotificationWarning.qml qml/RoomSettings.qml qml/emoji/EmojiPicker.qml qml/emoji/StickerPicker.qml -- cgit 1.5.1