File 0002-Always-add-data-sources-in-SystemMonitorEngine-sourc.patch of Package plasma5-workspace.7768
From 6cd90842c994615c8423cf278cb6019dfdacc950 Mon Sep 17 00:00:00 2001
From: Elvis Angelaccio <elvis.angelaccio@kde.org>
Date: Fri, 26 May 2017 10:59:28 +0200
Subject: [PATCH 2/8] Always add data sources in
SystemMonitorEngine::sourceRequestEvent()
Summary:
Otherwise if we show the plasma-nm applet twice, m_sensors won't be empty
and we won't be able to fect the connection speed data.
git blame points to
https://github.com/KDE/kde-workspace/commit/ba7444f99ab08cf0a305899bf66879314bd0d5a9
and
https://github.com/KDE/kde-workspace/commit/235fea1868b560acf32c5c13a3d16ef233b50be6
but they don't really explain why setData() was called only if m_sensors
was empty.
BUG: 380209
Test Plan:
- plasmoidviewer -a org.kde.plasma.networkmanagement
- open the networkmanager applet twice
- make sure the connection's speed graph works the 2nd time.
Reviewers: #plasma, jgrulich
Subscribers: plasma-devel
Tags: #plasma
Differential Revision: https://phabricator.kde.org/D5973
---
dataengines/systemmonitor/systemmonitor.cpp | 14 ++------------
1 file changed, 2 insertions(+), 12 deletions(-)
diff --git a/dataengines/systemmonitor/systemmonitor.cpp b/dataengines/systemmonitor/systemmonitor.cpp
index a8674186..e4d6498c 100644
--- a/dataengines/systemmonitor/systemmonitor.cpp
+++ b/dataengines/systemmonitor/systemmonitor.cpp
@@ -55,18 +55,8 @@ QStringList SystemMonitorEngine::sources() const
bool SystemMonitorEngine::sourceRequestEvent(const QString &name)
{
- // NB: do not follow this example in your own data engines!
- // This is kept for backwards compatilibility.
- // Visualizations should instead listen to sourceAdded()
- if (m_sensors.isEmpty()) {
- // we don't have our first data yet, so let's trust the requester, at least fo rnow
- // when we get our list of sensors later, then we'll know for sure and remove
- // this source if they were wrong
- setData(name, DataEngine::Data());
- return true;
- }
-
- return false;
+ setData(name, DataEngine::Data());
+ return true;
}
bool SystemMonitorEngine::updateSourceEvent(const QString &sensorName)
--
2.14.3