File indexing completed on 2024-12-22 04:57:55

0001 /*
0002     SPDX-FileCopyrightText: 2016 Stefan Stäglich <sstaeglich@kdemail.net>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include "o1tomboy.h"
0010 #include "o2/o1requestor.h"
0011 #include <KCompositeJob>
0012 #include <QNetworkAccessManager>
0013 #include <QString>
0014 
0015 enum TomboyJobError {
0016     NoError,
0017     TemporaryError,
0018     PermanentError,
0019 };
0020 
0021 class TomboyJobBase : public KCompositeJob
0022 {
0023     Q_OBJECT
0024 public:
0025     explicit TomboyJobBase(QNetworkAccessManager *manager, QObject *parent = nullptr);
0026 
0027     void setServerURL(const QString &apiurl, const QString &contenturl);
0028     void setAuthentication(const QString &token, const QString &secret);
0029 
0030 protected:
0031     QNetworkAccessManager *const mManager;
0032     O1Requestor *mRequestor = nullptr;
0033     O1Tomboy *const mO1;
0034     QNetworkReply *mReply = nullptr;
0035 
0036     QString mApiURL;
0037     QString mContentURL;
0038 
0039     void checkReplyError();
0040 };