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 Q_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 
177  void signalDestroyed(TreeNode*);
178 
180  void signalChanged(TreeNode*);
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