File indexing completed on 2024-05-12 16:23:39
0001 /** 0002 * SPDX-FileCopyrightText: 2020 Tobias Fella <fella@posteo.de> 0003 * 0004 * SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 0005 */ 0006 0007 #pragma once 0008 0009 #include <QDateTime> 0010 #include <QDebug> 0011 #include <QObject> 0012 #include <QString> 0013 #include <QStringList> 0014 0015 #include "author.h" 0016 #include "feed.h" 0017 0018 class Entry : public QObject 0019 { 0020 Q_OBJECT 0021 0022 Q_PROPERTY(QString id READ id CONSTANT) 0023 Q_PROPERTY(QString title READ title CONSTANT) 0024 Q_PROPERTY(QString content READ content CONSTANT) 0025 Q_PROPERTY(QVector<Author *> authors READ authors CONSTANT) 0026 Q_PROPERTY(QDateTime created READ created CONSTANT) 0027 Q_PROPERTY(QDateTime updated READ updated CONSTANT) 0028 Q_PROPERTY(QString link READ link CONSTANT) 0029 Q_PROPERTY(QString baseUrl READ baseUrl CONSTANT) 0030 Q_PROPERTY(bool read READ read WRITE setRead NOTIFY readChanged) 0031 0032 public: 0033 Entry(Feed *feed, int index); 0034 ~Entry(); 0035 0036 QString id() const; 0037 QString title() const; 0038 QString content() const; 0039 QVector<Author *> authors() const; 0040 QDateTime created() const; 0041 QDateTime updated() const; 0042 QString link() const; 0043 bool read() const; 0044 0045 Q_INVOKABLE void openLink(const QString &link); 0046 0047 QString baseUrl() const; 0048 0049 void setRead(bool read); 0050 0051 Q_INVOKABLE QString adjustedContent(int width, int fontSize); 0052 0053 Q_SIGNALS: 0054 void readChanged(bool read); 0055 0056 private: 0057 Feed *m_feed; 0058 QString m_id; 0059 QString m_title; 0060 QString m_content; 0061 QVector<Author *> m_authors; 0062 QDateTime m_created; 0063 QDateTime m_updated; 0064 QString m_link; 0065 bool m_read; 0066 };