Prepare for KF6 change in Page actions

This commit is contained in:
Bart De Vries 2023-04-25 12:58:31 +02:00
parent ba1cefd5fc
commit 27f4d6145b
6 changed files with 83 additions and 57 deletions

View File

@ -26,13 +26,22 @@ Kirigami.ScrollablePage {
} }
} }
actions.main: Kirigami.Action { property list<Kirigami.Action> pageActions: [
Kirigami.Action {
icon.name: "view-refresh" icon.name: "view-refresh"
text: i18n("Refresh All Podcasts") text: i18n("Refresh All Podcasts")
onTriggered: refreshing = true onTriggered: refreshing = true
} }
]
contextualActions: episodeList.defaultActionList Component.onCompleted: {
for (var i in episodeList.defaultActionList) {
pageActions.push(episodeList.defaultActionList[i]);
}
}
// TODO: KF6 replace contextualActions with actions
contextualActions: pageActions
GenericEntryListView { GenericEntryListView {
id: episodeList id: episodeList

View File

@ -35,16 +35,15 @@ Kirigami.ScrollablePage {
} }
} }
actions { property list<Kirigami.Action> pageActions: [
main: Kirigami.Action { Kirigami.Action {
icon.name: "download" icon.name: "download"
text: i18n("Downloads") text: i18n("Downloads")
onTriggered: { onTriggered: {
pushPage("DownloadListPage") pushPage("DownloadListPage")
} }
} },
Kirigami.Action {
left: Kirigami.Action {
id: searchActionButton id: searchActionButton
icon.name: "search" icon.name: "search"
text: i18nc("@action:intoolbar", "Search and Filter") text: i18nc("@action:intoolbar", "Search and Filter")
@ -55,17 +54,23 @@ Kirigami.ScrollablePage {
episodeProxyModel.searchFilter = ""; episodeProxyModel.searchFilter = "";
} }
} }
} },
Kirigami.Action {
right: Kirigami.Action {
icon.name: "view-refresh" icon.name: "view-refresh"
text: i18n("Refresh All Podcasts") text: i18n("Refresh All Podcasts")
onTriggered: refreshing = true onTriggered: refreshing = true
visible: episodeProxyModel.filterType == AbstractEpisodeProxyModel.NoFilter 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 { header: Loader {
anchors.right: parent.right anchors.right: parent.right

View File

@ -65,7 +65,8 @@ Kirigami.ScrollablePage {
} }
} }
actions.main: Kirigami.Action { // TODO: KF6 replace contextualActions with actions
contextualActions: Kirigami.Action {
id: searchActionButton id: searchActionButton
icon.name: "search" icon.name: "search"
text: i18nc("@action:intoolbar", "Search and Filter") text: i18nc("@action:intoolbar", "Search and Filter")

View File

@ -35,16 +35,15 @@ Kirigami.ScrollablePage {
} }
} }
actions.main: Kirigami.Action { property list<Kirigami.Action> pageActions: [
Kirigami.Action {
visible: Kirigami.Settings.isMobile visible: Kirigami.Settings.isMobile
text: i18n("Discover") text: i18n("Discover")
icon.name: "search" icon.name: "search"
onTriggered: { onTriggered: {
applicationWindow().pageStack.push("qrc:/DiscoverPage.qml"); applicationWindow().pageStack.push("qrc:/DiscoverPage.qml");
} }
} },
contextualActions: [
Kirigami.Action { Kirigami.Action {
text: i18n("Refresh All Podcasts") text: i18n("Refresh All Podcasts")
icon.name: "view-refresh" icon.name: "view-refresh"
@ -75,10 +74,13 @@ Kirigami.ScrollablePage {
// defined above // defined above
Component.onCompleted: { Component.onCompleted: {
for (var i in feedList.contextualActionList) { 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 { AddFeedSheet {
id: addSheet id: addSheet
} }

View File

@ -123,7 +123,7 @@ ListView {
// For lack of a better place, we put generic entry list actions here so // For lack of a better place, we put generic entry list actions here so
// they can be re-used across the different ListViews. // 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" icon.name: "edit-select-all"
text: i18n("Select All") text: i18n("Select All")
visible: true visible: true
@ -132,7 +132,7 @@ ListView {
} }
} }
property var selectNoneAction: Kirigami.Action { readonly property var selectNoneAction: Kirigami.Action {
icon.name: "edit-select-none" icon.name: "edit-select-none"
text: i18n("Deselect All") text: i18n("Deselect All")
visible: listView.selectionModel.hasSelection 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") text: i18n("Add to Queue")
icon.name: "media-playlist-append" icon.name: "media-playlist-append"
visible: listView.selectionModel.hasSelection && !listView.isQueue && (singleSelectedEntry ? !singleSelectedEntry.queueStatus : true) 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") text: i18n("Remove from Queue")
icon.name: "list-remove" icon.name: "list-remove"
visible: listView.selectionModel.hasSelection && (singleSelectedEntry ? singleSelectedEntry.queueStatus : true) 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") text: i18n("Mark as Played")
visible: listView.selectionModel.hasSelection && (singleSelectedEntry ? !singleSelectedEntry.read : true) visible: listView.selectionModel.hasSelection && (singleSelectedEntry ? !singleSelectedEntry.read : true)
onTriggered: { onTriggered: {
@ -169,7 +169,7 @@ ListView {
} }
} }
property var markNotPlayedAction: Kirigami.Action { readonly property var markNotPlayedAction: Kirigami.Action {
text: i18n("Mark as Unplayed") text: i18n("Mark as Unplayed")
visible: listView.selectionModel.hasSelection && (singleSelectedEntry ? singleSelectedEntry.read : true) visible: listView.selectionModel.hasSelection && (singleSelectedEntry ? singleSelectedEntry.read : true)
onTriggered: { onTriggered: {
@ -177,7 +177,7 @@ ListView {
} }
} }
property var markNewAction: Kirigami.Action { readonly property var markNewAction: Kirigami.Action {
text: i18n("Label as \"New\"") text: i18n("Label as \"New\"")
visible: listView.selectionModel.hasSelection && (singleSelectedEntry ? !singleSelectedEntry.new : true) visible: listView.selectionModel.hasSelection && (singleSelectedEntry ? !singleSelectedEntry.new : true)
onTriggered: { onTriggered: {
@ -185,7 +185,7 @@ ListView {
} }
} }
property var markNotNewAction: Kirigami.Action { readonly property var markNotNewAction: Kirigami.Action {
text: i18n("Remove \"New\" Label") text: i18n("Remove \"New\" Label")
visible: listView.selectionModel.hasSelection && (singleSelectedEntry ? singleSelectedEntry.new : true) visible: listView.selectionModel.hasSelection && (singleSelectedEntry ? singleSelectedEntry.new : true)
onTriggered: { 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") text: i18nc("@action:intoolbar Button to add a podcast episode as favorite", "Add to Favorites")
icon.name: "starred-symbolic" icon.name: "starred-symbolic"
visible: listView.selectionModel.hasSelection && (singleSelectedEntry ? !singleSelectedEntry.favorite : true) 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") text: i18nc("@action:intoolbar Button to remove the \"favorite\" property of a podcast episode", "Remove from Favorites")
icon.name: "non-starred-symbolic" icon.name: "non-starred-symbolic"
visible: listView.selectionModel.hasSelection && (singleSelectedEntry ? singleSelectedEntry.favorite : true) 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") text: i18n("Download")
icon.name: "download" icon.name: "download"
visible: listView.selectionModel.hasSelection && (singleSelectedEntry ? (singleSelectedEntry.hasEnclosure ? singleSelectedEntry.enclosure.status !== Enclosure.Downloaded : false) : true) 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) text: i18ncp("context menu action", "Delete Download", "Delete Downloads", selectionForContextMenu.length)
icon.name: "delete" icon.name: "delete"
visible: listView.selectionModel.hasSelection && (singleSelectedEntry ? (singleSelectedEntry.hasEnclosure ? singleSelectedEntry.enclosure.status !== Enclosure.Downloadable : false) : true) 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") 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" icon.source: "qrc:/media-playback-start-cloud"
visible: listView.selectionModel.hasSelection && (singleSelectedEntry ? (singleSelectedEntry.hasEnclosure ? singleSelectedEntry.enclosure.status !== Enclosure.Downloaded : false) : false) visible: listView.selectionModel.hasSelection && (singleSelectedEntry ? (singleSelectedEntry.hasEnclosure ? singleSelectedEntry.enclosure.status !== Enclosure.Downloaded : false) : false)
@ -243,7 +243,7 @@ ListView {
} }
} }
property var defaultActionList: [addToQueueAction, readonly property var defaultActionList: [addToQueueAction,
removeFromQueueAction, removeFromQueueAction,
markPlayedAction, markPlayedAction,
markNotPlayedAction, markNotPlayedAction,

View File

@ -32,13 +32,22 @@ Kirigami.ScrollablePage {
} }
} }
actions.main: Kirigami.Action { property list<Kirigami.Action> pageActions: [
Kirigami.Action {
icon.name: "view-refresh" icon.name: "view-refresh"
text: i18nc("@action:intoolbar", "Refresh All Podcasts") text: i18nc("@action:intoolbar", "Refresh All Podcasts")
onTriggered: refreshing = true onTriggered: refreshing = true
} }
]
contextualActions: queueList.defaultActionList Component.onCompleted: {
for (var i in queueList.defaultActionList) {
pageActions.push(queueList.defaultActionList[i]);
}
}
// TODO: KF6 replace contextualActions with actions
contextualActions: pageActions
GenericEntryListView { GenericEntryListView {
id: queueList id: queueList