<html>
<body>
<div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
<table bgcolor="#f9f3c9" width="100%" cellpadding="8" style="border: 1px #c9c399 solid;">
<tr>
<td>
This is an automatically generated e-mail. To reply, visit:
<a href="http://git.reviewboard.kde.org/r/107377/">http://git.reviewboard.kde.org/r/107377/</a>
</td>
</tr>
</table>
<br />
<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" style="background-image: url('http://git.reviewboard.kde.org/media/rb/images/review_request_box_top_bg.png'); background-position: left top; background-repeat: repeat-x; border: 1px black solid;">
<tr>
<td>
<div>Review request for Telepathy.</div>
<div>By David Edmundson.</div>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Description </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
<tr>
<td>
<pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Initial draft of a replacement for GroupsModel.
The key differences are:
- It doesn't rely on ContactModel* items, just a general model so can be used with the kpeople model as well as ours
- It can work on a tree (grouping by the top level items in the tree) for working with the kpeople model
- It can group on any property in the model. Not just GroupName. This will allow the KPeople model to still group by account.
- As it is generic it can also be used to provide the grouping in the LogViewer(for example), simplifying the entity model code there.
The code is pretty complex so I would like people to comment if it makes sense.
It is expected one subclasses this model for a specific purpose. i.e to group by groupNames:
QSet<QString> GroupGroupingModel::groupsForIndex(const QModelIndex &sourceIndex) const
{
QStringList groups = sourceIndex.data(AccountsModel::GroupsRole).value<QStringList>();
if (groups.isEmpty()) {
groups.append("_unsorted");
}
return groups.toSet();
}
QVariant GroupGroupingModel::dataForGroup(const QString &group, int role) const
{
switch (role) {
case Qt::DisplayRole:
if (group == "_unsorted") {
return i18n("Unsorted");
} else {
return group;
}
case AccountsModel::IdRole:
return group;
}
return QVariant();
}
Also if anyone can think of a better class name for something that group nodes by group name that isn't GroupGroupingModel that would be much appreciated.
</pre>
</td>
</tr>
</table>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Testing </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
<tr>
<td>
<pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">See it in action at: git@git.kde.org:scratch/davidedmundson/groupingmodel
Tested with ContactsModel->FlatModelProxy->This
Tested grouping by GroupName, by account, by client type, and grouping by presence.
In the near future ContactsModel will be a list, so this makes more sense.
No crashes, everything appeared to work.</pre>
</td>
</tr>
</table>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> </h1>
<ul style="margin-left: 3em; padding-left: 0;">
<li>KTp/Models/abstract-grouping-proxy-model.h <span style="color: grey">(PRE-CREATION)</span></li>
<li>KTp/Models/abstract-grouping-proxy-model.cpp <span style="color: grey">(PRE-CREATION)</span></li>
</ul>
<p><a href="http://git.reviewboard.kde.org/r/107377/diff/" style="margin-left: 3em;">View Diff</a></p>
</td>
</tr>
</table>
</div>
</body>
</html>