示例#1
0
QStringList RssDownloadRule::findMatchingArticles(const RssFeedPtr& feed) const
{
  QStringList ret;
  const RssArticleHash& feed_articles = feed->articleHash();

  RssArticleHash::ConstIterator artIt = feed_articles.begin();
  RssArticleHash::ConstIterator artItend = feed_articles.end();
  for ( ; artIt != artItend ; ++artIt) {
    const QString title = artIt.value()->title();
    if (matches(title))
      ret << title;
  }
  return ret;
}
示例#2
0
void RssFeed::saveItemsToDisk()
{
  qDebug() << Q_FUNC_INFO << m_url;
  if (!m_dirty)
    return;
  markAsDirty(false);

  QIniSettings qBTRSS("qBittorrent", "qBittorrent-rss");
  QVariantList old_items;

  RssArticleHash::ConstIterator it = m_articles.begin();
  RssArticleHash::ConstIterator itend = m_articles.end();
  for ( ; it != itend; ++it) {
    old_items << it.value()->toHash();
  }
  qDebug("Saving %d old items for feed %s", old_items.size(), qPrintable(displayName()));
  QHash<QString, QVariant> all_old_items = qBTRSS.value("old_items", QHash<QString, QVariant>()).toHash();
  all_old_items[m_url] = old_items;
  qBTRSS.setValue("old_items", all_old_items);
}