Version: KDE 4.2.63 (using Devel) OS: Linux Installed from: Compiled sources I noticed that The System Monitor - Network applet did not automatically update its network interface list, i.e. if I connect a dial-up modem, the interface ppp0 is not shown in the applet's settings. However, if the applet is restarted, the list is updated. I've examined the source ( kdebase/workspace/plasma/applets/system-monitor/net.cpp ) and found that it uses "systemmonitor" as the data engine, and whenever a call to engine()->sources() is made ( in the function SM::Net::parseSources() ), the list returned back doesn't contain "ppp0", if the interface was connected after the applet was started. This means that the data engine is not getting properly updated. Further, there are no public member functions of Plasma::DataEngine which can force a update/refresh. Kde devel mailing lists reply suggests that this is a bug in DataEngine.
"Kde devel mailing lists reply suggests that this is a bug in DataEngine." that would be incorrect.
My sincere apologies for having used an incorrect term. What was meant that I received replies to a mail I sent to the kde-devel mailing list saying that the engine was not updating the sources. I had no experience at that time, so just accepted it. But, I am now starting to grasp things in Plasma, so I'll confirm where the problem exactly lies. Regret for the inconvenience caused.
no inconvenience; i just wanted to clarify that point for the next person who comes along and reads the report, perhaps even attempting to fix it. it's a somewhat common misunderstanding that the widget can't kick the engine; another common misunderstanding is that widgets _should_ do such a thing (almost always they should *not*). in this case, the problem is that the engine itself isn't updating in response to changes in the hardware environment. the widget shouldn't be doing anything but responding to the engine, and the engine should be responding to signals from sysguard or solid, whichever it uses in this case.
Yes, I observed now with kDebug() outputs that its really the engine not refreshing. So, what could be a solution? I mean to say where to look for the cause of the problem, so that it can be fixed? I've noticed that closing and restarting the applet causes the engine to refresh. I think not being aware of system changes isn't a good thing for a System Monitor.
"Yes, I observed now with kDebug() outputs that its really the engine not refreshing. So, what could be a solution?" i'm not overly familiar with how ksysguard does thing, but SensorManager has an update() signal that looks like it might do the trick. perhaps connecting to that signal, getting the new list of sensors and altering the current list according to that would do the trick. if that doesn't work, we can ask John Tapsell about it. then in the widget, it would need to connect to the sourceAdded and sourceRemoved signals to get notified of these changes. "I've noticed that closing and restarting the applet causes the engine to refresh." but i bet that if you have two of these widgets running on your desktop and you close only one of them and then start a new one the engine doesn't refresh. my (educated) guess is that when the applet is closed, the engine is no longer in use so it is deleted. when the applet is started again, the engine is re-loaded and it re-initializes itself and so shows the current network configuration properly. "I think not being aware of system changes isn't a good thing for a System Monitor." agreed ;)
I connected a slot for the update() signal as you said. Now the next step is to update the list accordingly. I'm using void SystemMonitorEngine::updateSensors() [in kdebase/workspace/plasma/dataengines/systemmonitor/systemmonitor.cpp], as the slot for the update() signal. Now, If I build and run the applet, whenever there is some addition/removal of interface(s), it crashes. Is the slot I'm using for updating the current list correct? Anyway, I've attached the backtrace.
Created attachment 31678 [details] Crash backtrace I tried to figure out where the problem is, but couldn't find it.
Created attachment 31754 [details] Crash backtrace
Created attachment 31756 [details] Crash backtrace
Aaron, I've done some research on the engine, and ksysguard SensorManager and SensorAgent sources. By using some kDebug statements in kdebase/workspace/plasma/dataengines/systemmonitor/systemmonitor.cpp - void SystemMonitorEngine::answerReceived(int id, const QList<QByteArray> &answer) and connecting and disconnecting my modem, I found out that in the above function, ksysguard sends a list with id = -1 which is then processed by the function to build up the sensor list. But, ksysguard sends this list (for id=-1) only ONCE, regardless of any change in the system state. ( A kDebug log is attached ). When I tried the file kdebase/workspace/ksysguard/gui/ksgrd/SensorAgent.cc to locate this behavior, I found it difficult to analyse the source as I don't have much experience. I find that you mention John Tapsell, but I could not find where to contact him. Can you please bring this to his attention, if I'm right about this? I really want to fix this somehow.
Created attachment 31805 [details] Log for plasmoidviewer sm_net 2>sm_net.log Lines 10-509 -> lists of the sensors Line 2895 -> displays pppd running 1219 - 1395 -> information about network interfaces 3637,3638 -> KSGRD::SensorMgr::update() occured (the slot for which I've given updateSensors() ) 3642 - 3670 -> information about network interfaces after dialup connection, but still doesn't contain ppp0
i believe you need to do this: KSGRD::SensorMgr->sendRequest("localhost", "monitors", (KSGRD::SensorClient*)this, -1); to trigger the listing of the available monitors. it's currently only done in the constructor of the SystemMonitor DataEngine, but it would need to be done whenever ksysguard says the monitors have changed. as for John, his email address is in the license headers at the top of various files in ksysguard :)
Patch at http://reviewboard.kde.org/r/246/ please review.
SVN commit 938556 by shantanu: added functionality for system monitor data engine to update the monitors list when SensorMgr sends update() BUG: 184893 M +14 -2 systemmonitor.cpp M +1 -0 systemmonitor.h WebSVN link: http://websvn.kde.org/?view=rev&revision=938556