Attica

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
26/**
27 * @class BaseJob atticabasejob.h
28 *
29 * The baseclass for all job classes.
30 */
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
45 /**
46 * @returns whether abort() has been called on the job
47 *
48 * @since 5.87
49 */
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.
Status messages from the server.
Definition metadata.h:29
Q_SCRIPTABLE Q_NOREPLY void abort()
Q_SCRIPTABLE Q_NOREPLY void start()
The Attica namespace,.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:19:48 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.