KUserFeedback

qmlproviderextension.cpp
1/*
2 SPDX-FileCopyrightText: 2017 Volker Krause <vkrause@kde.org>
3
4 SPDX-License-Identifier: MIT
5*/
6
7#include "qmlproviderextension.h"
8
9using namespace KUserFeedback;
10
11QmlProviderExtension::QmlProviderExtension(QObject* parent) :
12 QObject(parent)
13{
14}
15
16QmlProviderExtension::~QmlProviderExtension()
17{
18}
19
20void QmlProviderExtension::sourceAppend(QQmlListProperty<QmlAbstractDataSource> *prop, QmlAbstractDataSource *value)
21{
22 static_cast<QmlProviderExtension*>(prop->object)->m_sourceWrappers.push_back(value);
23 static_cast<Provider*>(prop->object->parent())->addDataSource(value->source());
24}
25
26QmlProviderExtension::sizetype QmlProviderExtension::sourceCount(QQmlListProperty<QmlAbstractDataSource> *prop)
27{
28 return static_cast<QmlProviderExtension*>(prop->object)->m_sourceWrappers.size();
29}
30
31QmlAbstractDataSource* QmlProviderExtension::sourceAt(QQmlListProperty<QmlAbstractDataSource> *prop, QmlProviderExtension::sizetype index)
32{
33 return static_cast<QmlProviderExtension*>(prop->object)->m_sourceWrappers.at(index);
34}
35
36void QmlProviderExtension::sourceClear(QQmlListProperty<QmlAbstractDataSource> *prop)
37{
38 static_cast<QmlProviderExtension*>(prop->object)->m_sourceWrappers.clear();
39}
40
41QQmlListProperty<QmlAbstractDataSource> QmlProviderExtension::sources()
42{
43 return QQmlListProperty<QmlAbstractDataSource>(this, nullptr,
44 QmlProviderExtension::sourceAppend, QmlProviderExtension::sourceCount,
45 QmlProviderExtension::sourceAt, QmlProviderExtension::sourceClear);
46}
47
48#include "moc_qmlproviderextension.cpp"
The central object managing data sources and transmitting feedback to the server.
Definition provider.h:32
void addDataSource(AbstractDataSource *source)
Adds a data source for telemetry data collection.
Definition provider.cpp:508
Classes for integrating telemetry collection, survey targeting, and contribution encouragenemt and co...
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 29 2024 11:48:42 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.