Disable subscribe button when feed has been added
This disables the subscribe button once a feed has been added, i.e. when the button has been clicked. Additionally, when clicking on an already subscribed feed on the discover page will now open the full details including the episode list. BUG: 458560
This commit is contained in:
parent
16178b6441
commit
19a6e382db
@ -28,7 +28,7 @@ public:
|
||||
}
|
||||
|
||||
Feed *getFeed(const int index) const;
|
||||
Feed *getFeed(const QString &feedurl) const;
|
||||
Q_INVOKABLE Feed *getFeed(const QString &feedurl) const;
|
||||
Entry *getEntry(const int feed_index, const int entry_index) const;
|
||||
Entry *getEntry(const Feed *feed, const int entry_index) const;
|
||||
Q_INVOKABLE Entry *getEntry(const QString &id) const;
|
||||
|
@ -63,20 +63,23 @@ Kirigami.ScrollablePage {
|
||||
}
|
||||
actions: [
|
||||
Kirigami.Action {
|
||||
id: subscribeAction
|
||||
text: enabled ? i18n("Subscribe") : i18n("Subscribed")
|
||||
icon.name: "kt-add-feeds"
|
||||
enabled: !DataManager.feedExists(model.url)
|
||||
onTriggered: {
|
||||
DataManager.addFeed(model.url)
|
||||
DataManager.addFeed(model.url);
|
||||
enabled = false;
|
||||
}
|
||||
}
|
||||
]
|
||||
onClicked: {
|
||||
pageStack.push("qrc:/FeedDetailsPage.qml", {"feed": model, isSubscribed: false})
|
||||
pageStack.push("qrc:/FeedDetailsPage.qml", {"feed": subscribeAction.enabled ? model : DataManager.getFeed(model.url), "isSubscribed": !subscribeAction.enabled, "subscribeAction": subscribeAction})
|
||||
}
|
||||
}
|
||||
}
|
||||
ListView {
|
||||
id: listView
|
||||
anchors.fill: parent
|
||||
reuseItems: true
|
||||
|
||||
|
@ -22,6 +22,7 @@ Kirigami.ScrollablePage {
|
||||
|
||||
property QtObject feed;
|
||||
property bool isSubscribed: true
|
||||
property var subscribeAction: undefined // this is only used if instantiated from the discoverpage
|
||||
|
||||
property string author: isSubscribed ? (page.feed.authors.length === 0 ? "" : page.feed.authors[0].name) : feed.author
|
||||
property bool showMoreInfo: false
|
||||
@ -142,7 +143,14 @@ Kirigami.ScrollablePage {
|
||||
text: enabled ? i18n("Subscribe") : i18n("Subscribed")
|
||||
enabled: !DataManager.feedExists(feed.url)
|
||||
visible: !isSubscribed
|
||||
onTriggered: DataManager.addFeed(feed.url)
|
||||
onTriggered: {
|
||||
DataManager.addFeed(feed.url);
|
||||
enabled = false;
|
||||
// Also disable button on discoverpage
|
||||
if (subscribeAction !== undefined) {
|
||||
subscribeAction.enabled = false;
|
||||
}
|
||||
}
|
||||
},
|
||||
Kirigami.Action {
|
||||
iconName: "documentinfo"
|
||||
|
Loading…
x
Reference in New Issue
Block a user