Fix dialog layout which was totally broken (nobody uses knotes ?:) )
[kdepim.git] / akregator / src / articlemodel.h
blob0dc0f43ebfc21e9adcbb452c64af4aa36df8968c
1 /*
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>
28 #include <QList>
30 #include "akregatorpart_export.h"
32 #include <QSharedPointer>
33 #include <vector>
35 namespace Akregator
38 class Article;
39 class TreeNode;
41 namespace Filters
43 class AbstractMatcher;
46 class AKREGATORPART_EXPORT ArticleModel : public QAbstractTableModel
48 Q_OBJECT
50 public:
52 enum Column {
53 ItemTitleColumn = 0,
54 FeedTitleColumn,
55 AuthorColumn,
56 DateColumn,
57 DescriptionColumn,
58 ContentColumn,
59 ColumnCount
62 enum Role {
63 SortRole = Qt::UserRole,
64 LinkRole,
65 GuidRole,
66 ItemIdRole,
67 FeedIdRole,
68 StatusRole,
69 IsImportantRole,
70 IsDeletedRole
73 explicit ArticleModel(const QVector<Article> &articles, QObject *parent = Q_NULLPTR);
74 ~ArticleModel();
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;
94 public Q_SLOTS:
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> &);
99 void clear();
101 private:
102 ArticleModel(const ArticleModel &);
103 ArticleModel &operator=(const ArticleModel &);
105 class Private;
106 Private *const d;
109 } //namespace Akregator
111 #endif // AKREGATOR_ARTICLEMODEL_H