Fix Bug 302703 - [Dolphin 2.1] Icons view mode 'messed up' after switching from details view mode (w/o expandable folders)
Review Request #111632 - Created July 21, 2013 and discarded
The view mode for already visible items was not updated while layouting, so call initializeItemListWidget to tell the widget the changed view mode.
Works for me.
Thanks for the analyzing this problem. Hm, I looked at the code, and I have the impression that your patch hides the real bug (and also adds some unnecessary overhead every time KItemListView::doLayout() is called). Actually, KStandardItemListView::onItemLayoutChanged() already calls KStandardItemListView::updateLayoutOfVisibleItems(), which then calls initializeItemListWidget(). However, DolphinItemListView::onItemLayoutChanged(), which overrides KFileItemListView::onItemLayoutChanged(), does not call the base class implementation because the answer to the question "do we support expanding or not" is different in both classes - DolphinItemListView takes the "Expandable folders" setting into account. The code around changing the item layout and the "supports expanding" state is partly duplicated and not quite consistent in KStandardItemListView/KFileItemListView/DophinItemListView. I think we can make it more robust by refactoring it a bit, setting the "supports item expanding" property in KStandardItemListView, and answering the question if the layout supports it in a virtual function. Then we can just do everything that is needed if the state of that property chanes in onSupportsItemExpandingChanged(), and safely make DolphinItemListView::onItemLayoutChanged() call the base class implementation (which fixes the bug): http://paste.kde.org/p9a70554b/ What do you think?