Add possibility to delete feed from entrylistpage

This commit is contained in:
Bart De Vries 2021-04-21 11:46:54 +02:00
parent 20b767711a
commit 73c333cf61
3 changed files with 17 additions and 5 deletions

View File

@ -230,8 +230,10 @@ int DataManager::newEntryCount(const Feed* feed) const
return query.value(0).toInt();
}
void DataManager::removeFeed(const Feed* feed)
void DataManager::removeFeed(Feed* feed)
{
qDebug() << feed->url();
qDebug() << "deleting feed with index" << m_feedmap.indexOf(feed->url());
removeFeed(m_feedmap.indexOf(feed->url()));
}
@ -417,7 +419,7 @@ void DataManager::moveQueueItem(const int &from, const int &to)
void DataManager::removeQueueItem(const int &index)
{
qDebug() << m_queuemap;
//qDebug() << m_queuemap;
// Unset "new" state
getEntry(m_queuemap[index])->setNew(false);
// TODO: Make sure to unset the pointer in the Audio class once it's been

View File

@ -36,8 +36,8 @@ public:
Q_INVOKABLE void addFeed(const QString &url);
void addFeed(const QString &url, const bool fetch);
void addFeeds(const QStringList &urls);
Q_INVOKABLE void removeFeed(const Feed* feed);
Q_INVOKABLE void removeFeed(const int &index);
Q_INVOKABLE void removeFeed(Feed* feed);
void removeFeed(const int &index);
//Q_INVOKABLE void addEntry(const QString &url); // TODO: implement these methods
//Q_INVOKABLE void removeEntry(const QString &url);
@ -65,7 +65,7 @@ Q_SIGNALS:
void feedAdded(const QString &url);
void feedRemoved(const int &index);
void entryAdded(const QString &feedurl, const QString &id);
//void entryRemoved(const Feed*, const int &index); // TODO: implement this signal
//void entryRemoved(const Feed*, const int &index); // TODO: implement this signal, is this needed?
void feedEntriesUpdated(const QString &url);
void queueEntryAdded(const int &index, const QString &id);
void queueEntryRemoved(const int &index, const QString &id);

View File

@ -44,6 +44,16 @@ Kirigami.ScrollablePage {
pageStack.pop()
pageStack.push("qrc:/FeedDetailsPage.qml", {"feed": feed})
}
},
Kirigami.Action {
iconName: "delete"
text: i18n("Remove feed")
onTriggered: {
if(pageStack.depth > 1)
while(pageStack.depth > 1)
pageStack.pop()
DataManager.removeFeed(feed)
}
}
]