Improve contextual actions for the FeedList and EntryLists

This adds "select all", "deselect all" to the page contextual actions
and adds "show podcast info" to the OverlayPage opened by clicking on
the overflow menu button on the cards.
This also adds correct use of plurals for the actions if more than one
item has been selected.
This commit is contained in:
Bart De Vries 2021-09-29 08:36:17 +02:00
parent e1c80bff3d
commit f0f4da8aa7
3 changed files with 39 additions and 11 deletions

View File

@ -246,17 +246,26 @@ Controls.ItemDelegate {
header: Kirigami.Heading {
text: feed.name
level: 2
wrapMode: Text.Wrap
elide: Text.ElideRight
}
contentItem: ColumnLayout {
RowLayout {
Layout.preferredWidth: Kirigami.Units.gridUnit * 20
spacing: 0
Kirigami.BasicListItem {
Layout.fillWidth: true
leftPadding: Kirigami.Units.smallSpacing
rightPadding: 0
onClicked: {
while(pageStack.depth > 1)
pageStack.pop()
pageStack.push("qrc:/FeedDetailsPage.qml", {"feed": feed});
actionOverlay.close();
}
icon: "help-about-symbolic"
text: i18n("Podcast Details")
}
Kirigami.BasicListItem {
Layout.fillWidth: true
Layout.preferredHeight: Kirigami.Units.gridUnit * 2
leftPadding: Kirigami.Units.smallSpacing
rightPadding: 0
onClicked: {
@ -269,7 +278,6 @@ Controls.ItemDelegate {
icon: "delete"
text: i18n("Remove Podcast")
}
}
}
}

View File

@ -226,9 +226,27 @@ Kirigami.ScrollablePage {
// 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 {
iconName: "edit-select-all"
text: i18n("Select All")
visible: true
onTriggered: {
feedList.selectionModel.select(feedList.model.index(0, 0), ItemSelectionModel.ClearAndSelect | ItemSelectionModel.Columns);
}
}
property var selectNoneAction: Kirigami.Action {
iconName: "edit-select-none"
text: i18n("Deselect All")
visible: feedList.selectionModel.hasSelection
onTriggered: {
feedList.selectionModel.clearSelection();
}
}
property var deleteFeedAction: Kirigami.Action {
iconName: "delete"
text: i18n("Remove Podcast")
text: i18np("Remove Podcast", "Remove Podcasts", feedList.selectionForContextMenu.length)
visible: feedList.selectionModel.hasSelection
onTriggered: {
// First get an array of pointers to the feeds to be deleted
@ -255,13 +273,15 @@ Kirigami.ScrollablePage {
visible: feedList.selectionModel.hasSelection && (feedList.selectionForContextMenu.length == 1)
onTriggered: {
while(pageStack.depth > 1)
pageStack.pop()
pageStack.push("qrc:/FeedDetailsPage.qml", {"feed": feedList.selectionForContextMenu[0].model.data(feedList.selectionForContextMenu[0], FeedsModel.FeedRole)})
pageStack.pop();
pageStack.push("qrc:/FeedDetailsPage.qml", {"feed": feedList.selectionForContextMenu[0].model.data(feedList.selectionForContextMenu[0], FeedsModel.FeedRole)});
}
}
property var contextualActionList: [feedDetailsAction,
deleteFeedAction]
deleteFeedAction,
selectAllAction,
selectNoneAction]
property Controls.Menu contextMenu: Controls.Menu {
id: contextMenu

View File

@ -204,7 +204,7 @@ ListView {
}
property var deleteEnclosureAction: Kirigami.Action {
text: i18n("Delete Download")
text: i18np("Delete Download", "Delete Downloads", selectionForContextMenu.length)
icon.name: "delete"
visible: listView.selectionModel.hasSelection && (singleSelectedEntry ? (singleSelectedEntry.hasEnclosure ? singleSelectedEntry.enclosure.status !== Enclosure.Downloadable : false) : true)
onTriggered: {