diff --git a/src/rss/rss_imp.cpp b/src/rss/rss_imp.cpp index 90bb64015..e6f374178 100644 --- a/src/rss/rss_imp.cpp +++ b/src/rss/rss_imp.cpp @@ -508,7 +508,7 @@ void RSSImp::refreshTextBrowser() { m_currentArticle = item; } RssFeed *stream = m_feedList->getRSSItemFromUrl(item->data(Article::FeedUrlRole).toString()); - RssArticle &article = stream->getItem(item->data(Article::IdRole).toString()); + RssArticle article = stream->getItem(item->data(Article::IdRole).toString()); QString html; html += "
"; html += "
"+article.title() + "
"; diff --git a/src/rss/rssarticle.cpp b/src/rss/rssarticle.cpp index 265c57e52..766e72906 100644 --- a/src/rss/rssarticle.cpp +++ b/src/rss/rssarticle.cpp @@ -190,6 +190,11 @@ QDateTime RssArticle::parseDate(const QString &string) { return result; } +RssArticle::RssArticle(): + d(new RssArticleData(0)) +{ +} + // public constructor RssArticle::RssArticle(RssFeed* parent, QXmlStreamReader& xml): d(new RssArticleData(parent)) diff --git a/src/rss/rssarticle.h b/src/rss/rssarticle.h index 172bb96bc..9de4c79eb 100644 --- a/src/rss/rssarticle.h +++ b/src/rss/rssarticle.h @@ -43,8 +43,9 @@ class RssArticleData; class RssArticle { public: + RssArticle(); RssArticle(RssFeed* parent, QXmlStreamReader& xml); - RssArticle(RssFeed* parent = 0, const QString &guid = QString()); + RssArticle(RssFeed* parent, const QString &guid); RssArticle(const RssArticle& other); // Copy constructor RssArticle& operator=(const RssArticle& other); ~RssArticle(); diff --git a/src/rss/rssfeed.cpp b/src/rss/rssfeed.cpp index ddb719eb0..12b97fb74 100644 --- a/src/rss/rssfeed.cpp +++ b/src/rss/rssfeed.cpp @@ -177,8 +177,8 @@ void RssFeed::setIconPath(const QString &path) { m_icon = path; } -RssArticle& RssFeed::getItem(const QString &guid) { - return m_articles[guid]; +const RssArticle RssFeed::getItem(const QString &guid) const { + return m_articles.value(guid); } uint RssFeed::count() const{ @@ -300,7 +300,7 @@ void RssFeed::downloadMatchingArticleTorrents() { Q_ASSERT(RssSettings().isRssDownloadingEnabled()); QHash::iterator it; for (it = m_articles.begin(); it != m_articles.end(); it++) { - RssArticle &item = it.value(); + RssArticle item = it.value(); if(item.isRead()) continue; QString torrent_url; if(item.hasAttachment()) diff --git a/src/rss/rssfeed.h b/src/rss/rssfeed.h index dcb3add06..1a0dd39b0 100644 --- a/src/rss/rssfeed.h +++ b/src/rss/rssfeed.h @@ -59,7 +59,7 @@ public: QString icon() const; bool hasCustomIcon() const; void setIconPath(const QString &pathHierarchy); - RssArticle& getItem(const QString &guid); + const RssArticle getItem(const QString &guid) const; uint count() const; void markAsRead(); uint unreadCount() const; diff --git a/src/rss/rssmanager.cpp b/src/rss/rssmanager.cpp index cfc42e6db..af0968549 100644 --- a/src/rss/rssmanager.cpp +++ b/src/rss/rssmanager.cpp @@ -39,8 +39,7 @@ RssManager* RssManager::m_instance = 0; -RssManager::RssManager(): RssFolder() { - m_rssDownloader = new DownloadThread(this); +RssManager::RssManager(): m_rssDownloader(new DownloadThread(this)) { connect(&m_refreshTimer, SIGNAL(timeout()), this, SLOT(refresh())); m_refreshInterval = RssSettings().getRSSRefreshInterval(); m_refreshTimer.start(m_refreshInterval*60000);