summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'kde-apps/akregator/files')
-rw-r--r--kde-apps/akregator/files/akregator-18.04.3-syndication.patch222
1 files changed, 222 insertions, 0 deletions
diff --git a/kde-apps/akregator/files/akregator-18.04.3-syndication.patch b/kde-apps/akregator/files/akregator-18.04.3-syndication.patch
new file mode 100644
index 000000000000..f20f8fffa93e
--- /dev/null
+++ b/kde-apps/akregator/files/akregator-18.04.3-syndication.patch
@@ -0,0 +1,222 @@
+From d2797fe48b6d4429cd30163fd75003118400511f Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Daniel=20Vr=C3=A1til?= <dvratil@kde.org>
+Date: Sun, 22 Apr 2018 09:13:45 +0200
+Subject: Port away from remove Syndication API
+
+---
+ src/CMakeLists.txt | 1 +
+ src/akregator_part.cpp | 10 ------
+ src/feed/feed.cpp | 3 +-
+ src/feed/feedretriever.cpp | 78 ++++++++++++++++++++++++++++++++++++++++++++++
+ src/feed/feedretriever.h | 54 ++++++++++++++++++++++++++++++++
+ 5 files changed, 135 insertions(+), 11 deletions(-)
+ create mode 100644 src/feed/feedretriever.cpp
+ create mode 100644 src/feed/feedretriever.h
+
+diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
+index 86af10e..312daee 100644
+--- a/src/CMakeLists.txt
++++ b/src/CMakeLists.txt
+@@ -86,6 +86,7 @@ set(akregatorprivate_LIB_SRCS
+ article.cpp
+ feed/feed.cpp
+ feed/feedlist.cpp
++ feed/feedretriever.cpp
+ treenode.cpp
+ treenodevisitor.cpp
+ utils.cpp
+diff --git a/src/akregator_part.cpp b/src/akregator_part.cpp
+index 74acfab..afde53f 100644
+--- a/src/akregator_part.cpp
++++ b/src/akregator_part.cpp
+@@ -259,14 +259,6 @@ Part::Part(QWidget *parentWidget, QObject *parent, const QVariantList &)
+ connect(m_autosaveTimer, &QTimer::timeout, this, &Part::slotSaveFeedList);
+ m_autosaveTimer->start(5 * 60 * 1000); // 5 minutes
+
+- QString useragent = QStringLiteral("Akregator/%1; syndication").arg(QStringLiteral(AKREGATOR_VERSION));
+-
+- if (!Settings::customUserAgent().isEmpty()) {
+- useragent = Settings::customUserAgent();
+- }
+-
+- Syndication::FileRetriever::setUserAgent(useragent);
+-
+ loadPlugins(QStringLiteral("extension")); // FIXME: also unload them!
+ if (mCentralWidget->previousSessionCrashed()) {
+ mCentralWidget->needToRestoreCrashedSession();
+@@ -361,8 +353,6 @@ void Part::slotSettingsChanged()
+ m_actionManager->setTrayIcon(nullptr);
+ }
+
+- Syndication::FileRetriever::setUseCache(Settings::useHTMLCache());
+-
+ const QStringList fonts {
+ Settings::standardFont(),
+ Settings::fixedFont(),
+diff --git a/src/feed/feed.cpp b/src/feed/feed.cpp
+index 87ba473..774f506 100644
+--- a/src/feed/feed.cpp
++++ b/src/feed/feed.cpp
+@@ -36,6 +36,7 @@
+ #include "treenodevisitor.h"
+ #include "types.h"
+ #include "utils.h"
++#include "feedretriever.h"
+
+ #include <Syndication/Syndication>
+
+@@ -681,7 +682,7 @@ void Akregator::Feed::tryFetch()
+ d->loader = Syndication::Loader::create(this, SLOT(fetchCompleted(Syndication::Loader *,
+ Syndication::FeedPtr,
+ Syndication::ErrorCode)));
+- d->loader->loadFrom(QUrl(d->xmlUrl));
++ d->loader->loadFrom(QUrl(d->xmlUrl), new FeedRetriever());
+ }
+
+ void Akregator::Feed::slotImageFetched(const QPixmap &image)
+diff --git a/src/feed/feedretriever.cpp b/src/feed/feedretriever.cpp
+new file mode 100644
+index 0000000..62526c4
+--- /dev/null
++++ b/src/feed/feedretriever.cpp
+@@ -0,0 +1,78 @@
++/*
++ This file is part of Akregator.
++
++ Copyright (C) 2018 Daniel Vrátil <dvratil@kde.org>
++
++ This program is free software; you can redistribute it and/or modify
++ it under the terms of the GNU General Public License as published by
++ the Free Software Foundation; either version 2 of the License, or
++ (at your option) any later version.
++
++ This program is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ GNU General Public License for more details.
++
++ You should have received a copy of the GNU General Public License
++ along with this program; if not, write to the Free Software
++ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
++
++ As a special exception, permission is given to link this program
++ with any edition of Qt, and distribute the resulting executable,
++ without including the source code for Qt in the source distribution.
++*/
++
++#include "feedretriever.h"
++#include "akregatorconfig.h"
++#include "akregator-version.h"
++
++#include <KIO/StoredTransferJob>
++
++#include <QUrl>
++
++using namespace Akregator;
++
++FeedRetriever::FeedRetriever()
++ : Syndication::DataRetriever()
++{
++}
++
++void FeedRetriever::retrieveData(const QUrl &url)
++{
++ QString userAgent = QStringLiteral("Akregator/%1; syndication").arg(QStringLiteral(AKREGATOR_VERSION));
++ if (!Settings::customUserAgent().isEmpty()) {
++ userAgent = Settings::customUserAgent();
++ }
++ bool useCache = Settings::useHTMLCache();
++
++ auto job = KIO::storedGet(url, KIO::NoReload, KIO::HideProgressInfo);
++ job->addMetaData(QStringLiteral("UserAgent"), userAgent);
++ job->addMetaData(QStringLiteral("cache"), useCache ? QStringLiteral("refresh") : QStringLiteral("reload"));
++ connect(job, &KJob::result, this, &FeedRetriever::getFinished);
++ mJob = job;
++ mJob->start();
++}
++
++int FeedRetriever::errorCode() const
++{
++ return mError;
++}
++
++void FeedRetriever::abort()
++{
++ if (mJob) {
++ mJob->kill();
++ mJob = nullptr;
++ }
++}
++
++void FeedRetriever::getFinished(KJob *job)
++{
++ if (job->error()) {
++ mError = job->error();
++ Q_EMIT dataRetrieved({}, false);
++ return;
++ }
++
++ Q_EMIT dataRetrieved(static_cast<KIO::StoredTransferJob*>(job)->data(), true);
++}
+diff --git a/src/feed/feedretriever.h b/src/feed/feedretriever.h
+new file mode 100644
+index 0000000..3a0ff3d
+--- /dev/null
++++ b/src/feed/feedretriever.h
+@@ -0,0 +1,54 @@
++/*
++ This file is part of Akregator.
++
++ Copyright (C) 2018 Daniel Vrátil <dvratil@kde.org>
++
++ This program is free software; you can redistribute it and/or modify
++ it under the terms of the GNU General Public License as published by
++ the Free Software Foundation; either version 2 of the License, or
++ (at your option) any later version.
++
++ This program is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ GNU General Public License for more details.
++
++ You should have received a copy of the GNU General Public License
++ along with this program; if not, write to the Free Software
++ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
++
++ As a special exception, permission is given to link this program
++ with any edition of Qt, and distribute the resulting executable,
++ without including the source code for Qt in the source distribution.
++*/
++
++#ifndef FEEDRETRIEVER_H_
++#define FEEDRETRIEVER_H_
++
++#include <syndication/dataretriever.h>
++
++class KJob;
++
++namespace Akregator {
++
++class FeedRetriever : public Syndication::DataRetriever
++{
++ Q_OBJECT
++public:
++ explicit FeedRetriever();
++
++ void retrieveData(const QUrl &url) override;
++ void abort() override;
++ int errorCode() const override;
++
++private Q_SLOTS:
++ void getFinished(KJob *job);
++
++private:
++ KJob *mJob = nullptr;
++ int mError = 0;
++};
++
++}
++
++#endif
+--
+cgit v0.11.2