nodelist.h
00001 /* 00002 This file is part of Akregator. 00003 00004 Copyright (C) 2005 Frank Osterfeld <frank.osterfeld at kdemail.net> 00005 00006 This program is free software; you can redistribute it and/or modify 00007 it under the terms of the GNU General Public License as published by 00008 the Free Software Foundation; either version 2 of the License, or 00009 (at your option) any later version. 00010 00011 This program is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 GNU General Public License for more details. 00015 00016 You should have received a copy of the GNU General Public License 00017 along with this program; if not, write to the Free Software 00018 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00019 00020 As a special exception, permission is given to link this program 00021 with any edition of TQt, and distribute the resulting executable, 00022 without including the source code for TQt in the source distribution. 00023 */ 00024 00025 #ifndef AKREGATOR_NODELIST_H 00026 #define AKREGATOR_NODELIST_H 00027 00028 #include <tqobject.h> 00029 00030 class TQDomDocument; 00031 class TQDomNode; 00032 class TQString; 00033 00034 template <class K,class T> class TQMap; 00035 template <class T> class TQValueList; 00036 00037 // hack for KDE 3.x series 00038 #ifdef signals 00039 # undef signals 00040 # define signals public 00041 #endif 00042 00043 namespace Akregator { 00044 00045 class Folder; 00046 class TreeNode; 00047 00048 class NodeList : public TQObject 00049 { 00050 00051 Q_OBJECT 00052 00053 00054 public: 00055 NodeList(TQObject *parent=0, const char *name=0); 00056 virtual ~NodeList(); 00057 00058 virtual Folder* rootNode() const; 00059 00060 virtual bool readFromXML(const TQDomDocument& doc) = 0; 00061 00062 virtual TQDomDocument toXML() const = 0; 00063 00064 virtual bool isEmpty() const; 00065 00066 TreeNode* findByID(int id) const; 00067 00069 const TQString& title() const; 00070 00072 void setTitle(const TQString& name); 00073 00075 const TQValueList<TreeNode*>& asFlatList() const; 00076 00077 signals: 00078 void signalDestroyed(NodeList*); 00080 void signalNodeAdded(TreeNode*); 00082 void signalNodeRemoved(TreeNode*); 00083 00084 public slots: 00085 00089 void clear(); 00090 00091 public: // compat with KDE-3.x assertions, remove for KDE 4 00092 // protected: 00093 00094 TQValueList<TreeNode*>* flatList() const; 00095 TQMap<int, TreeNode*>* idMap() const; 00096 00097 int generateID(); 00098 void setRootNode(Folder* folder); 00099 virtual void addNode(TreeNode* node, bool preserveID); 00100 virtual void removeNode(TreeNode* node); 00101 00102 public slots: // compat with KDE-3.x assertions, remove for KDE 4 00103 // protected slots: 00104 00105 virtual void slotNodeDestroyed(TreeNode* node); 00106 virtual void slotNodeAdded(TreeNode* node); 00107 virtual void slotNodeRemoved(Folder* parent, TreeNode* node); 00108 00109 public: // compat with KDE-3.x assertions, remove for KDE 4 00110 // private: 00111 NodeList(const NodeList&) : TQObject() {} 00112 NodeList& operator=(const NodeList&) { return *this; } 00113 00114 friend class AddNodeVisitor; 00115 class AddNodeVisitor; 00116 00117 friend class RemoveNodeVisitor; 00118 class RemoveNodeVisitor; 00119 00120 class NodeListPrivate; 00121 NodeListPrivate* d; 00122 00123 }; 00124 00125 } // namespace Akregator 00126 00127 #endif // AKREGATOR_NODELIST_H