akregator/src

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 Qt, and distribute the resulting executable,
00022     without including the source code for Qt in the source distribution.
00023 */
00024 
00025 #ifndef AKREGATOR_NODELIST_H
00026 #define AKREGATOR_NODELIST_H
00027 
00028 #include <qobject.h>
00029 
00030 class QDomDocument;
00031 class QDomNode;
00032 class QString;
00033 
00034 template <class K,class T> class QMap;
00035 template <class T> class QValueList;
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 QObject
00049 {
00050 
00051 Q_OBJECT
00052 
00053 public:
00054     NodeList(QObject *parent=0, const char *name=0);
00055     virtual ~NodeList();
00056 
00057     virtual Folder* rootNode() const;
00058 
00059     virtual bool readFromXML(const QDomDocument& doc) = 0;
00060 
00061     virtual QDomDocument toXML() const = 0;
00062 
00063     virtual bool isEmpty() const;
00064 
00065     TreeNode* findByID(int id) const;
00066 
00068     const QString& title() const;
00069 
00071     void setTitle(const QString& name);
00072 
00074     const QValueList<TreeNode*>& asFlatList() const;
00075 
00076 signals:
00077     void signalDestroyed(NodeList*);
00079     void signalNodeAdded(TreeNode*);
00081     void signalNodeRemoved(TreeNode*);
00082 
00083 public slots:
00084 
00088     void clear();
00089 
00090 public:         // compat with KDE-3.x assertions, remove for KDE 4
00091 // protected:
00092 
00093     QValueList<TreeNode*>* flatList() const;
00094     QMap<int, TreeNode*>* idMap() const;
00095     
00096     int generateID();
00097     void setRootNode(Folder* folder);
00098     virtual void addNode(TreeNode* node, bool preserveID);
00099     virtual void removeNode(TreeNode* node);
00100   
00101 public slots:         // compat with KDE-3.x assertions, remove for KDE 4
00102 // protected slots:
00103 
00104     virtual void slotNodeDestroyed(TreeNode* node);
00105     virtual void slotNodeAdded(TreeNode* node);
00106     virtual void slotNodeRemoved(Folder* parent, TreeNode* node);
00107 
00108 public:         // compat with KDE-3.x assertions, remove for KDE 4
00109 // private:
00110     NodeList(const NodeList&) : QObject() {}
00111     NodeList& operator=(const NodeList&) { return *this; }
00112 
00113     friend class AddNodeVisitor;
00114     class AddNodeVisitor;
00115 
00116     friend class RemoveNodeVisitor;
00117     class RemoveNodeVisitor;
00118 
00119     class NodeListPrivate;
00120     NodeListPrivate* d;
00121     
00122 };
00123 
00124 } // namespace Akregator
00125 
00126 #endif // AKREGATOR_NODELIST_H
KDE Home | KDE Accessibility Home | Description of Access Keys