changeset 319:462a0a8894e3

browser_side: display the good text for microblog button regarding the context: "Send message" or "Update"
author souliane <souliane@mailoo.org>
date Fri, 03 Jan 2014 16:06:00 +0100
parents c12c9a1acf2f
children a0ded7df30f7
files browser_side/panels.py browser_side/richtext.py
diffstat 2 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/browser_side/panels.py	Fri Jan 03 14:19:01 2014 +0100
+++ b/browser_side/panels.py	Fri Jan 03 16:06:00 2014 +0100
@@ -537,7 +537,9 @@
                 def cb(result):
                     self._updateContent(result == richtext.CANCEL)
 
-                options = ('no_recipient', 'no_sync_unibox', 'no_style', 'update_msg', 'no_close')
+                options = ['no_recipient', 'no_sync_unibox', 'no_style', 'no_close']
+                if not self.empty:
+                    options.append('update_msg')
                 editor = richtext.RichTextEditor(self._blog_panel.host, self.panel, cb, options=options)
                 editor.setWidth('100%')
                 self.editbox = editor.textarea
--- a/browser_side/richtext.py	Fri Jan 03 14:19:01 2014 +0100
+++ b/browser_side/richtext.py	Fri Jan 03 16:06:00 2014 +0100
@@ -94,7 +94,7 @@
             if not self.no_sync_unibox:
                 self.command.add(Button("Back to quick box", listener=self.closeAndSave))
             self.command.add(Button("Update" if self.update_msg else "Send message",
-                                    listener=self.__close if self.update_msg else self.sendMessage))
+                                    listener=self.__close if (self.update_msg or self.no_recipient) else self.sendMessage))
             self.getFlexCellFormatter().setColSpan(offset1 + offset2 + 1, 0, 2)
             self.setWidget(offset1 + offset2 + 1, 0, self.command)
 
@@ -256,7 +256,7 @@
 
     def cancelWithoutSaving(self):
         """Ask for confirmation before closing the dialog."""
-        if self.update_msg and self.textarea.getText() == self.original_text:
+        if self.textarea.getText() == self.original_text:
             self.__close(CANCEL)
             return