[Kde-pim] Review Request: Add buffering and purging to EntityTreeModel

Stephen Kelly steveire at gmail.com
Mon Oct 5 17:32:14 BST 2009


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

Review request for KDE PIM.


Summary
-------


Before this patch, if a new resource with many items was added to
Akonadi, the monitor would emit signals notifying of the new Items
available. If the new resource is for an imap account, for example,
this could mean notifications for a great many Items, even if they
are not represented in a view.

This patch causes reference counting to be used for Collections,
so that if the ETM is populated lazily, and a Collection is
selected, its items will be fetched (This is old behaviour), and
its reference count will be increased (This is new behaviour). If
a Collection is unselected in a view, the reference count is
decreased.

If the reference count of a Collection drops to zero, the
Collection is put into a buffer of a predefined size. Currently
the size is 10. When the buffer is full, the items in one of the
Collections might be purged from the model. The Collection whose
items are purged is determined by a first-in-first-out system,
where the Collection which has been in the buffer the longest
(without being selected again) is the first to be purged.

I wrote above that the Collection 'might be purged'. If the model
already has fewer than a set number of items in it, there is no
need to remove/add items every time the buffer is filled. Currently
if the model has fewer than 10000 Items, the Collection is not purged.

As a nice side effect, favourite collections (those represented in a
FavoriteCollectionsModel) are always fully up-to-date and populated.

For the Application developer, the only thing that needs to be done
to use this feature is to use an Akonadi::SelectionProxyModel instead
of KSelectionProxyModel and use LazyPopulation.

I already have a patch ready for akonadiconsole:

-  KSelectionProxyModel *selectionProxyModel = new KSelectionProxyModel( mCollectionView->selectionModel(), this );
+  Akonadi::SelectionProxyModel *selectionProxyModel = new Akonadi::SelectionProxyModel( mCollectionView->selectionModel(), this );


Diffs
-----

  trunk/KDE/kdepimlibs/akonadi/CMakeLists.txt 1030481 
  trunk/KDE/kdepimlibs/akonadi/dragdropmanager.cpp 1030481 
  trunk/KDE/kdepimlibs/akonadi/dragdropmanager_p.h 1030481 
  trunk/KDE/kdepimlibs/akonadi/entityfilterproxymodel.cpp 1030453 
  trunk/KDE/kdepimlibs/akonadi/entitytreemodel.h 1030453 
  trunk/KDE/kdepimlibs/akonadi/entitytreemodel.cpp 1030453 
  trunk/KDE/kdepimlibs/akonadi/entitytreemodel_p.h 1030453 
  trunk/KDE/kdepimlibs/akonadi/entitytreemodel_p.cpp 1030453 
  trunk/KDE/kdepimlibs/akonadi/entitytreeview.h 1030481 
  trunk/KDE/kdepimlibs/akonadi/entitytreeview.cpp 1030481 
  trunk/KDE/kdepimlibs/akonadi/favoritecollectionsmodel.h 1030453 
  trunk/KDE/kdepimlibs/akonadi/favoritecollectionsmodel.cpp 1030453 
  trunk/KDE/kdepimlibs/akonadi/favoritecollectionsview.h 1030481 
  trunk/KDE/kdepimlibs/akonadi/favoritecollectionsview.cpp 1030481 
  trunk/KDE/kdepimlibs/akonadi/monitor.h 1030453 
  trunk/KDE/kdepimlibs/akonadi/monitor_p.h 1030453 
  trunk/KDE/kdepimlibs/akonadi/monitor_p.cpp 1030453 
  trunk/KDE/kdepimlibs/akonadi/selectionproxymodel.h PRE-CREATION 
  trunk/KDE/kdepimlibs/akonadi/selectionproxymodel.cpp PRE-CREATION 

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


Testing
-------

Attached modeltest to akonadiconsole and hacked the proxies a bit so I could see the items being added/removed in the collection tree.


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