changeset 391:c86d7a8d2c1e

browser_side: added a dialog in Settings/Account to update/delete the XMPP account
author souliane <souliane@mailoo.org>
date Mon, 03 Mar 2014 15:44:54 +0100 (2014-03-03)
parents 76583fab7ea0
children f539f6f8ee9c
files browser_side/menu.py libervia.py libervia_server/__init__.py
diffstat 3 files changed, 18 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/browser_side/menu.py	Mon Mar 03 15:44:13 2014 +0100
+++ b/browser_side/menu.py	Mon Mar 03 15:44:54 2014 +0100
@@ -140,6 +140,7 @@
 
         addMenu("Help", _("Help"), _("Social contract"), 'help', MenuCmd(self, "onSocialContract"))
         addMenu("Help", _("Help"), _("About"), 'help', MenuCmd(self, "onAbout"))
+        addMenu("Settings", _("Settings"), _("Account"), 'settings', MenuCmd(self, "onAccount"))
         addMenu("Settings", _("Settings"), _("Parameters"), 'settings', MenuCmd(self, "onParameters"))
 
         # XXX: temporary, will change when a full profile will be managed in SàT
@@ -301,6 +302,16 @@
 
     #Settings menu
 
+    def onAccount(self):
+        def gotUI(xmlui):
+            if not xmlui:
+                return
+            body = XMLUI(self.host, xmlui)
+            _dialog = dialog.GenericDialog("Manage your XMPP account", body, options=['NO_CLOSE'])
+            body.setCloseCb(_dialog.close)
+            _dialog.show()
+        self.host.bridge.call('getAccountDialogUI', gotUI)
+
     def onParameters(self):
         def gotParams(xmlui):
             if not xmlui:
--- a/libervia.py	Mon Mar 03 15:44:13 2014 +0100
+++ b/libervia.py	Mon Mar 03 15:44:54 2014 +0100
@@ -125,7 +125,7 @@
                          "getWaitingSub", "subscription", "delContact", "updateContact", "getCard",
                          "getEntityData", "getParamsUI", "asyncGetParamA", "setParam", "launchAction",
                          "disconnect", "chatStateComposing", "getNewAccountDomain", "confirmationAnswer",
-                         "syntaxConvert",
+                         "syntaxConvert", "getAccountDialogUI",
                         ])
 
 
--- a/libervia_server/__init__.py	Mon Mar 03 15:44:13 2014 +0100
+++ b/libervia_server/__init__.py	Mon Mar 03 15:44:54 2014 +0100
@@ -454,6 +454,12 @@
         profile = ISATSession(self.session).profile
         return self.sat_host.bridge.getCard(jid, profile)
 
+    def jsonrpc_getAccountDialogUI(self):
+        """Get the dialog for managing user account
+        @return: XML string of the XMLUI"""
+        profile = ISATSession(self.session).profile
+        return self.sat_host.bridge.getAccountDialogUI(profile)
+
     def jsonrpc_getParamsUI(self):
         """Return the parameters XML for profile"""
         profile = ISATSession(self.session).profile