Do not reset the 'isExpanded' state of folders when the 'refreshItems' signal is received.
Review Request #110401 - Created May 12, 2013 and submitted - Latest diff uploaded
When the refreshItems signal is received for an item, we call KFileItemModel::retrieveData(), which updates many of the item's properties. Unfortunately, it also resets the 'isExpanded' state to false. The result is that folders are (partly) collapsed in the view when their contents change. I propose to fix this by not initializing the 'isExpanded' role at all in retrieveData(). When KFileItemModel::isExpanded() tries to access the non-existing entry in the hash, the default-constructed QVariant evaluates to 'false' anyway.
Works for me, old and new unit tests pass.