akregator/src

feedlistview.h

00001 /*
00002     This file is part of Akregator.
00003 
00004     Copyright (C) 2004 Stanislav Karchebny <Stanislav.Karchebny@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 #ifndef AKREGATORFEEDLISTVIEW_H
00025 #define AKREGATORFEEDLISTVIEW_H
00026 
00027 #include <tdelistview.h>
00028 #include <kurl.h>
00029 
00030 namespace Akregator
00031 {
00032 class Feed;
00033 class Folder;
00034 class NodeList;
00035 class TreeNode;
00036 class TreeNodeItem;
00037 class TagNodeList;
00038 
00039 class NodeListView : public TDEListView
00040 {
00041 Q_OBJECT
00042   
00043 public:
00044     NodeListView( TQWidget *parent = 0, const char *name = 0 );
00045     virtual ~NodeListView();
00046     
00048     void setNodeList(NodeList* nodeList);
00049 
00053     Folder* rootNode();
00054     
00058     TreeNode* selectedNode();
00059 
00063     void setSelectedNode(TreeNode* node);
00064 
00070     TreeNode* findNodeByTitle(const TQString& title);
00071 
00073     void ensureNodeVisible(TreeNode* node);
00074 
00076     void startNodeRenaming(TreeNode* node);
00077     
00078     
00080     virtual void clear();
00081 
00083     void setShowTagFolders(bool enabled);
00084 
00085 public slots:
00086     
00088     void slotItemUp();
00090     void slotItemDown();
00092     void slotItemBegin();
00094     void slotItemEnd();
00096     void slotItemLeft();
00098     void slotItemRight();
00099 
00100     void slotPrevFeed();
00101     void slotNextFeed();
00102     void slotPrevUnreadFeed();
00103     void slotNextUnreadFeed();
00104     
00105 signals:
00106     void signalDropped (KURL::List &, TreeNode*, Folder*);
00107     void signalNodeSelected(TreeNode*);
00108     void signalRootNodeChanged(NodeListView*, TreeNode*);
00109     void signalContextMenu(TDEListView*, TreeNode*, const TQPoint&);
00110 
00111 public:         // compat with KDE-3.x assertions, remove for KDE 4
00112 // protected:
00113 
00118     TreeNodeItem* findNodeItem(TreeNode* node);
00119 
00121     virtual TreeNodeItem* findItemByTitle(const TQString& text, int column, ComparisonFlags compare = ExactMatch | CaseSensitive ) const;
00122 
00124     virtual void connectToNode(TreeNode* node);
00125 
00127     virtual void disconnectFromNode(TreeNode* node);
00128 
00129     virtual void connectToNodeList(NodeList* list);
00130     virtual void disconnectFromNodeList(NodeList* list);
00131     
00132     virtual void drawContentsOffset( TQPainter * p, int ox, int oy,
00133                                         int cx, int cy, int cw, int ch );
00134     virtual void contentsDragMoveEvent(TQDragMoveEvent* event);
00135     virtual bool acceptDrag(TQDropEvent *event) const;
00136     virtual void movableDropEvent(TQListViewItem* parent, TQListViewItem* afterme);
00137 
00138     virtual TQDragObject *dragObject();
00139             
00140 
00141 protected slots:
00142     
00143 
00144     void slotDropped(TQDropEvent *e, TQListViewItem* after);
00145     void slotRootNodeChanged(TreeNode*);
00146     virtual void slotSelectionChanged(TQListViewItem* item);
00147     virtual void slotContextMenu(TDEListView* list, TQListViewItem* item, const TQPoint& p);
00148     virtual void slotItemRenamed(TQListViewItem* item, int col, const TQString& text);
00149     virtual void slotFeedFetchStarted(Feed* feed);
00150     virtual void slotFeedFetchAborted(Feed* feed);
00151     virtual void slotFeedFetchError(Feed* feed);
00152     virtual void slotFeedFetchCompleted(Feed* feed);
00153     void openFolder();
00154 
00156     virtual void slotNodeAdded(TreeNode* node);
00157     
00161     virtual void slotNodeRemoved(Folder* parent, TreeNode* node);
00162     
00164     virtual void slotNodeDestroyed(TreeNode* node);
00165     
00167     virtual void slotNodeChanged(TreeNode* node);
00168 
00169     virtual void slotNodeListDestroyed(NodeList*);
00170 
00171 public:         // compat with KDE-3.x assertions, remove for KDE 4
00172 // private:
00173     friend class ConnectNodeVisitor;
00174     class ConnectNodeVisitor;
00175     
00176     friend class DisconnectNodeVisitor;
00177     class DisconnectNodeVisitor;
00178 
00179     friend class CreateItemVisitor;
00180     class CreateItemVisitor;
00181 
00182     friend class DeleteItemVisitor;
00183     class DeleteItemVisitor;
00184     
00185     friend class DragAndDropVisitor;
00186     class DragAndDropVisitor;
00187 
00188     class NodeListViewPrivate;
00189     NodeListViewPrivate* d;
00190 };
00191 
00192 
00193 class TagNodeListView : public NodeListView
00194 {
00195     Q_OBJECT
00196   
00197     public:
00198         TagNodeListView(TQWidget *parent = 0, const char *name = 0) {} 
00199         virtual ~TagNodeListView() {}
00200 
00201     private:
00202         class TagNodeListViewPrivate;
00203         TagNodeListViewPrivate* d;
00204 };
00205 
00206 } // namespace Akregator
00207 
00208 #endif