Paste P515

Masterwork From Distant Lands
ActivePublic

Authored by davidedmundson on Jan 9 2020, 1:21 AM.
commit 66dd3435a3d422562172c21566af7e2303aa87ef
Author: David Edmundson <kde@davidedmundson.co.uk>
Date: Thu Jan 9 00:44:34 2020 +0000
applet source
diff --git a/shell/panelcountsource.h b/shell/panelcountsource.h
index a621d9172..8b3af3622 100644
--- a/shell/panelcountsource.h
+++ b/shell/panelcountsource.h
@@ -23,6 +23,8 @@
#include "shellcorona.h"
#include <KLocalizedString>
#include <KUserFeedback/AbstractDataSource>
+#include <KPluginMetaData>
+#include <QDebug>
class PanelCountSource : public KUserFeedback::AbstractDataSource
{
@@ -42,4 +44,37 @@ private:
ShellCorona* const corona;
};
+class AppletListSource: public KUserFeedback::AbstractDataSource
+{
+public:
+ AppletListSource(ShellCorona *corona)
+ : AbstractDataSource(QStringLiteral("applets"), KUserFeedback::Provider::DetailedSystemInformation)
+ , corona(corona)
+ {}
+
+ QString name() const override { return i18n("Applets"); }
+ QString description() const override { return i18n("List of running applets"); }
+
+ QVariant data() override {
+ QStringList applets;
+ for(auto c: corona->containments()) {
+ for (auto applet: c->applets()) {
+ QString appletName = applet->pluginMetaData().pluginId();
+ qDebug() << appletName;
+ if (!appletName.startsWith("org.kde.")) {
+ // if it's not from us, it's probably in the form "net.davidedmundson.superawesomesecretapplet"
+ // at which point including it would leak a probable identifier
+ // by taking a hash, we can hide that but still see how popular net.some.random.store.thing is
+ appletName = QCryptographicHash::hash(appletName.toLatin1(), QCryptographicHash::Md5);
+ }
+ applets << appletName;
+ }
+ }
+ return applets;
+ }
+
+private:
+ ShellCorona* const corona;
+};
+
#endif
diff --git a/shell/shellcorona.cpp b/shell/shellcorona.cpp
index 127f5f6b6..a3e7f052b 100644
--- a/shell/shellcorona.cpp
+++ b/shell/shellcorona.cpp
@@ -313,6 +313,7 @@ void ShellCorona::setShell(const QString &shell)
feedbackProvider->addDataSource(new KUserFeedback::OpenGLInfoSource);
feedbackProvider->addDataSource(new KUserFeedback::ScreenInfoSource);
feedbackProvider->addDataSource(new PanelCountSource(this));
+ feedbackProvider->addDataSource(new AppletListSource(this));
{
auto plasmaConfig = KSharedConfig::openConfig(QStringLiteral("PlasmaUserFeedback"));
davidedmundson edited the content of this paste. (Show Details)Jan 9 2020, 1:21 AM
davidedmundson changed the title of this paste from untitled to Masterwork From Distant Lands.