Bug 325506 - Expansion of groups in the Contact List is not always remembered
Summary: Expansion of groups in the Contact List is not always remembered
Status: RESOLVED FIXED
Alias: None
Product: telepathy
Classification: Unclassified
Component: contactlist (show other bugs)
Version: 0.6.80
Platform: Gentoo Packages Linux
: NOR normal
Target Milestone: Future
Assignee: Telepathy Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-10-01 16:29 UTC by Dennis Schridde
Modified: 2014-04-26 18:02 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
A proposed solution for this bug (1.40 KB, patch)
2014-04-26 04:02 UTC, Renato Atilio
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Dennis Schridde 2013-10-01 16:29:18 UTC
I want to have certain groups in the Contact List expanded. When I expand them and close the Contact List and later open it again, some will be closed and I need to manually open them again.

There are three cases of what might happen when I open the Contact List:
1) All groups I had open last time are again open: Everything is fine!
2) Some groups will be closed. Usually this is Friends or Facebook Friends - the latter is fairly large, and Friends comes right after Facebook Friends in the list.
3) All groups will be closed.

Reproducible: Always
Comment 1 David Edmundson 2013-10-06 23:04:57 UTC
Works for me.

Can you look in ~/.kde4/share/config/ktelepathyrc before opening and after closing.
Check the [Groups] section and determine if it is failing to save or failing to open.
Comment 2 Dennis Schridde 2013-10-07 20:24:58 UTC
(In reply to comment #1)
> Can you look in ~/.kde4/share/config/ktelepathyrc before opening and after
> closing.
> Check the [Groups] section and determine if it is failing to save or failing
> to open.

Difficult task, because it seems to happen randomly. I'll report back, once I find a way to reproduce it reliably and thus get into a state where it actually makes sense to compare the file before/after.
Comment 3 David Edmundson 2013-10-07 20:29:44 UTC
Thanks.
Comment 4 Dennis Schridde 2013-10-12 15:11:02 UTC
(In reply to comment #1)
> Can you look in ~/.kde4/share/config/ktelepathyrc before opening and after
> closing.
> Check the [Groups] section and determine if it is failing to save or failing
> to open.

I opened the Contact List, found that one group closed, opened it, closed the Contact List. Then I took a snapshot of ~/.kde4/share/config/ktelepathyrc.

I then opened the Contact List again, group was again closed, I opened it, closed the Contact List and took another snapshot.

Then I opened the Contact List, found the group closed, did *not* open it, closed the Contact List and took a snapshot of the config.

In all three cases the config looked exactly the same. No group state changed, and the one in question had state "true".
Comment 5 Dennis Schridde 2013-10-12 15:11:55 UTC
Please note that I still do not know how to reliably reproduce this. It just happened that today the group would always be closed when opening the Contact List.
Comment 6 Dennis Schridde 2013-10-14 09:23:00 UTC
I found another way to "reproduce" this (could also be a separate issue, but the symptom is the same).

1. Open a group that was previously closed (I can reproduce this with at least two of my groups)
2. Search for anyone (does not matter which group he is in)
3. Clear the search field
4. Observe that the previously opened group is now closed again
Comment 7 Martin Klapetek 2014-02-27 15:11:13 UTC
In 0.7.80 (0.8 beta1) I cannot reproduce this anymore, including following your steps.

Dennis, can you please confirm?
Comment 8 Martin Klapetek 2014-04-12 13:39:18 UTC
Still cannot reproduce and given no activity for almost two months, closing.
Comment 9 Renato Atilio 2014-04-23 12:43:19 UTC
I'm using 0.8.0 from Kubuntu 14.04 and I can reproduce both the scenarios described here (closing the contacts list and searching for anything).

Watching ktelepathyrc, the [GroupsState] section is saved correctly (Group=true), but even after I close and open the contacts list, the group is still collapsed and the file is unchanged - meaning the Group=true is still there and just turns to Group=false when I expand and collapse the group manually.
Comment 10 Renato Atilio 2014-04-26 04:02:32 UTC
Created attachment 86272 [details]
A proposed solution for this bug

I've debugged this situation and the groups that didn't expand were always passed from rowsInserted to onNewGroupModelItemsInserted with invalid indices, so the method returns, not expanding these groups.

I was not able to understand why exactly this was happening, so I came with a working solution: even if the index passed to this method is invalid, it's possible to recover it from the model with the parameters from rowsInserted ("start", actually). Details on the submitted patch.

I've worked on the 0.8 branch, so this bug is reproducible on 0.8.1.

I didn't create a review request for the patch yet because this bug is marked as fixed. Please take a look at the solution and let me know if any further information or correction is needed. If it looks OK, I'll submit a review request.
Comment 11 David Edmundson 2014-04-26 10:46:12 UTC
Maybe you are onto something. The parent index being invalid makes perfect sense; the parent of a group node is nothing.

What this code was currently doing is looking for when you insert a child of a group node and then seeing if you should expand the group node (which will be the parent of the newly inserted child)
The reason we did this was because if you call expand() on a group node that doesn't have any children Qt just ignores your expand request; when I wrote that the code we had always inserted the group node, and then afterwards inserted the children.

Your patch basically restores the more obvious way of operating on the group node itself when is inserted.
Comment 12 Renato Atilio 2014-04-26 12:32:20 UTC
Is the patch OK?

Should I submit a review request targeting KDE/4.13?
Comment 13 David Edmundson 2014-04-26 13:08:47 UTC
Yes. Could you try and add some comments explaining why it's needed and what the two paths are doing.
Comment 14 Renato Atilio 2014-04-26 16:09:42 UTC
I've submitted a review request with some changes to my original solution, I hope it is clear enough.

https://git.reviewboard.kde.org/r/117791/
Comment 15 David Edmundson 2014-04-26 18:02:37 UTC
Git commit 57123038d097dd0fac80c31aadb27976ab2547a7 by David Edmundson, on behalf of Renato Atilio.
Committed on 26/04/2014 at 18:03.
Pushed by davidedmundson into branch 'kde-telepathy-0.8'.

Fix for a bug that caused the contacts list to not expand some groups on opening and filtering

I've fixed the 325506 bug by creating a decision upon the validity of the inserted item's parent. If it is valid, it works as before, considering it is a top-level element we want to collapse/expand. If it is invalid, the inserted item itself is probably the top-level node (hence the invalid parent - there's none), so we get it in another way.

I don't think the second validity check is strictly needed, but I thought it was safer to keep it anyway.

REVIEW: 117791

M  +11   -2    contact-list-widget.cpp
M  +1    -1    contact-list-widget.h

http://commits.kde.org/telepathy-contact-list/57123038d097dd0fac80c31aadb27976ab2547a7