diff --git a/src/datamanager.cpp b/src/datamanager.cpp index 90fb24c0..66b8a4f6 100644 --- a/src/datamanager.cpp +++ b/src/datamanager.cpp @@ -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 diff --git a/src/datamanager.h b/src/datamanager.h index 66162ab5..27d6cfbb 100644 --- a/src/datamanager.h +++ b/src/datamanager.h @@ -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); diff --git a/src/qml/EntryListPage.qml b/src/qml/EntryListPage.qml index 833fba22..b65f20d7 100644 --- a/src/qml/EntryListPage.qml +++ b/src/qml/EntryListPage.qml @@ -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) + } } ]