Improved feed assignment behavior

This commit is contained in:
Christophe Dumez
2010-11-13 18:08:09 +00:00
parent adffd7df74
commit 345222cf42
4 changed files with 36 additions and 33 deletions

View File

@@ -128,6 +128,9 @@ void RssDownloadRuleList::loadRulesFromVariantHash(const QVariantHash &h)
void RssDownloadRuleList::saveRule(const RssDownloadRule &rule)
{
Q_ASSERT(rule.isValid());
if(m_rules.contains(rule.name())) {
removeRule(rule.name());
}
m_rules.insert(rule.name(), rule);
// Update feedRules hashtable
foreach(const QString &feed_url, rule.rssFeeds()) {
@@ -150,15 +153,6 @@ void RssDownloadRuleList::removeRule(const QString &name)
saveRulesToStorage();
}
void RssDownloadRuleList::updateRule(const RssDownloadRule &rule)
{
if(!m_rules.contains(rule.name())) return;
removeRule(rule.name());
saveRule(rule);
// Save rules
saveRulesToStorage();
}
void RssDownloadRuleList::renameRule(const QString &old_name, const QString &new_name)
{
if(!m_rules.contains(old_name)) return;