From f0f4da8aa7606546860ade98643203c3ee154316 Mon Sep 17 00:00:00 2001 From: Bart De Vries Date: Wed, 29 Sep 2021 08:36:17 +0200 Subject: [PATCH] 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. --- src/qml/FeedListDelegate.qml | 20 ++++++++++++++------ src/qml/FeedListPage.qml | 28 ++++++++++++++++++++++++---- src/qml/GenericEntryListView.qml | 2 +- 3 files changed, 39 insertions(+), 11 deletions(-) diff --git a/src/qml/FeedListDelegate.qml b/src/qml/FeedListDelegate.qml index 58a667b8..37e3baab 100644 --- a/src/qml/FeedListDelegate.qml +++ b/src/qml/FeedListDelegate.qml @@ -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") } - } } } diff --git a/src/qml/FeedListPage.qml b/src/qml/FeedListPage.qml index bc9786ab..7ae179de 100644 --- a/src/qml/FeedListPage.qml +++ b/src/qml/FeedListPage.qml @@ -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 diff --git a/src/qml/GenericEntryListView.qml b/src/qml/GenericEntryListView.qml index bf668688..4814a9cb 100644 --- a/src/qml/GenericEntryListView.qml +++ b/src/qml/GenericEntryListView.qml @@ -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: {