File indexing completed on 2025-01-05 04:29:53
0001 /** 0002 * SPDX-FileCopyrightText: 2021 Bart De Vries <bart@mogwai.be> 0003 * 0004 * SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 0005 */ 0006 0007 #include "genericrequest.h" 0008 0009 #include <QNetworkReply> 0010 #include <QObject> 0011 0012 GenericRequest::GenericRequest(SyncUtils::Provider provider, QNetworkReply *reply, QObject *parent) 0013 : QObject(parent) 0014 , m_reply(reply) 0015 , m_provider(provider) 0016 { 0017 connect(m_reply, &QNetworkReply::finished, this, &GenericRequest::processResults); 0018 connect(this, &GenericRequest::aborting, m_reply, &QNetworkReply::abort); 0019 } 0020 0021 int GenericRequest::error() const 0022 { 0023 return m_error; 0024 } 0025 0026 QString GenericRequest::errorString() const 0027 { 0028 return m_errorString; 0029 } 0030 0031 bool GenericRequest::aborted() const 0032 { 0033 return m_abort; 0034 } 0035 0036 void GenericRequest::abort() 0037 { 0038 m_abort = true; 0039 Q_EMIT aborting(); 0040 } 0041 0042 QString GenericRequest::cleanupUrl(const QString &url) const 0043 { 0044 if (m_provider == SyncUtils::Provider::GPodderNet) { 0045 return QUrl::fromPercentEncoding(url.toUtf8()); 0046 } else { 0047 return url; 0048 } 0049 }