10#include <QJsonDocument>
14using namespace KGAPI2::Drive;
16class Q_DECL_HIDDEN App::Icon::Private
20 Private(
const Private &other);
26 static Category categoryFromName(
const QString &categoryName);
29App::Icon::Private::Private()
33App::Icon::Private::Private(
const Private &other)
36 , iconUrl(other.iconUrl)
40App::Icon::Category App::Icon::Private::categoryFromName(
const QString &categoryName)
43 return App::Icon::ApplicationCategory;
45 return App::Icon::DocumentCategory;
47 return App::Icon::DocumentSharedCategory;
49 return App::Icon::UndefinedCategory;
58App::Icon::Icon(
const App::Icon &other)
59 : d(new Private(*(other.d)))
68bool App::Icon::operator==(
const Icon &other)
const
70 GAPI_COMPARE(category)
76App::Icon::Category App::Icon::category()
const
81int App::Icon::size()
const
86QUrl App::Icon::iconUrl()
const
93class Q_DECL_HIDDEN App::Private
97 Private(
const Private &other);
114 static AppPtr fromJSON(
const QVariantMap &map);
117App::Private::Private()
118 : supportsCreate(false)
119 , supportsImport(false)
122 , useByDefault(false)
126App::Private::Private(
const App::Private &other)
129 , objectType(other.objectType)
130 , supportsCreate(other.supportsCreate)
131 , supportsImport(other.supportsImport)
132 , installed(other.installed)
133 , authorized(other.authorized)
134 , useByDefault(other.useByDefault)
135 , productUrl(other.productUrl)
136 , primaryMimeTypes(other.primaryMimeTypes)
137 , secondaryMimeTypes(other.secondaryMimeTypes)
138 , primaryFileExtensions(other.primaryFileExtensions)
139 , secondaryFileExtensions(other.secondaryFileExtensions)
144AppPtr App::Private::fromJSON(
const QVariantMap &map)
151 app->setEtag(map[QStringLiteral(
"etag")].
toString());
152 app->d->id =
map[QStringLiteral(
"id")].toString();
153 app->d->name =
map[QStringLiteral(
"map")].toString();
154 app->d->objectType =
map[QStringLiteral(
"objectType")].toString();
155 app->d->supportsCreate =
map[QStringLiteral(
"supportsCreate")].toBool();
156 app->d->supportsImport =
map[QStringLiteral(
"supportsImport")].toBool();
157 app->d->installed =
map[QStringLiteral(
"installed")].toBool();
158 app->d->authorized =
map[QStringLiteral(
"authorized")].toBool();
159 app->d->useByDefault =
map[QStringLiteral(
"useByDefault")].toBool();
160 app->d->productUrl =
map[QStringLiteral(
"productUrl")].toUrl();
161 app->d->primaryMimeTypes =
map[QStringLiteral(
"primaryMimeTypes")].toStringList();
162 app->d->secondaryMimeTypes =
map[QStringLiteral(
"secondaryMimeTypes")].toStringList();
163 app->d->primaryFileExtensions =
map[QStringLiteral(
"primaryFileExtensions")].toStringList();
164 app->d->secondaryFileExtensions =
map[QStringLiteral(
"secondaryFileExtensions")].toStringList();
166 const QVariantList icons =
map[QStringLiteral(
"icons")].toList();
168 const QVariantMap &iconData = i.toMap();
170 IconPtr icon(
new Icon());
171 icon->d->category = Icon::Private::categoryFromName(iconData[QStringLiteral(
"category")].
toString());
172 icon->d->size = iconData[QStringLiteral(
"size")].toInt();
173 icon->d->iconUrl = iconData[QStringLiteral(
"iconUrl")].toUrl();
175 app->d->icons << icon;
187App::App(
const App &other)
189 , d(new Private(*(other.d)))
198bool App::operator==(
const App &other)
const
200 if (!Object::operator==(other)) {
206 GAPI_COMPARE(objectType)
207 GAPI_COMPARE(supportsCreate)
208 GAPI_COMPARE(supportsImport)
209 GAPI_COMPARE(installed)
210 GAPI_COMPARE(authorized)
211 GAPI_COMPARE(useByDefault)
212 GAPI_COMPARE(productUrl)
213 GAPI_COMPARE(primaryMimeTypes)
214 GAPI_COMPARE(secondaryMimeTypes)
215 GAPI_COMPARE(primaryFileExtensions)
216 GAPI_COMPARE(secondaryFileExtensions)
217 GAPI_COMPARE_CONTAINERS(icons)
233 return d->objectType;
236bool App::supportsCreate()
const
238 return d->supportsCreate;
241bool App::supportsImport()
const
243 return d->supportsImport;
246bool App::installed()
const
251bool App::authorized()
const
253 return d->authorized;
256bool App::useByDefault()
const
258 return d->useByDefault;
261QUrl App::productUrl()
const
263 return d->productUrl;
268 return d->primaryMimeTypes;
273 return d->secondaryMimeTypes;
278 return d->primaryFileExtensions;
283 return d->secondaryFileExtensions;
298 return Private::fromJSON(data.
toMap());
308 const QVariantMap
map = data.
toMap();
314 const QVariantList items =
map[QStringLiteral(
"items")].toList();
315 for (
const QVariant &item : items) {
316 const AppPtr app = Private::fromJSON(item.toMap());
Base class for all objects.
char * toString(const EngineQuery &query)
A job to fetch a single map tile described by a StaticMapUrl.
KIOCORE_EXPORT QStringList list(const QString &fileClass)
QString name(StandardAction id)
Category category(StandardShortcut id)
QJsonDocument fromJson(const QByteArray &json, QJsonParseError *error)
bool isNull() const const
QVariant toVariant() const const
bool isNull() const const
QFuture< void > map(Iterator begin, Iterator end, MapFunctor &&function)
QMap< QString, QVariant > toMap() const const