Port GlobalNotificationsPage to FormCard

This commit is contained in:
Tobias Fella
2023-09-01 17:10:34 +02:00
parent 56f5ef2611
commit 1675c14c92

View File

@@ -6,27 +6,19 @@ import QtQuick.Controls 2.15 as QQC2
import QtQuick.Layouts 1.15
import org.kde.kirigami 2.15 as Kirigami
import org.kde.kirigamiaddons.labs.mobileform 0.1 as MobileForm
import org.kde.kirigamiaddons.formcard 1.0 as FormCard
import org.kde.kitemmodels 1.0
import org.kde.neochat 1.0
Kirigami.ScrollablePage {
FormCard.FormCardPage {
id: root
title: i18nc("@title:window", "Notifications")
topPadding: 0
leftPadding: 0
rightPadding: 0
ColumnLayout {
id: notificationLayout
spacing: 0
MobileForm.FormCard {
Layout.fillWidth: true
FormCard.FormCard {
Layout.topMargin: Kirigami.Units.largeSpacing
contentItem: MobileForm.FormCheckDelegate {
FormCard.FormCheckDelegate {
text: i18n("Enable notifications for this account")
description: i18n("Whether push notifications are generated by your Matrix server")
checked: Controller.pushRuleModel.globalNotificationsEnabled
@@ -37,16 +29,10 @@ Kirigami.ScrollablePage {
}
}
MobileForm.FormHeader {
Layout.fillWidth: true
FormCard.FormHeader {
title: i18n("Room Notifications")
}
MobileForm.FormCard {
Layout.fillWidth: true
contentItem: ColumnLayout {
spacing: 0
FormCard.FormCard {
Repeater {
model: KSortFilterProxyModel {
sourceModel: Controller.pushRuleModel
@@ -59,17 +45,11 @@ Kirigami.ScrollablePage {
delegate: ruleDelegate
}
}
}
MobileForm.FormHeader {
Layout.fillWidth: true
FormCard.FormHeader {
title: i18n("@Mentions")
}
MobileForm.FormCard {
Layout.fillWidth: true
contentItem: ColumnLayout {
spacing: 0
FormCard.FormCard {
Repeater {
model: KSortFilterProxyModel {
sourceModel: Controller.pushRuleModel
@@ -82,17 +62,11 @@ Kirigami.ScrollablePage {
delegate: ruleDelegate
}
}
}
MobileForm.FormHeader {
Layout.fillWidth: true
FormCard.FormHeader {
title: i18n("Keywords")
}
MobileForm.FormCard {
Layout.fillWidth: true
contentItem: ColumnLayout {
spacing: 0
FormCard.FormCard {
Repeater {
model: KSortFilterProxyModel {
sourceModel: Controller.pushRuleModel
@@ -105,7 +79,7 @@ Kirigami.ScrollablePage {
delegate: ruleDelegate
}
MobileForm.AbstractFormDelegate {
FormCard.AbstractFormDelegate {
Layout.fillWidth: true
contentItem : RowLayout {
@@ -152,17 +126,11 @@ Kirigami.ScrollablePage {
}
}
}
}
MobileForm.FormHeader {
Layout.fillWidth: true
FormCard.FormHeader {
title: i18n("Invites")
}
MobileForm.FormCard {
Layout.fillWidth: true
contentItem: ColumnLayout {
spacing: 0
FormCard.FormCard {
Repeater {
model: KSortFilterProxyModel {
sourceModel: Controller.pushRuleModel
@@ -175,19 +143,14 @@ Kirigami.ScrollablePage {
delegate: ruleDelegate
}
}
}
MobileForm.FormHeader {
Layout.fillWidth: true
FormCard.FormHeader {
title: i18n("Unknown")
visible: unknownModel.rowCount() > 0
}
MobileForm.FormCard {
Layout.fillWidth: true
FormCard.FormCard {
visible: unknownModel.rowCount() > 0
contentItem: ColumnLayout {
spacing: 0
Repeater {
model: KSortFilterProxyModel {
id: unknownModel
@@ -201,10 +164,8 @@ Kirigami.ScrollablePage {
delegate: ruleDelegate
}
}
}
}
Component {
property Component ruleDelegate: Component {
id: ruleDelegate
NotificationRuleItem {
onDeleteRule: {