Commit ecbbb898 authored by Dan Pascu's avatar Dan Pascu

Reorder contacts after editing if display name changed

parent 49819437
...@@ -1197,12 +1197,14 @@ class ContactModel(QAbstractListModel): ...@@ -1197,12 +1197,14 @@ class ContactModel(QAbstractListModel):
@updates_contacts_db @updates_contacts_db
def updateContact(self, contact, attributes): def updateContact(self, contact, attributes):
group = attributes.pop('group') group = attributes.pop('group')
for name, value in attributes.iteritems(): name = attributes.pop('name')
setattr(contact, name, value) for attr, value in attributes.iteritems():
if contact.group != group: setattr(contact, attr, value)
if contact.name != name or contact.group != group:
new_group = group not in self.items new_group = group not in self.items
self._pop_contact(contact) self._pop_contact(contact)
contact.group = group contact.group = group
contact.name = name
self._add_contact(contact) self._add_contact(contact)
if new_group: if new_group:
self.itemsAdded.emit([group]) self.itemsAdded.emit([group])
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment