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 TQt, and distribute the resulting executable,
00023     without including the source code for TQt in the source distribution.
00024 */
00025 
00026 #ifndef AKREGATOR_FOLDER_H
00027 #define AKREGATOR_FOLDER_H
00028 
00029 #include "treenode.h"
00030 
00031 class TQDomDocument;
00032 class TQDomElement;
00033 class TQStringList;
00034 template <class T> class TQValueList;
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   TQ_OBJECT
00048         public:
00053             static Folder* fromOPML(TQDomElement e);
00054             
00058             Folder(const TQString& title = TQString());
00059             
00060             virtual ~Folder();
00061 
00062             virtual bool accept(TreeNodeVisitor* visitor);
00063             
00066             virtual TQValueList<Article> articles(const TQString& tag=TQString());
00067 
00069             virtual TQStringList tags() const;
00070             
00073             virtual int unread() const;
00074             
00077             virtual int totalCount() const;
00078             
00080             virtual bool isGroup() const { return true; }
00081 
00087             virtual TQDomElement toOPML( TQDomElement parent, TQDomDocument document ) const;
00088             
00092             virtual TQValueList<TreeNode*> children() const;
00093             
00098             virtual void insertChild(TreeNode* node, TreeNode* after);
00099             
00102             virtual void prependChild(TreeNode* node);
00103 
00106             virtual void appendChild(TreeNode* node);
00107 
00110             virtual void removeChild(TreeNode* node);
00111 
00113             virtual TreeNode* firstChild();
00114             
00116             virtual TreeNode* lastChild();
00117             
00120             virtual bool isOpen() const;
00121             
00123             virtual void setOpen(bool open);
00124             
00125         signals:
00127             void signalChildAdded(TreeNode*);
00128 
00130             void signalChildRemoved(Folder*, TreeNode*);
00131                        
00132         public slots:
00133             
00135             virtual void slotDeleteExpiredArticles();
00136             
00138             virtual void slotMarkAllArticlesAsRead();
00139  
00143             virtual void slotChildChanged(TreeNode* node);
00144             
00148             virtual void slotChildDestroyed(TreeNode* node);
00149 
00153             virtual void slotAddToFetchQueue(FetchQueue* queue, bool intervalFetchesOnly=false);
00154 
00158             virtual TreeNode* next();
00159 
00160         protected:
00161         
00165             virtual void insertChild(uint index, TreeNode* node);
00166 
00167             virtual void doArticleNotification();
00168         private:
00169 
00170             void connectToNode(TreeNode* child);
00171             void disconnectFromNode(TreeNode* child);
00172             
00173             virtual void updateUnreadCount();
00174             
00175             class FolderPrivate;
00176             FolderPrivate* d;
00177     };
00178 }
00179 
00180 #endif // AKREGATOR_FOLDER_H