This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Manual update of a Plasma::DataEngine

Tags: None
(comma "," separated)
User avatar
giucam
KDE Developer
Posts
62
Karma
1
OS
I'd need to update the data of a dataengine manually, without setting an update interval.
I searched on http://api.kde.org/4.x-api/kdelibs-apidocs/plasma/html/classPlasma_1_1DataEngine.html#ccb20ef9b196ce72938c4e80201559a3 but I couln't find a way to do so.
Deleting the object and recreating it with Plasma::Applet::dataEngine("name") does the trick but when I close the plasmoid it crashes:

Code: Select all
[...]
Thread 1 (Thread 0x7f0cd62547a0 (LWP 10022)):
[KCrash Handler]
#5  Plasma::DataEnginePrivate::deref (this=0x160005002b) at /home/phil/kdemod/testing/kdelibs/src/kdelibs-4.2.95/plasma/dataengine.cpp:533
#6  0x00007f0cd581352a in Plasma::DataEngineManager::unloadEngine (this=0x2764510, name=<value optimized out>) at /home/phil/kdemod/testing/kdelibs/src/kdelibs-4.2.95/plasma/dataenginemanager.cpp:159
#7  0x00007f0cd57e6d01 in ~AppletPrivate (this=0x27aa880) at /home/phil/kdemod/testing/kdelibs/src/kdelibs-4.2.95/plasma/private/dataengineconsumer_p.h:40
#8  0x00007f0cd57ebfb2 in ~Applet (this=0x25c9e70) at /home/phil/kdemod/testing/kdelibs/src/kdelibs-4.2.95/plasma/applet.cpp:186
#9  0x00007f0cc4987a1e in ~DeviceManager (this=0x25c9e70) at /home/giulio/kde/plasmoidi/nativi/devicemanager/devicemanager.cpp:81
#10 0x00007f0cd57fc347 in ~Containment (this=0x250d990) at /usr/include/QtCore/qalgorithms.h:350
[...]


Is there a way or am I bound to set an update interval and connect the signal of the dataengine to a slot that does nothing?
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS
Judging by the documentation, you can call setData() at any time to update data stored in the data engine, however as it is a protected method, you would need to be the data engine itself to do this.

Plasma does not support plasmoid initiated deletion of data engines, they are managed by Plasma itself, which will delete them when they are no longer used.

What exactly are you trying to accomplish?
User avatar
giucam
KDE Developer
Posts
62
Karma
1
OS
I have a pointer to the soliddevice DataEngine.
Now if a device is mounted, I can get the free space via the dataengine, but if it is not mounted obviously I can't.
So, if the device is unmounted when I start my plasmoid, and then I mount it, I need to tell the dataengine to refresh its data because now i want to get the free space.
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS
That should be handled by the DataEngine itself, which should listen to the appropriate Solid signals to update the available data.

Please submit the changes you make to the DataEngine to the Plasma group on the Reviewboard ( reviewboard.kde.org )
User avatar
giucam
KDE Developer
Posts
62
Karma
1
OS
So I thought, but you can see using the plasmaengineexplorer, watching the keys and the values of a device and mounting and umounting it that the "Free Space" key doesn't shows up or hides.
Maybe it is a bug, because I just saw that the "Accessible" key changes values to yes or no when I mount or umount it.

For the Reviewboard, I want to add a bar to show the free space and an other thing before proposing it. I think that in few weeks I'll finish it.


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], Sogou [Bot]