Review Request 111004: When switching to "Sort by Type", really do sort by type
Commit Hook
null at kde.org
Tue Jun 18 16:42:32 BST 2013
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/111004/
-----------------------------------------------------------
(Updated June 18, 2013, 3:42 p.m.)
Status
------
This change has been marked as submitted.
Review request for Dolphin.
Description
-------
Emmanuel looked into this issue already in https://git.reviewboard.kde.org/r/109471/, but with this patch, the issue was for some reason not fixed on my system.
But I think I have found the root cause of the bug now. When switching to "Sort by Type", KFileItemModel::onSortRoleChanged() resorts the items, but it doesn't work because the "type" role isn't known yet. It only gets added later to the model when KFileItemListView::slotSortRoleChanged() calls applyRolesToModel(), which calls
KFileItemModel::setRoles(const QSet<QByteArray>& roles)
This function does set the "type" role (via retrieveData() - note that item.isMimeTypeKnown() is true because KFileItemModelRolesUpdater has determined the mime type in the mean time), but it does not trigger a resorting.
Fixed by adding the new role in KFileItemModel::onSortRoleChanged(), *before* the resorting is triggered.
This addresses bugs 310705 and 312014.
http://bugs.kde.org/show_bug.cgi?id=310705
http://bugs.kde.org/show_bug.cgi?id=312014
Diffs
-----
dolphin/src/tests/kfileitemmodeltest.cpp e636bcd
dolphin/src/kitemviews/kfileitemmodel.cpp c78fdc3
Diff: http://git.reviewboard.kde.org/r/111004/diff/
Testing
-------
Works for me, old unit tests pass (I had to modify one of them slightly though), added a new test.
Thanks,
Frank Reininghaus
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.kde.org/mailman/private/kfm-devel/attachments/20130618/ab77bbfc/attachment.htm>
More information about the kfm-devel
mailing list