Attica

metadata.cpp
1/*
2 This file is part of KDE.
3
4 SPDX-FileCopyrightText: 2009 Frederik Gladhorn <gladhorn@kde.org>
5
6 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
7*/
8
9#include "metadata.h"
10
11#include <QSharedData>
12
13using namespace Attica;
14
15class Q_DECL_HIDDEN Metadata::Private : public QSharedData
16{
17public:
18 Error error;
19
20 /// The status of the job, for example "Ok"
21 QString statusString;
22 /// The status as int, for easier interpretation.
23 /// 100 means "Ok", for other codes refer to http://www.freedesktop.org/wiki/Specifications/open-collaboration-services
24 int statusCode;
25
26 /// An optional additional message from the server
27 QString message;
28
29 /// The number of items returned by this job (only relevant for list jobs)
30 int totalItems;
31 /// The number of items per page the server was asked for
32 int itemsPerPage;
33
34 QString resultingId;
35
36 /// The http headers for the most recent network action in the case of a network error
38
39 Private()
40 // values that make sense for single item jobs
41 : error(NoError)
42 , statusCode(0)
43 , totalItems(1)
44 , itemsPerPage(1)
45 {
46 }
47};
48
49Metadata::Metadata()
50 : d(new Private)
51{
52}
53
54Metadata::~Metadata()
55{
56}
57
58Metadata::Metadata(const Attica::Metadata &other)
59 : d(other.d)
60{
61}
62
63Metadata &Metadata::operator=(const Attica::Metadata &other)
64{
65 d = other.d;
66 return *this;
67}
68
69Metadata::Error Metadata::error() const
70{
71 return d->error;
72}
73
74void Metadata::setError(Metadata::Error error)
75{
76 d->error = error;
77}
78
80{
81 return d->message;
82}
83
84void Metadata::setMessage(const QString &message)
85{
86 d->message = message;
87}
88
90{
91 return d->resultingId;
92}
93
94void Metadata::setResultingId(const QString &id)
95{
96 d->resultingId = id;
97}
98
100{
101 return d->statusCode;
102}
103
104void Metadata::setStatusCode(int code)
105{
106 d->statusCode = code;
107}
108
110{
111 return d->statusString;
112}
113
114void Metadata::setStatusString(const QString &status)
115{
116 d->statusString = status;
117}
118
120{
121 return d->totalItems;
122}
123
124void Metadata::setTotalItems(int items)
125{
126 d->totalItems = items;
127}
128
130{
131 return d->itemsPerPage;
132}
133
134void Metadata::setItemsPerPage(int itemsPerPage)
135{
136 d->itemsPerPage = itemsPerPage;
137}
138
140{
141 return d->headers;
142}
143
145{
146 d->headers = headers;
147}
Status messages from the server.
Definition metadata.h:29
QString message()
An optional additional message from the server.
Definition metadata.cpp:79
QString resultingId()
The resulting ID when a PostJob created a new item.
Definition metadata.cpp:89
QList< QNetworkReply::RawHeaderPair > headers() const
The http headers for the most recent network action in the case of a network error Use this to furthe...
Definition metadata.cpp:139
void setHeaders(const QList< QNetworkReply::RawHeaderPair > &headers)
Sets the http headers read by headers()
Definition metadata.cpp:144
int totalItems()
The number of items returned by this job (only relevant for list jobs)
Definition metadata.cpp:119
int itemsPerPage()
The number of items per page the server was asked for.
Definition metadata.cpp:129
int statusCode() const
The status as integer.
Definition metadata.cpp:99
QString statusString() const
The status of the job, for example "Ok".
Definition metadata.cpp:109
Error error() const
Check if the job was successful.
Definition metadata.cpp:69
Q_SCRIPTABLE CaptureState status()
The Attica namespace,.
void error(QWidget *parent, const QString &text, const QString &title, const KGuiItem &buttonOk, Options options=Notify)
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.