akregator/src

articleviewer.h
1 /*
2  This file is part of Akregator.
3 
4  Copyright (C) 2004 Sashmit Bhaduri <smt@vfemail.net>
5  2005 Frank Osterfeld <frank.osterfeld at kdemail.net>
6 
7  This program is free software; you can redistribute it and/or modify
8  it under the terms of the GNU General Public License as published by
9  the Free Software Foundation; either version 2 of the License, or
10  (at your option) any later version.
11 
12  This program is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License
18  along with this program; if not, write to the Free Software
19  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 
21  As a special exception, permission is given to link this program
22  with any edition of TQt, and distribute the resulting executable,
23  without including the source code for TQt in the source distribution.
24 */
25 
26 #ifndef ARTICLEVIEWER_H
27 #define ARTICLEVIEWER_H
28 
29 #include <tdelocale.h>
30 
31 #include <tqcolor.h>
32 #include <tqfont.h>
33 
34 #include "article.h"
35 #include "articlefilter.h"
36 #include "viewer.h"
37 
38 class TQKeyEvent;
39 
40 namespace Akregator
41 {
42  class Feed;
43  class Folder;
44  class TreeNode;
45 
48  class ArticleViewer : public Viewer
49  {
50  TQ_OBJECT
51 
52  public:
54  ArticleViewer(TQWidget* parent, const char* name);
55  virtual ~ArticleViewer();
56 
57  virtual bool openURL(const KURL &url);
58 
60  void reload();
61 
62  void displayAboutPage();
63 
64  public slots:
65 
66  // Commandment: We are your interfaces.
67  // You shall not use strange interfaces before us.
68 
71  void slotShowArticle(const Article& article);
72 
75  void slotShowNode(TreeNode* node);
76 
80  void slotSetFilter(const Akregator::Filters::ArticleMatcher& textFilter, const Akregator::Filters::ArticleMatcher& statusFilter);
81 
84 
86  void slotClear();
87 
88  void slotShowSummary(TreeNode *node);
89 
90  virtual void slotPaletteOrFontChanged();
91 
92  protected slots:
93 
94  void slotArticlesUpdated(TreeNode* node, const TQValueList<Article>& list);
95  void slotArticlesAdded(TreeNode* node, const TQValueList<Article>& list);
96  void slotArticlesRemoved(TreeNode* node, const TQValueList<Article>& list);
97 
98  protected:
99 
100  virtual void keyPressEvent(TQKeyEvent* e);
101  virtual void urlSelected (const TQString &url, int button, int state, const TQString &_target, KParts::URLArgs args);
102 
103  public: // compat with KDE-3.x assertions, remove for KDE 4
104  // private:
105 
106  friend class ShowNodeSummaryVisitor;
107  class ShowSummaryVisitor;
108  ShowSummaryVisitor* m_showSummaryVisitor;
109 
112  void renderContent(const TQString& body);
113 
118  TQString formatArticleNormalMode(Feed* feed, const Article& article);
119 
124  TQString formatArticleCombinedMode(Feed* feed, const Article& article);
125 
128  void beginWriting();
129 
131  void endWriting();
132 
134  void generateNormalModeCSS();
137  void connectToNode(TreeNode* node);
138  void disconnectFromNode(TreeNode* node);
139 
140  TQString m_normalModeCSS;
141  TQString m_combinedModeCSS;
142  TQString m_htmlFooter;
143  TQString m_currentText;
144  KURL m_imageDir;
145  TreeNode* m_node;
146  Article m_article;
147  KURL m_link;
149  Akregator::Filters::ArticleMatcher m_statusFilter;
150  enum ViewMode { NormalView, CombinedView, SummaryView };
151  ViewMode m_viewMode;
152  };
153 }
154 
155 #endif // ARTICLEVIEWER_H
This HTML viewer is used to display articles.
Definition: articleviewer.h:49
void slotClear()
Clears the canvas and disconnects from the currently observed node (if in combined view mode).
void generateNormalModeCSS()
generates the CSS used for rendering in single article mode (normal and wide screen view)
void slotUpdateCombinedView()
Update view if combined view mode is set.
ArticleViewer(TQWidget *parent, const char *name)
Constructor.
void reload()
Repaints the view.
TQString formatArticleNormalMode(Feed *feed, const Article &article)
Takes an article and renders it as HTML with settings for normal view and widescreen view.
void generateCombinedModeCSS()
generates the CSS for combined view mode
void beginWriting()
Resets the canvas and adds writes the HTML header to it.
void renderContent(const TQString &body)
renders body.
void slotShowArticle(const Article &article)
Show single article (normal view)
void endWriting()
Finishes writing to the canvas and completes the HTML (by adding closing tags)
TQString formatArticleCombinedMode(Feed *feed, const Article &article)
Takes an article and renders it as HTML with settings for combined view.
void slotSetFilter(const Akregator::Filters::ArticleMatcher &textFilter, const Akregator::Filters::ArticleMatcher &statusFilter)
Set filters textFilter and statusFilter which will be used if the viewer is in combined view mode.
void slotShowNode(TreeNode *node)
Shows the articles of the tree node node (combined view).
A proxy class for RSS::Article with some additional methods to assist sorting.
Definition: article.h:58
represents a feed
Definition: feed.h:63
a powerful matcher supporting multiple criterions, which can be combined via logical OR or AND
Abstract base class for all kind of elements in the feed tree, like feeds and feed groups (and search...
Definition: treenode.h:52