File indexing completed on 2025-01-05 04:29:52
0001 /** 0002 * SPDX-FileCopyrightText: 2020 Tobias Fella <tobias.fella@kde.org> 0003 * SPDX-FileCopyrightText: 2021 Bart De Vries <bart@mogwai.be> 0004 * 0005 * SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 0006 */ 0007 0008 #pragma once 0009 0010 #include <QAbstractListModel> 0011 #include <QHash> 0012 #include <QQmlEngine> 0013 #include <QSqlTableModel> 0014 #include <QUrl> 0015 0016 #include "feed.h" 0017 0018 class FeedsModel : public QAbstractListModel 0019 { 0020 Q_OBJECT 0021 QML_ELEMENT 0022 QML_UNCREATABLE("") 0023 0024 public: 0025 enum Roles { 0026 FeedRole = Qt::UserRole, 0027 UrlRole, 0028 TitleRole, 0029 UnreadCountRole, 0030 NewCountRole, 0031 FavoriteCountRole, 0032 }; 0033 Q_ENUM(Roles) 0034 0035 explicit FeedsModel(QObject *parent = nullptr); 0036 QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; 0037 QHash<int, QByteArray> roleNames() const override; 0038 int rowCount(const QModelIndex &parent) const override; 0039 0040 private: 0041 void triggerFeedUpdate(const QString &url); 0042 };