Rss code clean up

This commit is contained in:
Christophe Dumez 2011-01-29 14:18:45 +00:00
parent 74c32a0ecd
commit 7f0c8dde24
5 changed files with 10 additions and 14 deletions

View file

@ -183,11 +183,11 @@ uint RssFeed::unreadCount() const{
return nbUnread; return nbUnread;
} }
QList<RssArticle> RssFeed::articleList() const{ const QList<RssArticle> RssFeed::articleList() const{
return m_articles.values(); return m_articles.values();
} }
QList<RssArticle> RssFeed::unreadArticleList() const { const QList<RssArticle> RssFeed::unreadArticleList() const {
QList<RssArticle> unread_news; QList<RssArticle> unread_news;
foreach(const RssArticle &item, m_articles.values()) { foreach(const RssArticle &item, m_articles.values()) {
if(!item.isRead()) if(!item.isRead())
@ -344,7 +344,6 @@ void RssFeed::handleFinishedDownload(const QString& url, const QString &file_pat
m_icon = file_path; m_icon = file_path;
qDebug() << "icon path:" << m_icon; qDebug() << "icon path:" << m_icon;
RssManager::instance()->forwardFeedIconChanged(m_url, m_icon); // XXX: Ugly RssManager::instance()->forwardFeedIconChanged(m_url, m_icon); // XXX: Ugly
emit iconUpdated(m_icon);
} }
} }

View file

@ -63,12 +63,9 @@ public:
uint count() const; uint count() const;
void markAsRead(); void markAsRead();
uint unreadCount() const; uint unreadCount() const;
QList<RssArticle> articleList() const; const QList<RssArticle> articleList() const;
const QHash<QString, RssArticle>& articleListNoCopy() const { return m_articles; } const QHash<QString, RssArticle>& articleListNoCopy() const { return m_articles; }
QList<RssArticle> unreadArticleList() const; const QList<RssArticle> unreadArticleList() const;
signals:
void iconUpdated(const QString &icon);
private slots: private slots:
void handleFinishedDownload(const QString& url, const QString &file_path); void handleFinishedDownload(const QString& url, const QString &file_path);

View file

@ -54,8 +54,8 @@ public:
virtual void setParent(RssFolder* parent) = 0; virtual void setParent(RssFolder* parent) = 0;
virtual void refresh() = 0; virtual void refresh() = 0;
virtual void removeAllSettings() = 0; virtual void removeAllSettings() = 0;
virtual QList<RssArticle> articleList() const = 0; virtual const QList<RssArticle> articleList() const = 0;
virtual QList<RssArticle> unreadArticleList() const = 0; virtual const QList<RssArticle> unreadArticleList() const = 0;
QStringList pathHierarchy() const; QStringList pathHierarchy() const;
}; };

View file

@ -90,7 +90,7 @@ void RssFolder::refresh() {
} }
} }
QList<RssArticle> RssFolder::articleList() const { const QList<RssArticle> RssFolder::articleList() const {
QList<RssArticle> news; QList<RssArticle> news;
foreach(const IRssFile *child, m_children.values()) { foreach(const IRssFile *child, m_children.values()) {
news << child->articleList(); news << child->articleList();
@ -98,7 +98,7 @@ QList<RssArticle> RssFolder::articleList() const {
return news; return news;
} }
QList<RssArticle> RssFolder::unreadArticleList() const { const QList<RssArticle> RssFolder::unreadArticleList() const {
QList<RssArticle> unread_news; QList<RssArticle> unread_news;
foreach(const IRssFile *child, m_children.values()) { foreach(const IRssFile *child, m_children.values()) {
unread_news << child->unreadArticleList(); unread_news << child->unreadArticleList();

View file

@ -57,8 +57,8 @@ public:
QString displayName() const; QString displayName() const;
QString id() const; QString id() const;
bool hasChild(const QString &childId); bool hasChild(const QString &childId);
QList<RssArticle> articleList() const; const QList<RssArticle> articleList() const;
QList<RssArticle> unreadArticleList() const; const QList<RssArticle> unreadArticleList() const;
void removeAllSettings(); void removeAllSettings();
void removeAllItems(); void removeAllItems();
void renameChildFolder(const QString &old_name, const QString &new_name); void renameChildFolder(const QString &old_name, const QString &new_name);