Commit 46e76765 authored by Dan Pascu's avatar Dan Pascu

Do not allow dialing contacts without URIs

parent 249ce0d0
...@@ -3133,14 +3133,14 @@ class ContactListView(QListView): ...@@ -3133,14 +3133,14 @@ class ContactListView(QListView):
menu.addAction(self.actions.undo_last_delete) menu.addAction(self.actions.undo_last_delete)
self.actions.undo_last_delete.setText(undo_delete_text) self.actions.undo_last_delete.setText(undo_delete_text)
account_manager = AccountManager() account_manager = AccountManager()
default_account = account_manager.default_account can_call = account_manager.default_account is not None and contact.uri is not None
self.actions.start_audio_call.setEnabled(default_account is not None) self.actions.start_audio_call.setEnabled(can_call)
self.actions.start_video_call.setEnabled(default_account is not None) self.actions.start_video_call.setEnabled(can_call)
self.actions.start_chat_session.setEnabled(default_account is not None) self.actions.start_chat_session.setEnabled(can_call)
self.actions.send_sms.setEnabled(default_account is not None) self.actions.send_sms.setEnabled(can_call)
self.actions.send_files.setEnabled(default_account is not None) self.actions.send_files.setEnabled(can_call)
self.actions.request_screen.setEnabled(default_account is not None) self.actions.request_screen.setEnabled(can_call)
self.actions.share_my_screen.setEnabled(default_account is not None) self.actions.share_my_screen.setEnabled(can_call)
self.actions.edit_item.setEnabled(contact.editable) self.actions.edit_item.setEnabled(contact.editable)
self.actions.delete_item.setEnabled(contact.deletable) self.actions.delete_item.setEnabled(contact.deletable)
self.actions.undo_last_delete.setEnabled(len(model.deleted_items) > 0) self.actions.undo_last_delete.setEnabled(len(model.deleted_items) > 0)
...@@ -3542,14 +3542,14 @@ class ContactSearchListView(QListView): ...@@ -3542,14 +3542,14 @@ class ContactSearchListView(QListView):
menu.addAction(self.actions.undo_last_delete) menu.addAction(self.actions.undo_last_delete)
self.actions.undo_last_delete.setText(undo_delete_text) self.actions.undo_last_delete.setText(undo_delete_text)
account_manager = AccountManager() account_manager = AccountManager()
default_account = account_manager.default_account can_call = account_manager.default_account is not None and contact.uri is not None
self.actions.start_audio_call.setEnabled(default_account is not None) self.actions.start_audio_call.setEnabled(can_call)
self.actions.start_video_call.setEnabled(default_account is not None) self.actions.start_video_call.setEnabled(can_call)
self.actions.start_chat_session.setEnabled(default_account is not None) self.actions.start_chat_session.setEnabled(can_call)
self.actions.send_sms.setEnabled(default_account is not None) self.actions.send_sms.setEnabled(can_call)
self.actions.send_files.setEnabled(default_account is not None) self.actions.send_files.setEnabled(can_call)
self.actions.request_screen.setEnabled(default_account is not None) self.actions.request_screen.setEnabled(can_call)
self.actions.share_my_screen.setEnabled(default_account is not None) self.actions.share_my_screen.setEnabled(can_call)
self.actions.edit_item.setEnabled(contact.editable) self.actions.edit_item.setEnabled(contact.editable)
self.actions.delete_item.setEnabled(contact.deletable) self.actions.delete_item.setEnabled(contact.deletable)
self.actions.undo_last_delete.setEnabled(len(source_model.deleted_items) > 0) self.actions.undo_last_delete.setEnabled(len(source_model.deleted_items) > 0)
...@@ -3831,13 +3831,14 @@ class ContactDetailView(QListView): ...@@ -3831,13 +3831,14 @@ class ContactDetailView(QListView):
self.actions.make_uri_default.setEnabled(selected_item.uri is not model.contact.uris.default) self.actions.make_uri_default.setEnabled(selected_item.uri is not model.contact.uris.default)
menu.addAction(self.actions.edit_contact) menu.addAction(self.actions.edit_contact)
menu.addAction(self.actions.delete_contact) menu.addAction(self.actions.delete_contact)
self.actions.start_audio_call.setEnabled(account_manager.default_account is not None and contact_has_uris) can_call = account_manager.default_account is not None and contact_has_uris
self.actions.start_video_call.setEnabled(account_manager.default_account is not None and contact_has_uris) self.actions.start_audio_call.setEnabled(can_call)
self.actions.start_chat_session.setEnabled(account_manager.default_account is not None and contact_has_uris) self.actions.start_video_call.setEnabled(can_call)
self.actions.send_sms.setEnabled(account_manager.default_account is not None and contact_has_uris) self.actions.start_chat_session.setEnabled(can_call)
self.actions.send_files.setEnabled(account_manager.default_account is not None and contact_has_uris) self.actions.send_sms.setEnabled(can_call)
self.actions.request_screen.setEnabled(account_manager.default_account is not None and contact_has_uris) self.actions.send_files.setEnabled(can_call)
self.actions.share_my_screen.setEnabled(account_manager.default_account is not None and contact_has_uris) self.actions.request_screen.setEnabled(can_call)
self.actions.share_my_screen.setEnabled(can_call)
self.actions.edit_contact.setEnabled(model.contact_detail.editable) self.actions.edit_contact.setEnabled(model.contact_detail.editable)
self.actions.delete_contact.setEnabled(model.contact_detail.deletable) self.actions.delete_contact.setEnabled(model.contact_detail.deletable)
menu.exec_(event.globalPos()) menu.exec_(event.globalPos())
......
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