Warning, /network/tokodon/src/content/ui/LoginFlow/RulesPage.qml is written in an unsupported language. File is not indexed.

0001 // SPDX-FileCopyrightText: 2023 Joshua Goins <josh@redstrate.com>
0002 // SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0003 
0004 import QtQuick
0005 import org.kde.kirigami 2 as Kirigami
0006 import QtQuick.Controls 2 as QQC2
0007 import QtQuick.Layouts
0008 import QtQml.Models
0009 
0010 import org.kde.kirigamiaddons.formcard 1 as FormCard
0011 import org.kde.kirigamiaddons.components 1 as Components
0012 
0013 import org.kde.tokodon
0014 
0015 MastoPage {
0016     id: root
0017 
0018     title: i18nc("@title:window", "Rules")
0019 
0020     required property var account
0021 
0022     data: [
0023         Connections {
0024             target: Controller
0025             function onNetworkErrorOccurred(error) {
0026                 message.text = i18nc("@info:status Network status", "Failed to contact server: %1. Please check your proxy settings.", error)
0027                 message.visible = true;
0028             }
0029         }
0030     ]
0031 
0032     header: Components.Banner {
0033         id: message
0034         type: Kirigami.MessageType.Error
0035         width: parent.width
0036 
0037         showCloseButton: true
0038 
0039         actions: Kirigami.Action {
0040             text: i18n("Proxy Settings")
0041             icon.name: "settings-configure"
0042             onTriggered: pageStack.pushDialogLayer(Qt.createComponent("org.kde.tokodon", "NetworkProxyPage"))
0043         }
0044     }
0045 
0046     FormCard.FormHeader {
0047         title: i18nc("@title:group", "Rules")
0048     }
0049 
0050     FormCard.FormCard {
0051         Repeater {
0052             model: RulesModel {
0053                 account: root.account
0054             }
0055 
0056             delegate: ColumnLayout {
0057                 id: ruleLayout
0058 
0059                 required property int index
0060                 required property string text
0061 
0062                 spacing: 0
0063 
0064                 FormCard.FormDelegateSeparator {
0065                     visible: index !== 0
0066                 }
0067 
0068                 FormCard.FormTextDelegate {
0069                     text: ruleLayout.text
0070                 }
0071             }
0072         }
0073     }
0074 
0075     FormCard.FormCard {
0076         Layout.topMargin: Kirigami.Units.largeSpacing
0077 
0078         FormCard.FormButtonDelegate {
0079             id: agreeButton
0080 
0081             text: i18nc("@action:button Agree to server rules", "Agree")
0082             icon.name: "dialog-ok"
0083 
0084             onClicked: {
0085                 root.Window.window.pageStack.layers.push(Qt.createComponent("org.kde.tokodon", "RegistrationPage"), {
0086                     account: account,
0087                 });
0088             }
0089         }
0090 
0091         FormCard.FormDelegateSeparator {
0092             above: agreeButton
0093             below: disagreeButton
0094         }
0095 
0096         FormCard.FormButtonDelegate {
0097             id: disagreeButton
0098 
0099             text: i18nc("@action:button Disagree to server rules", "Disagree")
0100             icon.name: "dialog-cancel"
0101 
0102             onClicked: root.Window.window.pageStack.layers.pop()
0103         }
0104     }
0105 }