[Kde-pim] KJots on Akonadi. Help needed.
Stephen Kelly
steveire at gmail.com
Thu Oct 16 00:52:48 BST 2008
Hi,
I've made more progress on this. I now have a working tree model containing
kjots books and pages. You can see a screenshot in the commit digest. The
items in the model are sorted according to how they appear in the kjots
data files. The model requires a lot more work (currently it would probably
break if you tried setData, and all the item slots need to be implemented),
but as it needs to go into akonadi (It uses the internal
collectionmodel_p.cpp for its collection list etc), I need to get approval
for that before doing the rest of the work. Aside from KJots, the local
bookmarks resource could use this stuff. At least in KDE3 folders can be
anywhere in the bookmark model. I'm sure there are other uses too.
The code and the kdepimlibs/akonadi patch are now in playground.
Unfortunately the CollectionDisplayAttribute rename is mixed in with it.
That rename might not happen, but until there's some decision made that's
what I'm working with.
http://websvn.kde.org/trunk/playground/pim/kjotsrewrite/kdepimlibs-akonadi.patch?view=markup
Here's a walkthrough of the rest. I will of course break it into separate
commits if I can commit any of it now.
(using namespace Akonadi; :))
The model that does most of the work is EntityTreeModel, which is a subclass
of CollectionModel. It appends the Items in a Collection below that
collections childCollections. The EntitySortFilterProxyModel can change
that order by making use of EntityAboveAttribute. That new attribute
records the remoteId of the Entity that should appear the row above it in
the model. That allows sorting in ascending order by using
EntitySortFilterProxyModel::lessThan. I might be able to sort in Descending
order, but that's not a priority yet.
I also made CollectionModel::indexForId a const. This allows it to be called
from EntityTreeModel::parent const.
I also changed the behaviour of CollectionModelPrivate::collectionsChanged.
The current implementation calls the beginInsertRows/endInsertRows methods
conditionally. The condition holds only when the collections parent is
already in the model. As the list passed to that method from the
startFirstListJob is unordered, that could be true or not when the model is
first being filled. The EntityTreeModel relies on the correct signals being
emitted from the CollectionModel on row insert to insert items into the
tree. The new implementation should I think always call
begin/end-InsertRows (It works for me, but I don't know a lot about
Monitor).
Next up for me is:
- Finish the kjots resource to handle changes and removals to items and
collections.
- Finish the model to use that stuff.
- Figure out how to remove that 'Bookshelf' top level item from the model.
Please review the intent and approach of the patch and ignore the
incompleteness of it. I'm sure the missing pieces can be added if it can be
confirmed as the right approach.
All the best,
Steve.
_______________________________________________
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