quick_frontend, primitivus: display the number of alerts for each contact and not only a symbol (*)

This commit is contained in:
souliane 2015-11-24 13:31:28 +01:00
commit 54e9afe5a3

View file

@ -296,7 +296,7 @@ class QuickApp(object):
@property
def alerts_count(self):
"""Count the over whole alerts for all contact lists"""
return sum([len(clist._alerts) for clist in self.contact_lists.values()])
return sum([sum(clist._alerts.values()) for clist in self.contact_lists.values()])
def registerSignal(self, function_name, handler=None, iface="core", with_profile=True):
"""Register a handler for a signal
@ -510,13 +510,14 @@ class QuickApp(object):
chat_widget.newMessage(from_jid, target, msg, type_, extra, profile)
# ContactList alert
visible = False
for widget in self.visible_widgets:
if isinstance(widget, quick_chat.QuickChat) and widget.manageMessage(from_jid, type_):
visible = True
break
if not visible:
contact_list.setAlert(from_jid.bare if type_ == C.MESS_TYPE_GROUPCHAT else from_jid)
if not from_me:
visible = False
for widget in self.visible_widgets:
if isinstance(widget, quick_chat.QuickChat) and widget.manageMessage(from_jid, type_):
visible = True
break
if not visible:
contact_list.addAlert(from_jid.bare if type_ == C.MESS_TYPE_GROUPCHAT else from_jid)
def sendMessage(self, to_jid, message, subject='', mess_type="auto", extra={}, callback=None, errback=None, profile_key=C.PROF_KEY_NONE):
if callback is None: