[Kde-pim] Refactoring of the client side KResource/Akonadi bridges

Kevin Krammer kevin.krammer at gmx.at
Thu Mar 19 12:09:24 GMT 2009


Hi all,

I am have been working on refactoring/reimplementing the client side bridges 
so that they share code when possible.

I've already committed the new shared code base into 
kdepim/kresources/akonadi/shared and I have now finished the data type 
specific spezialications.

That's still quite some code, but I though maybe somebody is interested in 
having a quick look at the changes to check if I did obviously bad things :)

So I am going to create two review requests for the porting patches, feel free 
to thoroughly investigate the stuff ;)

A couple of words on the design and implementation:

Akonadi collections are mapped into a flat list of Subresources (limitation of 
the KRes subresource concept).

There is a base class calles AbstractSubResourceModel which does the base work 
and lets a templated subclass create the type specific collection handlers 
(derived from SubResourceBase)

The type specific implementations extract the payload and perform identifier 
arbitration, i.e. if two payloads have the same internal ID, one of them gets 
a new one locally and the original one is restored whenever sending the 
payload back to Akonadi again.

Loading (both synchronous and asynchronous) is implemented in the model, 
saving is implemented in the Resource Private base class 
(shared/resourceprivatebase.h/.cpp).

Synchronous jobs are handled through QtConcurrent::run() to make the calling 
thread block as expected. See ConcurrentJob template base class in 
shard/concurrentjobs.h/.cpp

The resource has to associated newly added data with a target subresource 
(Akonadi collection) as there is no API for that so the application can't do 
it.

The old implementation did that at save time, however for the new 
implementation I switch to doing it at the time of adding, e.g. when adding 
an event to the calendar.
IMHO this fits more nicely into the workflow, when using multiple top level 
resource the apps also ask at this stage for a selection between them.

See ResourcePrivateBase::addLocalItem()

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: 189 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-pim/attachments/20090319/06080710/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