From 30f694ba0932d68a2418e96c1b1007175ba44467 Mon Sep 17 00:00:00 2001 From: Bart De Vries Date: Sat, 3 Jul 2021 22:38:55 +0200 Subject: [PATCH] Add some more settings regarding marking episodes as played --- src/entry.cpp | 17 +++++++++++++++-- src/qml/SettingsPage.qml | 17 +++++++++++++++-- src/qml/main.qml | 2 +- src/settingsmanager.kcfg | 12 ++++++++++-- 4 files changed, 41 insertions(+), 7 deletions(-) diff --git a/src/entry.cpp b/src/entry.cpp index 10a9c282..a8c7d311 100644 --- a/src/entry.cpp +++ b/src/entry.cpp @@ -148,8 +148,21 @@ void Entry::setRead(bool read) // Follow up actions if (read && hasEnclosure()) { - // 1) Delete episode if that setting is set - if (SettingsManager::self()->autoDelete() == 1) { + // 1) Reset play position + 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(); } } diff --git a/src/qml/SettingsPage.qml b/src/qml/SettingsPage.qml index 91369e70..699dd5f1 100644 --- a/src/qml/SettingsPage.qml +++ b/src/qml/SettingsPage.qml @@ -86,12 +86,25 @@ Kirigami.ScrollablePage { model: [{"text": i18n("Do Not Delete"), "value": 0}, {"text": i18n("Delete Immediately"), "value": 1}, {"text": i18n("Delete at Next Startup"), "value": 2}] - Component.onCompleted: currentIndex = indexOfValue(SettingsManager.autoDelete) + Component.onCompleted: currentIndex = indexOfValue(SettingsManager.autoDeleteOnPlayed) 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.FormData.isSection: true text: i18n("Network") diff --git a/src/qml/main.qml b/src/qml/main.qml index 624800fa..d5938d2e 100644 --- a/src/qml/main.qml +++ b/src/qml/main.qml @@ -61,7 +61,7 @@ Kirigami.ApplicationWindow { pageStack.initialPage = getPage(SettingsManager.lastOpenedPage) // Delete played enclosures if set in settings - if (SettingsManager.autoDelete == 2) { + if (SettingsManager.autoDeleteOnPlayed == 2) { DataManager.deletePlayedEnclosures(); } diff --git a/src/settingsmanager.kcfg b/src/settingsmanager.kcfg index fe22832d..91a82728 100644 --- a/src/settingsmanager.kcfg +++ b/src/settingsmanager.kcfg @@ -25,7 +25,7 @@ false - + @@ -40,6 +40,14 @@ OnNextStartup + + + true + + + + true + false @@ -73,4 +81,4 @@ FeedListPage - + \ No newline at end of file