changeset 524:d41e850b31b9

browser_side (plugin OTR): limit the max width for all dialogs
author souliane <souliane@mailoo.org>
date Wed, 03 Sep 2014 11:22:37 +0200
parents 5add182e7dd5
children 307f84fee972
files src/browser/public/libervia.css src/browser/sat_browser/dialog.py src/browser/sat_browser/plugin_sec_otr.py
diffstat 3 files changed, 21 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/src/browser/public/libervia.css	Wed Sep 03 11:04:29 2014 +0200
+++ b/src/browser/public/libervia.css	Wed Sep 03 11:22:37 2014 +0200
@@ -1205,6 +1205,10 @@
     margin: auto;
 }
 
+.maxWidthLimit {
+    max-width: 500px;
+}
+
 .transparent {
     opacity: 0;
 }
--- a/src/browser/sat_browser/dialog.py	Wed Sep 03 11:04:29 2014 +0200
+++ b/src/browser/sat_browser/dialog.py	Wed Sep 03 11:22:37 2014 +0200
@@ -256,7 +256,10 @@
         If None, OK button will return "True". Cancel button always returns "False".
         """
         self.callback = callback
+        added_style = kwargs.pop('AddStyleName', None)
         DialogBox.__init__(self, centered=True, **kwargs)
+        if added_style:
+            self.addStyleName(added_style)
 
         if prompt is None:
             prompt = []
@@ -311,7 +314,11 @@
         @param callback: method to call on closing
         @param options: one or more of the following options:
                         - NO_CLOSE: don't add a close button"""
+        added_style = kwargs.pop('AddStyleName', None)
         DialogBox.__init__(self, centered=True, **kwargs)
+        if added_style:
+            self.addStyleName(added_style)
+
         self.callback = callback
         if not options:
             options = []
--- a/src/browser/sat_browser/plugin_sec_otr.py	Wed Sep 03 11:04:29 2014 +0200
+++ b/src/browser/sat_browser/plugin_sec_otr.py	Wed Sep 03 11:22:37 2014 +0200
@@ -143,7 +143,7 @@
                 msg = _("Your correspondent has successfully authenticated you. You may want to authenticate your correspondent as well by asking your own question.")
         else:
             msg = _("Authentication failed.")
-        dialog.InfoDialog(title, msg).show()
+        dialog.InfoDialog(title, msg, AddStyleName="maxWidthLimit").show()
         if act != "asked":
             return
         old_trust = self.getCurrentTrust()
@@ -164,7 +164,7 @@
         if other_key is None:
             # we have a private key, but not the fingerprint of our correspondent
             msg = AUTH_INFO_TXT + ("Your fingerprint is:{eol}{fingerprint}{eol}{eol}Start an OTR conversation to have your correspondent one.").format(fingerprint=priv_key.fingerprint(), eol=DIALOG_EOL)
-            dialog.InfoDialog(_("Fingerprint"), msg).show()
+            dialog.InfoDialog(_("Fingerprint"), msg, AddStyleName="maxWidthLimit").show()
             return
 
         def setTrust(confirm):
@@ -174,7 +174,7 @@
         text += _("Purported fingerprint for {jid}:{eol}{fingerprint}{eol}{eol}").format(jid=self.peer, fingerprint=other_key.fingerprint(), eol=DIALOG_EOL)
         text += _("Did you verify that this is in fact the correct fingerprint for {jid}?").format(jid=self.peer)
         title = _('Authentication of {jid}').format(jid=self.peer.full())
-        dialog.ConfirmDialog(setTrust, text, title).show()
+        dialog.ConfirmDialog(setTrust, text, title, AddStyleName="maxWidthLimit").show()
 
     def smpAuthCb(self, type_, data, act=None):
         """OTR v3 authentication using the socialist millionaire protocol.
@@ -206,7 +206,7 @@
                         return
                     self.smpAuthSecret(answer, question)
                 text = AUTH_INFO_TXT + AUTH_QUEST_DEF + _("Enter question here:{eol}").format(eol=DIALOG_EOL, question=data)
-                dialog.PromptDialog(cb, [text, AUTH_SECRET_TXT], title=title).show()
+                dialog.PromptDialog(cb, [text, AUTH_SECRET_TXT], title=title, AddStyleName="maxWidthLimit").show()
             else:
                 def cb(answer):
                     if not answer:  # dialog cancelled or the answer is empty
@@ -214,7 +214,7 @@
                         return
                     self.smpAuthSecret(answer)
                 text = AUTH_INFO_TXT + AUTH_QUEST_ASK + _("This is the question asked by your correspondent:{eol}{question}").format(eol=DIALOG_EOL, question=data)
-                dialog.PromptDialog(cb, text + AUTH_SECRET_TXT, title=title).show()
+                dialog.PromptDialog(cb, text + AUTH_SECRET_TXT, title=title, AddStyleName="maxWidthLimit").show()
         elif type_ == 'trust':
             self.setCurrentTrust('smp' if data else '', act)
         elif type_ == 'abort':
@@ -382,7 +382,7 @@
             elif otr_version == otr.context.OTR_VERSION_3:
                 otrctx.smpAuthCb('question', None, 'asked')
             else:
-                dialog.InfoDialog(_("No running session"), _("You must start a private conversation before authenticating your correspondent.")).show()
+                dialog.InfoDialog(_("No running session"), _("You must start a private conversation before authenticating your correspondent."), AddStyleName="maxWidthLimit").show()
 
         try:
             to_jid = menu_data['jid']
@@ -402,7 +402,7 @@
 
             if priv_key is None:
                 # we have no private key yet
-                dialog.InfoDialog(_("No private key"), _("You don't have any private key yet!")).show()
+                dialog.InfoDialog(_("No private key"), _("You don't have any private key yet!"), AddStyleName="maxWidthLimit").show()
                 return
 
             def dropKey(confirm):
@@ -413,11 +413,11 @@
                             context.disconnect()
                     self.context_manager.account.privkey = None
                     self.context_manager.account.getPrivkey()  # as account.privkey are None, getPrivkey will generate a new key, and save it
-                    dialog.InfoDialog(_("Your private key has been dropped"), _('Drop')).show()
+                    dialog.InfoDialog(_('Private key'), _("Your private key has been dropped."), AddStyleName="maxWidthLimit").show()
 
             text = _(DROP_TXT)
-            title = _('Confirm private key drop')
-            dialog.ConfirmDialog(dropKey, text, title).show()
+            title = _('Drop your private key')
+            dialog.ConfirmDialog(dropKey, text, title, AddStyleName="maxWidthLimit").show()
 
         try:
             to_jid = menu_data['jid']