Search for usage in LXR

KUserFeedback::Provider Class Reference

#include <provider.h>

Inheritance diagram for KUserFeedback::Provider:

Public Types

enum  TelemetryMode {
  NoTelemetry, BasicSystemInformation = 0x10, BasicUsageStatistics = 0x20, DetailedSystemInformation = 0x30,
  DetailedUsageStatistics = 0x40


int applicationStartsUntilEncouragement
int applicationUsageTimeUntilEncouragement
QString describeDataSources
bool enabled
int encouragementDelay
int encouragementInterval
QUrl feedbackServer
QString productIdentifier
int submissionInterval
int surveyInterval
TelemetryMode telemetryMode
- Properties inherited from QObject


void dataSourcesChanged ()
void enabledChanged ()
void providerSettingsChanged ()
void showEncouragementMessage ()
void surveyAvailable (const KUserFeedback::SurveyInfo &survey)
void surveyIntervalChanged ()
void telemetryModeChanged ()

Public Slots

void load ()
void store ()
void submit ()
void surveyCompleted (const KUserFeedback::SurveyInfo &info)

Public Member Functions

 Provider (QObject *parent=nullptr)
void addDataSource (AbstractDataSource *source)
int applicationStartsUntilEncouragement () const
int applicationUsageTimeUntilEncouragement () const
AbstractDataSourcedataSource (const QString &id) const
QVector< AbstractDataSource * > dataSources () const
QString describeDataSources () const
int encouragementDelay () const
int encouragementInterval () const
QUrl feedbackServer () const
bool isEnabled () const
QString productIdentifier () const
void restoreDefaults ()
void setApplicationStartsUntilEncouragement (int starts)
void setApplicationUsageTimeUntilEncouragement (int secs)
void setEnabled (bool enabled)
void setEncouragementDelay (int secs)
void setEncouragementInterval (int days)
void setFeedbackServer (const QUrl &url)
void setProductIdentifier (const QString &productId)
void setSubmissionInterval (int days)
void setSurveyInterval (int days)
void setTelemetryMode (TelemetryMode mode)
int submissionInterval () const
int surveyInterval () const
TelemetryMode telemetryMode () const
- Public Member Functions inherited from QObject
 QObject (QObject *parent)
bool blockSignals (bool block)
const QObjectListchildren () const const
QMetaObject::Connection connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const const
void deleteLater ()
void destroyed (QObject *obj)
bool disconnect (const char *signal, const QObject *receiver, const char *method) const const
bool disconnect (const QObject *receiver, const char *method) const const
void dumpObjectInfo ()
void dumpObjectInfo () const const
void dumpObjectTree ()
void dumpObjectTree () const const
QList< QByteArraydynamicPropertyNames () const const
virtual bool event (QEvent *e)
virtual bool eventFilter (QObject *watched, QEvent *event)
findChild (const QString &name, Qt::FindChildOptions options) const const
QList< T > findChildren (const QString &name, Qt::FindChildOptions options) const const
QList< T > findChildren (const QRegExp &regExp, Qt::FindChildOptions options) const const
QList< T > findChildren (const QRegularExpression &re, Qt::FindChildOptions options) const const
bool inherits (const char *className) const const
void installEventFilter (QObject *filterObj)
bool isWidgetType () const const
bool isWindowType () const const
void killTimer (int id)
virtual const QMetaObjectmetaObject () const const
void moveToThread (QThread *targetThread)
QString objectName () const const
void objectNameChanged (const QString &objectName)
QObjectparent () const const
QVariant property (const char *name) const const
 Q_CLASSINFO (Name, Value)
 Q_ENUM (...)
 Q_ENUM_NS (...)
 Q_ENUMS (...)
 Q_FLAG (...)
 Q_FLAG_NS (...)
 Q_FLAGS (...)
qFindChild (const QObject *obj, const QString &name)
QList< T > qFindChildren (const QObject *obj, const QRegExp &regExp)
QList< T > qFindChildren (const QObject *obj, const QString &name)
qobject_cast (QObject *object)
qobject_cast (const QObject *object)
void removeEventFilter (QObject *obj)
void setObjectName (const QString &name)
void setParent (QObject *parent)
bool setProperty (const char *name, const QVariant &value)
bool signalsBlocked () const const
int startTimer (int interval, Qt::TimerType timerType)
int startTimer (std::chrono::milliseconds time, Qt::TimerType timerType)
QThreadthread () const const

Additional Inherited Members

- Static Public Member Functions inherited from QObject
QMetaObject::Connection connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
QMetaObject::Connection connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type)
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type)
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, Functor functor)
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type)
bool disconnect (const QMetaObject::Connection &connection)
bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method)
bool disconnect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method)
bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method)
QString tr (const char *sourceText, const char *disambiguation, int n)
QString trUtf8 (const char *sourceText, const char *disambiguation, int n)
- Public Attributes inherited from QObject
typedef QObjectList
- Protected Member Functions inherited from QObject
virtual void childEvent (QChildEvent *event)
virtual void connectNotify (const QMetaMethod &signal)
virtual void customEvent (QEvent *event)
virtual void disconnectNotify (const QMetaMethod &signal)
bool isSignalConnected (const QMetaMethod &signal) const const
int receivers (const char *signal) const const
QObjectsender () const const
int senderSignalIndex () const const
virtual void timerEvent (QTimerEvent *event)

Detailed Description

The central object managing data sources and transmitting feedback to the server.

The defaults for this class are very defensive, so in order to make it actually operational and submit data, there is a number of settings you need to set in code, namely submission intervals, encouragement settings and adding data sources. The settings about what data to submit (telemetryMode) and how often to bother the user with surveys (surveyInterval) should not be set to hardcoded values in code, but left as choices to the user.

Definition at line 31 of file provider.h.

Member Enumeration Documentation

Telemetry collection modes.

Colleciton modes are inclusive, ie. higher modes always imply data from lower modes too.


Transmit no data at all.


Transmit basic information about the system.


Transmit basic usage statistics.


Transmit detailed system information.


Transmit detailed usage statistics.

Definition at line 102 of file provider.h.

Property Documentation

int Provider::applicationStartsUntilEncouragement

Times the application has to be started before an encouragement message is shown.

See also

Definition at line 73 of file provider.h.

int Provider::applicationUsageTimeUntilEncouragement

Application usage time in seconds before an encouragement message is shown.

See also

Definition at line 81 of file provider.h.

bool KUserFeedback::Provider::enabled

The global enabled state of the feedback functionality.

If this is false, all feedback functionality has to be disabled completely.

Definition at line 37 of file provider.h.

int Provider::encouragementDelay

Encouragement delay after application start in seconds.

See also

Definition at line 86 of file provider.h.

int Provider::encouragementInterval

Encouragement interval.

See also

Definition at line 91 of file provider.h.

QUrl Provider::feedbackServer

URL of the feedback server.

See also

Definition at line 60 of file provider.h.

QString Provider::productIdentifier

Unique product id as set on the feedback server.

See also

Definition at line 55 of file provider.h.

int Provider::submissionInterval

Submission interval in days.

See also

Definition at line 65 of file provider.h.

int Provider::surveyInterval

The interval in which the user accepts surveys.

This should be configurable for the user. -1 indicates surveys are disabled.

See also
surveyInterval(), setSurveyInterval()

Definition at line 44 of file provider.h.

Provider::TelemetryMode Provider::telemetryMode

The telemetry mode the user has configured.

This should be configurable for the user.

See also
telemetryMode(), setTelemetryMode()

Definition at line 50 of file provider.h.

Constructor & Destructor Documentation

Provider::Provider ( QObject parent = nullptr)

Create a new feedback provider.

parentThe parent object.

Definition at line 392 of file provider.cpp.

Member Function Documentation

void Provider::addDataSource ( AbstractDataSource source)

Adds a data source for telemetry data collection.

sourceThe data source to add. The Provider takes ownership of source.

Definition at line 501 of file provider.cpp.

int KUserFeedback::Provider::applicationStartsUntilEncouragement ( ) const

Returns the amount of application starts before an encouragement message is shown.

int KUserFeedback::Provider::applicationUsageTimeUntilEncouragement ( ) const

Returns the amount of application usage time before an encouragement message is shown.

AbstractDataSource * Provider::dataSource ( const QString id) const

Returns a data source with matched id.

iddata source unique identifier
pointer to found data source or nullptr if data source is not found

Definition at line 524 of file provider.cpp.

QVector< AbstractDataSource * > Provider::dataSources ( ) const

Returns all data sources that have been added to this provider.

See also

Definition at line 519 of file provider.cpp.

void KUserFeedback::Provider::dataSourcesChanged ( )

Emitted when a data source is added or removed.

QString KUserFeedback::Provider::describeDataSources ( ) const

Returns a string with each source and its enable mode.

void KUserFeedback::Provider::enabledChanged ( )

Emitted when the global enabled state changed.

int KUserFeedback::Provider::encouragementDelay ( ) const

Returns the current encouragement delay in seconds.

int KUserFeedback::Provider::encouragementInterval ( ) const

Returns the current encouragement interval.

QUrl KUserFeedback::Provider::feedbackServer ( ) const

Returns the current feedback server URL.

bool Provider::isEnabled ( ) const

Returns whether feedback functionality is enabled on this system.

This should be checked everywhere showing feedback UI to the user to respect the global "kill switch" for this. Provider does check this internally for encouragements, surveys and telemetry submission.

Definition at line 414 of file provider.cpp.

void Provider::load ( )

Manually load settings of the provider and all added data sources.

Automatically invoked after object construction and changing product ID.

Potentially long operation.

Definition at line 617 of file provider.cpp.

QString KUserFeedback::Provider::productIdentifier ( ) const

Returns the current product identifier.

void KUserFeedback::Provider::providerSettingsChanged ( )

Emitted when any provider setting changed.

void Provider::restoreDefaults ( )

Set the telemetry mode and the survey interval back to their default values.

See also
telemetryMode(), surveyInterval()

Definition at line 429 of file provider.cpp.

void Provider::setApplicationStartsUntilEncouragement ( int  starts)

Set the amount of application starts until the encouragement message should be shown.

The default is -1, ie. no encouragement based on application starts.

startsThe amount of application starts after which an encouragement message should be displayed.

Definition at line 553 of file provider.cpp.

void Provider::setApplicationUsageTimeUntilEncouragement ( int  secs)

Set the amount of usage time until the encouragement message should be shown.

The default is -1, ie. no encouragement based on application usage time.

secsAmount of seconds until the encouragement should be shown.

Definition at line 567 of file provider.cpp.

void Provider::setEnabled ( bool  enabled)

Set the global (user-wide) activation state for feedback functionality.

See also

Definition at line 421 of file provider.cpp.

void Provider::setEncouragementDelay ( int  secs)

Set the delay after application start for the earliest display of the encouragement message.

The default is 300, ie. 5 minutes after the application start.

This only adds an additional constraint on usage time and startup count based encouragement messages, it does not actually trigger encouragement messages itself.
secsAmount of seconds after the application start for the earliest display of an encouragement message.
See also
setApplicationStartsUntilEncouragement, setApplicationUsageTimeUntilEncouragement

Definition at line 581 of file provider.cpp.

void Provider::setEncouragementInterval ( int  days)

Sets the interval after the encouragement should be repeated.

Encouragement messages are only repeated if no feedback options have been enabled. The default is -1, that is no repeated encouragement at all.

daysDays between encouragement messages, 0 disables repeated encouragements.

Definition at line 595 of file provider.cpp.

void Provider::setFeedbackServer ( const QUrl url)

Set the feedback server URL.

This must be called with an appropriate URL for this class to be operational.

urlThe URL of the feedback server.

Definition at line 462 of file provider.cpp.

void Provider::setProductIdentifier ( const QString productId)

Set the product identifier.

This is used to distinguish independent products on the same server. If this is not specified, the product identifier is derived from the application name organisation domain specified in QCoreApplication.

productIdUnique product identifier, as configured on the feedback server.

Definition at line 440 of file provider.cpp.

void Provider::setSubmissionInterval ( int  days)

Set the automatic submission interval in days.

This must be called with a positive number for this class to be operational, as the default is -1 (no submission ever).

Definition at line 475 of file provider.cpp.

void Provider::setSurveyInterval ( int  days)

Sets the minimum time in days between two surveys.

-1 indicates no surveys should be requested. 0 indicates no minimum time between surveys at all (i.e. bother the user as often as you want).

Definition at line 535 of file provider.cpp.

void Provider::setTelemetryMode ( TelemetryMode  mode)

Set which telemetry data should be submitted.

Definition at line 489 of file provider.cpp.

void KUserFeedback::Provider::showEncouragementMessage ( )

Indicate that the encouragement notice should be shown.

void Provider::store ( )

Manually store settings of the provider and all added data sources.

Will be autromatically invoked upon QCoreApplication::aboutToQuit signal.

Potentially long operation.

Definition at line 622 of file provider.cpp.

int KUserFeedback::Provider::submissionInterval ( ) const

Returns the current submission interval.

Days between telemetry submissions, or -1 if submission is off.
void Provider::submit ( )

Manually submit currently recorded data.

Definition at line 627 of file provider.cpp.

void KUserFeedback::Provider::surveyAvailable ( const KUserFeedback::SurveyInfo survey)

Emitted whenever there is a new survey available that can be presented to the user.

void Provider::surveyCompleted ( const KUserFeedback::SurveyInfo info)

Marks the given survey as completed.

This avoids getting further notification about the same survey.

Definition at line 604 of file provider.cpp.

int KUserFeedback::Provider::surveyInterval ( ) const

Returns the minimum time between two surveys in days.

The default is -1 (no surveys enabled).

void KUserFeedback::Provider::surveyIntervalChanged ( )

Emitted when the survey interval changed.

TelemetryMode KUserFeedback::Provider::telemetryMode ( ) const

Returns the current telemetry collection mode.

The default is NoTelemetry.

void KUserFeedback::Provider::telemetryModeChanged ( )

Emitted when the telemetry collection mode has changed.

The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Sun Sep 19 2021 23:07:51 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.