1
0
mirror of https://github.com/d47081/qBittorrent.git synced 2025-01-10 14:57:52 +00:00

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

Stop to address issue #34.
This commit is contained in:
Christophe Dumez 2012-08-18 21:26:22 +03:00
parent a26723a57a
commit ad7c9ace50
2 changed files with 7 additions and 4 deletions

View File

@ -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() {
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
{
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;

View File

@ -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;