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 Qt, and distribute the resulting executable,
00023     without including the source code for Qt in the source distribution.
00024 */
00025 
00026 #ifndef AKREGATORTREENODE_H
00027 #define AKREGATORTREENODE_H
00028 
00029 #include <qobject.h>
00030 
00031 class QDomDocument;
00032 class QDomElement;
00033 class QString;
00034 class QStringList;
00035 template <class T> class QValueList;
00036 
00037 namespace Akregator 
00038 {
00039 
00040 class TreeNodeVisitor;
00041 class Article;
00042 class Folder;
00043 class FetchQueue;
00044 
00045 
00051 class TreeNode : public QObject
00052 {
00053 Q_OBJECT
00054 
00055 public:
00056         
00058     TreeNode();
00059 
00061     virtual ~TreeNode();
00062 
00063     virtual bool accept(TreeNodeVisitor* visitor) = 0;
00064     
00068     virtual int unread() const = 0;
00069     
00070 
00074     virtual int totalCount() const = 0;
00075 
00076     
00080     virtual const QString& title() const;
00081     
00082     
00087     virtual void setTitle(const QString& title);
00088     
00089     
00093     virtual TreeNode* nextSibling() const;
00094     
00095     
00099     virtual TreeNode* prevSibling() const;
00100     
00101     
00105     virtual Folder* parent() const;
00106     
00107     
00111     virtual void setParent(Folder* parent);
00112     
00113     
00118     virtual QValueList<Article> articles(const QString& tag=QString::null) = 0;
00119 
00122     virtual QStringList tags() const = 0;
00123     
00127     virtual bool isGroup() const = 0;
00128 
00133     virtual QDomElement toOPML( QDomElement parent, QDomDocument document ) const = 0;
00134     
00139     virtual void setNotificationMode(bool doNotify, bool notifyOccurredChanges = true);  
00143     virtual TreeNode* next() = 0; 
00144 
00149     virtual uint id() const;
00150 
00152     virtual void setId(uint id);
00153 
00154 public slots:
00155     
00159     virtual void slotDeleteExpiredArticles() = 0;
00160     
00161     
00165     virtual void slotMarkAllArticlesAsRead() = 0;
00166 
00171     virtual void slotAddToFetchQueue(FetchQueue* queue, bool intervalFetchesOnly=false) = 0;
00172       
00173 signals:
00174     
00176      void signalDestroyed(TreeNode*);
00177  
00179     void signalChanged(TreeNode*);
00180 
00185     void signalArticlesAdded(TreeNode* node, const QValueList<Article>& guids);
00186     
00188     void signalArticlesUpdated(TreeNode*, const QValueList<Article>& guids);
00189     
00191     void signalArticlesRemoved(TreeNode*, const QValueList<Article>& guids);
00192 
00193 protected:
00194 
00198     virtual void nodeModified();
00199     
00202     virtual void articlesModified();
00203 
00207     virtual void doArticleNotification();
00208 
00209     void emitSignalDestroyed();
00210     
00211 private:
00212     class TreeNodePrivate;
00213     TreeNodePrivate* d;
00214 };
00215 
00216 }
00217 
00218 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys