comparison src/browser/sat_browser/richtext.py @ 624:9092e624bb27 frontends_multi_profiles

browser_side: fixes various issues
author souliane <souliane@mailoo.org>
date Sun, 22 Feb 2015 21:51:20 +0100
parents 1c0d5a87c554
children 6d3142b782c3
comparison
equal deleted inserted replaced
623:4f7550a083b4 624:9092e624bb27
440 setText = lambda: self.host.uni_box.setText("" if emptyText else self.getContent()['text']) 440 setText = lambda: self.host.uni_box.setText("" if emptyText else self.getContent()['text'])
441 if not hasattr(self, 'recipient'): 441 if not hasattr(self, 'recipient'):
442 setText() 442 setText()
443 return True 443 return True
444 if recipients is None: 444 if recipients is None:
445 recipients = self.recipient.getContacts() 445 recipients = self.recipient.getItemsByKey()
446 target = "" 446 target = ""
447 # we could eventually allow more in the future 447 # we could eventually allow more in the future
448 allowed = 1 448 allowed = 1
449 for key in recipients: 449 for key in recipients:
450 count = len(recipients[key]) 450 count = len(recipients[key])
485 return 485 return
486 RichTextEditor.edit(self, edit, abort, sync) 486 RichTextEditor.edit(self, edit, abort, sync)
487 487
488 def __sendMessage(self): 488 def __sendMessage(self):
489 """Send the message.""" 489 """Send the message."""
490 recipients = self.recipient.getContacts() 490 recipients = self.recipient.getItemsByKey()
491 targets = [] 491 targets = []
492 for addr in recipients: 492 for addr in recipients:
493 for recipient in recipients[addr]: 493 for recipient in recipients[addr]:
494 if recipient.startswith("@"): 494 if recipient.startswith("@"):
495 targets.append(("PUBLIC", None, addr) if recipient == "@@" else ("GROUP", recipient[1:], addr)) 495 targets.append(("PUBLIC", None, addr) if recipient == "@@" else ("GROUP", recipient[1:], addr))
516 # TODO: be sure we also display empty groups and disconnected contacts + their groups 516 # TODO: be sure we also display empty groups and disconnected contacts + their groups
517 # store the full list of potential recipients (groups and contacts) 517 # store the full list of potential recipients (groups and contacts)
518 list_ = [] 518 list_ = []
519 list_.append("@@") 519 list_.append("@@")
520 list_.extend("@%s" % group for group in parent.host.contact_panel.getGroups()) 520 list_.extend("@%s" % group for group in parent.host.contact_panel.getGroups())
521 list_.extend(contact for contact in parent.host.contact_panel.getContacts()) 521 list_.extend(contact for contact in parent.host.contact_list.roster_entities)
522 list_manager.ListManager.__init__(self, parent, composition.RECIPIENT_TYPES, list_, {'y': y_offset}) 522 list_manager.ListManager.__init__(self, parent, composition.RECIPIENT_TYPES, list_, {'y': y_offset})
523 523
524 self.registerPopupMenuPanel(entries=composition.RECIPIENT_TYPES, 524 self.registerPopupMenuPanel(entries=composition.RECIPIENT_TYPES,
525 hide=lambda sender, key: self.__children[key]["panel"].isVisible(), 525 hide=lambda sender, key: self.__children[key]["panel"].isVisible(),
526 callback=self.setContactPanelVisible) 526 callback=self.setContactPanelVisible)