[Kde-pim] Review Request: Add capability to merge items containing multiple parts, and to know what parts are available for a given item.

Stephen Kelly steveire at gmail.com
Fri Aug 21 16:04:33 BST 2009


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://reviewboard.kde.org/r/1365/
-----------------------------------------------------------

(Updated 2009-08-21 15:04:33.620721)


Review request for KDE PIM.


Changes
-------

Changes:
* Fix whitespace issues, ( foo ) instead of (foo).
* Add some missing @since
* Fix explicit
* Change how the model and the PartFetcher interact. The PartFetcher now runs the item fetch job itself instead of requesting that the model execute the job using hacks with data/setData.
    The partfetcher fetches the part and then sets it on the model so that it's cached there.

The dynamic_cast is not changed to qobject_cast because the plugin object has already been cast to the ItemSerializerPlugin interface, so it is not a QObject. The dynamic_cast is safe anyway as it does not cross library boundaries.


Summary
-------

This patch adds a ItemSerializerPluginV2 class which contains API for merging two items, and for returning which parts are available for a given item.

For 'legacy' serializers which use ItemSerializerPlugin, there is a slower method of merging by multiple deserializations. The default implementation of merge also uses this slow method.

I also need to do a dynamic_cast of plugins in the ItemSerializer class so that it can know the capabilities of a plugin.

Both merge, and availableParts are available through the Item class.

These changes allow the ETM to function properly when a itemChanged signal is recieved. Current behaviour is to over-write the item currently in the internal data structure with the newly recieved item. The problem is that if the new item does not contain parts which the old item did, the old parts are discarded. The new behaviour is to merge the parts.

Additionally, the available parts are made available through the model, which means that a model could by default only fetch the Envelope part, and fetch the body on click, and fetch an attachment from akonadi when it is selected. A PartFetcher class is provided for convenience. Doing this operation though a generic, very ugly hack with setData/data allows the use of the PartFetcher class through proxy models, and it also allows the model to cache parts. That means that if the user clicks several emails for example, their body parts are retrieved from Akonadi only once, and cached, rather than being fetched multiple times as is the current behaviour.


Diffs (updated)
-----

  /trunk/KDE/kdepimlibs/akonadi/entitytreemodel_p.cpp 1014128 
  /trunk/KDE/kdepimlibs/akonadi/item.h 1014128 
  /trunk/KDE/kdepimlibs/akonadi/CMakeLists.txt 1014128 
  /trunk/KDE/kdepimlibs/akonadi/entitytreemodel.h 1014128 
  /trunk/KDE/kdepimlibs/akonadi/entitytreemodel.cpp 1014128 
  /trunk/KDE/kdepimlibs/akonadi/item.cpp 1014128 
  /trunk/KDE/kdepimlibs/akonadi/itemserializer.cpp 1014128 
  /trunk/KDE/kdepimlibs/akonadi/itemserializer_p.h 1014128 
  /trunk/KDE/kdepimlibs/akonadi/itemserializerplugin.h 1014128 
  /trunk/KDE/kdepimlibs/akonadi/itemserializerplugin.cpp 1014128 
  /trunk/KDE/kdepimlibs/akonadi/partfetcher.h PRE-CREATION 
  /trunk/KDE/kdepimlibs/akonadi/partfetcher.cpp PRE-CREATION 

Diff: http://reviewboard.kde.org/r/1365/diff


Testing
-------

Temporarily modified KJotsResource to make two parts available, title and content. The content is only fetched when a page is clicked, and it is noticably cached. 

http://websvn.kde.org/?view=rev&revision=1013595


Thanks,

Stephen

_______________________________________________
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