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 TQt, and distribute the resulting executable,
00022     without including the source code for TQt in the source distribution.
00023 */
00024 #ifndef AKREGATORARTICLELISTVIEW_H
00025 #define AKREGATORARTICLELISTVIEW_H
00026 
00027 #include <tdelistview.h>
00028 
00029 class TQKeyEvent;
00030 class TQDragObject;
00031 template <class T> class TQValueList;
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 TDEListView
00044     {
00045         Q_OBJECT
00046   
00047         public:
00048             ArticleListView(TQWidget *parent = 0, const char *name = 0);
00049             virtual ~ArticleListView();
00050             
00052             Article currentArticle() const;
00053             
00055             TQValueList<Article> selectedArticles() const;
00056             
00057             enum Columns { itemTitle, feedTitle, pubDate };
00058 
00059         public slots:
00060 
00062             void slotShowNode(TreeNode* node);
00063             
00065             void slotClear();
00066             
00070             void slotSetFilter(const Akregator::Filters::ArticleMatcher& textFilter, const Akregator::Filters::ArticleMatcher& statusFilter);
00071 
00073             void slotPreviousArticle();
00074 
00076             void slotNextArticle();
00077 
00079             void slotPreviousUnreadArticle();
00080 
00082             void slotNextUnreadArticle();
00083 
00084         signals:
00085             void signalArticleChosen(const Article& article);
00086             void signalDoubleClicked(const Article&, const TQPoint&, int);
00087             //void signalContextMenu(TDEListView*, ArticleItem*, const TQPoint&);
00088             void signalMouseButtonPressed(int, const Article&, const TQPoint &, int);
00089              
00090         protected:
00092             virtual void keyPressEvent(TQKeyEvent* e);
00093             
00096             virtual void applyFilters();
00097             
00101             int visibleArticles();
00102             
00105             void paintInfoBox(const TQString &message);
00106             
00107             virtual void viewportPaintEvent(TQPaintEvent *e);
00108             
00109             void connectToNode(TreeNode* node);
00110             void disconnectFromNode(TreeNode* node);
00111             
00112             virtual TQDragObject *dragObject();
00113 
00114         protected slots:
00115 
00116             void slotArticlesAdded(TreeNode* node, const TQValueList<Article>& list);
00117             void slotArticlesUpdated(TreeNode* node, const TQValueList<Article>& list);
00118             void slotArticlesRemoved(TreeNode* node, const TQValueList<Article>& list);
00119 
00120             virtual void slotCurrentChanged(TQListViewItem* item);
00121             virtual void slotSelectionChanged();
00122             virtual void slotDoubleClicked(TQListViewItem* item, const TQPoint& p, int i);
00123             virtual void slotContextMenu(TDEListView* list, TQListViewItem* item, const TQPoint& p);
00124             virtual void slotMouseButtonPressed(int, TQListViewItem *, const TQPoint &, int);
00125             
00126         public:         // compat with KDE-3.x assertions, remove for KDE 4
00127     // private:
00128             class ArticleListViewPrivate;
00129             ArticleListViewPrivate* d;
00130             
00131             friend class ColumnLayoutVisitor;
00132             class ColumnLayoutVisitor;
00133             
00134             class ArticleItem;
00135     };
00136 }
00137 
00138 #endif