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