Fun with Akonadi Dataengine (solved)

Sebastian Kügler sebas at kde.org
Sat Feb 14 00:22:30 CET 2009


On Friday 13 February 2009 10:30:22 David Baron wrote:
> >Got to try it.
> >
> >connectSource to ContactCollections.
> >dataUpdated() is called and I connectSource to ContactConnection-# that it
> >gives me in the data.uniqueKeys()
> >
> >dataUpdated() is never called again.
> >
> >The console shows all the contacts being added int but the program never
> > sees them.
> >
> >1. What do I do now?
> >2. How do I know when all the data has been loaded--no more calls to
> >dataUpdated() are going to happen?

You can do an initial loading with dataengine()->query(), and then use only 
connect to the sources you're actually interested in.

> Calling connectAllSources() OUTSIDE dataUpdated() worked. Makes sense since
> this one could have fun consequences if it worked inside :-)

Don't connectAllSources() when you only need a few, you can load the data when 
you actually want to use it, that way you prevent slow starting up.

> Since things are asynchronous, knowing when the data is loaded is desirable
> but hundreds of contacts loaded in a second or so on my clunker so I cannot
> complain. It could be a bit disconcerting, however, to see a listbox
> filling and sorting "live" so knowing when to actually (fill and) show it
> is desirable. So such a signal may be placed on the "wish list."

What's the problem with it filling? If it keeps moving this way, you could for 
example wait with adding new items when you

You don't need to use only dataUpdated() btw, you can just query() dataengine, 
and pre-populate your widgets that way. This is actually what I'm doing in 
Lion Mail's createConfigurationInterface().

> Afterwards, I assume a dataUpdated call implies an item was changed inside
> or outside the applet so this item would need updating in the
> "visualization" as well.

The applet is the visualization, and dataUpdated() *is* that notification you 
seem to be looking for :)

> At least now I can design my interface for viewing and using those
> contacts. A big congrats for job well done. When will it be released?

Didn't think about it yet. Guess we should do a bit more testing (especially 
monitoring, see my other email). Another thing is that most people don't have 
their contact data in Akonadi yet.
-- 
sebas

 http://www.kde.org | http://vizZzion.org |  GPG Key ID: 9119 0EF9 



More information about the Plasma-devel mailing list