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  Q_OBJECT
47  TQ_OBJECT
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:
127  void signalChildAdded(TreeNode*);
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