akregator/src

treenode.h

00001 
00002 /*
00003     This file is part of Akregator.
00004 
00005     Copyright (C) 2004 Frank Osterfeld <frank.osterfeld at kdemail.net>
00006 
00007     This program is free software; you can redistribute it and/or modify
00008     it under the terms of the GNU General Public License as published by
00009     the Free Software Foundation; either version 2 of the License, or
00010     (at your option) any later version.
00011 
00012     This program is distributed in the hope that it will be useful,
00013     but WITHOUT ANY WARRANTY; without even the implied warranty of
00014     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00015     GNU General Public License for more details.
00016 
00017     You should have received a copy of the GNU General Public License
00018     along with this program; if not, write to the Free Software
00019     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00020 
00021     As a special exception, permission is given to link this program
00022     with any edition of TQt, and distribute the resulting executable,
00023     without including the source code for TQt in the source distribution.
00024 */
00025 
00026 #ifndef AKREGATORTREENODE_H
00027 #define AKREGATORTREENODE_H
00028 
00029 #include <tqobject.h>
00030 
00031 class TQDomDocument;
00032 class TQDomElement;
00033 class TQString;
00034 class TQStringList;
00035 template <class T> class TQValueList;
00036 
00037 namespace Akregator 
00038 {
00039 
00040 class TreeNodeVisitor;
00041 class Article;
00042 class Folder;
00043 class FetchQueue;
00044 
00045 
00051 class TreeNode : public TQObject
00052 {
00053 Q_OBJECT
00054   
00055 
00056 public:
00057         
00059     TreeNode();
00060 
00062     virtual ~TreeNode();
00063 
00064     virtual bool accept(TreeNodeVisitor* visitor) = 0;
00065     
00069     virtual int unread() const = 0;
00070     
00071 
00075     virtual int totalCount() const = 0;
00076 
00077     
00081     virtual const TQString& title() const;
00082     
00083     
00088     virtual void setTitle(const TQString& title);
00089     
00090     
00094     virtual TreeNode* nextSibling() const;
00095     
00096     
00100     virtual TreeNode* prevSibling() const;
00101     
00102     
00106     virtual Folder* parent() const;
00107     
00108     
00112     virtual void setParent(Folder* parent);
00113     
00114     
00119     virtual TQValueList<Article> articles(const TQString& tag=TQString()) = 0;
00120 
00123     virtual TQStringList tags() const = 0;
00124     
00128     virtual bool isGroup() const = 0;
00129 
00134     virtual TQDomElement toOPML( TQDomElement parent, TQDomDocument document ) const = 0;
00135     
00140     virtual void setNotificationMode(bool doNotify, bool notifyOccurredChanges = true);  
00144     virtual TreeNode* next() = 0; 
00145 
00150     virtual uint id() const;
00151 
00153     virtual void setId(uint id);
00154 
00155 public slots:
00156     
00160     virtual void slotDeleteExpiredArticles() = 0;
00161     
00162     
00166     virtual void slotMarkAllArticlesAsRead() = 0;
00167 
00172     virtual void slotAddToFetchQueue(FetchQueue* queue, bool intervalFetchesOnly=false) = 0;
00173       
00174 signals:
00175     
00177      void signalDestroyed(TreeNode*);
00178  
00180     void signalChanged(TreeNode*);
00181 
00186     void signalArticlesAdded(TreeNode* node, const TQValueList<Article>& guids);
00187     
00189     void signalArticlesUpdated(TreeNode*, const TQValueList<Article>& guids);
00190     
00192     void signalArticlesRemoved(TreeNode*, const TQValueList<Article>& guids);
00193 
00194 protected:
00195 
00199     virtual void nodeModified();
00200     
00203     virtual void articlesModified();
00204 
00208     virtual void doArticleNotification();
00209 
00210     void emitSignalDestroyed();
00211     
00212 private:
00213     class TreeNodePrivate;
00214     TreeNodePrivate* d;
00215 };
00216 
00217 }
00218 
00219 #endif