changeset 499:ec3f30253040

browser_side: also display the warning banner when writing to a single contact and unibox is disabled
author souliane <souliane@mailoo.org>
date Fri, 25 Jul 2014 11:43:27 +0200
parents 60be99de3808
children 67a4e8383b70
files src/browser/sat_browser/panels.py
diffstat 1 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/browser/sat_browser/panels.py	Fri Jul 25 02:38:30 2014 +0200
+++ b/src/browser/sat_browser/panels.py	Fri Jul 25 11:43:27 2014 +0200
@@ -662,7 +662,7 @@
 
 
 class MicroblogPanel(base_widget.LiberviaWidget):
-    warning_msg_public = "This message will be PUBLIC and everybody will be able to see it, even people you don't know"
+    warning_msg_public = "This message will be <b>PUBLIC</b> and everybody will be able to see it, even people you don't know"
     warning_msg_group = "This message will be published for all the people of the group <span class='warningTarget'>%s</span>"
 
     def __init__(self, host, accepted_groups):
@@ -1093,7 +1093,7 @@
         self.host.setSelected(None)
 
 
-class ChatPanel(base_widget.LiberviaWidget):
+class ChatPanel(base_widget.LiberviaWidget, KeyboardHandler):
 
     def __init__(self, host, target, type_='one2one'):
         """Panel used for conversation (one 2 one or group chat)
@@ -1156,8 +1156,15 @@
         if enable_box:
             self.message_box = MessageBox(self.host)
             self.message_box.onSelectedChange(self)
+            self.message_box.addKeyboardListener(self)
             self.vpanel.add(self.message_box)
 
+    def onKeyDown(self, sender, keycode, modifiers):
+        if keycode == KEY_ENTER:
+            self.host.showWarning(None, None)
+        else:
+            self.host.showWarning(*self.getWarningData())
+
     def matchEntity(self, entity):
         """
         @param entity: target jid as a string or jid.JID instance.