File enable-natural-sorting-in-KDirSortFilterProxyModel.patch of Package kio

From 77d5fa131d695f4813c3f7834c1fd27632eac57e Mon Sep 17 00:00:00 2001
From: Wolfgang Bauer <wbauer@tmo.at>
Date: Wed, 12 Apr 2017 14:06:37 +0200
Subject: [PATCH] Enable natural sorting on QCollator in
 KDirSortFilterProxyModel

KDirSortFilterProxyModel is advertised in the header as performing a
"natural sort", ie. "7 8 9 10 11", instead of a lexical "10 11 7 8 9".
However, as far as I can tell this was never true from the start, since
the collator responsible for the actual sorting did not have the
requisite numeric mode enabled, and this setting has always been off by
default as far back as I can find docs for it (Qt 5.2).

(Dolphin, which offers "natural sort", did not run into this issue
because it does not actually use
KDirSortFilterProxyModel.)

BUG: 343452
REVIEW: 128574
---
 src/filewidgets/kdirsortfilterproxymodel.cpp | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/filewidgets/kdirsortfilterproxymodel.cpp b/src/filewidgets/kdirsortfilterproxymodel.cpp
index 89505acf..494999ae 100644
--- a/src/filewidgets/kdirsortfilterproxymodel.cpp
+++ b/src/filewidgets/kdirsortfilterproxymodel.cpp
@@ -76,6 +76,9 @@ void KDirSortFilterProxyModel::KDirSortFilterProxyModelPrivate::slotNaturalSorti
 {
     KConfigGroup g(KSharedConfig::openConfig(), "KDE");
     m_naturalSorting = g.readEntry("NaturalSorting", true);
+    if (m_naturalSorting) {
+        m_collator.setNumericMode(true);
+    }
 }
 
 KDirSortFilterProxyModel::KDirSortFilterProxyModel(QObject *parent)
-- 
2.12.0

openSUSE Build Service is sponsored by