File indexing completed on 2025-01-19 04:28:13

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 #pragma once
0008 
0009 #include <QNetworkReply>
0010 #include <QObject>
0011 
0012 #include "sync/syncutils.h"
0013 
0014 class GenericRequest : public QObject
0015 {
0016     Q_OBJECT
0017 
0018 public:
0019     GenericRequest(SyncUtils::Provider provider, QNetworkReply *reply, QObject *parent);
0020 
0021     int error() const;
0022     QString errorString() const;
0023     bool aborted() const;
0024     void abort();
0025 
0026 Q_SIGNALS:
0027     void finished();
0028     void aborting();
0029 
0030 protected:
0031     virtual void processResults() = 0;
0032 
0033     QString cleanupUrl(const QString &url) const;
0034 
0035     QNetworkReply *m_reply;
0036     SyncUtils::Provider m_provider;
0037     int m_error = 0;
0038     QString m_errorString;
0039     bool m_abort = false;
0040 };