Attica 5.109.0
atticabasejob.h
1/*
2 This file is part of KDE.
3
4 SPDX-FileCopyrightText: 2008 Cornelius Schumacher <schumacher@kde.org>
5
6 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
7 */
8#ifndef ATTICA_ATTICABASEJOB_H
9#define ATTICA_ATTICABASEJOB_H
10
11#include <QNetworkAccessManager>
12#include <QNetworkRequest>
13#include <QObject>
14#include <QSharedPointer>
15#include <QUrl>
16
17#include "attica_export.h"
18#include "metadata.h"
19
20class QNetworkReply;
21
22namespace Attica
23{
24class PlatformDependent;
25
31class ATTICA_EXPORT BaseJob : public QObject
32{
33 Q_OBJECT
34
35public:
36 ~BaseJob() override;
37
38 Metadata metadata() const;
39
40 enum NetworkRequestCustomAttributes {
41 UserAttribute = QNetworkRequest::User + 1,
42 PasswordAttribute,
43 };
44
50 bool isAborted() const;
51
52public Q_SLOTS:
53 void start();
54 void abort();
55
56Q_SIGNALS:
57 void finished(Attica::BaseJob *job);
58
59protected Q_SLOTS:
60 void dataFinished();
61
62protected:
63 BaseJob(PlatformDependent *internals);
64
65 void setMetadata(const Metadata &data) const;
66
67 virtual QNetworkReply *executeRequest() = 0;
68 virtual void parse(const QString &xml) = 0;
69 PlatformDependent *internals();
70 void setError(int errorCode);
71
72private Q_SLOTS:
73 ATTICA_NO_EXPORT void doWork();
74 ATTICA_NO_EXPORT void authenticationRequired(QNetworkReply *, QAuthenticator *);
75
76private:
77 BaseJob(const BaseJob &other) = delete;
78 BaseJob &operator=(const BaseJob &other) = delete;
79
80 class Private;
81 Private *d;
82};
83
84}
85
86#endif
The baseclass for all job classes.
Definition atticabasejob.h:32
bool isAborted() const
Status messages from the server.
Definition metadata.h:29
The Attica namespace,.
Definition activity.h:21