mirror of https://github.com/KDE/kasts.git
Remove unused Feed constructor
This constructor was also outdated.
This commit is contained in:
parent
bbba177462
commit
5ed70c41ff
69
src/feed.cpp
69
src/feed.cpp
|
@ -13,73 +13,6 @@
|
||||||
#include "feed.h"
|
#include "feed.h"
|
||||||
#include "fetcher.h"
|
#include "fetcher.h"
|
||||||
|
|
||||||
Feed::Feed(int index)
|
|
||||||
: QObject(nullptr)
|
|
||||||
{
|
|
||||||
|
|
||||||
QSqlQuery query;
|
|
||||||
query.prepare(QStringLiteral("SELECT * FROM Feeds LIMIT 1 OFFSET :index;"));
|
|
||||||
query.bindValue(QStringLiteral(":index"), index);
|
|
||||||
Database::instance().execute(query);
|
|
||||||
if (!query.next())
|
|
||||||
qWarning() << "Failed to load feed" << index;
|
|
||||||
|
|
||||||
QSqlQuery authorQuery;
|
|
||||||
authorQuery.prepare(QStringLiteral("SELECT * FROM Authors WHERE id='' AND feed=:feed"));
|
|
||||||
authorQuery.bindValue(QStringLiteral(":feed"), query.value(QStringLiteral("url")).toString());
|
|
||||||
Database::instance().execute(authorQuery);
|
|
||||||
while (authorQuery.next()) {
|
|
||||||
m_authors += new Author(authorQuery.value(QStringLiteral("name")).toString(), authorQuery.value(QStringLiteral("email")).toString(), authorQuery.value(QStringLiteral("uri")).toString(), nullptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
m_subscribed.setSecsSinceEpoch(query.value(QStringLiteral("subscribed")).toInt());
|
|
||||||
|
|
||||||
m_lastUpdated.setSecsSinceEpoch(query.value(QStringLiteral("lastUpdated")).toInt());
|
|
||||||
|
|
||||||
m_url = query.value(QStringLiteral("url")).toString();
|
|
||||||
m_name = query.value(QStringLiteral("name")).toString();
|
|
||||||
m_image = query.value(QStringLiteral("image")).toString();
|
|
||||||
m_link = query.value(QStringLiteral("link")).toString();
|
|
||||||
m_description = query.value(QStringLiteral("description")).toString();
|
|
||||||
m_deleteAfterCount = query.value(QStringLiteral("deleteAfterCount")).toInt();
|
|
||||||
m_deleteAfterType = query.value(QStringLiteral("deleteAfterType")).toInt();
|
|
||||||
m_notify = query.value(QStringLiteral("notify")).toBool();
|
|
||||||
|
|
||||||
m_errorId = 0;
|
|
||||||
m_errorString = QLatin1String("");
|
|
||||||
|
|
||||||
connect(&Fetcher::instance(), &Fetcher::startedFetchingFeed, this, [this](const QString &url) {
|
|
||||||
if (url == m_url) {
|
|
||||||
m_errorId = 0;
|
|
||||||
m_errorString = QLatin1String("");
|
|
||||||
setRefreshing(true);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
connect(&Fetcher::instance(), &Fetcher::feedUpdated, this, [this](const QString &url) {
|
|
||||||
if (url == m_url) {
|
|
||||||
setRefreshing(false);
|
|
||||||
Q_EMIT entryCountChanged();
|
|
||||||
Q_EMIT unreadEntryCountChanged();
|
|
||||||
setErrorId(0);
|
|
||||||
setErrorString(QLatin1String(""));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
connect(&Fetcher::instance(), &Fetcher::error, this, [this](const QString &url, int errorId, const QString &errorString) {
|
|
||||||
if(url == m_url) {
|
|
||||||
setErrorId(errorId);
|
|
||||||
setErrorString(errorString);
|
|
||||||
setRefreshing(false);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
connect(&Fetcher::instance(), &Fetcher::downloadFinished, this, [this](QString url) {
|
|
||||||
if(url == m_image)
|
|
||||||
Q_EMIT imageChanged(url);
|
|
||||||
});
|
|
||||||
|
|
||||||
m_entries = new EntriesModel(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
Feed::Feed(QString const feedurl)
|
Feed::Feed(QString const feedurl)
|
||||||
: QObject(nullptr)
|
: QObject(nullptr)
|
||||||
{
|
{
|
||||||
|
@ -147,7 +80,7 @@ Feed::~Feed()
|
||||||
|
|
||||||
void Feed::retrieveAuthors()
|
void Feed::retrieveAuthors()
|
||||||
{
|
{
|
||||||
qDebug() << "Start retrieving authors for" << m_name;
|
//qDebug() << "Start retrieving authors for" << m_name;
|
||||||
for (int i=0; i < m_authors.count(); i++) {
|
for (int i=0; i < m_authors.count(); i++) {
|
||||||
delete m_authors[i];
|
delete m_authors[i];
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,6 @@ class Feed : public QObject
|
||||||
Q_PROPERTY(EntriesModel *entries MEMBER m_entries CONSTANT)
|
Q_PROPERTY(EntriesModel *entries MEMBER m_entries CONSTANT)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Feed(int index);
|
|
||||||
Feed(QString const feedurl);
|
Feed(QString const feedurl);
|
||||||
|
|
||||||
~Feed();
|
~Feed();
|
||||||
|
|
Loading…
Reference in New Issue