Changeset View
Standalone View
kcms/feedback/feedback.cpp
- This file was added.
1 | #include "feedback.h" | ||||
---|---|---|---|---|---|
2 | | ||||
3 | #include <KSharedConfig> | ||||
4 | #include <KConfigGroup> | ||||
5 | #include <KPluginFactory> | ||||
6 | #include <KAboutData> | ||||
7 | #include <KLocalizedString> | ||||
8 | | ||||
9 | #include <KUserFeedback/Provider> | ||||
10 | | ||||
11 | K_PLUGIN_CLASS_WITH_JSON(Feedback, "kcm_feedback.json"); | ||||
12 | | ||||
13 | Feedback::Feedback(QObject *parent, const QVariantList &args) | ||||
14 | : KQuickAddons::ConfigModule(parent) | ||||
15 | //UserFeedback.conf is used by KUserFeedback which uses QSettings and won't go through globals | ||||
16 | , m_globalConfig(KSharedConfig::openConfig(QStringLiteral("KDE/UserFeedback.conf"), KConfig::NoGlobals)) | ||||
17 | , m_plasmaConfig(KSharedConfig::openConfig(QStringLiteral("PlasmaUserFeedback"))) | ||||
davidedmundson: Is including kdeglobals here deliberate?
KUserFeedback won't read it..but maybe it makes sense? | |||||
This setting needs to be read by every Plasma component, these can check through kconfig. apol: This setting needs to be read by every Plasma component, these can check through kconfig.
See… | |||||
18 | { | ||||
19 | Q_UNUSED(args) | ||||
20 | setAboutData(new KAboutData(QStringLiteral("kcm_feedback"), | ||||
21 | i18n("Configure Telemetry Settings"), | ||||
22 | QStringLiteral("1.0"), QString(), KAboutLicense::LGPL)); | ||||
23 | | ||||
Did I write that line? I genuinely can't remember :/ In any case, this should work for having a syadmin force disable telemetrics by kiosk which I thought was the most likely case. It doesn't cover the sysadmin force enabling it - but that probably isn't too useful if we don't have a configurable server anyway davidedmundson: Did I write that line? I genuinely can't remember :/
In any case, this should work for having… | |||||
Yes, you did. apol: Yes, you did.
I also wondered about that, I agree we should respect KUserfeedback's default. | |||||
24 | connect(this, &Feedback::feedbackEnabledChanged, this, [this](){ | ||||
25 | setNeedsSave(true); | ||||
26 | }); | ||||
27 | connect(this, &Feedback::plasmaFeedbackLevelChanged, this, [this](){ | ||||
28 | setNeedsSave(true); | ||||
29 | }); | ||||
30 | } | ||||
31 | | ||||
32 | Feedback::~Feedback() = default; | ||||
33 | | ||||
34 | void Feedback::load() | ||||
35 | { | ||||
36 | KUserFeedback::Provider p; | ||||
37 | | ||||
38 | setFeedbackEnabled(m_globalConfig->group("UserFeedback").readEntry("Enabled", p.isEnabled())); | ||||
39 | setPlasmaFeedbackLevel(m_plasmaConfig->group("Global").readEntry("FeedbackLevel", int(KUserFeedback::Provider::BasicUsageStatistics))); | ||||
40 | setNeedsSave(false); | ||||
41 | } | ||||
42 | | ||||
I would avoid using the word "Telemetry". It has negative connotations. Maybe "Feedback" instead. ngraham: I would avoid using the word "Telemetry". It has negative connotations. Maybe "Feedback"… | |||||
"telemetry" is also ambiguous. These are also telemetries:
aspotashev: "telemetry" is also ambiguous. These are also telemetries:
1. Ksysguard daemon,
2. GPS and… | |||||
He was suggesting moving away from "telemetry". Addressed, unsure where this line appears on the UI. apol: He was suggesting moving away from "telemetry". Addressed, unsure where this line appears on… | |||||
ngraham: Title should be the same as the name i.e. "User Feedback" | |||||
43 | void Feedback::save() | ||||
ngraham: Description should be "Configure user feedback settings" | |||||
44 | { | ||||
45 | m_globalConfig->group("UserFeedback").writeEntry("Enabled", m_feedbackEnabled); | ||||
46 | m_globalConfig->sync(); | ||||
47 | | ||||
48 | m_plasmaConfig->group("Global").writeEntry("FeedbackLevel", m_plasmaFeedbackLevel); | ||||
49 | m_plasmaConfig->sync(); | ||||
50 | } | ||||
51 | | ||||
52 | void Feedback::defaults() | ||||
53 | { | ||||
54 | setFeedbackEnabled(false); | ||||
55 | setPlasmaFeedbackLevel(KUserFeedback::Provider::BasicUsageStatistics); | ||||
56 | } | ||||
57 | | ||||
58 | #include "feedback.moc" |
Is including kdeglobals here deliberate?
KUserFeedback won't read it..but maybe it makes sense?