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

akregator

  • sources
  • kde-4.12
  • 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 
47 namespace Backend {
48  class Storage;
49 }
50 
52 class AKREGATOR_EXPORT Feed : public TreeNode, public virtual FaviconListener
53 {
54  friend class ::Akregator::Article;
55  friend class ::Akregator::Folder;
56  Q_OBJECT
57  public:
60  enum ArchiveMode {
61  globalDefault,
62  keepAllArticles,
63  disableArchiving,
64  limitArticleNumber,
65  limitArticleAge
66  };
67 
68  // class methods
72  static ArchiveMode stringToArchiveMode(const QString& str);
73 
75  static QString archiveModeToString(ArchiveMode mode);
76 
78  static Feed* fromOPML(QDomElement e, Akregator::Backend::Storage* storage);
79 
81  explicit Feed( Akregator::Backend::Storage* storage );
82  ~Feed();
83 
84  bool accept(TreeNodeVisitor* visitor);
85 
87  QDomElement toOPML( QDomElement parent, QDomDocument document ) const;
88 
93  bool useCustomFetchInterval() const;
94 
99  void setCustomFetchIntervalEnabled(bool enabled);
100 
101  // FIXME is it -1 or 0 to disable interval fetching?
104  int fetchInterval() const;
105 
108  void setFetchInterval(int interval);
109 
111  ArchiveMode archiveMode() const;
112 
114  void setArchiveMode(ArchiveMode archiveMode);
115 
118  int maxArticleAge() const;
119 
122  void setMaxArticleAge(int maxArticleAge);
123 
124 
126  int maxArticleNumber() const;
127 
129  void setMaxArticleNumber(int maxArticleNumber);
130 
132  bool markImmediatelyAsRead() const;
133 
134  void setMarkImmediatelyAsRead(bool enabled);
135 
136  void setUseNotification(bool enabled);
137 
138  bool useNotification() const;
139 
141  void setLoadLinkedWebsite(bool enabled);
142 
143  bool loadLinkedWebsite() const;
144 
146  QPixmap image() const;
147 
149  void setImage(const QPixmap &p);
150 
152  void setFavicon( const QIcon& icon );
153 
155  QString xmlUrl() const;
157  void setXmlUrl(const QString& s);
158 
160  QString htmlUrl() const;
162  void setHtmlUrl(const QString& s);
163 
165  QString description() const;
166 
168  void setDescription(const QString& s);
169 
175  Article findArticle(const QString& guid) const;
176 
178  bool fetchErrorOccurred() const;
179 
180  Syndication::ErrorCode fetchErrorCode() const;
181 
183  int unread() const;
184 
188  int totalCount() const;
189 
191  bool isArticlesLoaded() const;
192 
194  bool isGroup() const { return false; }
195 
196  //impl
197  bool isAggregation() const { return false; }
198 
202  const TreeNode* next() const;
203  TreeNode* next();
204 
205  //impl
206  QIcon icon() const;
207 
209  void deleteExpiredArticles( Akregator::ArticleDeleteJob* job );
210 
211  bool isFetching() const;
212 
213  QVector<const Feed*> feeds() const;
214  QVector<Feed*> feeds();
215  QVector<const Folder*> folders() const;
216  QVector<Folder*> folders();
217 
218  /* reimp */ KJob* createMarkAsReadJob();
219 
220  public slots:
222  void fetch(bool followDiscovery=false);
223 
224  void slotAbortFetch();
225 
227  void slotAddToFetchQueue(Akregator::FetchQueue* queue, bool intervalFetchOnly=false);
228 
229  void slotAddFeedIconListener();
230 
231  signals:
233  void fetchStarted(Akregator::Feed*);
235  void fetched(Akregator::Feed *);
237  void fetchError(Akregator::Feed *);
239  void fetchDiscovery(Akregator::Feed *);
241  void fetchAborted(Akregator::Feed *);
242 
243  private:
244  Akregator::Backend::Storage* storage();
245 
246  private:
247  QList<Article> articles();
248 
250  void loadArticles();
251  void enforceLimitArticleNumber();
252 
253  void recalcUnreadCount();
254 
255  void doArticleNotification();
256 
258  void setUnread(int unread);
259 
263  void setArticleDeleted(Article& a);
264 
269  void setArticleChanged(Article& a, int oldStatus=-1);
270 
271  void appendArticles(const Syndication::FeedPtr feed);
272 
274  void appendArticle(const Article& a);
275 
277  bool isExpired(const Article& a) const;
278 
280  bool usesExpiryByAge() const;
281 
283  void tryFetch();
284 
285  void markAsFetchedNow();
286 
287  private slots:
288 
289  void fetchCompleted(Syndication::Loader *loader, Syndication::FeedPtr doc, Syndication::ErrorCode errorCode);
290  void slotImageFetched(const QPixmap& image);
291 
292  private:
293 
294  class Private;
295  Private* d;
296 };
297 
298 } // namespace Akregator
299 
300 #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:62
Akregator::Feed::isAggregation
bool isAggregation() const
returns if the node represents an aggregation, i.e.
Definition: feed.h:197
Akregator::Feed::globalDefault
use default from Settings (default)
Definition: feed.h:61
Akregator::Feed::ArchiveMode
ArchiveMode
the archiving modes
Definition: feed.h:60
Akregator::ArticleDeleteJob
Definition: articlejobs.h:67
akregator_export.h
Akregator::TreeNodeVisitor
Definition: treenodevisitor.h:35
Akregator::Feed
represents a feed
Definition: feed.h:52
Akregator::Article
A proxy class for Syndication::ItemPtr with some additional methods to assist sorting.
Definition: article.h:61
Akregator::Feed::limitArticleNumber
Save maxArticleNumber() articles, plus the ones with keep flag set.
Definition: feed.h:64
feediconmanager.h
Akregator::FaviconListener
Definition: feediconmanager.h:41
Akregator::TreeNode
Abstract base class for all kind of elements in the feed tree, like feeds and feed groups (and search...
Definition: treenode.h:59
KJob
Akregator::Feed::isGroup
bool isGroup() const
returns if this node is a feed group (false here)
Definition: feed.h:194
Akregator::FetchQueue
Definition: fetchqueue.h:37
QList
Definition: article.h:39
Akregator::Feed::disableArchiving
Don't save any articles except articles with keep flag set (equal to maxArticleNumber() == 0) ...
Definition: feed.h:63
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:58:14 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

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