Version: (using KDE 4.2.4) OS: Linux Installed from: Gentoo Packages I create a plasma applet, and I am using the systemmonitor dataEngine. If I connect the sourceAdded(QString) signal to a slot. If the dataEngine emits sourceAdded(QString) my slot is called. Inside the slot i called dataEngine("systemmonitor").sources(), and voila, the list is empty. I consider this a bug, since I got the signal sourceAdded, which implies for me, that the source was already added. So either change the signal name, to clarify that the source is not yet in the dataEngine.sources() list, but will arrive soon, or the dataEngine("systemmonitor").sources() should already contain the source...
I can confirm this in trunk. sourceAdded() is emitted and the systemmonitor engine has 0 sources. At the second call to sourceAdded, the engine has 1 source, etc. Something like this is happening in my test case: sourceAdded("system/uptime") : 0 sources sourceAdded("acpi/fan/FAN/state") : 1 source (acpi/fan/FAN/state) sourceAdded("acpi/thermal_zone/THRM/temperature") : 2 sources (acpi/fan/FAN/state, acpi/thermal_zone/THRM/temperature) In fact it seems that the first source (in this case system/uptime) never gets added to the engine's source list.
this is a bug in the system monitor data engine. it overrides sources(): QStringList SystemMonitorEngine::sources() const { return m_sensors; } however, m_sensors isn't populated until the data is received and, from the looks of this report, it may at times not get all the entries. i've CC'd the author of the DataEngine on this so they can take a look at it and hopefully straighten it out. btw, sample/test code that shows the problem would be quite useful. consider attaching your plasmoid code to this bug report.
John: any update on this?
(In reply to comment #3) > John: any update on this? Sorry, no. Real life has ripped me away. The code is pretty simple, maybe you can see what is wrong?
It seems to be mostly fixed in KDE-4.5.1. Just one scenario where this signal was emitted but dataEngine("systemmonitor")->sources() did not contain the source is: void MyTestApplet::init() { dataEngine("systemmonitor")->connectSource("system/uptime", this, 60000); } Here we call first connectSource before even knowing whether a system/uptime exists at all. This in turn calls the virtual function sourceReqest in systemmonitor.cpp, which in turn calls setData(), which in turn emits the signal sourceAddedd.
Closing for lack of feedback. Please feel free to reopen this report if you can still reproduce this with KDE 4.8.3 or later.