Dear Roland,

Thanks for your reaction!

* The addressbook appears to not return all addresses for a given contact when searching, e.g., but just the first or first two.

There is an odd logic that "tries to sort out irrelevant email
addresses" [1] that ignores non-matching email addresses if the search
condition matches one at least. The point is to make search by email
address more comfortable. Maybe this is which playing tricks with you.


Yes, this is playing tricks on me. Actually, it makes my life relatively more difficult. I do not know my contact's email addresses by heart. These addresses do not always include the name I associate with them. I essentially search on contact name, not contact email address. For example, one contact of mine has 4 addresses. The search result is effectively unique after entering the first four characters of their first name. However, because this first name only appears in one address, only that address is returned. I need to type the full first name and a space to override the ‘logic’ and trigger true search-by-contact-name. This is but one example of many.

Now, some ideas about a solution. It appears to me that at most 8 addresses are returned; this is reasonable. So any search result longer than that must be filtered. I think that the logic you use is appropriate in this case. However, this logic must be dropped once the search result list is 8 or less! Would something like the code below work? (Or am I completely misinterpreting the code?)

        QStringList emails = contact.emails();
        if (emails.size() > 8) {
QStringList emails_filtered = emails.filter(m_input, Qt::CaseInsensitive);
                if (emails_filtered.size() > 0)
                        emails = emails_filtered;

This will still give situations where the filter causes the number of emails returned to go below 8.

Better would be to sort the unfiltered emails, putting the filtered ones first, and then limiting to at most 8. So, conceptually, split emails into emails_selected (= emails_filtered above) and its complement emails_rejected. Then join emails_rejected at the end of emails_selected and return the first 8 elements of this joined list.



Reply via email to