mirror of https://github.com/KDE/kasts.git
Implement "new" episodes feature and autoQueue
This commit is contained in:
parent
26986616c7
commit
a8e174739f
|
@ -9,6 +9,10 @@
|
|||
<label>How many recent episodes should be labeled 'new' when adding a new subscription</label>
|
||||
<default>1</default>
|
||||
</entry>
|
||||
<entry name="autoQueue" type="Bool">
|
||||
<label>Automatically add new episodes to queue</label>
|
||||
<default>true</default>
|
||||
</entry>
|
||||
<entry name="autoDownload" type="Bool">
|
||||
<label>Automatically download new episodes</label>
|
||||
<default>false</default>
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include "datamanager.h"
|
||||
#include "fetcher.h"
|
||||
#include "database.h"
|
||||
#include "alligatorsettings.h"
|
||||
|
||||
DataManager::DataManager()
|
||||
{
|
||||
|
@ -53,6 +54,18 @@ DataManager::DataManager()
|
|||
m_entrymap[feedurl] += query.value(QStringLiteral("id")).toString();
|
||||
//qDebug() << m_entrymap[feedurl];
|
||||
}
|
||||
|
||||
// Check for "new" entries
|
||||
if (AlligatorSettings::self()->autoQueue()) {
|
||||
query.prepare(QStringLiteral("SELECT id FROM Entries WHERE feed=:feed AND new=:new;"));
|
||||
query.bindValue(QStringLiteral(":feed"), feedurl);
|
||||
query.bindValue(QStringLiteral(":new"), true);
|
||||
Database::instance().execute(query);
|
||||
while (query.next()) {
|
||||
addtoQueue(feedurl, query.value(QStringLiteral("id")).toString());
|
||||
}
|
||||
}
|
||||
|
||||
Q_EMIT feedEntriesUpdated(feedurl);
|
||||
});
|
||||
|
||||
|
|
|
@ -140,7 +140,7 @@ void Fetcher::processFeed(Syndication::FeedPtr feed, const QString &url)
|
|||
processEntry(entry, url, isNewFeed);
|
||||
}
|
||||
|
||||
// Now mark the appropriate number of recent entries "new" and "read" for new feeds only
|
||||
// Now mark the appropriate number of recent entries "new" and "read" only for new feeds
|
||||
if (isNewFeed) {
|
||||
query.prepare(QStringLiteral("SELECT * FROM Entries WHERE feed=:feed ORDER BY updated DESC LIMIT :recentNew;"));
|
||||
query.bindValue(QStringLiteral(":feed"), url);
|
||||
|
|
|
@ -93,7 +93,8 @@ Kirigami.SwipeListItem {
|
|||
}
|
||||
|
||||
onClicked: {
|
||||
entry.read = true
|
||||
// only mark pure rss feeds as read; podcasts should only be marked read once they have been listened to
|
||||
if (!entry.enclosure) { entry.read = true; entry.new = false;}
|
||||
pageStack.push("qrc:/EntryPage.qml", {"entry": entry})
|
||||
}
|
||||
|
||||
|
|
|
@ -80,7 +80,8 @@ Kirigami.SwipeListItem {
|
|||
}
|
||||
|
||||
onClicked: {
|
||||
entry.read = true
|
||||
// only mark pure rss feeds as read; podcasts should only be marked read once they have been listened to
|
||||
if (!entry.enclosure) { entry.read = true; entry.new = false;}
|
||||
pageStack.push("qrc:/EntryPage.qml", {"entry": entry})
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue