• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdepim API Reference
  • KDE Home
  • Contact Us
 

akregator

  • sources
  • kde-4.14
  • kdepim
  • akregator
  • src
feed.h
Go to the documentation of this file.
1 /*
2  This file is part of Akregator.
3 
4  Copyright (C) 2004 Stanislav Karchebny <Stanislav.Karchebny@kdemail.net>
5  2005 Frank Osterfeld <osterfeld@kde.org>
6 
7  This program is free software; you can redistribute it and/or modify
8  it under the terms of the GNU General Public License as published by
9  the Free Software Foundation; either version 2 of the License, or
10  (at your option) any later version.
11 
12  This program is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License
18  along with this program; if not, write to the Free Software
19  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 
21  As a special exception, permission is given to link this program
22  with any edition of Qt, and distribute the resulting executable,
23  without including the source code for Qt in the source distribution.
24 */
25 
26 #ifndef AKREGATOR_FEED_H
27 #define AKREGATOR_FEED_H
28 
29 #include "akregator_export.h"
30 #include "feediconmanager.h"
31 #include "treenode.h"
32 
33 #include <syndication/syndication.h>
34 
35 #include <QIcon>
36 #include <QList>
37 
38 class QDomElement;
39 class QString;
40 
41 namespace Akregator {
42 
43 class Article;
44 class FetchQueue;
45 class TreeNodeVisitor;
46 class ArticleDeleteJob;
47 
48 namespace Backend {
49  class Storage;
50 }
51 
53 class AKREGATOR_EXPORT Feed : public TreeNode, public virtual FaviconListener
54 {
55  friend class ::Akregator::Article;
56  friend class ::Akregator::Folder;
57  Q_OBJECT
58  public:
61  enum ArchiveMode {
62  globalDefault,
63  keepAllArticles,
64  disableArchiving,
65  limitArticleNumber,
66  limitArticleAge
67  };
68 
69  // class methods
73  static ArchiveMode stringToArchiveMode(const QString& str);
74 
76  static QString archiveModeToString(ArchiveMode mode);
77 
79  static Feed* fromOPML(QDomElement e, Akregator::Backend::Storage* storage);
80 
82  explicit Feed( Akregator::Backend::Storage* storage );
83  ~Feed();
84 
85  bool accept(TreeNodeVisitor* visitor);
86 
88  QDomElement toOPML( QDomElement parent, QDomDocument document ) const;
89 
94  bool useCustomFetchInterval() const;
95 
100  void setCustomFetchIntervalEnabled(bool enabled);
101 
102  // FIXME is it -1 or 0 to disable interval fetching?
105  int fetchInterval() const;
106 
109  void setFetchInterval(int interval);
110 
112  ArchiveMode archiveMode() const;
113 
115  void setArchiveMode(ArchiveMode archiveMode);
116 
119  int maxArticleAge() const;
120 
123  void setMaxArticleAge(int maxArticleAge);
124 
125 
127  int maxArticleNumber() const;
128 
130  void setMaxArticleNumber(int maxArticleNumber);
131 
133  bool markImmediatelyAsRead() const;
134 
135  void setMarkImmediatelyAsRead(bool enabled);
136 
137  void setUseNotification(bool enabled);
138 
139  bool useNotification() const;
140 
142  void setLoadLinkedWebsite(bool enabled);
143 
144  bool loadLinkedWebsite() const;
145 
147  QPixmap image() const;
148 
150  void setImage(const QPixmap &p);
151 
153  void setFavicon( const QIcon& icon );
154 
156  QString xmlUrl() const;
158  void setXmlUrl(const QString& s);
159 
161  QString htmlUrl() const;
163  void setHtmlUrl(const QString& s);
164 
166  QString description() const;
167 
169  void setDescription(const QString& s);
170 
176  Article findArticle(const QString& guid) const;
177 
179  bool fetchErrorOccurred() const;
180 
181  Syndication::ErrorCode fetchErrorCode() const;
182 
184  int unread() const;
185 
189  int totalCount() const;
190 
192  bool isArticlesLoaded() const;
193 
195  bool isGroup() const { return false; }
196 
197  //impl
198  bool isAggregation() const { return false; }
199 
203  const TreeNode* next() const;
204  TreeNode* next();
205 
206  //impl
207  QIcon icon() const;
208 
210  void deleteExpiredArticles( Akregator::ArticleDeleteJob* job );
211 
212  bool isFetching() const;
213 
214  QVector<const Feed*> feeds() const;
215  QVector<Feed*> feeds();
216  QVector<const Folder*> folders() const;
217  QVector<Folder*> folders();
218 
219  /* reimp */ KJob* createMarkAsReadJob();
220 
221  public slots:
223  void fetch(bool followDiscovery=false);
224 
225  void slotAbortFetch();
226 
228  void slotAddToFetchQueue(Akregator::FetchQueue* queue, bool intervalFetchOnly=false);
229 
230  void slotAddFeedIconListener();
231 
232  signals:
234  void fetchStarted(Akregator::Feed*);
236  void fetched(Akregator::Feed *);
238  void fetchError(Akregator::Feed *);
240  void fetchDiscovery(Akregator::Feed *);
242  void fetchAborted(Akregator::Feed *);
243 
244  private:
245  Akregator::Backend::Storage* storage();
246 
247  private:
248  QList<Article> articles();
249 
251  void loadArticles();
252  void enforceLimitArticleNumber();
253 
254  void recalcUnreadCount();
255 
256  void doArticleNotification();
257 
259  void setUnread(int unread);
260 
264  void setArticleDeleted(Article& a);
265 
270  void setArticleChanged(Article& a, int oldStatus=-1);
271 
272  void appendArticles(const Syndication::FeedPtr feed);
273 
275  void appendArticle(const Article& a);
276 
278  bool isExpired(const Article& a) const;
279 
281  bool usesExpiryByAge() const;
282 
284  void tryFetch();
285 
286  void markAsFetchedNow();
287 
288  private slots:
289 
290  void fetchCompleted(Syndication::Loader *loader, Syndication::FeedPtr doc, Syndication::ErrorCode errorCode);
291  void slotImageFetched(const QPixmap& image);
292 
293  private:
294 
295  class Private;
296  Private* d;
297 };
298 
299 } // namespace Akregator
300 
301 #endif // AKREGATOR_FEED_H
treenode.h
AKREGATOR_EXPORT
#define AKREGATOR_EXPORT
Definition: akregator_export.h:35
Akregator::Backend::Storage
Storage is the main interface to the article archive.
Definition: storage.h:43
Akregator::Feed::keepAllArticles
Don't delete any articles.
Definition: feed.h:63
Akregator::Feed::isAggregation
bool isAggregation() const
returns if the node represents an aggregation, i.e.
Definition: feed.h:198
QString
QList
Definition: article.h:41
Akregator::Feed::globalDefault
use default from Settings (default)
Definition: feed.h:62
QPixmap
Akregator::Feed::ArchiveMode
ArchiveMode
the archiving modes
Definition: feed.h:61
QDomDocument
QVector
Akregator::ArticleDeleteJob
Definition: articlejobs.h:69
akregator_export.h
Akregator::TreeNodeVisitor
Definition: treenodevisitor.h:35
Akregator::Feed
represents a feed
Definition: feed.h:53
Akregator::Article
A proxy class for Syndication::ItemPtr with some additional methods to assist sorting.
Definition: article.h:63
Akregator::Feed::limitArticleNumber
Save maxArticleNumber() articles, plus the ones with keep flag set.
Definition: feed.h:65
feediconmanager.h
Akregator::FaviconListener
Definition: feediconmanager.h:40
QDomElement
Akregator::TreeNode
Abstract base class for all kind of elements in the feed tree, like feeds and feed groups (and search...
Definition: treenode.h:58
KJob
Akregator::Feed::isGroup
bool isGroup() const
returns if this node is a feed group (false here)
Definition: feed.h:195
Akregator::FetchQueue
Definition: fetchqueue.h:37
QIcon
Akregator::Feed::disableArchiving
Don't save any articles except articles with keep flag set (equal to maxArticleNumber() == 0) ...
Definition: feed.h:64
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:34:00 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

akregator

Skip menu "akregator"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kdepim API Reference

Skip menu "kdepim API Reference"
  • akonadi_next
  • akregator
  • blogilo
  • calendarsupport
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt2
  • kjots
  • kleopatra
  • kmail
  • knode
  • knotes
  • kontact
  • korgac
  • korganizer
  • ktimetracker
  • libkdepim
  • libkleo
  • libkpgp
  • mailcommon
  • messagelist
  • messageviewer
  • pimprint

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal