[Bug 31195] Implement models

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Fri Mar 11 21:26:11 CET 2011


https://bugs.freedesktop.org/show_bug.cgi?id=31195

--- Comment #13 from Martin Klapetek <martin.klapetek at gmail.com> 2011-03-11 12:26:10 PST ---
Hi, I've been working with kde-telepathy group to bring a working contact list
based on models from Telepathy-Qt4-Yell project. We did some modifications to
the AccountsModel with the (tree) view in mind. I've created a repo on github,
which includes copy of tp-qt4-yell master with our applied changes. We did
mainly 3 things:

1) Don't add accounts that are disabled or offline. Imagine this in the view -
you add all available accounts, that creates one tree node for every account
and those accounts that are disabled would be in the view for no reason. Same
with the offline accounts, because the group would be empty anyway (there are
no childs in this tree node until you actually connect), therefore it has no
use in the view.

2) When an account goes offline in the current implementation, all the contacts
of the account node are deleted, which leaves the account node with no
childrens, ie. empty group. So we remove the account node as well (in fact, we
remove only this node, all the children are deleted in the process). With this
comes also one fix in tree-node.cpp, when you go offline and online several
times, sooner or later it will crash because it tries to access already deleted
pointer. We moved the "mPriv->mParent->mPriv->mChildren.removeOne(this);" line
from destructor to the remove() method, which seems to fix the crashing.

3) There is one new method, AccountsModel::accountForContactIndex(const
QModelIndex& index). This returns the account where the contact at index index
belongs. This is needed when requesting text/audio/video channel, as you need
to call this on an account object with the contact as a parameter.

We'll continue to improve the model (implement groupping) and share all the
changes at github (we'll try to separate the added functionality by commits
with some descriptive commit message) so it can be eventuelly merged back.

Here's the repo: https://github.com/mck182/telepathy-qt4-yell

Feel free to ask about/comment whatever pops up there.

Marty
(mck182 @ #kde-telepathy)

-- 
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.



More information about the telepathy-bugs mailing list