akregator/src

articlelistview.h

00001 /*
00002     This file is part of Akregator.
00003 
00004     Copyright (C) 2004 Stanislav Karchebny <Stanislav.Karchebny@kdemail.net>
00005 
00006     This program is free software; you can redistribute it and/or modify
00007     it under the terms of the GNU General Public License as published by
00008     the Free Software Foundation; either version 2 of the License, or
00009     (at your option) any later version.
00010 
00011     This program is distributed in the hope that it will be useful,
00012     but WITHOUT ANY WARRANTY; without even the implied warranty of
00013     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00014     GNU General Public License for more details.
00015 
00016     You should have received a copy of the GNU General Public License
00017     along with this program; if not, write to the Free Software
00018     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00019 
00020     As a special exception, permission is given to link this program
00021     with any edition of Qt, and distribute the resulting executable,
00022     without including the source code for Qt in the source distribution.
00023 */
00024 #ifndef AKREGATORARTICLELISTVIEW_H
00025 #define AKREGATORARTICLELISTVIEW_H
00026 
00027 #include <klistview.h>
00028 
00029 class QKeyEvent;
00030 class QDragObject;
00031 template <class T> class QValueList;
00032 
00033 namespace Akregator
00034 {
00035     class Article;
00036     class TreeNode;
00037 
00038     namespace Filters
00039     {
00040         class ArticleMatcher;
00041     }
00042 
00043     class ArticleListView : public KListView
00044     {
00045         Q_OBJECT
00046         public:
00047             ArticleListView(QWidget *parent = 0, const char *name = 0);
00048             virtual ~ArticleListView();
00049             
00051             Article currentArticle() const;
00052             
00054             QValueList<Article> selectedArticles() const;
00055             
00056             enum Columns { itemTitle, feedTitle, pubDate };
00057 
00058         public slots:
00059 
00061             void slotShowNode(TreeNode* node);
00062             
00064             void slotClear();
00065             
00069             void slotSetFilter(const Akregator::Filters::ArticleMatcher& textFilter, const Akregator::Filters::ArticleMatcher& statusFilter);
00070 
00072             void slotPreviousArticle();
00073 
00075             void slotNextArticle();
00076 
00078             void slotPreviousUnreadArticle();
00079 
00081             void slotNextUnreadArticle();
00082 
00083         signals:
00084             void signalArticleChosen(const Article& article);
00085             void signalDoubleClicked(const Article&, const QPoint&, int);
00086             //void signalContextMenu(KListView*, ArticleItem*, const QPoint&);
00087             void signalMouseButtonPressed(int, const Article&, const QPoint &, int);
00088              
00089         protected:
00091             virtual void keyPressEvent(QKeyEvent* e);
00092             
00095             virtual void applyFilters();
00096             
00100             int visibleArticles();
00101             
00104             void paintInfoBox(const QString &message);
00105             
00106             virtual void viewportPaintEvent(QPaintEvent *e);
00107             
00108             void connectToNode(TreeNode* node);
00109             void disconnectFromNode(TreeNode* node);
00110             
00111             virtual QDragObject *dragObject();
00112 
00113         protected slots:
00114 
00115             void slotArticlesAdded(TreeNode* node, const QValueList<Article>& list);
00116             void slotArticlesUpdated(TreeNode* node, const QValueList<Article>& list);
00117             void slotArticlesRemoved(TreeNode* node, const QValueList<Article>& list);
00118 
00119             virtual void slotCurrentChanged(QListViewItem* item);
00120             virtual void slotSelectionChanged();
00121             virtual void slotDoubleClicked(QListViewItem* item, const QPoint& p, int i);
00122             virtual void slotContextMenu(KListView* list, QListViewItem* item, const QPoint& p);
00123             virtual void slotMouseButtonPressed(int, QListViewItem *, const QPoint &, int);
00124             
00125         public:         // compat with KDE-3.x assertions, remove for KDE 4
00126     // private:
00127             class ArticleListViewPrivate;
00128             ArticleListViewPrivate* d;
00129             
00130             friend class ColumnLayoutVisitor;
00131             class ColumnLayoutVisitor;
00132             
00133             class ArticleItem;
00134     };
00135 }
00136 
00137 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys