Review Request: Update models to stop exposing the ModelItem classes (part 1/4)
David Edmundson
kde at davidedmundson.co.uk
Thu Dec 1 02:16:03 UTC 2011
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/103302/
-----------------------------------------------------------
Review request for Telepathy.
Description
-------
This is the first patch in making it so we don't need to export ContactModelItem, AccountModelItem, TreeNode, ProxyTreeNode, GrouModelItem in our lib.
These classes get in the way of a port to the nepomuk model. The only uses for them is to get to a ContactPtr or AccountPtr, and it involves having to publicly expose a lot of internal classes in our library.
With this done, the code in the Contact List will be a lot less model dependant (as we won't have to proxy through these classes) it will also have a lot smaller and simpler.
This patch
- Adds roles to get a Tp::ContactPtr and Tp::AccountPtr directly.
- Expose a role to return the type of current index (i.e Account, Contact or Group) so we can use that instead of checking the QVariant type on ItemRole.
- Also adds exposure to get the relevant AccountPtr from a contact, rather than having to call an extra method on AccountsModel which again makes code simpler.
- this patch also introduces an asynchronous setting of a Tp::AccountManager on the model. This was needed to fix up the contact-list-applet.
The next step is to rewrite the contact list to not use ItemRole.
ItemRole has not been removed yet, as there is a /lot/ of code to update, so I'm doing it in four phases.
1) Expose the new information we need
2+3) Update everything to use ContactRole/AccountRole (both contact list, and groups-model.cpp need heavy updating)
4) Get rid of the old interface.
Diffs
-----
KTelepathy/Models/accounts-filter-model.cpp ca7aa91
KTelepathy/Models/accounts-model-item.cpp db1d98f
KTelepathy/Models/accounts-model.h 12f2438
KTelepathy/Models/accounts-model.cpp 355ee95
KTelepathy/Models/contact-model-item.cpp d87e21f
KTelepathy/Models/groups-model-item.cpp 9a88788
KTelepathy/Models/groups-model.h d3cd282
KTelepathy/Models/groups-model.cpp 2827e86
Diff: http://git.reviewboard.kde.org/r/103302/diff/diff
Testing
-------
Thanks,
David Edmundson
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-telepathy/attachments/20111201/667db45c/attachment.html>
More information about the KDE-Telepathy
mailing list