summaryrefslogtreecommitdiffstats
path: root/akregator/src/articleviewer.h
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commit460c52653ab0dcca6f19a4f492ed2c5e4e963ab0 (patch)
tree67208f7c145782a7e90b123b982ca78d88cc2c87 /akregator/src/articleviewer.h
downloadtdepim-460c52653ab0dcca6f19a4f492ed2c5e4e963ab0.tar.gz
tdepim-460c52653ab0dcca6f19a4f492ed2c5e4e963ab0.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'akregator/src/articleviewer.h')
-rw-r--r--akregator/src/articleviewer.h154
1 files changed, 154 insertions, 0 deletions
diff --git a/akregator/src/articleviewer.h b/akregator/src/articleviewer.h
new file mode 100644
index 000000000..a9eb65b65
--- /dev/null
+++ b/akregator/src/articleviewer.h
@@ -0,0 +1,154 @@
+/*
+ This file is part of Akregator.
+
+ Copyright (C) 2004 Sashmit Bhaduri <[email protected]>
+ 2005 Frank Osterfeld <frank.osterfeld at kdemail.net>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+ As a special exception, permission is given to link this program
+ with any edition of Qt, and distribute the resulting executable,
+ without including the source code for Qt in the source distribution.
+*/
+
+#ifndef ARTICLEVIEWER_H
+#define ARTICLEVIEWER_H
+
+#include <klocale.h>
+
+#include <qcolor.h>
+#include <qfont.h>
+
+#include "article.h"
+#include "articlefilter.h"
+#include "viewer.h"
+
+class QKeyEvent;
+
+namespace Akregator
+{
+ class Feed;
+ class Folder;
+ class TreeNode;
+
+ /** This HTML viewer is used to display articles.
+ Use the high-level interface provided by the public slots whereever possible (and extend them when necessary instead of using low-level methods).*/
+ class ArticleViewer : public Viewer
+ {
+ Q_OBJECT
+ public:
+ /** Constructor */
+ ArticleViewer(QWidget* parent, const char* name);
+ virtual ~ArticleViewer();
+
+ virtual bool openURL(const KURL &url);
+
+ /** Repaints the view. */
+ void reload();
+
+ void displayAboutPage();
+
+ public slots:
+
+ // Commandment: We are your interfaces.
+ // You shall not use strange interfaces before us.
+
+ /** Show single article (normal view)
+ @param article the article to render */
+ void slotShowArticle(const Article& article);
+
+ /** Shows the articles of the tree node @c node (combined view). Changes in the node will update the view automatically.
+ @param node The node to observe */
+ void slotShowNode(TreeNode* node);
+
+ /** Set filters @c textFilter and @c statusFilter which will be used if the viewer is in combined view mode
+ @param textFilter text filter
+ @param statusFilter status filter */
+ void slotSetFilter(const Akregator::Filters::ArticleMatcher& textFilter, const Akregator::Filters::ArticleMatcher& statusFilter);
+
+ /** Update view if combined view mode is set. Has to be called when the displayed node gets modified. */
+ void slotUpdateCombinedView();
+
+ /** Clears the canvas and disconnects from the currently observed node (if in combined view mode). */
+ void slotClear();
+
+ void slotShowSummary(TreeNode *node);
+
+ virtual void slotPaletteOrFontChanged();
+
+ protected slots:
+
+ void slotArticlesUpdated(TreeNode* node, const QValueList<Article>& list);
+ void slotArticlesAdded(TreeNode* node, const QValueList<Article>& list);
+ void slotArticlesRemoved(TreeNode* node, const QValueList<Article>& list);
+
+ protected:
+
+ virtual void keyPressEvent(QKeyEvent* e);
+ virtual void urlSelected (const QString &url, int button, int state, const QString &_target, KParts::URLArgs args);
+
+ public: // compat with KDE-3.x assertions, remove for KDE 4
+ // private:
+
+ friend class ShowNodeSummaryVisitor;
+ class ShowSummaryVisitor;
+ ShowSummaryVisitor* m_showSummaryVisitor;
+
+ /** renders @c body. Use this method whereever possible.
+ @param body html to render, without header and footer */
+ void renderContent(const QString& body);
+
+ /** Takes an article and renders it as HTML with settings for normal view and widescreen view
+ @param feed article's feed (used for feed icon atm) -- article.feed() would do. better use a (No)Icon flag. -fo
+ @param article The article to render
+ @return the rendered article as HTML */
+ QString formatArticleNormalMode(Feed* feed, const Article& article);
+
+ /** Takes an article and renders it as HTML with settings for combined view
+ @param feed article's feed (used for feed icon atm) -- article.feed() would do. better use a (No)Icon flag. -fo
+ @param article The article to render
+ @return the rendered article as HTML */
+ QString formatArticleCombinedMode(Feed* feed, const Article& article);
+
+ /** Resets the canvas and adds writes the HTML header to it.
+ */
+ void beginWriting();
+
+ /** Finishes writing to the canvas and completes the HTML (by adding closing tags) */
+ void endWriting();
+
+ /** generates the CSS used for rendering in single article mode (normal and wide screen view) */
+ void generateNormalModeCSS();
+ /** generates the CSS for combined view mode */
+ void generateCombinedModeCSS();
+ void connectToNode(TreeNode* node);
+ void disconnectFromNode(TreeNode* node);
+
+ QString m_normalModeCSS;
+ QString m_combinedModeCSS;
+ QString m_htmlFooter;
+ QString m_currentText;
+ KURL m_imageDir;
+ TreeNode* m_node;
+ Article m_article;
+ KURL m_link;
+ Akregator::Filters::ArticleMatcher m_textFilter;
+ Akregator::Filters::ArticleMatcher m_statusFilter;
+ enum ViewMode { NormalView, CombinedView, SummaryView };
+ ViewMode m_viewMode;
+ };
+}
+
+#endif // ARTICLEVIEWER_H