order contacts list by status
This commit is contained in:
parent
ca7d37e3cb
commit
9d4f02840b
2 changed files with 10 additions and 4 deletions
|
|
@ -153,9 +153,10 @@ class MetaGroup(IGroup):
|
|||
def cb(self, cb, backend, contact):
|
||||
if contact:
|
||||
contact.backend = backend
|
||||
else:
|
||||
cb(contact)
|
||||
elif not backend:
|
||||
self.process = None
|
||||
cb(contact)
|
||||
cb(None)
|
||||
|
||||
class ContactsWidget(QWidget):
|
||||
def __init__(self, weboob, parent=None):
|
||||
|
|
@ -216,6 +217,11 @@ class ContactsWidget(QWidget):
|
|||
item.setIcon(QIcon(QPixmap.fromImage(img)))
|
||||
item.setData(Qt.UserRole, contact)
|
||||
|
||||
for i in xrange(self.ui.contactList.count()):
|
||||
if self.ui.contactList.item(i).data(Qt.UserRole).toPyObject().status > contact.status:
|
||||
self.ui.contactList.insertItem(i, item)
|
||||
return
|
||||
|
||||
self.ui.contactList.addItem(item)
|
||||
|
||||
def contactChanged(self, current, previous):
|
||||
|
|
|
|||
|
|
@ -34,8 +34,8 @@ class ProfileNode(object):
|
|||
|
||||
class Contact(object):
|
||||
STATUS_ONLINE = 0x001
|
||||
STATUS_OFFLINE = 0x002
|
||||
STATUS_AWAY = 0x004
|
||||
STATUS_AWAY = 0x002
|
||||
STATUS_OFFLINE = 0x004
|
||||
STATUS_ALL = 0xfff
|
||||
|
||||
def __init__(self, id, name, status):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue