For the Opportunistic encryption task (T2520, D1639), we need to show an icon next to a each recipient showing status of the encryption key we are going to use. However it is not possible to put icons mid-text in K(Q)LineEdit, only at the beginning of the line, which is a problem if there are multiple recipients in a single line. I've spent quite some time trying to come up with a fake LineEdit widget that would be seemlessly composed of multiple QToolButton+QLineEdit widgets inside a QScrollArea, but the user experience was never as good as with a single QLineEdit. Therefore I opted for an alternative strategy of only allowing a single recipient per line. The RecipientEditor already automatically jumps to next line when you autocomplete a contact from addressbook/LDAP, so I only needed to handle situation when user does not autocomplete but instead types comma (or semicolon) to write more contacts into single edit, or when they copy-paste a comma-separated list of emails into a single edit.
This patch adds a simple eventFilter that listens for comma/semicolon keypresses in the RecipientLineEdit and adds a new line, gives it a focus and consumes the keypress. I also adjusted the slotCalculateTotal() method which is called whenever a new email(s) are entered into any RecipientLineEdit to automatically split any RecipientLineEdit which has more than one recipient into multiple lines.
If you can figure out any other way how get multiple contacts into single line, let me know :-)