Browse Source

Save article 'read' state on exit

adaptive-webui-19844
Nick Tiskov 12 years ago
parent
commit
9b121fd5d0
  1. 1
      src/rss/rssarticle.cpp
  2. 9
      src/rss/rssfeed.cpp
  3. 1
      src/rss/rssfeed.h

1
src/rss/rssarticle.cpp

@ -108,6 +108,7 @@ void RssArticle::markAsRead() {
m_read = true; m_read = true;
m_parent->decrementUnreadCount(); m_parent->decrementUnreadCount();
m_parent->markAsDirty();
} }
const QString& RssArticle::guid() const const QString& RssArticle::guid() const

9
src/rss/rssfeed.cpp

@ -83,7 +83,7 @@ void RssFeed::saveItemsToDisk()
qDebug() << Q_FUNC_INFO << m_url; qDebug() << Q_FUNC_INFO << m_url;
if (!m_dirty) if (!m_dirty)
return; return;
m_dirty = false; markAsDirty(false);
QIniSettings qBTRSS("qBittorrent", "qBittorrent-rss"); QIniSettings qBTRSS("qBittorrent", "qBittorrent-rss");
QVariantList old_items; QVariantList old_items;
@ -248,6 +248,11 @@ void RssFeed::markAsRead()
m_manager->forwardFeedInfosChanged(m_url, displayName(), 0); m_manager->forwardFeedInfosChanged(m_url, displayName(), 0);
} }
void RssFeed::markAsDirty(bool dirty)
{
m_dirty = dirty;
}
uint RssFeed::unreadCount() const uint RssFeed::unreadCount() const
{ {
return m_unreadCount; return m_unreadCount;
@ -356,7 +361,7 @@ void RssFeed::handleNewArticle(const QString& feedUrl, const QVariantHash& artic
if (m_articles.contains(guid)) if (m_articles.contains(guid))
return; return;
m_dirty = true; markAsDirty();
RssArticlePtr article = hashToRssArticle(this, articleData); RssArticlePtr article = hashToRssArticle(this, articleData);
Q_ASSERT(article); Q_ASSERT(article);

1
src/rss/rssfeed.h

@ -72,6 +72,7 @@ public:
RssArticlePtr getItem(const QString &guid) const; RssArticlePtr getItem(const QString &guid) const;
uint count() const; uint count() const;
virtual void markAsRead(); virtual void markAsRead();
void markAsDirty(bool dirty = true);
virtual uint unreadCount() const; virtual uint unreadCount() const;
virtual RssArticleList articleListByDateDesc() const; virtual RssArticleList articleListByDateDesc() const;
const RssArticleHash& articleHash() const { return m_articles; } const RssArticleHash& articleHash() const { return m_articles; }

Loading…
Cancel
Save