KUserFeedback
provider.cpp
60 QObject::connect(&encouragementTimer, &QTimer::timeout, q, [this]() { emitShowEncouragementMessage(); });
86 QCoreApplication::organizationDomain().isEmpty() ? QCoreApplication::organizationName() : QCoreApplication::organizationDomain();
88 QCoreApplication::organizationName().isEmpty() ? QCoreApplication::organizationDomain() : QCoreApplication::organizationName();
116 telemetryMode = static_cast<Provider::TelemetryMode>(std::max(telemetryModeEnum().keyToValue(modeStr.constData()), 0));
150 lastEncouragementTime = std::max(g->value(QStringLiteral("LastEncouragement")).toDateTime(), lastEncouragementTime);
199 qCWarning(Log) << "Source" << source->id() << "attempts to report data unconditionally, ignoring!";
266 qCWarning(Log) << "failed to submit user feedback:" << reply->errorString() << reply->readAll() << ". Calling scheduleNextSubmission with minTime" << backoffIntervalMinutes << "minutes";
271 const auto redirectTarget = reply->attribute(QNetworkRequest::RedirectionTargetAttribute).toUrl();
324 if (!q->isEnabled() || !survey.isValid() || completedSurveys.contains(survey.uuid().toString()))
327 if (surveyInterval != 0 && lastSurveyTime.addDays(surveyInterval) > QDateTime::currentDateTime())
372 if (telemetryMode >= highestTelemetryMode() && surveyInterval == 0) // already everything enabled
375 if (lastEncouragementTime.isValid() && (telemetryMode > Provider::NoTelemetry || surveyInterval >= 0))
381 timeToEncouragement = std::max(timeToEncouragement, encouragementTime - currentApplicationTime());
385 timeToEncouragement = std::max(timeToEncouragement, (int)QDateTime::currentDateTime().secsTo(targetTime));
392 lastEncouragementTime = QDateTime::currentDateTime(); // TODO make this explicit, in case the host application decides to delay?
405 connect(QCoreApplication::instance(), &QCoreApplication::aboutToQuit, this, [this]() { d->aboutToQuit(); });
502 d->storeOne(QStringLiteral("StatisticsCollectionMode"), QString::fromLatin1(telemetryModeEnum().valueToKey(d->telemetryMode)));
665 request.setHeader(QNetworkRequest::UserAgentHeader, QString(QStringLiteral("KUserFeedback/") + QStringLiteral(KUSERFEEDBACK_VERSION_STRING)));
667 QObject::connect(reply, &QNetworkReply::finished, q, [this, reply]() { submitFinished(reply); });
673 request.setHeader(QNetworkRequest::UserAgentHeader, QString(QStringLiteral("KUserFeedback/") + QStringLiteral(KUSERFEEDBACK_VERSION_STRING)));
675 QObject::connect(reply, &QNetworkReply::finished, q, [this, reply]() { submitProbeFinished(reply); });
683 qCWarning(Log) << "failed to probe user feedback submission interface:" << reply->errorString() << reply->readAll();
687 const auto redirectTarget = reply->attribute(QNetworkRequest::RedirectionTargetAttribute).toUrl();
702 const QString path = QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + QStringLiteral("/kuserfeedback/audit");
717 obj.insert(QLatin1String("telemetryMode"), QString::fromLatin1(telemetryModeEnum().valueToKey(source->telemetryMode())));
722 QFile file(path + QLatin1Char('/') + dt.toString(QStringLiteral("yyyyMMdd-hhmmss")) + QStringLiteral(".log"));
744 ret += QString::fromUtf8(modeEnum.valueToKey(source->telemetryMode())) + QStringLiteral(": ") + source->name() + QLatin1Char('\n');
Base class for data sources for telemetry data.
Definition abstractdatasource.h:25
void load(QSettings *settings)
Load persistent state for this data source.
Definition abstractdatasource.cpp:103
void reset(QSettings *settings)
Reset the persistent state of this data source.
Definition abstractdatasource.cpp:119
virtual QVariant data()=0
Returns the data gathered by this source.
virtual QString name() const
Returns a short name of this data source.
Definition abstractdatasource.cpp:78
Provider::TelemetryMode telemetryMode() const
Returns which telemetry colleciton mode this data source belongs to.
Definition abstractdatasource.cpp:127
bool isActive() const
Checks whether this data source is active or not If the data source is not active,...
Definition abstractdatasource.cpp:144
virtual QString description() const =0
Returns a human-readable, translated description of what this source provides.
The central object managing data sources and transmitting feedback to the server.
Definition provider.h:32
void providerSettingsChanged()
Emitted when any provider setting changed.
void store()
Manually store settings of the provider and all added data sources.
Definition provider.cpp:629
void setProductIdentifier(const QString &productId)
Set the product identifier.
Definition provider.cpp:447
void surveyCompleted(const KUserFeedback::SurveyInfo &info)
Marks the given survey as completed.
Definition provider.cpp:611
void restoreDefaults()
Set the telemetry mode and the survey interval back to their default values.
Definition provider.cpp:436
void setTelemetryMode(TelemetryMode mode)
Set which telemetry data should be submitted.
Definition provider.cpp:496
int encouragementDelay
Encouragement delay after application start in seconds.
Definition provider.h:86
int applicationUsageTimeUntilEncouragement
Application usage time in seconds before an encouragement message is shown.
Definition provider.h:81
void setEncouragementDelay(int secs)
Set the delay after application start for the earliest display of the encouragement message.
Definition provider.cpp:588
void setApplicationStartsUntilEncouragement(int starts)
Set the amount of application starts until the encouragement message should be shown.
Definition provider.cpp:560
void telemetryModeChanged()
Emitted when the telemetry collection mode has changed.
void load()
Manually load settings of the provider and all added data sources.
Definition provider.cpp:624
void enabledChanged()
Emitted when the global enabled state changed.
AbstractDataSource * dataSource(const QString &id) const
Returns a data source with matched id.
Definition provider.cpp:531
void setSurveyInterval(int days)
Sets the minimum time in days between two surveys.
Definition provider.cpp:542
void surveyIntervalChanged()
Emitted when the survey interval changed.
void addDataSource(AbstractDataSource *source)
Adds a data source for telemetry data collection.
Definition provider.cpp:508
void setEnabled(bool enabled)
Set the global (user-wide) activation state for feedback functionality.
Definition provider.cpp:428
bool isEnabled() const
Returns whether feedback functionality is enabled on this system.
Definition provider.cpp:421
void setApplicationUsageTimeUntilEncouragement(int secs)
Set the amount of usage time until the encouragement message should be shown.
Definition provider.cpp:574
void dataSourcesChanged()
Emitted when a data source is added or removed.
int applicationStartsUntilEncouragement
Times the application has to be started before an encouragement message is shown.
Definition provider.h:73
void setSubmissionInterval(int days)
Set the automatic submission interval in days.
Definition provider.cpp:482
QVector< AbstractDataSource * > dataSources() const
Returns all data sources that have been added to this provider.
Definition provider.cpp:526
void setEncouragementInterval(int days)
Sets the interval after the encouragement should be repeated.
Definition provider.cpp:602
Data source reporting the total amount of applications starts.
Definition startcountsource.h:24
Data source reporting the total usage time of the application.
Definition usagetimesource.h:24
QString path(const QString &relativePath)
Classes for integrating telemetry collection, survey targeting, and contribution encouragenemt and co...
Definition surveytargetexpression.h:16
void aboutToQuit()
applicationName
QCoreApplication * instance()
organizationDomain
organizationName
QDateTime currentDateTime()
QString toString(QStringView format, QCalendar cal) const const
bool mkpath(const QString &dirPath) const const
QString errorString() const const
QByteArray readAll()
WriteOnly
QJsonArray fromVariantList(const QVariantList &list)
QJsonDocument fromJson(const QByteArray &json, QJsonParseError *error)
QJsonObject object() const const
iterator end()
iterator find(QLatin1StringView key)
QJsonObject fromVariantMap(const QVariantMap &map)
iterator insert(QLatin1StringView key, const QJsonValue &value)
bool isEmpty() const const
NoError
QVariant attribute(QNetworkRequest::Attribute code) const const
NetworkError error() const const
void finished()
QUrl url() const const
RedirectionTargetAttribute
ContentTypeHeader
Q_EMITQ_EMIT
QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, Functor functor)
void deleteLater()
AppLocalDataLocation
QString writableLocation(StandardLocation type)
bool endsWith(QChar c, Qt::CaseSensitivity cs) const const
QString fromLatin1(QByteArrayView str)
QString fromUtf8(QByteArrayView str)
bool isEmpty() const const
void timeout()
QUrl resolved(const QUrl &relative) const const
QString toString(FormattingOptions options) const const
QString toString(StringFormat mode) const const
QUrl toUrl() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 4 2024 16:31:30 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 4 2024 16:31:30 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.