akregator
articlelistview.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef AKREGATOR_ARTICLELISTVIEW_H
00026 #define AKREGATOR_ARTICLELISTVIEW_H
00027
00028 #include "akregator_export.h"
00029 #include "abstractselectioncontroller.h"
00030
00031 #include <QPointer>
00032 #include <QSortFilterProxyModel>
00033 #include <QTreeView>
00034
00035 #include <boost/shared_ptr.hpp>
00036
00037 class KUrl;
00038 class KMenu;
00039
00040 class QContextMenuEvent;
00041 class QPaintEvent;
00042 class QKeyEvent;
00043 template <class T> class QList;
00044
00045 namespace Akregator {
00046
00047 class Article;
00048 class FilterColumnsProxyModel;
00049
00050 namespace Filters
00051 {
00052 class ArticleMatcher;
00053 }
00054
00055 class AKREGATORPART_EXPORT FilterDeletedProxyModel : public QSortFilterProxyModel {
00056 Q_OBJECT
00057 public:
00058
00059 explicit FilterDeletedProxyModel( QObject* parent = 0 );
00060
00061 private:
00062
00063 bool filterAcceptsRow( int source_row, const QModelIndex& source_parent ) const;
00064 };
00065
00066 class AKREGATORPART_EXPORT SortColorizeProxyModel : public QSortFilterProxyModel {
00067 Q_OBJECT
00068 public:
00069
00070 explicit SortColorizeProxyModel( QObject* parent = 0 );
00071
00072
00073 QVariant data( const QModelIndex& index, int role=Qt::DisplayRole ) const;
00074
00075 void setFilters( const std::vector<boost::shared_ptr<const Akregator::Filters::AbstractMatcher> >& );
00076
00077 private:
00078
00079
00080 bool filterAcceptsRow( int source_row, const QModelIndex& source_parent ) const;
00081
00082 QIcon m_keepFlagIcon;
00083 std::vector<boost::shared_ptr<const Akregator::Filters::AbstractMatcher> > m_matchers;
00084 };
00085
00086
00087 class AKREGATORPART_EXPORT ArticleListView : public QTreeView, public ArticleLister
00088 {
00089 Q_OBJECT
00090
00091 public:
00092
00093 explicit ArticleListView( QWidget* parent = 0 );
00094 ~ArticleListView();
00095
00096
00097 void setArticleModel( Akregator::ArticleModel* model );
00098
00099
00100 QItemSelectionModel* articleSelectionModel() const;
00101
00102
00103 const QAbstractItemView* itemView() const;
00104
00105
00106 QAbstractItemView* itemView();
00107
00108
00109
00110 void setFilters( const std::vector<boost::shared_ptr<const Akregator::Filters::AbstractMatcher> >& );
00111
00112 void setIsAggregation( bool isAggregation );
00113
00114 protected:
00115 void mousePressEvent( QMouseEvent *ev );
00116
00117 signals:
00118 void signalMouseButtonPressed( int, const KUrl );
00119
00120 public Q_SLOTS:
00121
00122 void slotClear();
00123
00124 void slotPreviousArticle();
00125
00126 void slotNextArticle();
00127
00128 void slotPreviousUnreadArticle();
00129
00130 void slotNextUnreadArticle();
00131
00132 private:
00133 void saveHeaderSettings();
00134 void loadHeaderSettings();
00135
00136
00137 void paintEvent( QPaintEvent* e );
00138
00139
00140 void contextMenuEvent( QContextMenuEvent* event );
00141
00142 void selectIndex( const QModelIndex& index );
00143
00144 void setFeedMode();
00145 void setGroupMode();
00146
00147 private Q_SLOTS:
00148 void showHeaderMenu( const QPoint& pos );
00149 void headerMenuItemTriggered( QAction* action );
00150
00151 private:
00152
00153 enum Column { ItemTitleColumn=0, FeedTitleColumn, DateColumn, ColumnCount };
00154 enum ColumnMode { Unspecified, GroupMode, FeedMode };
00155 ColumnMode m_columnMode;
00156 bool m_isAggregation;
00157 QPointer<SortColorizeProxyModel> m_proxy;
00158 bool m_headerSetUp;
00159 };
00160
00161 }
00162
00163
00164 #endif // AKREGATOR_ARTICLELISTVIEW_H