changeset 754:d3fa1e8904cf

browser_side: display the number of alerts for each contact and not only a symbol (*) + favicon displays the total number of waiting messages
author souliane <souliane@mailoo.org>
date Tue, 24 Nov 2015 13:33:19 +0100
parents 76a9c074327b
children bfe2f09d208e
files src/browser/sat_browser/contact_list.py src/browser/sat_browser/contact_widget.py
diffstat 2 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/browser/sat_browser/contact_list.py	Tue Nov 24 11:00:26 2015 +0100
+++ b/src/browser/sat_browser/contact_list.py	Tue Nov 24 13:33:19 2015 +0100
@@ -129,7 +129,7 @@
 
         def on_click(contact_jid):
             self.host.displayWidget(chat.Chat, contact_jid, type_=C.CHAT_ONE2ONE)
-            self.removeAlert(contact_jid, True)
+            self.removeAlerts(contact_jid, True)
 
         self._contacts_panel = contact_panel.ContactsPanel(host, contacts_click=on_click, contacts_menus=(C.MENU_JID_CONTEXT, C.MENU_ROSTER_JID_CONTEXT))
         self._contacts_panel.setStyleName('contactPanel') # FIXME: style doesn't exists !
--- a/src/browser/sat_browser/contact_widget.py	Tue Nov 24 11:00:26 2015 +0100
+++ b/src/browser/sat_browser/contact_widget.py	Tue Nov 24 13:33:19 2015 +0100
@@ -57,8 +57,8 @@
 
     def update(self):
         clist = self.host.contact_list
-        alerts = clist._alerts if self.jid.resource else contact_list.JIDList([contact.bare for contact in clist._alerts])
-        alert_html = "<strong>(*)</strong>&nbsp;" if self.jid in alerts else ""
+        alerts_count = clist.getAlerts(self.jid, use_bare_jid=not self.jid.resource)
+        alert_html = ("<strong>(%i)</strong>&nbsp;" % alerts_count) if alerts_count else ""
 
         contact_raw = None
         for disp in self.display: