2020-10-30 14:15:17 -04:00
|
|
|
// SPDX-License-Identifier: LGPL-3.0-or-later
|
|
|
|
|
|
|
|
import QtQuick 2.12
|
|
|
|
import QtQuick.Layouts 1.12
|
|
|
|
import "../.."
|
|
|
|
import "../../Base"
|
|
|
|
import "../../Base/HTile"
|
|
|
|
import "../../MainPane"
|
|
|
|
|
|
|
|
HTile {
|
|
|
|
id: root
|
|
|
|
|
2020-11-01 00:55:29 -04:00
|
|
|
property Item page
|
2020-10-30 14:15:17 -04:00
|
|
|
|
|
|
|
readonly property QtObject matchingRoom:
|
|
|
|
model.kind === "Room" ?
|
2020-11-01 01:10:49 -04:00
|
|
|
ModelStore.get(page.userId, "rooms").find(model.rule_id) :
|
2020-10-30 14:15:17 -04:00
|
|
|
null
|
|
|
|
|
|
|
|
|
|
|
|
contentOpacity: model.enabled ? 1 : theme.disabledElementsOpacity
|
|
|
|
hoverEnabled: false
|
|
|
|
|
|
|
|
contentItem: HColumnLayout {
|
|
|
|
spacing: root.spacing / 2
|
|
|
|
|
|
|
|
TitleLabel {
|
|
|
|
opacity: model.enabled ? 1 : theme.disabledElementsOpacity
|
|
|
|
elide: Text.ElideNone
|
|
|
|
wrapMode: HLabel.Wrap
|
|
|
|
|
|
|
|
textFormat:
|
2020-11-01 01:10:49 -04:00
|
|
|
model.rule_id === ".m.rule.contains_user_name" ||
|
|
|
|
model.rule_id === ".m.rule.roomnotif" ||
|
2020-10-30 14:15:17 -04:00
|
|
|
model.kind === "Sender" ?
|
|
|
|
HLabel.StyledText :
|
|
|
|
HLabel.PlainText
|
|
|
|
|
|
|
|
text:
|
2020-11-01 01:10:49 -04:00
|
|
|
model.rule_id === ".m.rule.master" ?
|
2020-10-30 14:15:17 -04:00
|
|
|
qsTr("Any message") :
|
|
|
|
|
2020-11-01 01:10:49 -04:00
|
|
|
model.rule_id === ".m.rule.suppress_notices" ?
|
2020-10-30 14:15:17 -04:00
|
|
|
qsTr("Messages sent by bots") :
|
|
|
|
|
2020-11-01 01:10:49 -04:00
|
|
|
model.rule_id === ".m.rule.invite_for_me" ?
|
2020-10-30 14:15:17 -04:00
|
|
|
qsTr("Received room invites") :
|
|
|
|
|
2020-11-01 01:10:49 -04:00
|
|
|
model.rule_id === ".m.rule.member_event" ?
|
2020-10-30 14:15:17 -04:00
|
|
|
qsTr("Membership, name & avatar changes") :
|
|
|
|
|
2020-11-01 01:10:49 -04:00
|
|
|
model.rule_id === ".m.rule.contains_display_name" ?
|
2020-10-30 14:15:17 -04:00
|
|
|
qsTr("Messages containing my display name") :
|
|
|
|
|
2020-11-01 01:10:49 -04:00
|
|
|
model.rule_id === ".m.rule.tombstone" ?
|
2020-10-30 14:15:17 -04:00
|
|
|
qsTr("Room migration alerts") :
|
|
|
|
|
2020-11-01 01:10:49 -04:00
|
|
|
model.rule_id === ".m.rule.reaction" ?
|
2020-10-30 14:15:17 -04:00
|
|
|
qsTr("Emoji reactions") :
|
|
|
|
|
2020-11-01 01:10:49 -04:00
|
|
|
model.rule_id === ".m.rule.roomnotif" ?
|
2020-10-30 14:15:17 -04:00
|
|
|
qsTr("Messages containing %1").arg(
|
|
|
|
utils.htmlColorize("@room", theme.colors.accentText),
|
|
|
|
) :
|
|
|
|
|
2020-11-01 01:10:49 -04:00
|
|
|
model.rule_id === ".m.rule.contains_user_name" ?
|
2020-10-30 14:15:17 -04:00
|
|
|
qsTr("Contains %1").arg(utils.coloredNameHtml(
|
2020-11-01 00:55:29 -04:00
|
|
|
"", page.userId, page.userId.split(":")[0].substring(1),
|
2020-10-30 14:15:17 -04:00
|
|
|
)):
|
|
|
|
|
2020-11-01 01:10:49 -04:00
|
|
|
model.rule_id === ".m.rule.call" ?
|
2020-10-30 14:15:17 -04:00
|
|
|
qsTr("Incoming audio calls") :
|
|
|
|
|
2020-11-01 01:10:49 -04:00
|
|
|
model.rule_id === ".m.rule.encrypted_room_one_to_one" ?
|
2020-10-30 14:15:17 -04:00
|
|
|
qsTr("Encrypted 1-to-1 messages") :
|
|
|
|
|
2020-11-01 01:10:49 -04:00
|
|
|
model.rule_id === ".m.rule.room_one_to_one" ?
|
2020-10-30 14:15:17 -04:00
|
|
|
qsTr("Unencrypted 1-to-1 messages") :
|
|
|
|
|
2020-11-01 01:10:49 -04:00
|
|
|
model.rule_id === ".m.rule.message" ?
|
2020-10-30 14:15:17 -04:00
|
|
|
qsTr("Unencrypted group messages") :
|
|
|
|
|
2020-11-01 01:10:49 -04:00
|
|
|
model.rule_id === ".m.rule.encrypted" ?
|
2020-10-30 14:15:17 -04:00
|
|
|
qsTr("Encrypted group messages") :
|
|
|
|
|
|
|
|
model.kind === "Content" ?
|
|
|
|
qsTr('Contains "%1"').arg(model.pattern) :
|
|
|
|
|
|
|
|
model.kind === "Sender" ?
|
2020-11-01 01:10:49 -04:00
|
|
|
utils.coloredNameHtml("", model.rule_id) :
|
2020-10-30 14:15:17 -04:00
|
|
|
|
|
|
|
matchingRoom && matchingRoom.display_name ?
|
|
|
|
matchingRoom.display_name :
|
|
|
|
|
2020-11-01 01:10:49 -04:00
|
|
|
model.rule_id
|
2020-10-30 14:15:17 -04:00
|
|
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
}
|
|
|
|
|
|
|
|
HRowLayout {
|
|
|
|
NotificationRuleButton {
|
2020-11-01 00:55:29 -04:00
|
|
|
toggles: "notify"
|
2020-10-30 14:15:17 -04:00
|
|
|
|
|
|
|
contentItem: MessageIndicator {
|
|
|
|
indicatorTheme:
|
|
|
|
theme.mainPane.listView.room.unreadIndicator
|
|
|
|
unreads: 1
|
|
|
|
text: "+1"
|
|
|
|
font.pixelSize: theme.fontSize.normal
|
|
|
|
topPadding: leftPadding / 3
|
|
|
|
bottomPadding: topPadding
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
NotificationRuleButton {
|
2020-11-01 00:55:29 -04:00
|
|
|
toggles: "highlight"
|
2020-10-30 14:15:17 -04:00
|
|
|
|
|
|
|
contentItem: MessageIndicator {
|
|
|
|
indicatorTheme:
|
|
|
|
theme.mainPane.listView.room.unreadIndicator
|
|
|
|
|
|
|
|
unreads: 1
|
|
|
|
highlights: 1
|
|
|
|
text: "+1"
|
|
|
|
font.pixelSize: theme.fontSize.normal
|
|
|
|
topPadding: leftPadding / 3
|
|
|
|
bottomPadding: topPadding
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
NotificationRuleButton {
|
|
|
|
icon.name: "pushrule-action-bubble"
|
2020-11-01 00:55:29 -04:00
|
|
|
toggles: "bubble"
|
2020-10-30 14:15:17 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
NotificationRuleButton {
|
|
|
|
icon.name: "pushrule-action-sound"
|
2020-11-01 00:55:29 -04:00
|
|
|
toggles: "sound"
|
2020-10-30 14:15:17 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
NotificationRuleButton {
|
|
|
|
icon.name: "pushrule-action-urgency-hint"
|
2020-11-01 00:55:29 -04:00
|
|
|
toggles: "urgency_hint"
|
2020-10-30 14:15:17 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
HSpacer {}
|
|
|
|
|
|
|
|
NotificationRuleButton {
|
|
|
|
icon.name: "pushrule-edit"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|