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.
137 lines
5.2 KiB
QML
137 lines
5.2 KiB
QML
// SPDX-FileCopyrightText: 2020 Tobias Fella <fella@posteo.de>
|
|
// SPDX-FileCopyrightText: 2021 Carl Schwan <carl@carlschwan.eu>
|
|
// 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 {
|
|
title: i18nc("@title:window", "General")
|
|
ColumnLayout {
|
|
Kirigami.FormLayout {
|
|
Layout.fillWidth: true
|
|
QQC2.CheckBox {
|
|
Kirigami.FormData.label: i18n("General settings:")
|
|
text: i18n("Close to system tray")
|
|
checked: Config.systemTray
|
|
visible: Controller.supportSystemTray
|
|
enabled: !Config.isSystemTrayImmutable
|
|
onToggled: {
|
|
Config.systemTray = checked
|
|
Config.save()
|
|
}
|
|
}
|
|
QQC2.CheckBox {
|
|
text: i18n("Minimize to system tray on startup")
|
|
checked: Config.minimizeToSystemTrayOnStartup
|
|
visible: Controller.supportSystemTray && !Kirigami.Settings.isMobile
|
|
enabled: Config.systemTray && !Config.isMinimizeToSystemTrayOnStartupImmutable
|
|
onToggled: {
|
|
Config.minimizeToSystemTrayOnStartup = checked
|
|
Config.save()
|
|
}
|
|
}
|
|
QQC2.CheckBox {
|
|
// TODO: When there are enough notification and timeline event
|
|
// settings, make 2 separate groups with FormData labels.
|
|
Kirigami.FormData.label: i18n("Notifications and events:")
|
|
text: i18n("Show notifications")
|
|
checked: Config.showNotifications
|
|
enabled: !Config.isShowNotificationsImmutable
|
|
onToggled: {
|
|
Config.showNotifications = checked
|
|
Config.save()
|
|
NotificationsManager.globalNotificationsEnabled = checked
|
|
}
|
|
}
|
|
QQC2.CheckBox {
|
|
text: i18n("Show leave and join events")
|
|
checked: Config.showLeaveJoinEvent
|
|
enabled: !Config.isShowLeaveJoinEventImmutable
|
|
onToggled: {
|
|
Config.showLeaveJoinEvent = checked
|
|
Config.save()
|
|
}
|
|
}
|
|
QQC2.CheckBox {
|
|
text: i18n("Show name change events")
|
|
checked: Config.showRename
|
|
enabled: !Config.isShowRenameImmutable
|
|
onToggled: {
|
|
Config.showRename = checked
|
|
Config.save()
|
|
}
|
|
}
|
|
QQC2.CheckBox {
|
|
text: i18n("Show avatar update events")
|
|
checked: Config.showAvatarUpdate
|
|
enabled: !Config.isShowAvatarUpdateImmutable
|
|
onToggled: {
|
|
Config.showAvatarUpdate = checked
|
|
Config.save()
|
|
}
|
|
}
|
|
QQC2.RadioButton {
|
|
Kirigami.FormData.label: i18n("Rooms and private chats:")
|
|
text: i18n("Separated")
|
|
checked: !Config.mergeRoomList
|
|
enabled: !Config.isMergeRoomListImmutable
|
|
onToggled: {
|
|
Config.mergeRoomList = false
|
|
Config.save()
|
|
}
|
|
}
|
|
QQC2.RadioButton {
|
|
text: i18n("Intermixed")
|
|
checked: Config.mergeRoomList
|
|
enabled: !Config.isMergeRoomListImmutable
|
|
onToggled: {
|
|
Config.mergeRoomList = true
|
|
Config.save()
|
|
}
|
|
}
|
|
QQC2.CheckBox {
|
|
id: quickEditCheckbox
|
|
Layout.maximumWidth: parent.width
|
|
text: i18n("Use s/text/replacement syntax to edit your last message")
|
|
checked: Config.allowQuickEdit
|
|
enabled: !Config.isAllowQuickEditImmutable
|
|
onToggled: {
|
|
Config.allowQuickEdit = checked
|
|
Config.save()
|
|
}
|
|
|
|
// TODO KF5.97 remove this line
|
|
Component.onCompleted: this.contentItem.wrap = QQC2.Label.Wrap
|
|
}
|
|
QQC2.CheckBox {
|
|
text: i18n("Send Typing Notifications")
|
|
checked: Config.typingNotifications
|
|
enabled: !Config.isTypingNotificationsImmutable
|
|
onToggled: {
|
|
Config.typingNotifications = checked
|
|
Config.save()
|
|
}
|
|
}
|
|
QQC2.CheckBox {
|
|
text: i18n("Automatically hide/unhide the room information when resizing the window")
|
|
Layout.maximumWidth: parent.width
|
|
checked: Config.autoRoomInfoDrawer
|
|
enabled: !Config.isAutoRoomInfoDrawerImmutable
|
|
onToggled: {
|
|
Config.autoRoomInfoDrawer = checked
|
|
Config.save()
|
|
}
|
|
|
|
// TODO KF5.97 remove this line
|
|
Component.onCompleted: this.contentItem.wrap = QQC2.Label.Wrap
|
|
}
|
|
}
|
|
}
|
|
}
|