akregator/src

folder.h
1 /*
2  This file is part of Akregator.
3 
4  Copyright (C) 2004 Stanislav Karchebny <Stanislav.Karchebny@kdemail.net>
5  2004-2005 Frank Osterfeld <frank.osterfeld@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 AKREGATOR_FOLDER_H
27 #define AKREGATOR_FOLDER_H
28 
29 #include "treenode.h"
30 
31 class TQDomDocument;
32 class TQDomElement;
33 class TQStringList;
34 template <class T> class TQValueList;
35 
36 namespace Akregator
37 {
38  class Article;
39  class FetchQueue;
40  class TreeNodeVisitor;
41 
44  class Folder : public TreeNode
45  {
46  TQ_OBJECT
47 
48  public:
53  static Folder* fromOPML(TQDomElement e);
54 
58  Folder(const TQString& title = TQString());
59 
60  virtual ~Folder();
61 
62  virtual bool accept(TreeNodeVisitor* visitor);
63 
66  virtual TQValueList<Article> articles(const TQString& tag=TQString());
67 
69  virtual TQStringList tags() const;
70 
73  virtual int unread() const;
74 
77  virtual int totalCount() const;
78 
80  virtual bool isGroup() const { return true; }
81 
87  virtual TQDomElement toOPML( TQDomElement parent, TQDomDocument document ) const;
88 
92  virtual TQValueList<TreeNode*> children() const;
93 
98  virtual void insertChild(TreeNode* node, TreeNode* after);
99 
102  virtual void prependChild(TreeNode* node);
103 
106  virtual void appendChild(TreeNode* node);
107 
110  virtual void removeChild(TreeNode* node);
111 
113  virtual TreeNode* firstChild();
114 
116  virtual TreeNode* lastChild();
117 
120  virtual bool isOpen() const;
121 
123  virtual void setOpen(bool open);
124 
125  signals:
128 
131 
132  public slots:
133 
135  virtual void slotDeleteExpiredArticles();
136 
138  virtual void slotMarkAllArticlesAsRead();
139 
143  virtual void slotChildChanged(TreeNode* node);
144 
148  virtual void slotChildDestroyed(TreeNode* node);
149 
153  virtual void slotAddToFetchQueue(FetchQueue* queue, bool intervalFetchesOnly=false);
154 
158  virtual TreeNode* next();
159 
160  protected:
161 
165  virtual void insertChild(uint index, TreeNode* node);
166 
167  virtual void doArticleNotification();
168  private:
169 
170  void connectToNode(TreeNode* child);
171  void disconnectFromNode(TreeNode* child);
172 
173  virtual void updateUnreadCount();
174 
175  class FolderPrivate;
176  FolderPrivate* d;
177  };
178 }
179 
180 #endif // AKREGATOR_FOLDER_H
Represents a folder (containing feeds and/or other folders)
Definition: folder.h:45
static Folder * fromOPML(TQDomElement e)
creates a feed group parsed from a XML dom element.
Definition: folder.cpp:63
Folder(const TQString &title=TQString())
Creates a new folder with a given title.
Definition: folder.cpp:71
virtual bool isOpen() const
returns whether the feed group is opened or not.
Definition: folder.cpp:230
virtual TQValueList< Article > articles(const TQString &tag=TQString())
returns recursively concatenated articles of children
Definition: folder.cpp:108
virtual void doArticleNotification()
reimplement this in subclasses to do the actual notification called by articlesModified
Definition: folder.cpp:305
virtual void insertChild(TreeNode *node, TreeNode *after)
inserts node as child after child node after.
Definition: folder.cpp:138
virtual void slotDeleteExpiredArticles()
Delete expired articles recursively.
Definition: folder.cpp:289
virtual void prependChild(TreeNode *node)
inserts node as first child
Definition: folder.cpp:185
virtual TreeNode * next()
returns the next node in the tree.
Definition: folder.cpp:327
virtual void slotMarkAllArticlesAsRead()
Mark articles of children recursively as read.
Definition: folder.cpp:267
virtual TQValueList< TreeNode * > children() const
returns the (direct) children of this node.
Definition: folder.cpp:133
virtual TreeNode * firstChild()
returns the first child of the group, 0 if none exist
Definition: folder.cpp:220
virtual void removeChild(TreeNode *node)
remove node from children.
Definition: folder.cpp:202
void signalChildRemoved(Folder *, TreeNode *)
emitted when a child was removed
virtual int unread() const
returns the number of unread articles in all children
Definition: folder.cpp:240
virtual void slotAddToFetchQueue(FetchQueue *queue, bool intervalFetchesOnly=false)
enqueues children recursively for fetching
Definition: folder.cpp:298
virtual bool isGroup() const
Helps the rest of the app to decide if node should be handled as group or not.
Definition: folder.h:80
virtual void appendChild(TreeNode *node)
inserts node as last child
Definition: folder.cpp:168
virtual TQDomElement toOPML(TQDomElement parent, TQDomDocument document) const
converts the feed group into OPML format for save and export and appends it to node parent in documen...
Definition: folder.cpp:118
virtual TreeNode * lastChild()
returns the last child of the group, 0 if none exist
Definition: folder.cpp:225
virtual void slotChildChanged(TreeNode *node)
Called when a child was modified.
Definition: folder.cpp:276
virtual int totalCount() const
returns the number of articles in all children
Definition: folder.cpp:245
virtual void setOpen(bool open)
open/close the feed group (display it as expanded/collapsed in the tree view).
Definition: folder.cpp:235
virtual TQStringList tags() const
returns a list of all tags occurring in the subtree of this folder
Definition: folder.cpp:93
void signalChildAdded(TreeNode *)
emitted when a child was added
virtual void slotChildDestroyed(TreeNode *node)
Called when a child was destroyed.
Definition: folder.cpp:282
Abstract base class for all kind of elements in the feed tree, like feeds and feed groups (and search...
Definition: treenode.h:52
virtual const TQString & title() const
Get title of node.
Definition: treenode.cpp:77
virtual Folder * parent() const
Returns the parent node.
Definition: treenode.cpp:115