changeset 2899:5b0f897689b7

quick frontend (app): (un)set sync state on (dis)connect: when connected signal is received, a whole (re)connection has happened, meaning that everything is potentially out of sync (opened widget and contact lists), so host.sync is set accordingly. It's a temporary option, as (dis)connect is a per-profile signal, and host.sync is global. Methods similar to sync workflow must be implemented on a per-profile basis.
author Goffi <goffi@goffi.org>
date Sun, 07 Apr 2019 21:09:49 +0200
parents fc78d53f0ffa
children 93dfbeb41da8
files sat_frontends/quick_frontend/quick_app.py
diffstat 1 files changed, 10 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/sat_frontends/quick_frontend/quick_app.py	Sun Apr 07 21:06:57 2019 +0200
+++ b/sat_frontends/quick_frontend/quick_app.py	Sun Apr 07 21:09:49 2019 +0200
@@ -696,12 +696,22 @@
         log.debug(_("Connected"))
         self.profiles[profile].whoami = jid.JID(jid_s)
         self.setPresenceStatus(profile=profile)
+        # FIXME: fill() is already called for all profiles when doing self.sync = True
+        #        a per-profile fill() should be done once, see below note
         self.contact_lists[profile].fill()
+        # if we were already displaying widgets, they must be resynchronized
+        # FIXME: self.sync is for all profiles
+        #        while (dis)connection is per-profile.
+        #        A mechanism similar to sync should be available
+        #        on a per-profile basis
+        self.sync = True
 
     def disconnectedHandler(self, profile):
         """called when the connection is closed"""
         log.debug(_("Disconnected"))
         self.contact_lists[profile].disconnect()
+        # FIXME: see note on connectedHandler
+        self.sync = False
         self.setPresenceStatus(C.PRESENCE_UNAVAILABLE, "", profile=profile)
 
     def actionNewHandler(self, action_data, id_, security_limit, profile):