9#include <QJsonDocument>
13using namespace KGAPI2::Blogger;
15class Q_DECL_HIDDEN
Page::Private
38Page::Private::Private()
43Page::Private::~Private()
63void Page::setId(
const QString &
id)
73void Page::setBlogId(
const QString &blogId)
83void Page::setPublished(
const QDateTime &published)
85 d->published = published;
93void Page::setUpdated(
const QDateTime &updated)
103void Page::setUrl(
const QUrl &url)
113void Page::setTitle(
const QString &title)
123void Page::setContent(
const QString &content)
133QString Page::authorName()
const
135 return d->authorName;
138QUrl Page::authorUrl()
const
143QUrl Page::authorImageUrl()
const
145 return d->authorImageUrl;
148Page::Status Page::status()
const
153void Page::setStatus(Page::Status
status)
161 const QVariantMap
map = json.
toMap();
163 page->d->id =
map[QStringLiteral(
"id")].toString();
164 page->d->blogId =
map[QStringLiteral(
"blog")].toMap()[QStringLiteral(
"id")].toString();
167 page->d->url =
map[QStringLiteral(
"url")].toUrl();
168 page->d->title =
map[QStringLiteral(
"title")].toString();
169 page->d->content =
map[QStringLiteral(
"content")].toString();
170 const QVariantMap author =
map[QStringLiteral(
"author")].toMap();
171 page->d->authorId = author[QStringLiteral(
"id")].toString();
172 page->d->authorName = author[QStringLiteral(
"displayName")].toString();
173 page->d->authorUrl = author[QStringLiteral(
"url")].toUrl();
174 page->d->authorImageUrl = author[QStringLiteral(
"image")].toMap()[QStringLiteral(
"url")].toUrl();
176 const QString status =
map[QStringLiteral(
"status")].toString();
178 page->d->status = Live;
180 page->d->status = Draft;
182 page->d->status = Imported;
184 page->d->status = UnknownStatus;
195 if (!page->d->id.isEmpty()) {
196 map[QStringLiteral(
"id")] = page->d->id;
198 map[QStringLiteral(
"blogId")] = page->d->blogId;
199 if (page->d->published.isValid()) {
200 map[QStringLiteral(
"published")] = page->d->published.toString(
Qt::ISODate);
202 if (page->d->updated.isValid()) {
203 map[QStringLiteral(
"updated")] = page->d->updated.toString(
Qt::ISODate);
205 map[QStringLiteral(
"url")] = page->d->url.toString();
206 map[QStringLiteral(
"title")] = page->d->title;
207 map[QStringLiteral(
"content")] = page->d->content;
208 switch (page->d->status) {
209 case Blogger::Page::Draft:
212 case Blogger::Page::Live:
230 const QVariantMap
map = json.
toMap();
235 return Private::fromJSON(map);
245 const QVariantMap
map = json.
toMap();
251 const QVariantList variantList =
map[QStringLiteral(
"items")].toList();
253 for (
const QVariant &item : variantList) {
254 list << Private::fromJSON(item);
Base class for all objects.
Q_SCRIPTABLE CaptureState status()
char * toString(const EngineQuery &query)
A job to fetch a single map tile described by a StaticMapUrl.
KIOCORE_EXPORT QStringList list(const QString &fileClass)
QDateTime fromString(QStringView string, QStringView format, QCalendar cal)
QJsonDocument fromJson(const QByteArray &json, QJsonParseError *error)
QJsonDocument fromVariant(const QVariant &variant)
bool isNull() const const
QByteArray toJson(JsonFormat format) const const
QVariant toVariant() const const
void reserve(qsizetype size)
QFuture< void > map(Iterator begin, Iterator end, MapFunctor &&function)
QString url(FormattingOptions options) const const
QMap< QString, QVariant > toMap() const const