Warning, /network/tokodon/src/content/ui/SocialGraphPage.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-3.0-only
0003 
0004 import QtQuick 2.15
0005 import org.kde.kirigami 2.19 as Kirigami
0006 import QtQuick.Controls 2.15 as QQC2
0007 import QtQuick.Layouts 1.15
0008 import org.kde.kmasto 1.0
0009 import org.kde.kirigamiaddons.delegates 1.0 as Delegates
0010 
0011 import "./StatusDelegate"
0012 
0013 Kirigami.ScrollablePage {
0014     id: root
0015 
0016     property alias model: listview.model
0017 
0018     title: model.displayName
0019     titleDelegate: Kirigami.Heading {
0020         // identical to normal Kirigami headers
0021         Layout.fillWidth: true
0022         Layout.maximumWidth: implicitWidth + 1
0023         Layout.minimumWidth: 0
0024         maximumLineCount: 1
0025         elide: Text.ElideRight
0026         text: root.title
0027         textFormat: TextEdit.RichText
0028     }
0029 
0030     ListView {
0031         id: listview
0032 
0033         currentIndex: -1
0034 
0035         delegate: Delegates.RoundedItemDelegate {
0036             id: delegate
0037 
0038             required property var index
0039             required property var identity
0040 
0041             text: identity.displayName
0042 
0043             onClicked: Navigation.openAccount(delegate.identity.id)
0044 
0045             contentItem: ColumnLayout {
0046                 spacing: 0
0047 
0048                 RowLayout {
0049                     Layout.fillWidth: true
0050 
0051                     InlineIdentityInfo {
0052                         identity: delegate.identity
0053                         secondary: false
0054                         avatar.actions.main: null
0055                     }
0056 
0057                     QQC2.Button {
0058                         text: i18nc("@action:button Allow follow request", "Allow")
0059                         icon.name: "checkmark"
0060                         onClicked: model.actionAllow(model.index(delegate.index, 0))
0061                         visible: model.isFollowRequest
0062                     }
0063 
0064                     QQC2.Button {
0065                         text: i18nc("@action:button Deny follow request", "Deny")
0066                         icon.name: "cards-block"
0067                         onClicked: model.actionDeny(model.index(delegate.index, 0))
0068                         visible: model.isFollowRequest
0069                     }
0070                 }
0071 
0072                 QQC2.ProgressBar {
0073                     visible: listview.model.loading && (index == listview.count - 1)
0074                     indeterminate: true
0075                     padding: Kirigami.Units.largeSpacing * 2
0076 
0077                     Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
0078                     Layout.topMargin: Kirigami.Units.largeSpacing
0079                     Layout.bottomMargin: Kirigami.Units.largeSpacing
0080                     Layout.leftMargin: Kirigami.Units.largeSpacing
0081                     Layout.rightMargin: Kirigami.Units.largeSpacing
0082                 }
0083             }
0084         }
0085 
0086         QQC2.ProgressBar {
0087             visible: listview.model.loading && listview.count === 0
0088             anchors.centerIn: parent
0089             indeterminate: true
0090         }
0091 
0092         Kirigami.PlaceholderMessage {
0093             anchors.centerIn: parent
0094             text: listview.model.placeholderText
0095             visible: listview.count === 0 && !listview.model.loading
0096             width: parent.width - Kirigami.Units.gridUnit * 4
0097         }
0098     }
0099 }