Attica

metadata.cpp
1 /*
2  This file is part of KDE.
3 
4  SPDX-FileCopyrightText: 2009 Frederik Gladhorn <[email protected]>
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 
13 using namespace Attica;
14 
15 class Q_DECL_HIDDEN Metadata::Private : public QSharedData
16 {
17 public:
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
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 
49 Metadata::Metadata()
50  : d(new Private)
51 {
52 }
53 
54 Metadata::~Metadata()
55 {
56 }
57 
58 Metadata::Metadata(const Attica::Metadata &other)
59  : d(other.d)
60 {
61 }
62 
63 Metadata &Metadata::operator=(const Attica::Metadata &other)
64 {
65  d = other.d;
66  return *this;
67 }
68 
69 Metadata::Error Metadata::error() const
70 {
71  return d->error;
72 }
73 
74 void Metadata::setError(Metadata::Error error)
75 {
76  d->error = error;
77 }
78 
80 {
81  return d->message;
82 }
83 
84 void Metadata::setMessage(const QString &message)
85 {
86  d->message = message;
87 }
88 
90 {
91  return d->resultingId;
92 }
93 
94 void Metadata::setResultingId(const QString &id)
95 {
96  d->resultingId = id;
97 }
98 
100 {
101  return d->statusCode;
102 }
103 
104 void Metadata::setStatusCode(int code)
105 {
106  d->statusCode = code;
107 }
108 
110 {
111  return d->statusString;
112 }
113 
114 void Metadata::setStatusString(const QString &status)
115 {
116  d->statusString = status;
117 }
118 
120 {
121  return d->totalItems;
122 }
123 
124 void Metadata::setTotalItems(int items)
125 {
126  d->totalItems = items;
127 }
128 
130 {
131  return d->itemsPerPage;
132 }
133 
134 void Metadata::setItemsPerPage(int itemsPerPage)
135 {
136  d->itemsPerPage = itemsPerPage;
137 }
138 
140 {
141  return d->headers;
142 }
143 
145 {
146  d->headers = headers;
147 }
Error error() const
Check if the job was successful.
Definition: metadata.cpp:69
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
QString message()
An optional additional message from the server.
Definition: metadata.cpp:79
Q_SCRIPTABLE CaptureState status()
int itemsPerPage()
The number of items per page the server was asked for.
Definition: metadata.cpp:129
void error(QWidget *parent, const QString &text, const QString &title, const KGuiItem &buttonOk, Options options=Notify)
QString statusString() const
The status of the job, for example "Ok".
Definition: metadata.cpp:109
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
The Attica namespace,.
QString resultingId()
The resulting ID when a PostJob created a new item.
Definition: metadata.cpp:89
QString message
int statusCode() const
The status as integer.
Definition: metadata.cpp:99
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Sun Dec 3 2023 04:08:16 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.