[Kde-pim] Problem with bulk fetching of items with 4.8

Kevin Krammer kevin.krammer at gmx.at
Fri Jan 27 19:23:48 GMT 2012


Hi Shaheed,

On Friday, 2012-01-27, Shaheed Haque wrote:
> Hi Kevin,
> 
> Given that I want to do bulk fetches from Exchange, it would be nice
> to do bulk writes to Akonadi too. Since all the various Item-related
> Job work on single items at a time, I'd like to continue using the
> itemsRetrievedIncremental() API.

That internally uses item jobs as well IIRC.

> So, how about if I rearrange the code
> to avoid calling cancelTask, i.e. like this:
> 

[snip code]

> IIUC, the context for itemsRetrievedIncremental() will be correct, and
> this should be the most efficient way to do it. DOes that sound
> plausible?

No, that won't work. While not cancelling the tasks keeps it the active 
context, it also keeps your custom task from being executed.

However, since the purpose of custom task right here seems to be calling 
retrieveGALItems() asynchronously you could do that with 
QMetaObject::invokeMethod().

retrieveItems()
{
   ...
   scheduleCustomTask("retrieveGALItems")
   // Don't cancelTask() , just return.
   QMetaObject::invokeMethod(this, "retrieveGALItems", Qt::QueuedConnection);
}

retrieveGALItems()
{
   ...
   fetch 300 items from Exchange
   itemsRetrievedIncremental(items);
   if (no more items) {
      itemsRetrievalDone();
   } else {
       // go around again.
      QMetaObject::invokeMethod(this, "retrieveGALItems", 
Qt::QueuedConnection);
   }
}

Cheers,
Kevin

-- 
Kevin Krammer, KDE developer, xdg-utils developer
KDE user support, developer mentoring
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-pim/attachments/20120127/df617d53/attachment.sig>
-------------- next part --------------
_______________________________________________
KDE PIM mailing list kde-pim at kde.org
https://mail.kde.org/mailman/listinfo/kde-pim
KDE PIM home page at http://pim.kde.org/


More information about the kde-pim mailing list