Commit 2dd40cfb authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧
Browse files

feedback kcm: Make it about Plasma

Summary:
At the moment we were merging two different concepts into a same KCM and it was
too confusing.
Simplify making the kcm only about Plasma by removing the kill switch and
making sure the text only affects Plasma components.

Reviewers: #plasma, vkrause, davidedmundson, ngraham

Reviewed By: #plasma, davidedmundson, ngraham

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D24733
parent f5110613
......@@ -33,7 +33,6 @@ K_PLUGIN_CLASS_WITH_JSON(Feedback, "kcm_feedback.json");
Feedback::Feedback(QObject *parent, const QVariantList &args)
: KQuickAddons::ConfigModule(parent)
//UserFeedback.conf is used by KUserFeedback which uses QSettings and won't go through globals
, m_globalConfig(KSharedConfig::openConfig(QStringLiteral("KDE/UserFeedback.conf"), KConfig::NoGlobals))
, m_plasmaConfig(KSharedConfig::openConfig(QStringLiteral("PlasmaUserFeedback")))
{
Q_UNUSED(args)
......@@ -41,9 +40,6 @@ Feedback::Feedback(QObject *parent, const QVariantList &args)
i18n("User Feedback"),
QStringLiteral("1.0"), i18n("Configure user feedback settings"), KAboutLicense::LGPL));
connect(this, &Feedback::feedbackEnabledChanged, this, [this](){
setNeedsSave(true);
});
connect(this, &Feedback::plasmaFeedbackLevelChanged, this, [this](){
setNeedsSave(true);
});
......@@ -51,28 +47,27 @@ Feedback::Feedback(QObject *parent, const QVariantList &args)
Feedback::~Feedback() = default;
void Feedback::load()
bool Feedback::feedbackEnabled() const
{
//The global kill switch is off by default, all KDE components should default to KUserFeedback::Provider::NoTelemetry
KUserFeedback::Provider p;
setFeedbackEnabled(p.isEnabled());
return p.isEnabled();
}
void Feedback::load()
{
//We only operate if the kill switch is off, all KDE components should default to KUserFeedback::Provider::NoTelemetry
setPlasmaFeedbackLevel(m_plasmaConfig->group("Global").readEntry("FeedbackLevel", int(KUserFeedback::Provider::NoTelemetry)));
setNeedsSave(false);
}
void Feedback::save()
{
m_globalConfig->group("UserFeedback").writeEntry("Enabled", m_feedbackEnabled);
m_globalConfig->sync();
m_plasmaConfig->group("Global").writeEntry("FeedbackLevel", m_plasmaFeedbackLevel);
m_plasmaConfig->sync();
}
void Feedback::defaults()
{
setFeedbackEnabled(true);
setPlasmaFeedbackLevel(KUserFeedback::Provider::NoTelemetry);
}
......
......@@ -28,23 +28,16 @@ class Feedback : public KQuickAddons::ConfigModule
{
Q_OBJECT
Q_PROPERTY(bool feedbackEnabled READ feedbackEnabled WRITE setFeedbackEnabled NOTIFY feedbackEnabledChanged)
Q_PROPERTY(bool feedbackEnabled READ feedbackEnabled CONSTANT)
Q_PROPERTY(int plasmaFeedbackLevel READ plasmaFeedbackLevel WRITE setPlasmaFeedbackLevel NOTIFY plasmaFeedbackLevelChanged)
public:
explicit Feedback(QObject* parent = nullptr, const QVariantList &list = QVariantList());
~Feedback() override;
bool feedbackEnabled() const { return m_feedbackEnabled; }
bool feedbackEnabled() const;
int plasmaFeedbackLevel() const { return m_plasmaFeedbackLevel; }
void setFeedbackEnabled(bool feedbackEnabled) {
if (feedbackEnabled != m_feedbackEnabled) {
m_feedbackEnabled = feedbackEnabled;
Q_EMIT feedbackEnabledChanged(feedbackEnabled);
}
}
void setPlasmaFeedbackLevel(int plasmaFeedbackLevel) {
if (plasmaFeedbackLevel != m_plasmaFeedbackLevel) {
m_plasmaFeedbackLevel = plasmaFeedbackLevel;
......@@ -58,12 +51,9 @@ class Feedback : public KQuickAddons::ConfigModule
void defaults() override;
Q_SIGNALS:
void feedbackEnabledChanged(bool feedbackEnabled) const;
void plasmaFeedbackLevelChanged(bool plasmaFeedbackLevel);
private:
KSharedConfig::Ptr m_globalConfig;
KSharedConfig::Ptr m_plasmaConfig;
bool m_feedbackEnabled = false;
int m_plasmaFeedbackLevel = 0;
};
......@@ -32,15 +32,15 @@ SimpleKCM {
leftPadding: width * 0.1
rightPadding: leftPadding
ColumnLayout {
Kirigami.InlineMessage {
id: infoLabel
Layout.fillWidth: true
QQC2.CheckBox {
Layout.topMargin: Kirigami.Units.gridUnit
Layout.bottomMargin: Kirigami.Units.gridUnit
Layout.alignment: Qt.AlignHCenter
checked: kcm.feedbackEnabled
onToggled: kcm.feedbackEnabled = checked
text: i18n("Allow KDE software to collect anonymous usage information")
type: Kirigami.MessageType.Information
visible: !form.enabled
text: i18n("User Feedback has been disabled centrally. Please contact your distributor.")
}
QQC2.Label {
......@@ -48,7 +48,7 @@ SimpleKCM {
Layout.alignment: Qt.AlignHCenter
Layout.fillWidth: true
wrapMode: Text.WordWrap
text: xi18nc("@info", "You can help us improve this software by sharing information about how you use it. This allows us to focus on things that matter to you.<nl/><nl/>Contributing usage information is optional and entirely anonymous. It will not associate the data with any kind of unique identifier, and will never track the documents you open, the websites you visit, or any other kind of personal information.<nl/><nl/>You can read more about our policy in the following link:")
text: xi18nc("@info", "You can read about our policy in the following link:")
}
Kirigami.UrlButton {
......@@ -63,6 +63,8 @@ SimpleKCM {
}
Kirigami.FormLayout {
id: form
enabled: kcm.feedbackEnabled
QQC2.Slider {
id: statisticsModeSlider
Kirigami.FormData.label: i18n("Plasma:")
......@@ -110,7 +112,12 @@ SimpleKCM {
Layout.alignment: Qt.AlignHCenter
Layout.maximumWidth: root.width * 0.5
wrapMode: Text.WordWrap
text: feedbackController.telemetryDescription(statisticsModeSlider.modeOptions[statisticsModeSlider.value])
enabled: statisticsModeSlider.value > 0
text: {
feedbackController.applicationName
return feedbackController.telemetryDescription(statisticsModeSlider.modeOptions[statisticsModeSlider.value])
}
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment