Dataengnies

Aaron J. Seigo aseigo at kde.org
Wed Aug 27 19:04:11 CEST 2008


On Wednesday 27 August 2008, Aaron J. Seigo wrote:
> On Wednesday 27 August 2008, Petri Damstén wrote:
> > On Tuesday 26 August 2008 23:38:47 Aaron J. Seigo wrote:
> > > and yes, if the engine is doing any sort of expensive work then the
> > > code needs to protect against it being called while the async job is in
> > > progreess.
> >
> > Yes, that's true.
> >
> > > doing async calls inside the DataEngine subclas itself is really not
> > > the best way to do things. encapsulating it inside a DataContainer
> > > subclass makes it waaaay easier to manage.
> >
> > This was new to me :-) Converted ExecutableEngine to use custom Container
> > (attached). One problem. exec is called in constructor to start process
> > for the first time. checkForUpdate is called when process finished but
> > seems that m_queued is false and dataUpdated is not called. On second
> > exec (first updateRequested signal, which comes after first timeout) it
> > works:
>
> you probably want to do:
>
> 	emit dataUpdated(objectName(), data());
>
> in ExecutableContainer::finished

actually, scratch that. checkForUpdate is better than doing it manually; the 
issue is *probably* that the signal/slot connections haven't been made yet.

it's not safe to start an update from the constructor due to this. so ..... 
you can do one of two things:

* call ExecutableContainer::exec() from the engine right after it is created

* QTimer::singleShot(0, this, SLOT(exec())); inside the ExecutableContainer 
ctor

the first option is probably the safest, however.

-- 
Aaron J. Seigo
humru othro a kohnu se
GPG Fingerprint: 8B8B 2209 0C6F 7C47 B1EA  EE75 D6B7 2EB1 A7F1 DB43

KDE core developer sponsored by Trolltech

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
Url : http://mail.kde.org/pipermail/plasma-devel/attachments/20080827/dfdf323e/attachment.sig 


More information about the Plasma-devel mailing list