articleviewer.h
00001 /* 00002 This file is part of Akregator. 00003 00004 Copyright (C) 2004 Sashmit Bhaduri <smt@vfemail.net> 00005 2005 Frank Osterfeld <frank.osterfeld at kdemail.net> 00006 00007 This program is free software; you can redistribute it and/or modify 00008 it under the terms of the GNU General Public License as published by 00009 the Free Software Foundation; either version 2 of the License, or 00010 (at your option) any later version. 00011 00012 This program is distributed in the hope that it will be useful, 00013 but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 GNU General Public License for more details. 00016 00017 You should have received a copy of the GNU General Public License 00018 along with this program; if not, write to the Free Software 00019 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00020 00021 As a special exception, permission is given to link this program 00022 with any edition of TQt, and distribute the resulting executable, 00023 without including the source code for TQt in the source distribution. 00024 */ 00025 00026 #ifndef ARTICLEVIEWER_H 00027 #define ARTICLEVIEWER_H 00028 00029 #include <tdelocale.h> 00030 00031 #include <tqcolor.h> 00032 #include <tqfont.h> 00033 00034 #include "article.h" 00035 #include "articlefilter.h" 00036 #include "viewer.h" 00037 00038 class TQKeyEvent; 00039 00040 namespace Akregator 00041 { 00042 class Feed; 00043 class Folder; 00044 class TreeNode; 00045 00048 class ArticleViewer : public Viewer 00049 { 00050 Q_OBJECT 00051 00052 public: 00054 ArticleViewer(TQWidget* parent, const char* name); 00055 virtual ~ArticleViewer(); 00056 00057 virtual bool openURL(const KURL &url); 00058 00060 void reload(); 00061 00062 void displayAboutPage(); 00063 00064 public slots: 00065 00066 // Commandment: We are your interfaces. 00067 // You shall not use strange interfaces before us. 00068 00071 void slotShowArticle(const Article& article); 00072 00075 void slotShowNode(TreeNode* node); 00076 00080 void slotSetFilter(const Akregator::Filters::ArticleMatcher& textFilter, const Akregator::Filters::ArticleMatcher& statusFilter); 00081 00083 void slotUpdateCombinedView(); 00084 00086 void slotClear(); 00087 00088 void slotShowSummary(TreeNode *node); 00089 00090 virtual void slotPaletteOrFontChanged(); 00091 00092 protected slots: 00093 00094 void slotArticlesUpdated(TreeNode* node, const TQValueList<Article>& list); 00095 void slotArticlesAdded(TreeNode* node, const TQValueList<Article>& list); 00096 void slotArticlesRemoved(TreeNode* node, const TQValueList<Article>& list); 00097 00098 protected: 00099 00100 virtual void keyPressEvent(TQKeyEvent* e); 00101 virtual void urlSelected (const TQString &url, int button, int state, const TQString &_target, KParts::URLArgs args); 00102 00103 public: // compat with KDE-3.x assertions, remove for KDE 4 00104 // private: 00105 00106 friend class ShowNodeSummaryVisitor; 00107 class ShowSummaryVisitor; 00108 ShowSummaryVisitor* m_showSummaryVisitor; 00109 00112 void renderContent(const TQString& body); 00113 00118 TQString formatArticleNormalMode(Feed* feed, const Article& article); 00119 00124 TQString formatArticleCombinedMode(Feed* feed, const Article& article); 00125 00128 void beginWriting(); 00129 00131 void endWriting(); 00132 00134 void generateNormalModeCSS(); 00136 void generateCombinedModeCSS(); 00137 void connectToNode(TreeNode* node); 00138 void disconnectFromNode(TreeNode* node); 00139 00140 TQString m_normalModeCSS; 00141 TQString m_combinedModeCSS; 00142 TQString m_htmlFooter; 00143 TQString m_currentText; 00144 KURL m_imageDir; 00145 TreeNode* m_node; 00146 Article m_article; 00147 KURL m_link; 00148 Akregator::Filters::ArticleMatcher m_textFilter; 00149 Akregator::Filters::ArticleMatcher m_statusFilter; 00150 enum ViewMode { NormalView, CombinedView, SummaryView }; 00151 ViewMode m_viewMode; 00152 }; 00153 } 00154 00155 #endif // ARTICLEVIEWER_H