┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/userfeedback/settingsdatasource.cpp
diff options
context:
space:
mode:
authorElvis Angelaccio <[email protected]>2020-08-18 23:47:53 +0200
committerElvis Angelaccio <[email protected]>2020-11-05 18:31:28 +0000
commit465e06138e8baaefb967d32a2eaccf67daef8285 (patch)
tree1b6ec2114228a7429b01b670f43d75d1ff0ee0ed /src/userfeedback/settingsdatasource.cpp
parent61bf84c13d203840d4ffeb55ce92dc8b660871a1 (diff)
Add support for KUserFeedback
This commit introduces KUserFeedback in dolphin with some basic data sources and with a settings page to configure the telemetry values. There are also a couple custom data sources as proof of concept: a bunch of settings and the count of available network shares as listed by Solid. The settings page is shown only if the user feedback framework is enabled, but currently in Plasma we don't have a global kill switch to disable it. At the moment we never show an encouragement message. We need to connect to the `Provider::showEncouragementMessage()` signal, but first we should agree to a common way to show a non-annoying message to the users.
Diffstat (limited to 'src/userfeedback/settingsdatasource.cpp')
-rw-r--r--src/userfeedback/settingsdatasource.cpp55
1 files changed, 55 insertions, 0 deletions
diff --git a/src/userfeedback/settingsdatasource.cpp b/src/userfeedback/settingsdatasource.cpp
new file mode 100644
index 000000000..03a25ff75
--- /dev/null
+++ b/src/userfeedback/settingsdatasource.cpp
@@ -0,0 +1,55 @@
+/*
+ * SPDX-FileCopyrightText: 2020 Elvis Angelaccio <[email protected]
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#include "settingsdatasource.h"
+#include "dolphinmainwindow.h"
+#include "dolphin_generalsettings.h"
+
+#include <KLocalizedString>
+#include <KUserFeedback/Provider>
+
+#include <QApplication>
+#include <QVariant>
+
+SettingsDataSource::SettingsDataSource()
+ : KUserFeedback::AbstractDataSource(QStringLiteral("settings"), KUserFeedback::Provider::DetailedSystemInformation)
+{}
+
+QString SettingsDataSource::name() const
+{
+ return i18nc("name of kuserfeedback data source provided by dolphin", "Settings");
+}
+
+QString SettingsDataSource::description() const
+{
+ return i18nc("description of kuserfeedback data source provided by dolphin", "A subset of Dolphin settings.");
+}
+
+QVariant SettingsDataSource::data()
+{
+ if (!m_mainWindow) {
+ // This assumes there is only one DolphinMainWindow per process.
+ const auto topLevelWidgets = QApplication::topLevelWidgets();
+ for (const auto widget : topLevelWidgets) {
+ if (qobject_cast<DolphinMainWindow *>(widget)) {
+ m_mainWindow = static_cast<DolphinMainWindow *>(widget);
+ break;
+ }
+ }
+ }
+
+ QVariantMap map;
+
+ if (m_mainWindow) {
+ map.insert(QStringLiteral("informationPanelEnabled"), m_mainWindow->isInformationPanelEnabled());
+ map.insert(QStringLiteral("foldersPanelEnabled"), m_mainWindow->isFoldersPanelEnabled());
+ }
+
+ map.insert(QStringLiteral("tooltipsEnabled"), GeneralSettings::showToolTips());
+ map.insert(QStringLiteral("browseArchivesEnable"), GeneralSettings::browseThroughArchives());
+
+ return map;
+}