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