Version: unspecified (using KDE 4.5.1) OS: Linux If you have Contacts in your Addressbook with similar surnames, where one name is longer then the other, e.g. "Peters" and "Peterson", then these will not be sorted correctly. Simple Example, of how it would look like: Peters, Andrew Peters, Henry Peterson, Julia Peterson, Mike Peters, Sonya Peters, Stan See, how the Petersons and the Peters are mixed up? If you delete the commas and spaces between the names, you will see why: PetersAndrew PetersHenry PetersonJulia PetersonMike PetersSonya PetersStan Seems like the sort algorithm does exectly that: Delete the commas and spaces and then take the whole string and sort it. In this case, it produces a wrong result. Instead of this, it should rather first sort by surename, then by forename. Would be even better, if one could choose, by which fields to sort in what order. That way you could sort your contacts by location first, then by name. Or one could sort by organisation, then by department and then by name etc. Reproducible: Always Steps to Reproduce: Create Contacts with the names shown in the description and show them as "surname, forename" or "surename forename" (with or without comma). Actual Results: These Contacts will be shown in wrong order. Expected Results: They should be shown in correct order (sorted by surname first, then by given name). OS: Linux (x86_64) release 2.6.35-22-generic Compiler: cc
Have you clicked the name header twice ? In my case at startup the names are unsorted.
Sure. Have you tried to reproduce with the names i wrote above? As I said, it must be in the sort-algorithm, that doesn't care about commas and spaces.
Hej, we use the QString::compareLocaleAware() here. If you have the feeling that this sorting is wrong, please file a bug on the Qt bug tracker. Ciao, Tobias
I did that. It is now listed under: http://bugreports.qt.nokia.com/browse/QTBUG-16398 Btw: The function is called localeAwareCompare() not compareLocaleAware().
OK, now I have tested out the localeAwareCompare(). If you compare "Smithers, Eve" with "Smith, Eve" and "Smithers, Eve" with "Smith, Adam" like this: [code] #include <iostream> #include <QString> int main(int argc, char* argv[]) { if ( QString::localeAwareCompare("Smithers, Eve", "Smith, Eve") < 0 ) std::cout << "1. Smithers, Eve\n2. Smith, Eve" << std::endl; else std::cout << "1. Smith, Eve\n2. Smithers, Eve" << std::endl; std::cout << "---" << std::endl; if ( QString::localeAwareCompare("Smithers, Eve", "Smith, Adam") < 0 ) std::cout << "1. Smithers, Eve\n2. Smith, Adam" << std::endl; else std::cout << "1. Smith, Adam\n2. Smithers, Eve" << std::endl; } [/code] it outputs: 1. Smith, Eve 2. Smithers, Eve --- 1. Smith, Adam 2. Smithers, Eve So both Smith's come before Mrs. Smithers. Use the same names in KAddressbook and and it will sorted like this: 1. Smith, Adam 2. Smithers, Eve 3. Smith, Eve So the issue cannot be in localeAwareCompare().