[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [calligra/calligra/2.6] plugins/textshape/dialogs: Fix sorting of style names.
From:       Pierre Stirnweiss <pstirnweiss () googlemail ! com>
Date:       2012-12-30 10:34:19
Message-ID: 20121230103419.50B3FA6091 () git ! kde ! org
[Download RAW message or body]

Git commit 36a0bd51606da12659519021c219a778fd77034a by Pierre Stirnweiss.
Committed on 30/12/2012 at 10:46.
Pushed by pstirnweiss into branch 'calligra/2.6'.

Fix sorting of style names.

The style names were not sorted in natural order.
Use KStringHandler::naturalCompare to fix the problem.

The sorting of styles per category (ie. list styles,...) belongs to
a wish item, and needs debating first.
BUG: 288651
REVIEW: 108020

Conflicts:
	plugins/textshape/dialogs/DockerStylesComboModel.cpp

Conflicts:
	plugins/textshape/dialogs/DockerStylesComboModel.cpp

M  +7    -6    plugins/textshape/dialogs/StylesModel.cpp

http://commits.kde.org/calligra/36a0bd51606da12659519021c219a778fd77034a

diff --git a/plugins/textshape/dialogs/StylesModel.cpp b/plugins/textshape/dialogs/StylesModel.cpp
index 64767f8..f888e5e 100644
--- a/plugins/textshape/dialogs/StylesModel.cpp
+++ b/plugins/textshape/dialogs/StylesModel.cpp
@@ -29,6 +29,7 @@
 #include <QList>
 #include <QSignalMapper>
 
+#include <KStringHandler>
 #include <KLocale>
 #include <KDebug>
 
@@ -284,7 +285,7 @@ void StylesModel::addParagraphStyle(KoParagraphStyle *style)
             s = m_draftParStyleList[*begin];
         // s should be found as the manager and the m_styleList should be in sync
         Q_ASSERT(s);
-        if (QString::localeAwareCompare(style->name(), s->name()) < 0) {
+        if (KStringHandler::naturalCompare(style->name(),s->name()) < 0) {
             break;
         }
         ++index;
@@ -300,7 +301,7 @@ bool sortParagraphStyleByName(KoParagraphStyle *style1, KoParagraphStyle *style2
 {
     Q_ASSERT(style1);
     Q_ASSERT(style2);
-    return QString::localeAwareCompare(style1->name(), style2->name()) < 0;
+    return KStringHandler::naturalCompare(style1->name(), style2->name()) < 0;
 }
 
 void StylesModel::updateParagraphStyles()
@@ -340,7 +341,7 @@ void StylesModel::addCharacterStyle(KoCharacterStyle *style)
             s = m_draftCharStyleList[*begin];
         // s should be found as the manager and the m_styleList should be in sync
         Q_ASSERT(s);
-        if (QString::localeAwareCompare(style->name(), s->name()) < 0) {
+        if (KStringHandler::naturalCompare(style->name(),s->name()) < 0) {
             break;
         }
         ++index;
@@ -356,7 +357,7 @@ bool sortCharacterStyleByName(KoCharacterStyle *style1, KoCharacterStyle *style2
 {
     Q_ASSERT(style1);
     Q_ASSERT(style2);
-    return QString::localeAwareCompare(style1->name(), style2->name()) < 0;
+    return KStringHandler::naturalCompare(style1->name(), style2->name()) < 0;
 }
 
 void StylesModel::updateCharacterStyles()
@@ -428,7 +429,7 @@ void StylesModel::updateName(int styleId)
                         s = m_draftParStyleList[*begin];
                     // s should be found as the manager and the m_styleList should be in sync
                     Q_ASSERT(s);
-                    if (QString::localeAwareCompare(paragStyle->name(), s->name()) < 0) {
+                    if (KStringHandler::naturalCompare(paragStyle->name(), s->name()) < 0) {
                         break;
                     }
                     ++newIndex;
@@ -465,7 +466,7 @@ void StylesModel::updateName(int styleId)
                         s = m_draftCharStyleList[*begin];
                     // s should be found as the manager and the m_styleList should be in sync
                     Q_ASSERT(s);
-                    if (QString::localeAwareCompare(characterStyle->name(), s->name()) < 0) {
+                    if (KStringHandler::naturalCompare(characterStyle->name(), s->name()) < 0) {
                         break;
                     }
                     ++newIndex;
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic