This commit adds the ability to set the master push rule and set push rules for individual rooms as per the matrix spec. See https://spec.matrix.org/v1.3/client-server-api/#push-rules. The master push rule is just on/off and uses the existing notification setting in general setting to enable/disable the server default master push rule .m.rule.master. For each room there is now a page in the room setting that allows the following to be set: - Default - All messages - @mentions and keywords - off New room or override rules are added/removed to achieve this. There is also functionality to check the master/room notification state whenever the setting menu is entered. This allows the status to be updated if changed in another client or get the initial state for a room as it isn't stored. Note - There is currently no menu items in the room list for setting the room push rule settings. This will be added in a later commit, the aim is to focus on making sure the technical implementation is good for now.
58 lines
2.0 KiB
QML
58 lines
2.0 KiB
QML
// SPDX-FileCopyrightText: 2022 James Graham <james.h.graham@protonmail.com>
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
import QtQuick 2.15
|
|
import QtQuick.Controls 2.15 as QQC2
|
|
import QtQuick.Layouts 1.15
|
|
|
|
import org.kde.kirigami 2.15 as Kirigami
|
|
|
|
import org.kde.neochat 1.0
|
|
|
|
Kirigami.ScrollablePage {
|
|
|
|
property var room
|
|
|
|
title: i18nc('@title:window', 'Notifications')
|
|
|
|
ColumnLayout {
|
|
Kirigami.FormLayout {
|
|
Layout.fillWidth: true
|
|
|
|
QQC2.RadioButton {
|
|
text: i18n("Default")
|
|
Kirigami.FormData.label: i18n("Room notifications setting:")
|
|
checked: room.pushNotificationState === PushNotificationState.Default
|
|
enabled: room.pushNotificationState != PushNotificationState.Unknown
|
|
onToggled: {
|
|
room.pushNotificationState = PushNotificationState.Default
|
|
}
|
|
}
|
|
QQC2.RadioButton {
|
|
text: i18n("All messages")
|
|
checked: room.pushNotificationState === PushNotificationState.All
|
|
enabled: room.pushNotificationState != PushNotificationState.Unknown
|
|
onToggled: {
|
|
room.pushNotificationState = PushNotificationState.All
|
|
}
|
|
}
|
|
QQC2.RadioButton {
|
|
text: i18n("@mentions and keywords")
|
|
checked: room.pushNotificationState === PushNotificationState.MentionKeyword
|
|
enabled: room.pushNotificationState != PushNotificationState.Unknown
|
|
onToggled: {
|
|
room.pushNotificationState = PushNotificationState.MentionKeyword
|
|
}
|
|
}
|
|
QQC2.RadioButton {
|
|
text: i18n("Off")
|
|
checked: room.pushNotificationState === PushNotificationState.Mute
|
|
enabled: room.pushNotificationState != PushNotificationState.Unknown
|
|
onToggled: {
|
|
room.pushNotificationState = PushNotificationState.Mute
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|