Browse Source

Rss code clean up

adaptive-webui-19844
Christophe Dumez 14 years ago
parent
commit
7f0c8dde24
  1. 5
      src/rss/rssfeed.cpp
  2. 7
      src/rss/rssfeed.h
  3. 4
      src/rss/rssfile.h
  4. 4
      src/rss/rssfolder.cpp
  5. 4
      src/rss/rssfolder.h

5
src/rss/rssfeed.cpp

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

7
src/rss/rssfeed.h

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

4
src/rss/rssfile.h

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

4
src/rss/rssfolder.cpp

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

4
src/rss/rssfolder.h

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

Loading…
Cancel
Save