]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Only do a fast pre-sorting when "Sort by Name" is used
authorFrank Reininghaus <frank78ac@googlemail.com>
Tue, 5 Nov 2013 07:44:31 +0000 (08:44 +0100)
committerFrank Reininghaus <frank78ac@googlemail.com>
Tue, 5 Nov 2013 07:44:31 +0000 (08:44 +0100)
This is a follow-up to commit 0e9f4a398735cfc19ae783d2ab054d2400d95416,
which tries to speed up sorting the items naturally by their name using
the idea that a fast non-natural pre-sorting already sorts the items
mostly correctly and thus reduces the number of expensive natural
comparisons.

This change only makes sense if the view is really sorted by "Name". In
other cases, the pre-sorting will most likely not be useful.

Thanks to Christoph Feck for pointing this out!

src/kitemviews/kfileitemmodel.cpp

index 261b23046dbfdccb0910b86e96f19f321617978e..4c8577543fdd3bb897a7d2e1c8034409617d0bcd 100644 (file)
@@ -1034,7 +1034,7 @@ void KFileItemModel::insertItems(QList<ItemData*>& newItems)
 
     m_groups.clear();
 
-    if (m_naturalSorting) {
+    if (m_sortRole == NameRole && m_naturalSorting) {
         // Natural sorting of items can be very slow. However, it becomes much
         // faster if the input sequence is already mostly sorted. Therefore, we
         // first sort 'newItems' according to the QStrings returned by