akregator/src

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 Qt, and distribute the resulting executable,
00023     without including the source code for Qt in the source distribution.
00024 */
00025 
00026 #ifndef ARTICLEVIEWER_H
00027 #define ARTICLEVIEWER_H
00028 
00029 #include <klocale.h>
00030 
00031 #include <qcolor.h>
00032 #include <qfont.h>
00033 
00034 #include "article.h"
00035 #include "articlefilter.h"
00036 #include "viewer.h"
00037 
00038 class QKeyEvent;
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         public:
00053             ArticleViewer(QWidget* parent, const char* name);
00054             virtual ~ArticleViewer();
00055             
00056             virtual bool openURL(const KURL &url);
00057 
00059             void reload();
00060 
00061             void displayAboutPage();
00062             
00063             public slots:
00064         
00065             // Commandment: We are your interfaces.
00066             // You shall not use strange interfaces before us.
00067         
00070             void slotShowArticle(const Article& article);
00071             
00074             void slotShowNode(TreeNode* node);
00075             
00079             void slotSetFilter(const Akregator::Filters::ArticleMatcher& textFilter, const Akregator::Filters::ArticleMatcher& statusFilter);
00080             
00082             void slotUpdateCombinedView();
00083             
00085             void slotClear();
00086         
00087             void slotShowSummary(TreeNode *node);
00088 
00089             virtual void slotPaletteOrFontChanged();
00090             
00091         protected slots:
00092                     
00093             void slotArticlesUpdated(TreeNode* node, const QValueList<Article>& list);
00094             void slotArticlesAdded(TreeNode* node, const QValueList<Article>& list);
00095             void slotArticlesRemoved(TreeNode* node, const QValueList<Article>& list);
00096             
00097         protected:
00098             
00099             virtual void keyPressEvent(QKeyEvent* e);
00100             virtual void urlSelected (const QString &url, int button, int state, const QString &_target, KParts::URLArgs args);
00101 
00102         public:     // compat with KDE-3.x assertions, remove for KDE 4
00103     // private:
00104 
00105             friend class ShowNodeSummaryVisitor;
00106             class ShowSummaryVisitor;
00107             ShowSummaryVisitor* m_showSummaryVisitor;
00108             
00111             void renderContent(const QString& body);
00112             
00117             QString formatArticleNormalMode(Feed* feed, const Article& article);
00118             
00123             QString formatArticleCombinedMode(Feed* feed, const Article& article);
00124             
00127             void beginWriting();
00128 
00130             void endWriting();
00131             
00133             void generateNormalModeCSS();
00135             void generateCombinedModeCSS();
00136             void connectToNode(TreeNode* node);
00137             void disconnectFromNode(TreeNode* node);
00138                                   
00139             QString m_normalModeCSS;
00140             QString m_combinedModeCSS;
00141             QString m_htmlFooter;
00142             QString m_currentText;
00143             KURL m_imageDir;
00144             TreeNode* m_node;
00145             Article m_article;
00146             KURL m_link;
00147             Akregator::Filters::ArticleMatcher m_textFilter; 
00148             Akregator::Filters::ArticleMatcher m_statusFilter;
00149             enum ViewMode { NormalView, CombinedView, SummaryView };
00150             ViewMode m_viewMode;
00151    };
00152 }
00153 
00154 #endif // ARTICLEVIEWER_H
KDE Home | KDE Accessibility Home | Description of Access Keys