KUserFeedback

surveyinfo.cpp
1/*
2 SPDX-FileCopyrightText: 2016 Volker Krause <vkrause@kde.org>
3
4 SPDX-License-Identifier: MIT
5*/
6
7#include "surveyinfo.h"
8
9#include <QJsonObject>
10#include <QSharedData>
11
12using namespace KUserFeedback;
13
14class KUserFeedback::SurveyInfoData : public QSharedData
15{
16public:
17 QUuid uuid;
18 QUrl url;
19 QString target;
20};
21
22
23SurveyInfo::SurveyInfo() : d (new SurveyInfoData)
24{
25}
26
28 d(other.d)
29{
30}
31
32SurveyInfo::~SurveyInfo()
33{
34}
35
37{
38 d = other.d;
39 return *this;
40}
41
42bool SurveyInfo::isValid() const
43{
44 return !d->uuid.isNull() && d->url.isValid();
45}
46
47QUuid SurveyInfo::uuid() const
48{
49 return d->uuid;
50}
51
52void SurveyInfo::setUuid(const QUuid &id)
53{
54 d->uuid = id;
55}
56
57QUrl SurveyInfo::url() const
58{
59 return d->url;
60}
61
62void SurveyInfo::setUrl(const QUrl& url)
63{
64 d->url = url;
65}
66
67QString SurveyInfo::target() const
68{
69 return d->target;
70}
71
72void SurveyInfo::setTarget(const QString &target)
73{
74 d->target = target;
75}
76
77SurveyInfo SurveyInfo::fromJson(const QJsonObject& obj)
78{
79 SurveyInfo s;
80 s.setUuid(QUuid(obj.value(QLatin1String("uuid")).toString()));
81 s.setUrl(QUrl(obj.value(QLatin1String("url")).toString()));
82 s.setTarget(obj.value(QLatin1String("target")).toString());
83 return s;
84}
85
86#include "moc_surveyinfo.cpp"
Information about a survey request.
Definition surveyinfo.h:31
SurveyInfo()
Create an empty, invalid survey request.
SurveyInfo & operator=(const SurveyInfo &)
Assignment operator.
Classes for integrating telemetry collection, survey targeting, and contribution encouragenemt and co...
QJsonValue value(QLatin1StringView key) const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 16:57:44 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.