2 This file is part of Akregator.
4 Copyright (C) 2007 Frank Osterfeld <osterfeld@kde.org>
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 As a special exception, permission is given to link this program
21 with any edition of Qt, and distribute the resulting executable,
22 without including the source code for Qt in the source distribution.
24 #ifndef AKREGATOR_ARTICLEMODEL_H
25 #define AKREGATOR_ARTICLEMODEL_H
27 #include <QAbstractTableModel>
30 #include "akregatorpart_export.h"
32 #include <QSharedPointer>
43 class AbstractMatcher
;
46 class AKREGATORPART_EXPORT ArticleModel
: public QAbstractTableModel
63 SortRole
= Qt::UserRole
,
73 explicit ArticleModel(const QVector
<Article
> &articles
, QObject
*parent
= Q_NULLPTR
);
76 int columnCount(const QModelIndex
&parent
= QModelIndex()) const Q_DECL_OVERRIDE
;
78 int rowCount(const QModelIndex
&parent
= QModelIndex()) const Q_DECL_OVERRIDE
;
80 QVariant
headerData(int section
, Qt::Orientation
, int role
) const Q_DECL_OVERRIDE
;
82 QVariant
data(const QModelIndex
&index
, int role
= Qt::DisplayRole
) const Q_DECL_OVERRIDE
;
84 bool rowMatches(int row
, const QSharedPointer
<const Akregator::Filters::AbstractMatcher
> &matcher
) const;
86 Article
article(int row
) const;
88 QStringList
mimeTypes() const Q_DECL_OVERRIDE
;
90 QMimeData
*mimeData(const QModelIndexList
&indexes
) const Q_DECL_OVERRIDE
;
92 Qt::ItemFlags
flags(const QModelIndex
&idx
) const Q_DECL_OVERRIDE
;
96 void articlesAdded(Akregator::TreeNode
*, const QVector
<Akregator::Article
> &);
97 void articlesUpdated(Akregator::TreeNode
*, const QVector
<Akregator::Article
> &);
98 void articlesRemoved(Akregator::TreeNode
*, const QVector
<Akregator::Article
> &);
102 ArticleModel(const ArticleModel
&);
103 ArticleModel
&operator=(const ArticleModel
&);
109 } //namespace Akregator
111 #endif // AKREGATOR_ARTICLEMODEL_H