Implement a non-functional push rule control UI
This commit is contained in:
@@ -18,11 +18,14 @@ HPage {
|
||||
height: Math.min(implicitHeight, page.availableHeight)
|
||||
|
||||
header: HTabBar {
|
||||
currentIndex: 1 // XXX
|
||||
HTabButton { text: qsTr("Account") }
|
||||
HTabButton { text: qsTr("Notifications") }
|
||||
HTabButton { text: qsTr("Security") }
|
||||
}
|
||||
|
||||
Account { userId: page.userId }
|
||||
Notifications { userId: page.userId }
|
||||
Security { userId: page.userId }
|
||||
}
|
||||
}
|
||||
|
12
src/gui/Pages/AccountSettings/NotificationRuleButton.qml
Normal file
12
src/gui/Pages/AccountSettings/NotificationRuleButton.qml
Normal file
@@ -0,0 +1,12 @@
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||
|
||||
import QtQuick 2.12
|
||||
import "../../Base"
|
||||
|
||||
HButton {
|
||||
property bool on: true
|
||||
|
||||
opacity: on ? 1 : theme.disabledElementsOpacity
|
||||
hoverEnabled: true
|
||||
backgroundColor: "transparent"
|
||||
}
|
157
src/gui/Pages/AccountSettings/NotificationRuleDelegate.qml
Normal file
157
src/gui/Pages/AccountSettings/NotificationRuleDelegate.qml
Normal file
@@ -0,0 +1,157 @@
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||
|
||||
import QtQuick 2.12
|
||||
import QtQuick.Controls 2.12
|
||||
import QtQuick.Layouts 1.12
|
||||
import "../.."
|
||||
import "../../Base"
|
||||
import "../../Base/Buttons"
|
||||
import "../../Base/HTile"
|
||||
import "../../MainPane"
|
||||
import "../../PythonBridge"
|
||||
import "../../ShortcutBundles"
|
||||
|
||||
HTile {
|
||||
id: root
|
||||
|
||||
property string userId
|
||||
|
||||
readonly property QtObject matchingRoom:
|
||||
model.kind === "Room" ?
|
||||
ModelStore.get(userId, "rooms").find(model.id) :
|
||||
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:
|
||||
model.id === ".m.rule.contains_user_name" ||
|
||||
model.id === ".m.rule.roomnotif" ||
|
||||
model.kind === "Sender" ?
|
||||
HLabel.StyledText :
|
||||
HLabel.PlainText
|
||||
|
||||
text:
|
||||
model.id === ".m.rule.master" ?
|
||||
qsTr("Any message") :
|
||||
|
||||
model.id === ".m.rule.suppress_notices" ?
|
||||
qsTr("Messages sent by bots") :
|
||||
|
||||
model.id === ".m.rule.invite_for_me" ?
|
||||
qsTr("Received room invites") :
|
||||
|
||||
model.id === ".m.rule.member_event" ?
|
||||
qsTr("Membership, name & avatar changes") :
|
||||
|
||||
model.id === ".m.rule.contains_display_name" ?
|
||||
qsTr("Messages containing my display name") :
|
||||
|
||||
model.id === ".m.rule.tombstone" ?
|
||||
qsTr("Room migration alerts") :
|
||||
|
||||
model.id === ".m.rule.reaction" ?
|
||||
qsTr("Emoji reactions") :
|
||||
|
||||
model.id === ".m.rule.roomnotif" ?
|
||||
qsTr("Messages containing %1").arg(
|
||||
utils.htmlColorize("@room", theme.colors.accentText),
|
||||
) :
|
||||
|
||||
model.id === ".m.rule.contains_user_name" ?
|
||||
qsTr("Contains %1").arg(utils.coloredNameHtml(
|
||||
"", userId, userId.split(":")[0].substring(1),
|
||||
)):
|
||||
|
||||
model.id === ".m.rule.call" ?
|
||||
qsTr("Incoming audio calls") :
|
||||
|
||||
model.id === ".m.rule.encrypted_room_one_to_one" ?
|
||||
qsTr("Encrypted 1-to-1 messages") :
|
||||
|
||||
model.id === ".m.rule.room_one_to_one" ?
|
||||
qsTr("Unencrypted 1-to-1 messages") :
|
||||
|
||||
model.id === ".m.rule.message" ?
|
||||
qsTr("Unencrypted group messages") :
|
||||
|
||||
model.id === ".m.rule.encrypted" ?
|
||||
qsTr("Encrypted group messages") :
|
||||
|
||||
model.kind === "Content" ?
|
||||
qsTr('Contains "%1"').arg(model.pattern) :
|
||||
|
||||
model.kind === "Sender" ?
|
||||
utils.coloredNameHtml("", model.id) :
|
||||
|
||||
matchingRoom && matchingRoom.display_name ?
|
||||
matchingRoom.display_name :
|
||||
|
||||
model.id
|
||||
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
HRowLayout {
|
||||
NotificationRuleButton {
|
||||
on: model.notify
|
||||
|
||||
contentItem: MessageIndicator {
|
||||
indicatorTheme:
|
||||
theme.mainPane.listView.room.unreadIndicator
|
||||
unreads: 1
|
||||
text: "+1"
|
||||
font.pixelSize: theme.fontSize.normal
|
||||
topPadding: leftPadding / 3
|
||||
bottomPadding: topPadding
|
||||
}
|
||||
}
|
||||
|
||||
NotificationRuleButton {
|
||||
on: model.highlight
|
||||
|
||||
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"
|
||||
on: model.bubble
|
||||
}
|
||||
|
||||
NotificationRuleButton {
|
||||
icon.name: "pushrule-action-sound"
|
||||
on: model.sound
|
||||
}
|
||||
|
||||
NotificationRuleButton {
|
||||
icon.name: "pushrule-action-urgency-hint"
|
||||
on: model.urgency_hint
|
||||
}
|
||||
|
||||
HSpacer {}
|
||||
|
||||
NotificationRuleButton {
|
||||
icon.name: "pushrule-edit"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
56
src/gui/Pages/AccountSettings/Notifications.qml
Normal file
56
src/gui/Pages/AccountSettings/Notifications.qml
Normal file
@@ -0,0 +1,56 @@
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||
|
||||
import QtQuick 2.12
|
||||
import QtQuick.Controls 2.12
|
||||
import QtQuick.Layouts 1.12
|
||||
import "../.."
|
||||
import "../../Base"
|
||||
import "../../Base/Buttons"
|
||||
import "../../PythonBridge"
|
||||
import "../../ShortcutBundles"
|
||||
|
||||
HListView {
|
||||
id: root
|
||||
|
||||
property string userId
|
||||
|
||||
property bool enableFlickShortcuts:
|
||||
SwipeView ? SwipeView.isCurrentItem : true
|
||||
|
||||
function takeFocus() {
|
||||
// deviceList.headerItem.exportButton.forceActiveFocus()
|
||||
}
|
||||
|
||||
|
||||
clip: true
|
||||
model: ModelStore.get(userId, "pushrules")
|
||||
bottomMargin: theme.spacing
|
||||
implicitHeight: Math.min(window.height, contentHeight + bottomMargin)
|
||||
|
||||
section.property: "kind"
|
||||
section.delegate: HLabel {
|
||||
width: root.width
|
||||
topPadding: padding * (section === "Override" ? 1 : 1.5)
|
||||
padding: theme.spacing
|
||||
font.pixelSize: theme.fontSize.big
|
||||
text:
|
||||
section === "Override" ? qsTr("High-priority general rules") :
|
||||
section === "Content" ? qsTr("Message text rules") :
|
||||
section === "Room" ? qsTr("Room rules") :
|
||||
section === "Sender" ? qsTr("Sender rules") :
|
||||
qsTr("General rules")
|
||||
}
|
||||
|
||||
delegate: NotificationRuleDelegate {
|
||||
userId: root.userId
|
||||
width: root.width
|
||||
}
|
||||
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
|
||||
FlickShortcuts {
|
||||
flickable: root
|
||||
active: ! mainUI.debugConsole.visible && root.enableFlickShortcuts
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user