I suspect the rest of the onValueChanged handler is mistaken too:

                if (containsLetter && (filters.length > 1)) {
                    filters = [filters[0]]
                } else if (!containsLetter) {
                    filters = [filters[0], phoneNumberFilter]
                }

If I understand it correctly, that's assuming a token that doesn't
contain a letter must be part of a phone number, which isn't true. For
example, in London, The Bar With No Name is also known as 69 Colebrooke
Row because that is its address. But if I add a contact with that name
and address, and then search for "69", I get no results, presumably
because the address book is looking for "69" only in the phone number
and not finding it.

If it is legitimate to be using a containsLetter here, though, I think
it needs to be a function that calls isLetter() on each character of the
string, stopping and returning true if any of those calls return true.
isLetter() does the right thing by checking whether the character is in
*any* of the Unicode Letter- categories, not just [a-zA-Z].
<http://doc.qt.io/qt-5/qchar.html#isLetter> Unfortunately there doesn't
seem to be any equivalent element for this in QRegExp.

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1421245

Title:
  Contact search doesn't support Chinese

To manage notifications about this bug go to:
https://bugs.launchpad.net/canonical-devices-system-image/+bug/1421245/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to