Simplify comparison of children of expanded folders

Review Request #108766 - Created Feb. 3, 2013 and submitted

Frank Reininghaus
The comparison of items when expanded folders are present, which is done mainly in the function KFileItemModel::expandedParentsCountCompare() is unnecessarily complex. It analyzes the sub-folder structure based on the URLs of both items. This is quite complicated and can cause problems in some situations, see bug 311947.

I propose to remove most of the current code and just use the 'parent', which is stored in the ItemData for each item, to compare the items. This requires much less code, is faster, and less buggy. 

This patch consists of three parts:

1. The changes in KFileItemModel (including additional checks in KFileItemModel::isConsistent()),
2. A new unit test for bug 311947,
3. A new benchmark for adding and removing many items in a tree structure.

Comments welcome!
I cannot reproduce the crash any more. Existing tests still work OK. The benchmark for adding and removing many items in a tree structure runs in about 1.7 seconds, rather than 2.9 seconds.
Emmanuel Pescosta
Commit Hook
Frank Reininghaus
Review request changed

Status: Closed (submitted)