Bug 327008 - Contacts not always (almost never) sorted
Summary: Contacts not always (almost never) sorted
Status: RESOLVED FIXED
Alias: None
Product: telepathy
Classification: Frameworks and Libraries
Component: contactlist (show other bugs)
Version: 0.7.0
Platform: Arch Linux Linux
: NOR normal
Target Milestone: Future
Assignee: Telepathy Bugs
URL:
Keywords:
: 325507 (view as bug list)
Depends on:
Blocks:
 
Reported: 2013-11-01 19:30 UTC by Max Sydorenko
Modified: 2014-02-17 17:03 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In: 0.8.0


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Max Sydorenko 2013-11-01 19:30:06 UTC
I have Instant messaging presence plasmoid running most of the time. Every time I start contact list (using click on the plasmoid) contacts are not properly sorted (neither alphabetically nor by presence). Sort by Presence/Sort by Name button do not help. The only way I have found to trigger contact list to resort is switching Contact grouping (initial grouping mode do not affect issue, only change in the mode help). But this workaround is not permanent: close Contact list window, reopen it -- and contact sorting is messed up again.
Comment 1 David Edmundson 2013-11-01 19:59:54 UTC
Note that we group away + mobile as lower than just "away". which can make things look off on first glance.

I can't reproduce it here, can I have some information:
What do you initially group contacts by? Does it make a difference

Are you running in kpeople mode? If you are you will have an extra button in your toolbar on the left with the tooltip "Merge Selected Contacts"
Comment 2 Max Sydorenko 2013-11-01 20:15:18 UTC
(In reply to comment #1)
> Note that we group away + mobile as lower than just "away". which can make
> things look off on first glance.
Yes, I have accounted that, and this is not the reason.
> What do you initially group contacts by? Does it make a difference
No difference at all. I have tried both.
Actually, "Sort by Presence/Sort by Name" button works only after the resorting, triggered by switching Contact grouping (as I described in the first post). 
> Are you running in kpeople mode?
Yes, I'm running kpeople mode and have several merged contacts in the list.

The problem appeared only after upgrade to 0.7.0, no issue on 0.6.x before.
Comment 3 Christoph Feck 2013-11-17 13:41:12 UTC
David, does comment #2 provide the requested information? Please set the bug status.
Comment 4 Martin Klapetek 2013-11-17 13:43:03 UTC
Sort of. We know what's causing it, should be able to fix it now.
Comment 5 David Edmundson 2014-02-17 14:51:28 UTC
*** Bug 325507 has been marked as a duplicate of this bug. ***
Comment 6 David Edmundson 2014-02-17 17:03:47 UTC
Git commit 1be2526bfc18254fdd335645bfcf236efcc83ae8 by David Edmundson.
Committed on 17/02/2014 at 12:19.
Pushed by davidedmundson into branch 'master'.

Add a workaround for broken sorting

There is a bug in QSortFilterProxyModel in which if sort() is called
on a model where all items are filtered out it will not start sorting
as it cannot map the proxy column to the source column.

This gets updated whenever there's an insertRows but not from
a dataChanged.

With the kpeople cache we load all items, but
none make it through the filter as everyone is assumed to be
offline whilst we query telepathy over DBus. When we get data
from Tp we will only ever call dataChanged() not insertRows()
so we hit the Qt bug.

This bug is fixed in Qt 5.2.1, but not in 4.x

REVIEW:115828
FIXED-IN: 0.8.0

DIGEST: Please do not put this in the commit log. No-one should see
how horrible this is.

M  +42   -5    KTp/Models/contacts-filter-model.cpp
M  +2    -0    KTp/Models/contacts-filter-model.h

http://commits.kde.org/telepathy-common-internals/1be2526bfc18254fdd335645bfcf236efcc83ae8