Add popup to edit push rules
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
// Copyright Mirage authors & contributors <https://github.com/mirukana/mirage>
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||
|
||||
import QtQuick 2.12
|
||||
@@ -5,19 +6,15 @@ import QtQuick.Layouts 1.12
|
||||
import "../.."
|
||||
import "../../Base"
|
||||
import "../../Base/HTile"
|
||||
import "../../Base/Buttons"
|
||||
import "../../MainPane"
|
||||
import "../../Popups"
|
||||
|
||||
HTile {
|
||||
id: root
|
||||
|
||||
property Item page
|
||||
|
||||
readonly property QtObject matchingRoom:
|
||||
model.kind === "room" ?
|
||||
ModelStore.get(page.userId, "rooms").find(model.rule_id) :
|
||||
null
|
||||
|
||||
|
||||
contentOpacity: model.enabled ? 1 : theme.disabledElementsOpacity
|
||||
hoverEnabled: false
|
||||
leftPadding: theme.spacing / 4
|
||||
@@ -30,71 +27,8 @@ HTile {
|
||||
opacity: model.enabled ? 1 : theme.disabledElementsOpacity
|
||||
elide: Text.ElideNone
|
||||
wrapMode: HLabel.Wrap
|
||||
|
||||
textFormat:
|
||||
model.rule_id === ".m.rule.contains_user_name" ||
|
||||
model.rule_id === ".m.rule.roomnotif" ||
|
||||
model.kind === "sender" ?
|
||||
HLabel.StyledText :
|
||||
HLabel.PlainText
|
||||
|
||||
text:
|
||||
model.rule_id === ".m.rule.master" ?
|
||||
qsTr("Any message") :
|
||||
|
||||
model.rule_id === ".m.rule.suppress_notices" ?
|
||||
qsTr("Messages sent by bots") :
|
||||
|
||||
model.rule_id === ".m.rule.invite_for_me" ?
|
||||
qsTr("Received room invites") :
|
||||
|
||||
model.rule_id === ".m.rule.member_event" ?
|
||||
qsTr("Membership, name & avatar changes") :
|
||||
|
||||
model.rule_id === ".m.rule.contains_display_name" ?
|
||||
qsTr("Messages containing my display name") :
|
||||
|
||||
model.rule_id === ".m.rule.tombstone" ?
|
||||
qsTr("Room migration alerts") :
|
||||
|
||||
model.rule_id === ".m.rule.reaction" ?
|
||||
qsTr("Emoji reactions") :
|
||||
|
||||
model.rule_id === ".m.rule.roomnotif" ?
|
||||
qsTr("Messages containing %1").arg(
|
||||
utils.htmlColorize("@room", theme.colors.accentText),
|
||||
) :
|
||||
|
||||
model.rule_id === ".m.rule.contains_user_name" ?
|
||||
qsTr("Contains %1").arg(utils.coloredNameHtml(
|
||||
"", page.userId, page.userId.split(":")[0].substring(1),
|
||||
)):
|
||||
|
||||
model.rule_id === ".m.rule.call" ?
|
||||
qsTr("Incoming audio calls") :
|
||||
|
||||
model.rule_id === ".m.rule.encrypted_room_one_to_one" ?
|
||||
qsTr("Encrypted 1-to-1 messages") :
|
||||
|
||||
model.rule_id === ".m.rule.room_one_to_one" ?
|
||||
qsTr("Unencrypted 1-to-1 messages") :
|
||||
|
||||
model.rule_id === ".m.rule.message" ?
|
||||
qsTr("Unencrypted group messages") :
|
||||
|
||||
model.rule_id === ".m.rule.encrypted" ?
|
||||
qsTr("Encrypted group messages") :
|
||||
|
||||
model.kind === "content" ?
|
||||
qsTr('Contains "%1"').arg(model.pattern) :
|
||||
|
||||
model.kind === "sender" ?
|
||||
utils.coloredNameHtml("", model.rule_id) :
|
||||
|
||||
matchingRoom && matchingRoom.display_name ?
|
||||
matchingRoom.display_name :
|
||||
|
||||
model.rule_id
|
||||
textFormat: HLabel.StyledText
|
||||
text: utils.formatPushRuleName(page.userId, model)
|
||||
|
||||
Layout.fillWidth: true
|
||||
Layout.leftMargin: theme.spacing
|
||||
@@ -161,6 +95,10 @@ HTile {
|
||||
|
||||
NotificationRuleButton {
|
||||
icon.name: "pushrule-edit"
|
||||
onClicked: window.makePopup(
|
||||
"Popups/PushRuleSettingsPopup/PushRuleSettingsPopup.qml",
|
||||
{userId: page.userId, rule: model},
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -73,11 +73,11 @@ HListView {
|
||||
padding: theme.spacing
|
||||
font.pixelSize: theme.fontSize.big
|
||||
text:
|
||||
section === "override" ? qsTr("High-priority general rules") :
|
||||
section === "content" ? qsTr("Message text rules") :
|
||||
section === "override" ? qsTr("High priority general rules") :
|
||||
section === "content" ? qsTr("Message content rules") :
|
||||
section === "room" ? qsTr("Room rules") :
|
||||
section === "sender" ? qsTr("Sender rules") :
|
||||
qsTr("General rules")
|
||||
qsTr("Low priority general rules")
|
||||
}
|
||||
|
||||
delegate: NotificationRuleDelegate {
|
||||
|
Reference in New Issue
Block a user