From 27f4d6145b238bef585585cae5d12c4427dc0647 Mon Sep 17 00:00:00 2001 From: Bart De Vries Date: Tue, 25 Apr 2023 12:58:31 +0200 Subject: [PATCH] Prepare for KF6 change in Page actions --- src/qml/DownloadListPage.qml | 19 +++++++++--- src/qml/EpisodeListPage.qml | 23 ++++++++------ src/qml/FeedDetailsPage.qml | 3 +- src/qml/FeedListPage.qml | 24 ++++++++------- src/qml/GenericEntryListView.qml | 52 ++++++++++++++++---------------- src/qml/QueuePage.qml | 19 +++++++++--- 6 files changed, 83 insertions(+), 57 deletions(-) diff --git a/src/qml/DownloadListPage.qml b/src/qml/DownloadListPage.qml index 42785e6d..45e4cddc 100644 --- a/src/qml/DownloadListPage.qml +++ b/src/qml/DownloadListPage.qml @@ -26,13 +26,22 @@ Kirigami.ScrollablePage { } } - actions.main: Kirigami.Action { - icon.name: "view-refresh" - text: i18n("Refresh All Podcasts") - onTriggered: refreshing = true + property list pageActions: [ + Kirigami.Action { + icon.name: "view-refresh" + text: i18n("Refresh All Podcasts") + onTriggered: refreshing = true + } + ] + + Component.onCompleted: { + for (var i in episodeList.defaultActionList) { + pageActions.push(episodeList.defaultActionList[i]); + } } - contextualActions: episodeList.defaultActionList + // TODO: KF6 replace contextualActions with actions + contextualActions: pageActions GenericEntryListView { id: episodeList diff --git a/src/qml/EpisodeListPage.qml b/src/qml/EpisodeListPage.qml index 1b18b405..80193f2d 100644 --- a/src/qml/EpisodeListPage.qml +++ b/src/qml/EpisodeListPage.qml @@ -35,16 +35,15 @@ Kirigami.ScrollablePage { } } - actions { - main: Kirigami.Action { + property list pageActions: [ + Kirigami.Action { icon.name: "download" text: i18n("Downloads") onTriggered: { pushPage("DownloadListPage") } - } - - left: Kirigami.Action { + }, + Kirigami.Action { id: searchActionButton icon.name: "search" text: i18nc("@action:intoolbar", "Search and Filter") @@ -55,17 +54,23 @@ Kirigami.ScrollablePage { episodeProxyModel.searchFilter = ""; } } - } - - right: Kirigami.Action { + }, + Kirigami.Action { icon.name: "view-refresh" text: i18n("Refresh All Podcasts") onTriggered: refreshing = true visible: episodeProxyModel.filterType == AbstractEpisodeProxyModel.NoFilter } + ] + + Component.onCompleted: { + for (var i in episodeList.defaultActionList) { + pageActions.push(episodeList.defaultActionList[i]); + } } - contextualActions: episodeList.defaultActionList + // TODO: KF6 replace contextualActions with actions + contextualActions: pageActions header: Loader { anchors.right: parent.right diff --git a/src/qml/FeedDetailsPage.qml b/src/qml/FeedDetailsPage.qml index f0bfe2df..219685bc 100644 --- a/src/qml/FeedDetailsPage.qml +++ b/src/qml/FeedDetailsPage.qml @@ -65,7 +65,8 @@ Kirigami.ScrollablePage { } } - actions.main: Kirigami.Action { + // TODO: KF6 replace contextualActions with actions + contextualActions: Kirigami.Action { id: searchActionButton icon.name: "search" text: i18nc("@action:intoolbar", "Search and Filter") diff --git a/src/qml/FeedListPage.qml b/src/qml/FeedListPage.qml index fab5b315..db83f730 100644 --- a/src/qml/FeedListPage.qml +++ b/src/qml/FeedListPage.qml @@ -35,16 +35,15 @@ Kirigami.ScrollablePage { } } - actions.main: Kirigami.Action { - visible: Kirigami.Settings.isMobile - text: i18n("Discover") - icon.name: "search" - onTriggered: { - applicationWindow().pageStack.push("qrc:/DiscoverPage.qml"); - } - } - - contextualActions: [ + property list pageActions: [ + Kirigami.Action { + visible: Kirigami.Settings.isMobile + text: i18n("Discover") + icon.name: "search" + onTriggered: { + applicationWindow().pageStack.push("qrc:/DiscoverPage.qml"); + } + }, Kirigami.Action { text: i18n("Refresh All Podcasts") icon.name: "view-refresh" @@ -75,10 +74,13 @@ Kirigami.ScrollablePage { // defined above Component.onCompleted: { for (var i in feedList.contextualActionList) { - contextualActions.push(feedList.contextualActionList[i]); + pageActions.push(feedList.contextualActionList[i]); } } + // TODO: KF6 replace contextualActions with actions + contextualActions: pageActions + AddFeedSheet { id: addSheet } diff --git a/src/qml/GenericEntryListView.qml b/src/qml/GenericEntryListView.qml index 4064244f..5452a119 100644 --- a/src/qml/GenericEntryListView.qml +++ b/src/qml/GenericEntryListView.qml @@ -123,7 +123,7 @@ ListView { // For lack of a better place, we put generic entry list actions here so // they can be re-used across the different ListViews. - property var selectAllAction: Kirigami.Action { + readonly property var selectAllAction: Kirigami.Action { icon.name: "edit-select-all" text: i18n("Select All") visible: true @@ -132,7 +132,7 @@ ListView { } } - property var selectNoneAction: Kirigami.Action { + readonly property var selectNoneAction: Kirigami.Action { icon.name: "edit-select-none" text: i18n("Deselect All") visible: listView.selectionModel.hasSelection @@ -141,7 +141,7 @@ ListView { } } - property var addToQueueAction: Kirigami.Action { + readonly property var addToQueueAction: Kirigami.Action { text: i18n("Add to Queue") icon.name: "media-playlist-append" visible: listView.selectionModel.hasSelection && !listView.isQueue && (singleSelectedEntry ? !singleSelectedEntry.queueStatus : true) @@ -151,7 +151,7 @@ ListView { } } - property var removeFromQueueAction: Kirigami.Action { + readonly property var removeFromQueueAction: Kirigami.Action { text: i18n("Remove from Queue") icon.name: "list-remove" visible: listView.selectionModel.hasSelection && (singleSelectedEntry ? singleSelectedEntry.queueStatus : true) @@ -161,7 +161,7 @@ ListView { } } - property var markPlayedAction: Kirigami.Action { + readonly property var markPlayedAction: Kirigami.Action { text: i18n("Mark as Played") visible: listView.selectionModel.hasSelection && (singleSelectedEntry ? !singleSelectedEntry.read : true) onTriggered: { @@ -169,7 +169,7 @@ ListView { } } - property var markNotPlayedAction: Kirigami.Action { + readonly property var markNotPlayedAction: Kirigami.Action { text: i18n("Mark as Unplayed") visible: listView.selectionModel.hasSelection && (singleSelectedEntry ? singleSelectedEntry.read : true) onTriggered: { @@ -177,7 +177,7 @@ ListView { } } - property var markNewAction: Kirigami.Action { + readonly property var markNewAction: Kirigami.Action { text: i18n("Label as \"New\"") visible: listView.selectionModel.hasSelection && (singleSelectedEntry ? !singleSelectedEntry.new : true) onTriggered: { @@ -185,7 +185,7 @@ ListView { } } - property var markNotNewAction: Kirigami.Action { + readonly property var markNotNewAction: Kirigami.Action { text: i18n("Remove \"New\" Label") visible: listView.selectionModel.hasSelection && (singleSelectedEntry ? singleSelectedEntry.new : true) onTriggered: { @@ -193,7 +193,7 @@ ListView { } } - property var markFavoriteAction: Kirigami.Action { + readonly property var markFavoriteAction: Kirigami.Action { text: i18nc("@action:intoolbar Button to add a podcast episode as favorite", "Add to Favorites") icon.name: "starred-symbolic" visible: listView.selectionModel.hasSelection && (singleSelectedEntry ? !singleSelectedEntry.favorite : true) @@ -202,7 +202,7 @@ ListView { } } - property var markNotFavoriteAction: Kirigami.Action { + readonly property var markNotFavoriteAction: Kirigami.Action { text: i18nc("@action:intoolbar Button to remove the \"favorite\" property of a podcast episode", "Remove from Favorites") icon.name: "non-starred-symbolic" visible: listView.selectionModel.hasSelection && (singleSelectedEntry ? singleSelectedEntry.favorite : true) @@ -211,7 +211,7 @@ ListView { } } - property var downloadEnclosureAction: Kirigami.Action { + readonly property var downloadEnclosureAction: Kirigami.Action { text: i18n("Download") icon.name: "download" visible: listView.selectionModel.hasSelection && (singleSelectedEntry ? (singleSelectedEntry.hasEnclosure ? singleSelectedEntry.enclosure.status !== Enclosure.Downloaded : false) : true) @@ -221,7 +221,7 @@ ListView { } } - property var deleteEnclosureAction: Kirigami.Action { + readonly property var deleteEnclosureAction: Kirigami.Action { text: i18ncp("context menu action", "Delete Download", "Delete Downloads", selectionForContextMenu.length) icon.name: "delete" visible: listView.selectionModel.hasSelection && (singleSelectedEntry ? (singleSelectedEntry.hasEnclosure ? singleSelectedEntry.enclosure.status !== Enclosure.Downloadable : false) : true) @@ -230,7 +230,7 @@ ListView { } } - property var streamAction: Kirigami.Action { + readonly property var streamAction: Kirigami.Action { text: i18nc("@action:inmenu Action to start playback by streaming the episode rather than downloading it first", "Stream") icon.source: "qrc:/media-playback-start-cloud" visible: listView.selectionModel.hasSelection && (singleSelectedEntry ? (singleSelectedEntry.hasEnclosure ? singleSelectedEntry.enclosure.status !== Enclosure.Downloaded : false) : false) @@ -243,19 +243,19 @@ ListView { } } - property var defaultActionList: [addToQueueAction, - removeFromQueueAction, - markPlayedAction, - markNotPlayedAction, - markNewAction, - markNotNewAction, - markFavoriteAction, - markNotFavoriteAction, - downloadEnclosureAction, - deleteEnclosureAction, - streamAction, - selectAllAction, - selectNoneAction] + readonly property var defaultActionList: [addToQueueAction, + removeFromQueueAction, + markPlayedAction, + markNotPlayedAction, + markNewAction, + markNotNewAction, + markFavoriteAction, + markNotFavoriteAction, + downloadEnclosureAction, + deleteEnclosureAction, + streamAction, + selectAllAction, + selectNoneAction] property Controls.Menu contextMenu: Controls.Menu { id: contextMenu diff --git a/src/qml/QueuePage.qml b/src/qml/QueuePage.qml index b7559721..eed2b39e 100644 --- a/src/qml/QueuePage.qml +++ b/src/qml/QueuePage.qml @@ -32,13 +32,22 @@ Kirigami.ScrollablePage { } } - actions.main: Kirigami.Action { - icon.name: "view-refresh" - text: i18nc("@action:intoolbar", "Refresh All Podcasts") - onTriggered: refreshing = true + property list pageActions: [ + Kirigami.Action { + icon.name: "view-refresh" + text: i18nc("@action:intoolbar", "Refresh All Podcasts") + onTriggered: refreshing = true + } + ] + + Component.onCompleted: { + for (var i in queueList.defaultActionList) { + pageActions.push(queueList.defaultActionList[i]); + } } - contextualActions: queueList.defaultActionList + // TODO: KF6 replace contextualActions with actions + contextualActions: pageActions GenericEntryListView { id: queueList