2020-02-28 23:25:08 +01:00
|
|
|
/**
|
2020-08-14 20:56:04 +02:00
|
|
|
* SPDX-FileCopyrightText: 2020 Tobias Fella <fella@posteo.de>
|
2020-02-28 23:25:08 +01:00
|
|
|
*
|
2020-08-14 20:56:04 +02:00
|
|
|
* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
|
2020-02-28 23:25:08 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2020-05-26 16:32:07 +02:00
|
|
|
#include <QAbstractListModel>
|
|
|
|
#include <QHash>
|
2020-04-18 21:07:49 +02:00
|
|
|
#include <QSqlTableModel>
|
2020-02-28 23:25:08 +01:00
|
|
|
#include <QUrl>
|
|
|
|
|
2020-05-26 16:32:07 +02:00
|
|
|
#include "feed.h"
|
2020-02-28 23:25:08 +01:00
|
|
|
|
2020-05-26 16:32:07 +02:00
|
|
|
class FeedListModel : public QAbstractListModel
|
2020-02-28 23:25:08 +01:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
explicit FeedListModel(QObject *parent = nullptr);
|
|
|
|
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
|
|
|
QHash<int, QByteArray> roleNames() const override;
|
2020-05-26 16:32:07 +02:00
|
|
|
int rowCount(const QModelIndex &parent) const override;
|
2020-04-15 21:36:59 +02:00
|
|
|
Q_INVOKABLE void removeFeed(int index);
|
2020-05-31 18:17:25 +02:00
|
|
|
Q_INVOKABLE void refreshAll();
|
2020-05-26 16:32:07 +02:00
|
|
|
|
|
|
|
private:
|
|
|
|
void loadFeed(int index) const;
|
|
|
|
|
2020-09-02 22:54:09 +02:00
|
|
|
mutable QVector<Feed *> m_feeds;
|
2020-02-28 23:25:08 +01:00
|
|
|
};
|