From 601649f49ad633f78c6a44f4c55c5133765d16af Mon Sep 17 00:00:00 2001 From: Tim Delaney Date: Sun, 6 Nov 2016 13:52:12 +1100 Subject: [PATCH] Save rule on enable/disable even if not selected. Closes #6163. --HG-- branch : magao-dev --- src/gui/rss/automatedrssdownloader.cpp | 14 ++++++++++++++ src/gui/rss/automatedrssdownloader.h | 1 + 2 files changed, 15 insertions(+) diff --git a/src/gui/rss/automatedrssdownloader.cpp b/src/gui/rss/automatedrssdownloader.cpp index cd253f849..702f7651e 100644 --- a/src/gui/rss/automatedrssdownloader.cpp +++ b/src/gui/rss/automatedrssdownloader.cpp @@ -92,6 +92,8 @@ AutomatedRssDownloader::AutomatedRssDownloader(const QWeakPointer Q_ASSERT(ok); ok = connect(ui->listRules, SIGNAL(itemSelectionChanged()), SLOT(updateFeedList())); Q_ASSERT(ok); + ok = connect(ui->listRules, SIGNAL(itemChanged(QListWidgetItem *)), SLOT(handleRuleCheckStateChange(QListWidgetItem *))); + Q_ASSERT(ok); ok = connect(ui->listFeeds, SIGNAL(itemChanged(QListWidgetItem *)), SLOT(handleFeedCheckStateChange(QListWidgetItem *))); Q_ASSERT(ok); // Update matching articles when necessary @@ -492,6 +494,18 @@ void AutomatedRssDownloader::renameSelectedRule() } } +void AutomatedRssDownloader::handleRuleCheckStateChange(QListWidgetItem *rule_item) +{ + if (ui->ruleDefBox->isEnabled()) + // Make sure the current rule is saved + saveEditedRule(); + + // Make sure we save the rule that was enabled or disabled - it might not be the current selection. + m_editedRule = rule_item; + saveEditedRule(); + m_editedRule = 0; +} + void AutomatedRssDownloader::handleFeedCheckStateChange(QListWidgetItem *feed_item) { if (ui->ruleDefBox->isEnabled()) diff --git a/src/gui/rss/automatedrssdownloader.h b/src/gui/rss/automatedrssdownloader.h index 54f474048..19b6d6fe5 100644 --- a/src/gui/rss/automatedrssdownloader.h +++ b/src/gui/rss/automatedrssdownloader.h @@ -67,6 +67,7 @@ protected slots: void loadSettings(); void saveSettings(); void loadRulesList(); + void handleRuleCheckStateChange(QListWidgetItem *rule_item); void handleFeedCheckStateChange(QListWidgetItem *feed_item); void updateRuleDefinitionBox(); void clearRuleDefinitionBox();