class ContactView(RecordView):
    def __init__(self, app, parent, records):
        RecordView.__init__(self, app, parent, records, ContactDoc,
                            'edit')
        self.manager = ClientManager(self.app)
        
    def setSource(self, url):
        action, context, id = str(url).split('.')
        dlg = EditContactDialog(self.app, self, self.doc.records[int(id)].record)
        dlg.connect(dlg, SIGNAL('okClicked()'), self.updateRecord)
        self.dialogs['edit-contact'] = dlg

    def updateRecord(self):
        dlg = self.dialogs['edit-contact']
        data = dlg.getRecordData()
        contactid = dlg.record.contactid
        data['addressid'] = dlg.addressid
        print 'updateRecord', contactid
        print 'data', data
        self.manager.updateContact(contactid, data)
        self.parent().emit(PYSIGNAL('updated()'), ())
        self.parent().close()