akregator/src

feedlistview.h
1 /*
2  This file is part of Akregator.
3 
4  Copyright (C) 2004 Stanislav Karchebny <Stanislav.Karchebny@kdemail.net>
5 
6  This program is free software; you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation; either version 2 of the License, or
9  (at your option) any later version.
10 
11  This program is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with this program; if not, write to the Free Software
18  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 
20  As a special exception, permission is given to link this program
21  with any edition of TQt, and distribute the resulting executable,
22  without including the source code for TQt in the source distribution.
23 */
24 #ifndef AKREGATORFEEDLISTVIEW_H
25 #define AKREGATORFEEDLISTVIEW_H
26 
27 #include <tdelistview.h>
28 #include <kurl.h>
29 
30 namespace Akregator
31 {
32 class Feed;
33 class Folder;
34 class NodeList;
35 class TreeNode;
36 class TreeNodeItem;
37 class TagNodeList;
38 
39 class NodeListView : public TDEListView
40 {
41 TQ_OBJECT
42 
43 public:
44  NodeListView( TQWidget *parent = 0, const char *name = 0 );
45  virtual ~NodeListView();
46 
48  void setNodeList(NodeList* nodeList);
49 
53  Folder* rootNode();
54 
58  TreeNode* selectedNode();
59 
63  void setSelectedNode(TreeNode* node);
64 
70  TreeNode* findNodeByTitle(const TQString& title);
71 
73  void ensureNodeVisible(TreeNode* node);
74 
76  void startNodeRenaming(TreeNode* node);
77 
78 
80  virtual void clear();
81 
83  void setShowTagFolders(bool enabled);
84 
85 public slots:
86 
88  void slotItemUp();
90  void slotItemDown();
92  void slotItemBegin();
94  void slotItemEnd();
96  void slotItemLeft();
98  void slotItemRight();
99 
100  void slotPrevFeed();
101  void slotNextFeed();
102  void slotPrevUnreadFeed();
103  void slotNextUnreadFeed();
104 
105 signals:
106  void signalDropped (KURL::List &, TreeNode*, Folder*);
107  void signalNodeSelected(TreeNode*);
108  void signalRootNodeChanged(NodeListView*, TreeNode*);
109  void signalContextMenu(TDEListView*, TreeNode*, const TQPoint&);
110 
111 public: // compat with KDE-3.x assertions, remove for KDE 4
112 // protected:
113 
118  TreeNodeItem* findNodeItem(TreeNode* node);
119 
121  virtual TreeNodeItem* findItemByTitle(const TQString& text, int column, ComparisonFlags compare = ExactMatch | CaseSensitive ) const;
122 
124  virtual void connectToNode(TreeNode* node);
125 
127  virtual void disconnectFromNode(TreeNode* node);
128 
129  virtual void connectToNodeList(NodeList* list);
130  virtual void disconnectFromNodeList(NodeList* list);
131 
132  virtual void drawContentsOffset( TQPainter * p, int ox, int oy,
133  int cx, int cy, int cw, int ch );
134  virtual void contentsDragMoveEvent(TQDragMoveEvent* event);
135  virtual bool acceptDrag(TQDropEvent *event) const;
136  virtual void movableDropEvent(TQListViewItem* parent, TQListViewItem* afterme);
137 
138  virtual TQDragObject *dragObject();
139 
140 
141 protected slots:
142 
143 
144  void slotDropped(TQDropEvent *e, TQListViewItem* after);
145  void slotRootNodeChanged(TreeNode*);
146  virtual void slotSelectionChanged(TQListViewItem* item);
147  virtual void slotContextMenu(TDEListView* list, TQListViewItem* item, const TQPoint& p);
148  virtual void slotItemRenamed(TQListViewItem* item, int col, const TQString& text);
149  virtual void slotFeedFetchStarted(Feed* feed);
150  virtual void slotFeedFetchAborted(Feed* feed);
151  virtual void slotFeedFetchError(Feed* feed);
152  virtual void slotFeedFetchCompleted(Feed* feed);
153  void openFolder();
154 
156  virtual void slotNodeAdded(TreeNode* node);
157 
161  virtual void slotNodeRemoved(Folder* parent, TreeNode* node);
162 
164  virtual void slotNodeDestroyed(TreeNode* node);
165 
167  virtual void slotNodeChanged(TreeNode* node);
168 
169  virtual void slotNodeListDestroyed(NodeList*);
170 
171 public: // compat with KDE-3.x assertions, remove for KDE 4
172 // private:
173  friend class ConnectNodeVisitor;
174  class ConnectNodeVisitor;
175 
176  friend class DisconnectNodeVisitor;
177  class DisconnectNodeVisitor;
178 
179  friend class CreateItemVisitor;
180  class CreateItemVisitor;
181 
182  friend class DeleteItemVisitor;
183  class DeleteItemVisitor;
184 
185  friend class DragAndDropVisitor;
186  class DragAndDropVisitor;
187 
188  class NodeListViewPrivate;
189  NodeListViewPrivate* d;
190 };
191 
192 
193 class TagNodeListView : public NodeListView
194 {
195  TQ_OBJECT
196 
197  public:
198  TagNodeListView(TQWidget *parent = 0, const char *name = 0) {}
199  virtual ~TagNodeListView() {}
200 
201  private:
202  class TagNodeListViewPrivate;
203  TagNodeListViewPrivate* d;
204 };
205 
206 } // namespace Akregator
207 
208 #endif