akregator/src

articlelistview.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 AKREGATORARTICLELISTVIEW_H
25 #define AKREGATORARTICLELISTVIEW_H
26 
27 #include <tdelistview.h>
28 
29 class TQKeyEvent;
30 class TQDragObject;
31 template <class T> class TQValueList;
32 
33 namespace Akregator
34 {
35  class Article;
36  class TreeNode;
37 
38  namespace Filters
39  {
40  class ArticleMatcher;
41  }
42 
43  class ArticleListView : public TDEListView
44  {
45  TQ_OBJECT
46 
47  public:
48  ArticleListView(TQWidget *parent = 0, const char *name = 0);
49  virtual ~ArticleListView();
50 
52  Article currentArticle() const;
53 
55  TQValueList<Article> selectedArticles() const;
56 
57  enum Columns { itemTitle, feedTitle, pubDate };
58 
59  public slots:
60 
62  void slotShowNode(TreeNode* node);
63 
65  void slotClear();
66 
70  void slotSetFilter(const Akregator::Filters::ArticleMatcher& textFilter, const Akregator::Filters::ArticleMatcher& statusFilter);
71 
73  void slotPreviousArticle();
74 
76  void slotNextArticle();
77 
79  void slotPreviousUnreadArticle();
80 
82  void slotNextUnreadArticle();
83 
84  signals:
85  void signalArticleChosen(const Article& article);
86  void signalDoubleClicked(const Article&, const TQPoint&, int);
87  //void signalContextMenu(TDEListView*, ArticleItem*, const TQPoint&);
88  void signalMouseButtonPressed(int, const Article&, const TQPoint &, int);
89 
90  protected:
92  virtual void keyPressEvent(TQKeyEvent* e);
93 
96  virtual void applyFilters();
97 
101  int visibleArticles();
102 
105  void paintInfoBox(const TQString &message);
106 
107  virtual void viewportPaintEvent(TQPaintEvent *e);
108 
109  void connectToNode(TreeNode* node);
110  void disconnectFromNode(TreeNode* node);
111 
112  virtual TQDragObject *dragObject();
113 
114  protected slots:
115 
116  void slotArticlesAdded(TreeNode* node, const TQValueList<Article>& list);
117  void slotArticlesUpdated(TreeNode* node, const TQValueList<Article>& list);
118  void slotArticlesRemoved(TreeNode* node, const TQValueList<Article>& list);
119 
120  virtual void slotCurrentChanged(TQListViewItem* item);
121  virtual void slotSelectionChanged();
122  virtual void slotDoubleClicked(TQListViewItem* item, const TQPoint& p, int i);
123  virtual void slotContextMenu(TDEListView* list, TQListViewItem* item, const TQPoint& p);
124  virtual void slotMouseButtonPressed(int, TQListViewItem *, const TQPoint &, int);
125 
126  public: // compat with KDE-3.x assertions, remove for KDE 4
127  // private:
128  class ArticleListViewPrivate;
129  ArticleListViewPrivate* d;
130 
131  friend class ColumnLayoutVisitor;
132  class ColumnLayoutVisitor;
133 
134  class ArticleItem;
135  };
136 }
137 
138 #endif
a powerful matcher supporting multiple criterions, which can be combined via logical OR or AND