akregator/src

treenode.h
1 
2 /*
3  This file is part of Akregator.
4 
5  Copyright (C) 2004 Frank Osterfeld <frank.osterfeld at kdemail.net>
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 TQt, and distribute the resulting executable,
23  without including the source code for TQt in the source distribution.
24 */
25 
26 #ifndef AKREGATORTREENODE_H
27 #define AKREGATORTREENODE_H
28 
29 #include <tqobject.h>
30 
31 class TQDomDocument;
32 class TQDomElement;
33 class TQString;
34 class TQStringList;
35 template <class T> class TQValueList;
36 
37 namespace Akregator
38 {
39 
40 class TreeNodeVisitor;
41 class Article;
42 class Folder;
43 class FetchQueue;
44 
45 
51 class TreeNode : public TQObject
52 {
53 TQ_OBJECT
54 
55 
56 public:
57 
59  TreeNode();
60 
62  virtual ~TreeNode();
63 
64  virtual bool accept(TreeNodeVisitor* visitor) = 0;
65 
69  virtual int unread() const = 0;
70 
71 
75  virtual int totalCount() const = 0;
76 
77 
81  virtual const TQString& title() const;
82 
83 
88  virtual void setTitle(const TQString& title);
89 
90 
94  virtual TreeNode* nextSibling() const;
95 
96 
100  virtual TreeNode* prevSibling() const;
101 
102 
106  virtual Folder* parent() const;
107 
108 
112  virtual void setParent(Folder* parent);
113 
114 
119  virtual TQValueList<Article> articles(const TQString& tag=TQString()) = 0;
120 
123  virtual TQStringList tags() const = 0;
124 
128  virtual bool isGroup() const = 0;
129 
134  virtual TQDomElement toOPML( TQDomElement parent, TQDomDocument document ) const = 0;
135 
140  virtual void setNotificationMode(bool doNotify, bool notifyOccurredChanges = true);
144  virtual TreeNode* next() = 0;
145 
150  virtual uint id() const;
151 
153  virtual void setId(uint id);
154 
155 public slots:
156 
160  virtual void slotDeleteExpiredArticles() = 0;
161 
162 
166  virtual void slotMarkAllArticlesAsRead() = 0;
167 
172  virtual void slotAddToFetchQueue(FetchQueue* queue, bool intervalFetchesOnly=false) = 0;
173 
174 signals:
175 
178 
181 
186  void signalArticlesAdded(TreeNode* node, const TQValueList<Article>& guids);
187 
189  void signalArticlesUpdated(TreeNode*, const TQValueList<Article>& guids);
190 
192  void signalArticlesRemoved(TreeNode*, const TQValueList<Article>& guids);
193 
194 protected:
195 
199  virtual void nodeModified();
200 
203  virtual void articlesModified();
204 
208  virtual void doArticleNotification();
209 
210  void emitSignalDestroyed();
211 
212 private:
213  class TreeNodePrivate;
214  TreeNodePrivate* d;
215 };
216 
217 }
218 
219 #endif
Represents a folder (containing feeds and/or other folders)
Definition: folder.h:45
Abstract base class for all kind of elements in the feed tree, like feeds and feed groups (and search...
Definition: treenode.h:52
virtual TreeNode * nextSibling() const
Get the next sibling.
Definition: treenode.cpp:92
virtual uint id() const
returns the ID of this node.
Definition: treenode.cpp:145
virtual bool isGroup() const =0
Helps the rest of the app to decide if node should be handled as group or not.
virtual int totalCount() const =0
returns the number of total articles in the node (for groups: the accumulated count of the subtree)
virtual void setTitle(const TQString &title)
Sets the title of the node.
Definition: treenode.cpp:82
void signalArticlesAdded(TreeNode *node, const TQValueList< Article > &guids)
emitted when new articles were added to this node or any node in the subtree (for folders).
virtual TreeNode * next()=0
returns the next node in the tree.
virtual TreeNode * prevSibling() const
Get the previous sibling.
Definition: treenode.cpp:104
virtual void setNotificationMode(bool doNotify, bool notifyOccurredChanges=true)
Definition: treenode.cpp:125
virtual void slotMarkAllArticlesAsRead()=0
Marks all articles in this node as read.
TreeNode()
Standard constructor.
Definition: treenode.cpp:48
void signalArticlesUpdated(TreeNode *, const TQValueList< Article > &guids)
emitted when articles were updated
virtual void slotAddToFetchQueue(FetchQueue *queue, bool intervalFetchesOnly=false)=0
adds node to a fetch queue
virtual void doArticleNotification()
reimplement this in subclasses to do the actual notification called by articlesModified
Definition: treenode.cpp:171
virtual void articlesModified()
call this if the articles in the node were changed.
Definition: treenode.cpp:163
void signalChanged(TreeNode *)
Notification mechanism: emitted, when the node was modified and notification is enabled.
virtual TQStringList tags() const =0
returns a list of all tags occurring in this node (sub tree for folders)
void signalArticlesRemoved(TreeNode *, const TQValueList< Article > &guids)
emitted when articles were removed from this subtree.
virtual TQValueList< Article > articles(const TQString &tag=TQString())=0
Returns a sequence of the articles this node contains.
virtual ~TreeNode()
Standard destructor.
Definition: treenode.cpp:70
virtual void setId(uint id)
sets the ID
Definition: treenode.cpp:150
virtual int unread() const =0
The unread count, returns the number of new/unread articles in the node (for groups: the accumulated ...
virtual const TQString & title() const
Get title of node.
Definition: treenode.cpp:77
virtual void setParent(Folder *parent)
Sets parent node; Don't call this directly, is done automatically by insertChild-methods in Folder.
Definition: treenode.cpp:120
virtual void nodeModified()
call this if you modified the actual node (title, unread count).
Definition: treenode.cpp:155
virtual Folder * parent() const
Returns the parent node.
Definition: treenode.cpp:115
virtual void slotDeleteExpiredArticles()=0
Deletes all expired articles in the node (depending on the expiry settings).
virtual TQDomElement toOPML(TQDomElement parent, TQDomDocument document) const =0
exports node and child nodes to OPML (with akregator settings)
void signalDestroyed(TreeNode *)
Emitted when this object is deleted.