Changeset View
Standalone View
kcms/feedback/feedback.cpp
- This file was added.
1 | /* | ||||
---|---|---|---|---|---|
2 | * Copyright (C) 2019 David Edmundson <davidedmundson@kde.org> | ||||
3 | * Copyright (C) 2019 Aleix Pol Gonzalez <aleixpol@kde.org> | ||||
4 | * | ||||
5 | * This library is free software; you can redistribute it and/or | ||||
6 | * modify it under the terms of the GNU Library General Public | ||||
7 | * License as published by the Free Software Foundation; either | ||||
8 | * version 2 of the License, or (at your option) any later version. | ||||
9 | * | ||||
10 | * This library is distributed in the hope that it will be useful, | ||||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||||
13 | * Library General Public License for more details. | ||||
14 | * | ||||
15 | * You should have received a copy of the GNU Library General Public License | ||||
16 | * along with this library; see the file COPYING.LIB. If not, write to | ||||
17 | * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||||
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 | * Boston, MA 02110-1301, USA. | ||||
19 | */ | ||||
20 | | ||||
21 | #include "feedback.h" | ||||
22 | | ||||
23 | #include <KSharedConfig> | ||||
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 | #include <KConfigGroup> | ||||
25 | #include <KPluginFactory> | ||||
26 | #include <KAboutData> | ||||
27 | #include <KLocalizedString> | ||||
28 | | ||||
29 | #include <KUserFeedback/Provider> | ||||
30 | | ||||
31 | K_PLUGIN_CLASS_WITH_JSON(Feedback, "kcm_feedback.json"); | ||||
32 | | ||||
33 | Feedback::Feedback(QObject *parent, const QVariantList &args) | ||||
34 | : KQuickAddons::ConfigModule(parent) | ||||
35 | //UserFeedback.conf is used by KUserFeedback which uses QSettings and won't go through globals | ||||
36 | , m_globalConfig(KSharedConfig::openConfig(QStringLiteral("KDE/UserFeedback.conf"), KConfig::NoGlobals)) | ||||
37 | , m_plasmaConfig(KSharedConfig::openConfig(QStringLiteral("PlasmaUserFeedback"))) | ||||
38 | { | ||||
39 | Q_UNUSED(args) | ||||
40 | setAboutData(new KAboutData(QStringLiteral("kcm_feedback"), | ||||
41 | i18n("Configure Telemetry Settings"), | ||||
42 | QStringLiteral("1.0"), QString(), KAboutLicense::LGPL)); | ||||
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 | | ||||
ngraham: Description should be "Configure user feedback settings" | |||||
44 | connect(this, &Feedback::feedbackEnabledChanged, this, [this](){ | ||||
45 | setNeedsSave(true); | ||||
46 | }); | ||||
47 | connect(this, &Feedback::plasmaFeedbackLevelChanged, this, [this](){ | ||||
48 | setNeedsSave(true); | ||||
49 | }); | ||||
50 | } | ||||
51 | | ||||
52 | Feedback::~Feedback() = default; | ||||
53 | | ||||
54 | void Feedback::load() | ||||
55 | { | ||||
56 | KUserFeedback::Provider p; | ||||
57 | | ||||
58 | setFeedbackEnabled(m_globalConfig->group("UserFeedback").readEntry("Enabled", p.isEnabled())); | ||||
59 | setPlasmaFeedbackLevel(m_plasmaConfig->group("Global").readEntry("FeedbackLevel", int(KUserFeedback::Provider::BasicUsageStatistics))); | ||||
60 | setNeedsSave(false); | ||||
61 | } | ||||
62 | | ||||
63 | void Feedback::save() | ||||
64 | { | ||||
65 | m_globalConfig->group("UserFeedback").writeEntry("Enabled", m_feedbackEnabled); | ||||
66 | m_globalConfig->sync(); | ||||
67 | | ||||
68 | m_plasmaConfig->group("Global").writeEntry("FeedbackLevel", m_plasmaFeedbackLevel); | ||||
69 | m_plasmaConfig->sync(); | ||||
70 | } | ||||
71 | | ||||
72 | void Feedback::defaults() | ||||
73 | { | ||||
74 | setFeedbackEnabled(false); | ||||
75 | setPlasmaFeedbackLevel(KUserFeedback::Provider::BasicUsageStatistics); | ||||
76 | } | ||||
77 | | ||||
78 | #include "feedback.moc" |
Is including kdeglobals here deliberate?
KUserFeedback won't read it..but maybe it makes sense?