Pages
API Documentation
On this page

KUserFeedback::Provider Class

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

  • Header: #include <KUserFeedback/Provider>
  • CMake: find_package(KF6 REQUIRED COMPONENTS UserFeedbackCore)
    target_link_libraries(mytarget PRIVATE KF6::UserFeedbackCore)
  • Inherits: QObject

List of all members, including inherited members

Public Types

Properties

Public Functions

Public Slots

Signals

Detailed Description

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.

Member Type Documentation

enum Provider::TelemetryMode

Telemetry collection modes.

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

Constant Value Description
KUserFeedback::Provider::NoTelemetry 0 Transmit no data at all.
KUserFeedback::Provider::BasicSystemInformation 0x10 Transmit basic information about the* system.
KUserFeedback::Provider::BasicUsageStatistics 0x20 Transmit basic usage statistics.
KUserFeedback::Provider::DetailedSystemInformation 0x30 Transmit detailed system information.
KUserFeedback::Provider::DetailedUsageStatistics 0x40 Transmit detailed usage statistics.

Property Documentation

applicationStartsUntilEncouragement : int

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

Access functions:

Notifier signal:

See also setApplicationStartsUntilEncouragement

applicationUsageTimeUntilEncouragement : int

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

Access functions:

Notifier signal:

See also setApplicationUsageTimeUntilEncouragement

[read-only] describeDataSources : QString

Access functions:

Notifier signal:

enabled : bool

The global enabled state of the feedback functionality.

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

Access functions:

Notifier signal:

encouragementDelay : int

Encouragement delay after application start in seconds.

Access functions:

Notifier signal:

See also setEncouragementDelay

encouragementInterval : int

Encouragement interval.

Access functions:

Notifier signal:

See also setEncouragementInterval

feedbackServer : QUrl

URL of the feedback server.

Access functions:

Notifier signal:

See also setFeedbackServer

productIdentifier : QString

Unique product id as set on the feedback server.

Access functions:

Notifier signal:

See also setProductIdentifier

submissionInterval : int

Submission interval in days.

Access functions:

Notifier signal:

See also setSubmissionInterval

surveyInterval : int

The interval in which the user accepts surveys.

This should be configurable for the user.

-1 indicates surveys are disabled.

Access functions:

Notifier signal:

See also surveyInterval(), setSurveyInterval()

telemetryMode : TelemetryMode

The telemetry mode the user has configured.

This should be configurable for the user.

Access functions:

Notifier signal:

See also telemetryMode(), setTelemetryMode()

Member Function Documentation

[explicit] Provider::Provider(QObject *parent = nullptr)

Create a new feedback provider.

parent The parent object.

void Provider::addDataSource(KUserFeedback::AbstractDataSource *source)

Adds a data source for telemetry data collection.

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

int Provider::applicationStartsUntilEncouragement() const

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

Note: Getter function for property applicationStartsUntilEncouragement.

See also setApplicationStartsUntilEncouragement()

int Provider::applicationUsageTimeUntilEncouragement() const

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

Note: Getter function for property applicationUsageTimeUntilEncouragement.

See also setApplicationUsageTimeUntilEncouragement()

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

Returns a data source with matched id

id data source unique identifier

Returns pointer to found data source or nullptr if data source is not found

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

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

See also addDataSource

[signal] void Provider::dataSourcesChanged()

Emitted when a data source is added or removed.

Note: Notifier signal for property describeDataSources.

QString Provider::describeDataSources() const

Returns a string with each source and its enable mode.

Note: Getter function for property describeDataSources.

[signal] void Provider::enabledChanged()

Emitted when the global enabled state changed.

Note: Notifier signal for property enabled.

int Provider::encouragementDelay() const

Returns the current encouragement delay in seconds.

Note: Getter function for property encouragementDelay.

See also setEncouragementDelay()

int Provider::encouragementInterval() const

Returns the current encouragement interval.

Note: Getter function for property encouragementInterval.

See also setEncouragementInterval()

QUrl Provider::feedbackServer() const

Returns the current feedback server URL.

Note: Getter function for property feedbackServer.

See also setFeedbackServer()

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.

Note: Getter function for property enabled.

[slot] void Provider::load()

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

Automatically invoked after object construction and changing product ID.

Note: Potentially long operation.

QString Provider::productIdentifier() const

Returns the current product identifier.

Note: Getter function for property productIdentifier.

See also setProductIdentifier()

[signal] void Provider::providerSettingsChanged()

Emitted when any provider setting changed.

Note: Notifier signal for properties applicationStartsUntilEncouragement, applicationUsageTimeUntilEncouragement, encouragementDelay, encouragementInterval, feedbackServer, productIdentifier, and submissionInterval.

void Provider::restoreDefaults()

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

See also telemetryMode(), surveyInterval()

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.

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

Note: Setter function for property applicationStartsUntilEncouragement.

See also applicationStartsUntilEncouragement()

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.

secs Amount of seconds until the encouragement should be shown.

Note: Setter function for property applicationUsageTimeUntilEncouragement.

See also applicationUsageTimeUntilEncouragement()

void Provider::setEnabled(bool enabled)

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

Note: Setter function for property enabled.

See also isEnabled

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.

Note: This only adds an additional constraint on usage time and startup count based encouragement messages, it does not actually trigger encouragement messages itself.

secs Amount of seconds after the application start for the earliest display of an encouragement message.

Note: Setter function for property encouragementDelay.

See also encouragementDelay(), setApplicationStartsUntilEncouragement, setApplicationUsageTimeUntilEncouragement

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.

days Days between encouragement messages, 0 disables repeated encouragements.

Note: Setter function for property encouragementInterval.

See also encouragementInterval()

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.

url The URL of the feedback server.

Note: Setter function for property feedbackServer.

See also feedbackServer()

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.

productId Unique product identifier, as configured on the feedback server.

Note: Setter function for property productIdentifier.

See also productIdentifier()

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).

Note: Setter function for property submissionInterval.

See also submissionInterval()

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).

Note: Setter function for property surveyInterval.

See also surveyInterval()

void Provider::setTelemetryMode(KUserFeedback::Provider::TelemetryMode mode)

Set which telemetry data should be submitted.

Note: Setter function for property telemetryMode.

See also telemetryMode()

[signal] void Provider::showEncouragementMessage()

Indicate that the encouragement notice should be shown.

[slot] void Provider::store()

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

Will be automatically invoked upon QCoreApplication::aboutToQuit() signal.

Note: Potentially long operation.

int Provider::submissionInterval() const

Returns the current submission interval.

Returns days between telemetry submissions, or -1 if submission is off.

Note: Getter function for property submissionInterval.

See also setSubmissionInterval()

[slot] void Provider::submit()

Manually submit currently recorded data.

[signal] void Provider::surveyAvailable(const KUserFeedback::SurveyInfo &survey)

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

[slot] void Provider::surveyCompleted(const KUserFeedback::SurveyInfo &info)

Marks the given survey as completed. This avoids getting further notification about the same survey.

int Provider::surveyInterval() const

Returns the minimum time between two surveys in days.

The default is -1 (no surveys enabled).

Note: Getter function for property surveyInterval.

See also setSurveyInterval()

[signal] void Provider::surveyIntervalChanged()

Emitted when the survey interval changed.

Note: Notifier signal for property surveyInterval.

KUserFeedback::Provider::TelemetryMode Provider::telemetryMode() const

Returns the current telemetry collection mode.

The default is NoTelemetry.

Note: Getter function for property telemetryMode.

See also setTelemetryMode()

[signal] void Provider::telemetryModeChanged()

Emitted when the telemetry collection mode has changed.

Note: Notifier signal for property telemetryMode.

We use cookies to personalize content and to analyze our traffic. Please decide if you are willing to accept cookies from our website.