Fun with Akonadi Dataengine

David Baron d_baron at 012.net.il
Mon Feb 16 19:42:03 CET 2009


On Monday 16 February 2009 19:08:03 Aaron J. Seigo wrote:
> On Sunday 15 February 2009, David Baron wrote:
> > 1. The ContactCollection-# loads all the contacts but they are not
> > necessarily accessible at this point. I might have to try
>
> hm; this sounds rather inefficient for large address books. perhaps it's a
> good idea to collect use cases for this part of the engine and build
> specifically for those rather than build something too general purpose; the
> engine doesn't need to be able to support building an entire address book
> application around it (that's not the point of engines), so defining what a
> widget should like to do with it is probably a good start point.

It's a point. But I am dialing the phone. Here is how I do it now:

1. In init(), I start a QTimer with 1 second interval.

2. At 1st timeout, I do the a query("ContactCollections")
then if I find a suitable key, connectSource, i.e to ContentCollection-6.

3. After that, I connectAllSources at 1 second intervals until dataUpdated 
gets called. At this point, I stop the QTimer and am now receiving the 
contacts. Using these, I assemble my phone book into a QListWIdget.

This works nicely in the background without delaying the panel/desktop and the 
GUI stays live. Using a QThread was my 1st try but the dataengine did not like 
that. The QTimer looks like a thread but is done differently so this plays.

The alternative of writing a dataengine tailored to this type of task such as 
was done in a birthday plasmoid could be considered, not using Akonadi. Unless 
these background daemons are tactfully niced, I think folks may uninstall 
them. Nepomuk and all the Akonadi children take a large bite of CPU, 
especially after login. They may quiet down a lot later on (after everything 
is sync'ed?).



More information about the Plasma-devel mailing list