diff --git a/src/feed.cpp b/src/feed.cpp index 0ffa1cb3..b5544319 100644 --- a/src/feed.cpp +++ b/src/feed.cpp @@ -13,73 +13,6 @@ #include "feed.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) : QObject(nullptr) { @@ -147,7 +80,7 @@ Feed::~Feed() 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++) { delete m_authors[i]; } diff --git a/src/feed.h b/src/feed.h index 5ee9d6ba..9faa0584 100644 --- a/src/feed.h +++ b/src/feed.h @@ -39,7 +39,6 @@ class Feed : public QObject Q_PROPERTY(EntriesModel *entries MEMBER m_entries CONSTANT) public: - Feed(int index); Feed(QString const feedurl); ~Feed();