(*** This bug was imported into bugs.kde.org ***) Package: kaddressbook Version: KDE 3.0.0 Severity: normal Installed from: RedHat RPMs Compiler: Not Specified OS: Linux OS/Compiler notes: Not Specified Countries in the combo box (described below) are sorted using ASCII string comparison or something instead of locale-specified collation sequence. Steps to Reproduce: 1.Set your locale to cs_CZ (or something other you can read which places accented characters between unaccented Latin ones) 2.Run kaddressbook create a new entry push the Address button 3.Open the Country combo box. Actual Results: The countries whose name starts with an accented character (i.e. [using HTML notation because bugzilla will probably mangle it etc.] Česká republika [Czech Republic]) are placed after all others. Expected Results: Česká republika is placed after countries whose name starts with C but before countries with name starting with D similarly for other countries. (Submitted via bugs.kde.org)
Hi this bug is fixed in CVS HEAD Thank you for your bug report Ciao Tobias -- In a world without walls and fences who needs Windows and Gates???
Still wrong in kdepim-3.1.3. "countries.sort ()" is used in AddressEditDialog::fillCountryCombo (), but it uses QString::operator< (), which compares unicode values.
Created attachment 2705 [details] Patch agains kdepim 3.1.4 to use QString::localeAwareCompare for country list sorting
Subject: kdepim/kaddressbook CVS commit by tokoe: Sort the country list locale aware. That fixes bug #42434. CCMAIL:42434-done@bugs.kde.org M +40 -1 addresseditwidget.cpp 1.29 --- kdepim/kaddressbook/addresseditwidget.cpp #1.28:1.29 @@ -53,4 +53,6 @@ #include "addresseditwidget.h" +static QStringList sortLocaleAware( const QStringList &list ); + class TabPressEater : public QObject { @@ -562,5 +564,5 @@ void AddressEditDialog::fillCountryCombo countries.append( country[ i ] ); - countries.sort(); + countries = sortLocaleAware( countries ); mCountryCombo->insertStringList( countries ); @@ -607,4 +609,41 @@ int AddressTypeDialog::type() const return type; +} + +/** + Small helper class, I hope we can remove it as soon as a general solution has + been committed to kdelibs + */ +class LocaleAwareString : public QString +{ + public: + LocaleAwareString() : QString() + {} + + LocaleAwareString( const QString &str ) : QString( str ) + {} +}; + +static bool operator<( const LocaleAwareString &s1, const LocaleAwareString &s2 ) +{ + return ( QString::localeAwareCompare( s1, s2 ) < 0 ); +} + +QStringList sortLocaleAware( const QStringList &list ) +{ + QValueList<LocaleAwareString> sortedList; + + QStringList::ConstIterator it; + for ( it = list.begin(); it != list.end(); ++it ) + sortedList.append( LocaleAwareString( *it ) ); + + qHeapSort( sortedList ); + + QStringList retval; + QValueList<LocaleAwareString>::ConstIterator retIt; + for ( retIt = sortedList.begin(); retIt != sortedList.end(); ++retIt ) + retval.append( *retIt ); + + return retval; }
The development of the old KAddressBook will be discontinued for KDE 4.4. Since the new application has the same name, but a completly new code base we close all bug reports against the old version and ask the submitters to resend there reports against the new product.