Browse Source

Do not save RSS feed to disk unless it has changed.

Stop to address issue #34.
adaptive-webui-19844
Christophe Dumez 12 years ago
parent
commit
ad7c9ace50
  1. 9
      src/rss/rssfeed.cpp
  2. 2
      src/rss/rssfeed.h

9
src/rss/rssfeed.cpp

@ -43,7 +43,7 @@ @@ -43,7 +43,7 @@
RssFeed::RssFeed(RssManager* manager, RssFolder* parent, const QString &url):
m_manager(manager), m_parent(parent), m_icon(":/Icons/oxygen/application-rss+xml.png"),
m_refreshed(false), m_inErrorState(false), m_loading(false) {
m_dirty(false), m_inErrorState(false), m_loading(false) {
qDebug() << Q_FUNC_INFO << url;
m_url = QUrl::fromEncoded(url.toUtf8()).toString();
// Listen for new RSS downloads
@ -68,8 +68,10 @@ RssFeed::~RssFeed() { @@ -68,8 +68,10 @@ RssFeed::~RssFeed() {
void RssFeed::saveItemsToDisk() {
qDebug() << Q_FUNC_INFO << m_url;
if (!m_refreshed)
if (!m_dirty)
return;
m_dirty = false;
QIniSettings qBTRSS("qBittorrent", "qBittorrent-rss");
QVariantList old_items;
@ -273,12 +275,13 @@ void RssFeed::handleNewArticle(const QString& feedUrl, const QVariantHash& artic @@ -273,12 +275,13 @@ void RssFeed::handleNewArticle(const QString& feedUrl, const QVariantHash& artic
{
if (feedUrl != m_url)
return;
m_refreshed = true;
const QString guid = articleData["id"].toString();
if (m_articles.contains(guid))
return;
m_dirty = true;
RssArticlePtr article = hashToRssArticle(this, articleData);
Q_ASSERT(article);
m_articles[guid] = article;

2
src/rss/rssfeed.h

@ -96,7 +96,7 @@ private: @@ -96,7 +96,7 @@ private:
QString m_icon;
QString m_iconUrl;
bool m_read;
bool m_refreshed;
bool m_dirty;
bool m_inErrorState;
bool m_loading;

Loading…
Cancel
Save