Warning, /network/tokodon/src/content/ui/ListsPage.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 org.kde.tokodon
0009 import org.kde.kirigamiaddons.delegates 1 as Delegates
0010 
0011 import "./StatusDelegate"
0012 
0013 Kirigami.ScrollablePage {
0014     id: root
0015 
0016     title: i18nc("@title", "Lists")
0017     titleDelegate: Kirigami.Heading {
0018         // identical to normal Kirigami headers
0019         Layout.fillWidth: true
0020         Layout.maximumWidth: implicitWidth + 1
0021         Layout.minimumWidth: 0
0022         maximumLineCount: 1
0023         elide: Text.ElideRight
0024         text: root.title
0025         textFormat: TextEdit.RichText
0026     }
0027 
0028     actions: Kirigami.Action {
0029         text: i18n("Create List")
0030         icon.name: "gtk-add"
0031         onTriggered: {
0032             pageStack.layers.push(Qt.createComponent("org.kde.tokodon", "EditListPage"), {
0033                 purpose: EditListPage.New
0034             });
0035         }
0036     }
0037 
0038     ListView {
0039         id: listview
0040 
0041         model: ListsModel {
0042             id: model
0043         }
0044         currentIndex: -1
0045 
0046         delegate: Delegates.RoundedItemDelegate {
0047             id: delegate
0048 
0049             required property string id
0050             required property string title
0051 
0052             text: title
0053 
0054             onClicked: Navigation.openList(id, title)
0055         }
0056 
0057         QQC2.ProgressBar {
0058             visible: listview.model.loading && listview.count === 0
0059             anchors.centerIn: parent
0060             indeterminate: true
0061         }
0062 
0063         Kirigami.PlaceholderMessage {
0064             anchors.centerIn: parent
0065             text: i18n("No lists")
0066             visible: listview.count === 0 && !listview.model.loading
0067             width: parent.width - Kirigami.Units.gridUnit * 4
0068         }
0069     }
0070 }