Add some more settings regarding marking episodes as played

This commit is contained in:
Bart De Vries 2021-07-03 22:38:55 +02:00
parent fe2a977a6b
commit 30f694ba09
4 changed files with 41 additions and 7 deletions

View File

@ -148,8 +148,21 @@ void Entry::setRead(bool read)
// Follow up actions // Follow up actions
if (read && hasEnclosure()) { if (read && hasEnclosure()) {
// 1) Delete episode if that setting is set // 1) Reset play position
if (SettingsManager::self()->autoDelete() == 1) { if (SettingsManager::self()->resetPositionOnPlayed()) {
m_enclosure->setPlayPosition(0);
}
// 2) Remove item from queue
if (SettingsManager::self()->removeFromQueueOnPlayed()) {
setQueueStatus(false);
}
// 3) Remove "new" label
setNew(false);
// 4) Delete episode if that setting is set
if (SettingsManager::self()->autoDeleteOnPlayed() == 1) {
m_enclosure->deleteFile(); m_enclosure->deleteFile();
} }
} }

View File

@ -86,12 +86,25 @@ Kirigami.ScrollablePage {
model: [{"text": i18n("Do Not Delete"), "value": 0}, model: [{"text": i18n("Do Not Delete"), "value": 0},
{"text": i18n("Delete Immediately"), "value": 1}, {"text": i18n("Delete Immediately"), "value": 1},
{"text": i18n("Delete at Next Startup"), "value": 2}] {"text": i18n("Delete at Next Startup"), "value": 2}]
Component.onCompleted: currentIndex = indexOfValue(SettingsManager.autoDelete) Component.onCompleted: currentIndex = indexOfValue(SettingsManager.autoDeleteOnPlayed)
onActivated: { onActivated: {
SettingsManager.autoDelete = currentValue; SettingsManager.autoDeleteOnPlayed = currentValue;
} }
} }
Controls.CheckBox {
checked: SettingsManager.removeFromQueueOnPlayed
text: i18n("Remove from Queue")
onToggled: SettingsManager.removeFromQueueOnPlayed = checked
}
Controls.CheckBox {
checked: SettingsManager.resetPositionOnPlayed
text: i18n("Reset Play Position")
onToggled: SettingsManager.resetPositionOnPlayed = checked
}
Kirigami.Heading { Kirigami.Heading {
Kirigami.FormData.isSection: true Kirigami.FormData.isSection: true
text: i18n("Network") text: i18n("Network")

View File

@ -61,7 +61,7 @@ Kirigami.ApplicationWindow {
pageStack.initialPage = getPage(SettingsManager.lastOpenedPage) pageStack.initialPage = getPage(SettingsManager.lastOpenedPage)
// Delete played enclosures if set in settings // Delete played enclosures if set in settings
if (SettingsManager.autoDelete == 2) { if (SettingsManager.autoDeleteOnPlayed == 2) {
DataManager.deletePlayedEnclosures(); DataManager.deletePlayedEnclosures();
} }

View File

@ -25,7 +25,7 @@
<label>Automatically download new episodes</label> <label>Automatically download new episodes</label>
<default>false</default> <default>false</default>
</entry> </entry>
<entry name="autoDelete" type="Enum"> <entry name="autoDeleteOnPlayed" type="Enum">
<label>Setting to select if or when to delete played episode</label> <label>Setting to select if or when to delete played episode</label>
<choices> <choices>
<choice name="Disabled"> <choice name="Disabled">
@ -40,6 +40,14 @@
</choices> </choices>
<default>OnNextStartup</default> <default>OnNextStartup</default>
</entry> </entry>
<entry name="removeFromQueueOnPlayed" type="Bool">
<label>Remove episode from queue when marked as played</label>
<default>true</default>
</entry>
<entry name="resetPositionOnPlayed" type="Bool">
<label>Reset play position when episode is marked as played</label>
<default>true</default>
</entry>
<entry name="toggleRemainingTime" type="Bool"> <entry name="toggleRemainingTime" type="Bool">
<label>Whether the player shows remaining track time instead of total track time</label> <label>Whether the player shows remaining track time instead of total track time</label>
<default>false</default> <default>false</default>
@ -73,4 +81,4 @@
<default>FeedListPage</default> <default>FeedListPage</default>
</entry> </entry>
</group> </group>
</kcfg> </kcfg>