Plasma newbie questions and API fuzzyness (perhaps)

Dmitry Suzdalev dimsuzkde at gmail.com
Sat Mar 22 22:37:52 CET 2008


On Saturday 22 March 2008 17:38:42 Aaron J. Seigo wrote:
> On Saturday 22 March 2008, Dmitry Suzdalev wrote:
> > actual source data to myData 7. dataUpdated is called again - this time
> > with correct data.
>
> well .. i can see a few ways of making it so that the data is set first. i
> don't know if it's exactly worth it, but it can't hurt either.
After some thinking, I'm not sure if it's worth it too.
I just spent some time in plasma code trying to figure out what happens, so I 
got my mind slightly shifted to "oh, my why does this happen?!" :)

Maybe the good choise would be again to add some api docs to connectSource, 
stating that this method might trigger dataUpdated call with current contents 
of that data source as argument. This would make behaviour I faced more 
evident to the end-user so he can handle it.

> > Step 5 is unexpected and could cause some "WTF?!" from user space :)
> > Happenned here ;)

> what problem did this cause in your code, exactly?

I have an "id" key in my data source. In data updated I add an item based on 
"id" i received. At first I wrote dataUpdated method with assumption that it 
always get a valid data.
I just use m_data->value("id").toInt() as id.

So it was a surprise for me when I was seeng the following:

Engine calls setData with "id"=1. Once.
Surprisingly an Applet adds two items with "id"=0, and "id"=1.
For each new data source i got two updates...

That's why I started to investigate this strange behaviour :)

Cheers,
Dmitry.

P.S. You can reproduce this "tricky" behaviour by putting a comment on line
"if( !data.isEmpty() )..." in playground/applets/notifier/notifier.cpp.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.kde.org/pipermail/panel-devel/attachments/20080322/9395ab2d/attachment-0001.html 


More information about the Panel-devel mailing list