playground/base/plasma/dataengines/akonadi

David Baron d_baron at 012.net.il
Tue Feb 10 07:55:57 CET 2009


On Monday 09 February 2009 22:52:58 Sebastian Kügler wrote:
> On Monday 09 February 2009 21:28:17 David Baron wrote:
> > > On Monday 09 February 2009 08:37:48 David Baron wrote:
> > > > Great.
> > > >
> > > > I downloaded and compiled.
> > > >
> > > > I still get "no data sources" in the explorer and in some test code
> > > > which would simply show the sources() list.
> > >
> > > You need to actually request sources. For example connect to
> > > "EmailCollections" or "ContactCollections". The dataengine will only
> > > load the stuff from Akonadi you actually ask for.
> >
> > OK.
> >
> > In the explorer, requeted ContactCollections
> > This showed by a ContactCollection-6 dir address book
> > If I the request ContactCollection-6, I do indeed get all the contacts by
> > number. Trying to navigate this (now large) list quickly hangs up the
> > explorer.
> >
> > > Alternatively, add
> > >
> > > fetchEmailCollections();
> > > fetchContactColletions();
> > >
> > > to the constructor of the dataengine. This way it'll load the
> > > collections on engine startup. You can then use the collections you get
> > > back to retrieve emails and contacts.
> >
> > Because of a pontentially large amount to date, this approach should not
> > be used.
>
> Yes of course, otherwise I would have added to the dataengine in the first
> place... It's completely transparant to the user though (thanks to the
> design of dataengines).
>
> > My applet will want to assemble a list of QAbstractListItems or
> > QStringLists something like:
> > contact-name phone-number-1
> > contact-name phone-number-2
> > contact-name2 phone-number-1
> > etc.
> >
> > There may be several collection-# lists and a lot of data. Once loaded
> > which takes a bit of time, possibly geometric by number of items!,
> > kaddressbook seems to run reasonably (using the akonadi dir resource).
> >
> > I would load the data in a background thread--question is how long it
> > will need to load and be navigated to fill a sorted listwidget. I guess
> > I'll just have to try it out and see.
>
> The loading of data in the dataengine is async. Don't block on it but react
> to signals announcing new datasources instead. Look at lionmail.cpp for an
> example.

What if the initial get sources always returned something, in this case 
EmailCollections, ContactCollections which is a handful of items? The caller 
will always have something to test and can choose which if any to request.


More information about the Plasma-devel mailing list