Warning, /multimedia/kasts/src/qml/EpisodeListPage.qml is written in an unsupported language. File is not indexed.

0001 /**
0002  * SPDX-FileCopyrightText: 2020 Tobias Fella <tobias.fella@kde.org>
0003  * SPDX-FileCopyrightText: 2021-2023 Bart De Vries <bart@mogwai.be>
0004  *
0005  * SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0006  */
0007 
0008 import QtQuick
0009 import QtQuick.Controls as Controls
0010 import QtQuick.Layouts
0011 import org.kde.kirigami as Kirigami
0012 
0013 import org.kde.kasts
0014 
0015 Kirigami.ScrollablePage {
0016     id: episodeListPage
0017     title: i18n("Episode List")
0018 
0019     property alias episodeList: episodeList
0020 
0021     LayoutMirroring.enabled: Qt.application.layoutDirection === Qt.RightToLeft
0022     LayoutMirroring.childrenInherit: true
0023 
0024     supportsRefreshing: true
0025     onRefreshingChanged: {
0026         if(refreshing) {
0027             updateAllFeeds.run();
0028             refreshing = false;
0029         }
0030     }
0031 
0032     Keys.onPressed: (event) => {
0033         if (event.matches(StandardKey.Find)) {
0034             searchActionButton.checked = true;
0035         }
0036     }
0037 
0038     property list<Kirigami.Action> pageActions: [
0039         Kirigami.Action {
0040             icon.name: "download"
0041             text: i18n("Downloads")
0042             onTriggered: {
0043                 pushPage("DownloadListPage")
0044             }
0045         },
0046         Kirigami.Action {
0047             icon.name: "view-refresh"
0048             text: i18n("Refresh All Podcasts")
0049             onTriggered: refreshing = true
0050             visible: episodeProxyModel.filterType == AbstractEpisodeProxyModel.NoFilter
0051         },
0052         Kirigami.Action {
0053             id: searchActionButton
0054             icon.name: "search"
0055             text: i18nc("@action:intoolbar", "Search")
0056             checkable: true
0057         }
0058     ]
0059 
0060     Component.onCompleted: {
0061         for (var i in episodeList.defaultActionList) {
0062             pageActions.push(episodeList.defaultActionList[i]);
0063         }
0064     }
0065 
0066     actions: pageActions
0067 
0068     header: Loader {
0069         anchors.right: parent.right
0070         anchors.left: parent.left
0071 
0072         active: searchActionButton.checked
0073         visible: active
0074         sourceComponent: SearchBar {
0075             proxyModel: episodeProxyModel
0076             parentKey: searchActionButton
0077         }
0078     }
0079 
0080     GenericEntryListView {
0081         id: episodeList
0082         anchors.fill: parent
0083         reuseItems: true
0084 
0085         Kirigami.PlaceholderMessage {
0086             visible: episodeList.count === 0
0087 
0088             width: Kirigami.Units.gridUnit * 20
0089             anchors.centerIn: parent
0090 
0091             text: i18n("No episodes available")
0092         }
0093 
0094         model: EpisodeProxyModel {
0095             id: episodeProxyModel
0096         }
0097 
0098         delegate: GenericEntryDelegate {
0099             listViewObject: episodeList
0100         }
0101 
0102         FilterInlineMessage {
0103             proxyModel: episodeProxyModel
0104         }
0105     }
0106 }