Mercurial > libervia-backend
diff frontends/src/quick_frontend/quick_app.py @ 262:af3d4f11fe43
Added management of connection error
- core: connection_error signal is sent if it's impossible to connect
- bridge: added connection_error signal
- quick_frontend: an error_message is shown when a connection_error is received
author | Goffi <goffi@goffi.org> |
---|---|
date | Sat, 22 Jan 2011 15:53:56 +0100 |
parents | 3bc4457687a2 |
children | bfd01aed0a3a |
line wrap: on
line diff
--- a/frontends/src/quick_frontend/quick_app.py Tue Jan 18 15:22:58 2011 +0100 +++ b/frontends/src/quick_frontend/quick_app.py Sat Jan 22 15:53:56 2011 +0100 @@ -46,6 +46,7 @@ sys.exit(1) self.bridge.register("connected", self.connected) self.bridge.register("disconnected", self.disconnected) + self.bridge.register("connection_error", self.connection_error) self.bridge.register("newContact", self.newContact) self.bridge.register("newMessage", self.newMessage) self.bridge.register("newAlert", self.newAlert) @@ -177,7 +178,6 @@ return debug(_("Connected")) self.setStatusOnline(True) - def disconnected(self, profile): """called when the connection is closed""" @@ -188,6 +188,17 @@ self.contactList.clear_contacts() self.setStatusOnline(False) + def connection_error(self, profile, error_type): + """called when something goest wrong with the connection""" + if not self.check_profile(profile): + return + debug(_("Connection Error")) + self.disconnected(profile) + if error_type == "AUTH_ERROR": + self.showDialog(_("Can't connect to account, check your password"), _("Connection error"), "error") + else: + error(_('FIXME: error_type %s not implemented') % error_type) + def newContact(self, JabberId, attributes, groups, profile): if not self.check_profile(profile): return