If the text in the combobox is a valid name return it as a contact

dbus-notify
Zlatin Balevsky 2022-06-08 20:30:46 +01:00
parent 1b6a175605
commit cb204a6c79
No known key found for this signature in database
GPG Key ID: A72832072D525E41
1 changed files with 10 additions and 1 deletions

View File

@ -9,8 +9,10 @@ import javax.swing.JTextField
class ContactChooser extends JComboBox{
private final ContactChooserEditor chooserEditor
private final ContactChooserModel chooserModel
ContactChooser(UISettings settings, ContactChooserModel model) {
setModel(model)
this.chooserModel = model
chooserEditor = new ContactChooserEditor(model, this, settings)
setEditor(chooserEditor)
setRenderer(new PersonaOrProfileListCellRenderer(settings))
@ -22,6 +24,13 @@ class ContactChooser extends JComboBox{
}
Set<PersonaOrProfile> getSelectedPOPs() {
chooserEditor.textPane.getSelectedPOPs()
Set<PersonaOrProfile> rv = chooserEditor.textPane.getSelectedPOPs()
def lastPOP = chooserEditor.getItem()
if (lastPOP == null)
return rv
lastPOP = chooserModel.findByName(lastPOP.toString())
if (lastPOP != null)
rv << lastPOP
rv
}
}