akregator/src

folder.h

00001 /*
00002     This file is part of Akregator.
00003 
00004     Copyright (C) 2004 Stanislav Karchebny <Stanislav.Karchebny@kdemail.net>
00005                   2004-2005 Frank Osterfeld <frank.osterfeld@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 AKREGATOR_FOLDER_H
00027 #define AKREGATOR_FOLDER_H
00028 
00029 #include "treenode.h"
00030 
00031 class QDomDocument;
00032 class QDomElement;
00033 class QStringList;
00034 template <class T> class QValueList;
00035 
00036 namespace Akregator
00037 {
00038     class Article;
00039     class FetchQueue;
00040     class TreeNodeVisitor;
00041         
00044     class Folder : public TreeNode
00045     {
00046         Q_OBJECT
00047         public:
00052             static Folder* fromOPML(QDomElement e);
00053             
00057             Folder(const QString& title = QString::null);
00058             
00059             virtual ~Folder();
00060 
00061             virtual bool accept(TreeNodeVisitor* visitor);
00062             
00065             virtual QValueList<Article> articles(const QString& tag=QString::null);
00066 
00068             virtual QStringList tags() const;
00069             
00072             virtual int unread() const;
00073             
00076             virtual int totalCount() const;
00077             
00079             virtual bool isGroup() const { return true; }
00080 
00086             virtual QDomElement toOPML( QDomElement parent, QDomDocument document ) const;
00087             
00091             virtual QValueList<TreeNode*> children() const;
00092             
00097             virtual void insertChild(TreeNode* node, TreeNode* after);
00098             
00101             virtual void prependChild(TreeNode* node);
00102 
00105             virtual void appendChild(TreeNode* node);
00106 
00109             virtual void removeChild(TreeNode* node);
00110 
00112             virtual TreeNode* firstChild();
00113             
00115             virtual TreeNode* lastChild();
00116             
00119             virtual bool isOpen() const;
00120             
00122             virtual void setOpen(bool open);
00123             
00124         signals:
00126             void signalChildAdded(TreeNode*);
00127 
00129             void signalChildRemoved(Folder*, TreeNode*);
00130                        
00131         public slots:
00132             
00134             virtual void slotDeleteExpiredArticles();
00135             
00137             virtual void slotMarkAllArticlesAsRead();
00138  
00142             virtual void slotChildChanged(TreeNode* node);
00143             
00147             virtual void slotChildDestroyed(TreeNode* node);
00148 
00152             virtual void slotAddToFetchQueue(FetchQueue* queue, bool intervalFetchesOnly=false);
00153 
00157             virtual TreeNode* next();
00158 
00159         protected:
00160         
00164             virtual void insertChild(uint index, TreeNode* node);
00165 
00166             virtual void doArticleNotification();
00167         private:
00168 
00169             void connectToNode(TreeNode* child);
00170             void disconnectFromNode(TreeNode* child);
00171             
00172             virtual void updateUnreadCount();
00173             
00174             class FolderPrivate;
00175             FolderPrivate* d;
00176     };
00177 }
00178 
00179 #endif // AKREGATOR_FOLDER_H
KDE Home | KDE Accessibility Home | Description of Access Keys